summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2010-01-29 15:26:37 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2010-01-29 15:26:37 +0000
commitf851cc84497986e5af50a102e504270d5f2fbd70 (patch)
tree3070653a41da8947d92b6d802c526978701700db
parent179cb343c8534c04b4d53b01290cb93395893133 (diff)
parent211dce571775ee68aa32a74a92645fc6caf148fb (diff)
ab71: merge with DEV300_m54
-rw-r--r--chart2/prj/build.lst2
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.cxx1
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx11
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx4
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx4
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx29
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx26
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx54
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.cxx1
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx1
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx11
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx3
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx557
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx234
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx2
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.hrc28
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.src14
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.hrc26
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.src14
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx36
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.hxx13
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx45
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx46
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx59
-rw-r--r--chart2/source/controller/dialogs/DialogModel.hxx8
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx9
-rw-r--r--chart2/source/controller/dialogs/Strings.src11
-rw-r--r--chart2/source/controller/dialogs/Strings_ChartTypes.src9
-rw-r--r--chart2/source/controller/dialogs/Strings_Statistic.src4
-rw-r--r--chart2/source/controller/dialogs/TabPages.hrc16
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.src4
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx12
-rw-r--r--chart2/source/controller/dialogs/hidother.src2
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx100
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.hxx9
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel_IDs.hrc4
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc54
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.cxx7
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.hxx1
-rw-r--r--chart2/source/controller/dialogs/res_Trendline_tmpl.hrc2
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx1
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.src2
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx18
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hrc4
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hxx3
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.src18
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx69
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hrc48
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hxx5
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.src27
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx2
-rw-r--r--chart2/source/controller/inc/ChartRenderer.hxx2
-rw-r--r--chart2/source/controller/inc/ConfigurationAccess.hxx17
-rw-r--r--chart2/source/controller/inc/DataPointItemConverter.hxx1
-rw-r--r--chart2/source/controller/inc/HelpIds.hrc4
-rw-r--r--chart2/source/controller/inc/ItemConverter.hxx2
-rw-r--r--chart2/source/controller/inc/SeriesOptionsItemConverter.hxx3
-rw-r--r--chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx76
-rw-r--r--chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx7
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx41
-rw-r--r--chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx5
-rw-r--r--chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx10
-rw-r--r--chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx35
-rw-r--r--chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx2
-rw-r--r--chart2/source/controller/main/ChartController.cxx5
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx5
-rw-r--r--chart2/source/controller/main/ChartController_TextEdit.cxx25
-rw-r--r--chart2/source/controller/main/ChartRenderer.cxx5
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx28
-rw-r--r--chart2/source/controller/main/ChartWindow.hxx6
-rw-r--r--chart2/source/controller/main/ConfigurationAccess.cxx39
-rw-r--r--chart2/source/controller/main/ControllerCommandDispatch.cxx1
-rw-r--r--chart2/source/controller/makefile.mk1
-rw-r--r--chart2/source/inc/AxisHelper.hxx15
-rw-r--r--chart2/source/inc/BaseGFXHelper.hxx7
-rw-r--r--chart2/source/inc/CachedDataSequence.hxx20
-rw-r--r--chart2/source/inc/CharacterProperties.hxx1
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx27
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx21
-rw-r--r--chart2/source/inc/ColorPerPointHelper.hxx2
-rw-r--r--chart2/source/inc/CommonConverters.hxx41
-rw-r--r--chart2/source/inc/CommonFunctors.hxx5
-rw-r--r--chart2/source/inc/ConfigColorScheme.hxx15
-rw-r--r--chart2/source/inc/ControllerLockGuard.hxx4
-rw-r--r--chart2/source/inc/DataSeriesHelper.hxx10
-rw-r--r--chart2/source/inc/DataSource.hxx3
-rw-r--r--chart2/source/inc/DataSourceHelper.hxx36
-rw-r--r--chart2/source/inc/DiagramHelper.hxx8
-rw-r--r--chart2/source/inc/ErrorBar.hxx6
-rw-r--r--chart2/source/inc/ExplicitCategoriesProvider.hxx4
-rw-r--r--chart2/source/inc/ExponentialRegressionCurveCalculator.hxx3
-rw-r--r--chart2/source/inc/InternalDataProvider.hxx3
-rw-r--r--chart2/source/inc/LabeledDataSequence.hxx3
-rw-r--r--chart2/source/inc/LifeTime.hxx28
-rw-r--r--chart2/source/inc/LineProperties.hxx4
-rw-r--r--chart2/source/inc/LinearRegressionCurveCalculator.hxx3
-rw-r--r--chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx3
-rw-r--r--chart2/source/inc/MeanValueRegressionCurveCalculator.hxx3
-rw-r--r--chart2/source/inc/MediaDescriptorHelper.hxx2
-rw-r--r--chart2/source/inc/ModifyListenerCallBack.hxx6
-rw-r--r--chart2/source/inc/ModifyListenerHelper.hxx6
-rw-r--r--chart2/source/inc/NameContainer.hxx5
-rw-r--r--chart2/source/inc/OPropertySet.hxx3
-rw-r--r--chart2/source/inc/ObjectIdentifier.hxx10
-rw-r--r--chart2/source/inc/PotentialRegressionCurveCalculator.hxx2
-rw-r--r--chart2/source/inc/RangeHighlighter.hxx4
-rw-r--r--chart2/source/inc/ReferenceSizeProvider.hxx36
-rw-r--r--chart2/source/inc/RegressionCurveCalculator.hxx3
-rw-r--r--chart2/source/inc/RegressionCurveHelper.hxx6
-rw-r--r--chart2/source/inc/RelativePositionHelper.hxx2
-rw-r--r--chart2/source/inc/RessourceManager.hxx2
-rw-r--r--chart2/source/inc/Scaling.hxx23
-rw-r--r--chart2/source/inc/Strings.hrc10
-rw-r--r--chart2/source/inc/ThreeDHelper.hxx6
-rw-r--r--chart2/source/inc/UncachedDataSequence.hxx4
-rw-r--r--chart2/source/inc/UndoGuard.hxx4
-rw-r--r--chart2/source/inc/UndoManager.hxx3
-rw-r--r--chart2/source/inc/WeakListenerAdapter.hxx5
-rw-r--r--chart2/source/inc/WrappedIgnoreProperty.hxx10
-rw-r--r--chart2/source/inc/WrappedPropertySet.hxx4
-rw-r--r--chart2/source/inc/XMLRangeHelper.hxx2
-rw-r--r--chart2/source/inc/chartview/ChartSfxItemIds.hxx6
-rw-r--r--chart2/source/inc/chartview/DrawModelWrapper.hxx20
-rw-r--r--chart2/source/inc/chartview/ExplicitValueProvider.hxx9
-rw-r--r--chart2/source/inc/chartview/NumberFormatterWrapper.hxx3
-rw-r--r--chart2/source/inc/servicenames_charttypes.hxx1
-rw-r--r--chart2/source/model/inc/BaseCoordinateSystem.hxx1
-rw-r--r--chart2/source/model/inc/Diagram.hxx1
-rw-r--r--chart2/source/model/inc/StockBar.hxx1
-rw-r--r--chart2/source/model/main/Axis.cxx4
-rw-r--r--chart2/source/model/main/BaseCoordinateSystem.cxx4
-rw-r--r--chart2/source/model/main/ChartData.cxx29
-rw-r--r--chart2/source/model/main/ChartData.hxx13
-rw-r--r--chart2/source/model/main/ChartModel.cxx19
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx2
-rw-r--r--chart2/source/model/main/DataPoint.cxx10
-rw-r--r--chart2/source/model/main/DataPointProperties.cxx9
-rw-r--r--chart2/source/model/main/DataPointProperties.hxx1
-rw-r--r--chart2/source/model/main/DataSeries.cxx4
-rw-r--r--chart2/source/model/main/Diagram.cxx15
-rw-r--r--chart2/source/model/main/FormattedString.cxx4
-rw-r--r--chart2/source/model/main/GridProperties.cxx6
-rw-r--r--chart2/source/model/main/ImplChartModel.cxx18
-rw-r--r--chart2/source/model/main/Legend.cxx4
-rw-r--r--chart2/source/model/main/PageBackground.cxx4
-rw-r--r--chart2/source/model/main/RectangularDataSource.cxx297
-rw-r--r--chart2/source/model/main/StockBar.cxx5
-rw-r--r--chart2/source/model/main/Title.cxx4
-rw-r--r--chart2/source/model/main/Wall.cxx4
-rw-r--r--chart2/source/model/makefile.mk2
-rw-r--r--chart2/source/model/template/BubbleChartType.cxx245
-rw-r--r--chart2/source/model/template/BubbleChartType.hxx89
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.cxx322
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.hxx106
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.cxx317
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.hxx64
-rw-r--r--chart2/source/model/template/ChartType.cxx8
-rw-r--r--chart2/source/model/template/ChartTypeManager.cxx9
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx25
-rw-r--r--chart2/source/model/template/DataInterpreter.cxx4
-rw-r--r--chart2/source/model/template/NetChartType.cxx5
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx1
-rw-r--r--chart2/source/model/template/PieChartType.cxx4
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx1
-rw-r--r--chart2/source/model/template/ScatterChartType.cxx4
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.cxx1
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.cxx1
-rw-r--r--chart2/source/model/template/_serviceregistration_charttypes.cxx9
-rw-r--r--chart2/source/model/template/makefile.mk3
-rw-r--r--chart2/source/tools/AxisHelper.cxx12
-rw-r--r--chart2/source/tools/CachedDataSequence.cxx62
-rw-r--r--chart2/source/tools/CharacterProperties.cxx8
-rw-r--r--chart2/source/tools/ChartModelHelper.cxx129
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx57
-rw-r--r--chart2/source/tools/CommonConverters.cxx186
-rw-r--r--chart2/source/tools/ConfigColorScheme.cxx6
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx91
-rw-r--r--chart2/source/tools/DataSourceHelper.cxx37
-rw-r--r--chart2/source/tools/DiagramHelper.cxx18
-rw-r--r--chart2/source/tools/ErrorBar.cxx9
-rw-r--r--chart2/source/tools/ImplUndoManager.cxx4
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx55
-rw-r--r--chart2/source/tools/LabeledDataSequence.cxx6
-rw-r--r--chart2/source/tools/ModifyListenerHelper.cxx10
-rw-r--r--chart2/source/tools/NameContainer.cxx6
-rw-r--r--chart2/source/tools/OPropertySet.cxx26
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx8
-rw-r--r--chart2/source/tools/RangeHighlighter.cxx10
-rw-r--r--chart2/source/tools/ReferenceSizeProvider.cxx20
-rw-r--r--chart2/source/tools/RegressionCurveModel.cxx4
-rw-r--r--chart2/source/tools/StatisticsHelper.cxx2
-rw-r--r--chart2/source/tools/TitleHelper.cxx42
-rw-r--r--chart2/source/tools/UncachedDataSequence.cxx28
-rw-r--r--chart2/source/view/axes/ScaleAutomatism.cxx54
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx197
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx52
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx10
-rw-r--r--chart2/source/view/charttypes/BarChart.cxx12
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx420
-rw-r--r--chart2/source/view/charttypes/BubbleChart.hxx97
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.cxx2
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx4
-rw-r--r--chart2/source/view/charttypes/Splines.cxx350
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx63
-rw-r--r--chart2/source/view/charttypes/makefile.mk3
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx10
-rw-r--r--chart2/source/view/inc/LabelPositionHelper.hxx3
-rw-r--r--chart2/source/view/inc/PlottingPositionHelper.hxx2
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx7
-rw-r--r--chart2/source/view/inc/Stripe.hxx2
-rw-r--r--chart2/source/view/inc/VDataSeries.hxx19
-rw-r--r--chart2/source/view/inc/VSeriesPlotter.hxx1
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx68
-rw-r--r--chart2/source/view/main/LabelPositionHelper.cxx355
-rw-r--r--chart2/source/view/main/NumberFormatterWrapper.cxx24
-rw-r--r--chart2/source/view/main/PlottingPositionHelper.cxx36
-rw-r--r--chart2/source/view/main/PropertyMapper.cxx1
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx52
-rw-r--r--chart2/source/view/main/Stripe.cxx47
-rw-r--r--chart2/source/view/main/VDataSeries.cxx221
-rw-r--r--chart2/source/view/makefile.mk3
-rw-r--r--sc/inc/address.hxx45
-rw-r--r--sc/inc/brdcst.hxx1
-rw-r--r--sc/inc/cell.hxx17
-rw-r--r--sc/inc/cellsuno.hxx55
-rw-r--r--sc/inc/chart2uno.hxx82
-rw-r--r--sc/inc/chartlis.hxx41
-rw-r--r--sc/inc/chgtrack.hxx6
-rw-r--r--sc/inc/collect.hxx30
-rw-r--r--sc/inc/compiler.hxx9
-rw-r--r--sc/inc/compressedarray.hxx2
-rw-r--r--sc/inc/conditio.hxx22
-rw-r--r--sc/inc/dapiuno.hxx401
-rw-r--r--sc/inc/datauno.hxx11
-rw-r--r--sc/inc/defltuno.hxx2
-rw-r--r--sc/inc/docoptio.hxx1
-rw-r--r--sc/inc/document.hxx63
-rw-r--r--sc/inc/docuno.hxx4
-rw-r--r--sc/inc/dpdimsave.hxx65
-rw-r--r--sc/inc/dpobject.hxx4
-rw-r--r--sc/inc/drwlayer.hxx6
-rw-r--r--sc/inc/editutil.hxx5
-rw-r--r--sc/inc/externalrefmgr.hxx41
-rw-r--r--sc/inc/fielduno.hxx4
-rw-r--r--sc/inc/fmtuno.hxx33
-rw-r--r--sc/inc/formulaparserpool.hxx70
-rw-r--r--sc/inc/formularesult.hxx39
-rw-r--r--sc/inc/funcuno.hxx1
-rw-r--r--sc/inc/global.hxx9
-rw-r--r--sc/inc/globstr.hrc1
-rw-r--r--sc/inc/optuno.hxx17
-rw-r--r--sc/inc/pch/precompiled_sc.hxx3
-rw-r--r--sc/inc/postit.hxx177
-rw-r--r--sc/inc/progress.hxx11
-rw-r--r--sc/inc/refdata.hxx21
-rw-r--r--sc/inc/reftokenhelper.hxx3
-rw-r--r--sc/inc/sc.hrc10
-rw-r--r--sc/inc/scabstdlg.hxx1
-rw-r--r--sc/inc/scextopt.hxx2
-rw-r--r--sc/inc/shapeuno.hxx32
-rw-r--r--sc/inc/styleuno.hxx7
-rw-r--r--sc/inc/table.hxx63
-rw-r--r--sc/inc/tabprotection.hxx180
-rw-r--r--sc/inc/tokenuno.hxx20
-rw-r--r--sc/inc/unonames.hxx13
-rw-r--r--sc/inc/validat.hxx4
-rw-r--r--sc/prj/build.lst2
-rw-r--r--sc/prj/d.lst2
-rwxr-xr-xsc/qa/complex/calcPreview/makefile.mk2
-rwxr-xr-xsc/qa/complex/cellRanges/makefile.mk2
-rw-r--r--sc/qa/complex/sc/makefile.mk2
-rw-r--r--sc/sdi/prevwsh.sdi1
-rw-r--r--sc/sdi/scalc.sdi25
-rw-r--r--sc/sdi/tabvwsh.sdi1
-rw-r--r--sc/source/core/data/attarray.cxx5
-rw-r--r--sc/source/core/data/bcaslot.cxx594
-rw-r--r--sc/source/core/data/cell.cxx19
-rw-r--r--sc/source/core/data/cell2.cxx287
-rw-r--r--sc/source/core/data/column.cxx26
-rw-r--r--sc/source/core/data/column2.cxx7
-rw-r--r--sc/source/core/data/column3.cxx62
-rw-r--r--sc/source/core/data/conditio.cxx62
-rw-r--r--sc/source/core/data/documen2.cxx22
-rw-r--r--sc/source/core/data/documen3.cxx52
-rw-r--r--sc/source/core/data/documen4.cxx11
-rw-r--r--sc/source/core/data/documen5.cxx8
-rw-r--r--sc/source/core/data/documen8.cxx13
-rw-r--r--sc/source/core/data/document.cxx337
-rw-r--r--sc/source/core/data/dpdimsave.cxx253
-rw-r--r--sc/source/core/data/dpobject.cxx17
-rw-r--r--sc/source/core/data/dpsave.cxx4
-rw-r--r--sc/source/core/data/dptabsrc.cxx31
-rw-r--r--sc/source/core/data/drwlayer.cxx28
-rw-r--r--sc/source/core/data/makefile.mk3
-rw-r--r--sc/source/core/data/postit.cxx645
-rw-r--r--sc/source/core/data/stlsheet.cxx8
-rw-r--r--sc/source/core/data/table1.cxx20
-rw-r--r--sc/source/core/data/table2.cxx142
-rw-r--r--sc/source/core/data/table3.cxx105
-rw-r--r--sc/source/core/data/table4.cxx9
-rw-r--r--sc/source/core/data/table5.cxx21
-rw-r--r--sc/source/core/data/table6.cxx2
-rw-r--r--sc/source/core/data/tabprotection.cxx465
-rw-r--r--sc/source/core/data/validat.cxx49
-rw-r--r--sc/source/core/inc/bcaslot.hxx136
-rw-r--r--sc/source/core/inc/interpre.hxx26
-rw-r--r--sc/source/core/tool/address.cxx55
-rw-r--r--sc/source/core/tool/chartlis.cxx52
-rw-r--r--sc/source/core/tool/chartpos.cxx94
-rw-r--r--sc/source/core/tool/chgtrack.cxx263
-rw-r--r--sc/source/core/tool/compiler.cxx405
-rw-r--r--sc/source/core/tool/detfunc.cxx2
-rw-r--r--sc/source/core/tool/editutil.cxx18
-rw-r--r--sc/source/core/tool/formulaparserpool.cxx171
-rw-r--r--sc/source/core/tool/interpr1.cxx435
-rw-r--r--sc/source/core/tool/interpr4.cxx9
-rw-r--r--sc/source/core/tool/makefile.mk4
-rw-r--r--sc/source/core/tool/progress.cxx2
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx59
-rw-r--r--sc/source/core/tool/token.cxx3
-rw-r--r--sc/source/filter/dif/difimp.cxx195
-rw-r--r--sc/source/filter/excel/biffrecdumper.ini340
-rw-r--r--sc/source/filter/excel/colrowst.cxx6
-rw-r--r--sc/source/filter/excel/excdoc.cxx67
-rw-r--r--sc/source/filter/excel/excel.cxx16
-rw-r--r--sc/source/filter/excel/excimp8.cxx57
-rw-r--r--sc/source/filter/excel/excrecds.cxx63
-rw-r--r--sc/source/filter/excel/expop2.cxx4
-rw-r--r--sc/source/filter/excel/impop.cxx48
-rw-r--r--sc/source/filter/excel/makefile.mk1
-rw-r--r--sc/source/filter/excel/read.cxx20
-rw-r--r--sc/source/filter/excel/xechart.cxx722
-rw-r--r--sc/source/filter/excel/xeescher.cxx5
-rw-r--r--sc/source/filter/excel/xepivot.cxx6
-rw-r--r--sc/source/filter/excel/xerecord.cxx18
-rw-r--r--sc/source/filter/excel/xeroot.cxx44
-rw-r--r--sc/source/filter/excel/xestream.cxx317
-rw-r--r--sc/source/filter/excel/xestyle.cxx4
-rw-r--r--sc/source/filter/excel/xetable.cxx4
-rw-r--r--sc/source/filter/excel/xichart.cxx416
-rw-r--r--sc/source/filter/excel/xicontent.cxx192
-rw-r--r--sc/source/filter/excel/xiescher.cxx34
-rw-r--r--sc/source/filter/excel/xilink.cxx1
-rw-r--r--sc/source/filter/excel/xiroot.cxx26
-rw-r--r--sc/source/filter/excel/xistream.cxx17
-rw-r--r--sc/source/filter/excel/xlchart.cxx47
-rw-r--r--sc/source/filter/excel/xlpage.cxx206
-rw-r--r--sc/source/filter/excel/xlroot.cxx14
-rw-r--r--sc/source/filter/excel/xlstyle.cxx8
-rw-r--r--sc/source/filter/html/htmlexp.cxx178
-rw-r--r--sc/source/filter/html/htmlexp2.cxx10
-rw-r--r--sc/source/filter/html/htmlimp.cxx4
-rw-r--r--sc/source/filter/html/htmlpars.cxx397
-rw-r--r--sc/source/filter/inc/XclExpChangeTrack.hxx3
-rw-r--r--sc/source/filter/inc/biffdump.hxx564
-rw-r--r--sc/source/filter/inc/dif.hxx4
-rw-r--r--sc/source/filter/inc/excimp8.hxx2
-rw-r--r--sc/source/filter/inc/excrecds.hxx17
-rw-r--r--sc/source/filter/inc/htmlpars.hxx357
-rw-r--r--sc/source/filter/inc/imp_op.hxx6
-rw-r--r--sc/source/filter/inc/xcl97rec.hxx196
-rw-r--r--sc/source/filter/inc/xechart.hxx121
-rw-r--r--sc/source/filter/inc/xerecord.hxx17
-rw-r--r--sc/source/filter/inc/xeroot.hxx5
-rw-r--r--sc/source/filter/inc/xestream.hxx116
-rw-r--r--sc/source/filter/inc/xestyle.hxx5
-rw-r--r--sc/source/filter/inc/xetable.hxx2
-rw-r--r--sc/source/filter/inc/xichart.hxx38
-rw-r--r--sc/source/filter/inc/xicontent.hxx61
-rw-r--r--sc/source/filter/inc/xiroot.hxx16
-rw-r--r--sc/source/filter/inc/xistream.hxx5
-rw-r--r--sc/source/filter/inc/xlchart.hxx90
-rw-r--r--sc/source/filter/inc/xlconst.hxx13
-rw-r--r--sc/source/filter/inc/xlroot.hxx4
-rw-r--r--sc/source/filter/lotus/op.cxx2
-rw-r--r--sc/source/filter/qpro/qpro.cxx2
-rw-r--r--sc/source/filter/rtf/rtfexp.cxx62
-rw-r--r--sc/source/filter/starcalc/scflt.cxx18
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx36
-rw-r--r--sc/source/filter/xcl97/makefile.mk1
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx358
-rw-r--r--sc/source/filter/xml/XMLConverter.cxx302
-rw-r--r--sc/source/filter/xml/XMLConverter.hxx58
-rw-r--r--sc/source/filter/xml/XMLExportDataPilot.cxx3
-rw-r--r--sc/source/filter/xml/XMLExportDatabaseRanges.cxx50
-rw-r--r--sc/source/filter/xml/XMLExportDatabaseRanges.hxx12
-rw-r--r--sc/source/filter/xml/XMLExportIterator.cxx7
-rw-r--r--sc/source/filter/xml/XMLExportIterator.hxx3
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx4
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.hxx2
-rw-r--r--sc/source/filter/xml/XMLTrackedChangesContext.cxx24
-rw-r--r--sc/source/filter/xml/xmlannoi.cxx92
-rw-r--r--sc/source/filter/xml/xmlannoi.hxx51
-rw-r--r--sc/source/filter/xml/xmlbodyi.cxx13
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx202
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx25
-rw-r--r--sc/source/filter/xml/xmlcvali.cxx289
-rw-r--r--sc/source/filter/xml/xmldrani.cxx5
-rw-r--r--sc/source/filter/xml/xmldrani.hxx6
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx84
-rw-r--r--sc/source/filter/xml/xmlexprt.hxx4
-rw-r--r--sc/source/filter/xml/xmlexternaltabi.cxx45
-rw-r--r--sc/source/filter/xml/xmlexternaltabi.hxx24
-rw-r--r--sc/source/filter/xml/xmlfilti.cxx44
-rw-r--r--sc/source/filter/xml/xmlfilti.hxx9
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx118
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx81
-rw-r--r--sc/source/filter/xml/xmlnexpi.cxx15
-rw-r--r--sc/source/filter/xml/xmlstyli.cxx250
-rw-r--r--sc/source/filter/xml/xmlstyli.hxx30
-rw-r--r--sc/source/filter/xml/xmlsubti.cxx63
-rw-r--r--sc/source/filter/xml/xmlsubti.hxx6
-rw-r--r--sc/source/filter/xml/xmltabi.cxx6
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx25
-rw-r--r--sc/source/ui/app/inputhdl.cxx66
-rw-r--r--sc/source/ui/app/inputwin.cxx2
-rw-r--r--sc/source/ui/app/transobj.cxx9
-rw-r--r--sc/source/ui/attrdlg/attrdlg.cxx10
-rw-r--r--sc/source/ui/attrdlg/condfrmt.cxx70
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx72
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx21
-rw-r--r--sc/source/ui/dbgui/fieldwnd.cxx2
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx533
-rw-r--r--sc/source/ui/dbgui/pivot.hrc4
-rw-r--r--sc/source/ui/dbgui/pivot.src47
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx184
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx5
-rw-r--r--sc/source/ui/dbgui/sortdlg.cxx53
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx24
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx21
-rw-r--r--sc/source/ui/docshell/docfunc.cxx862
-rw-r--r--sc/source/ui/docshell/docsh.cxx124
-rw-r--r--sc/source/ui/docshell/docsh3.cxx6
-rw-r--r--sc/source/ui/docshell/docsh4.cxx42
-rw-r--r--sc/source/ui/docshell/docsh5.cxx44
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx132
-rw-r--r--sc/source/ui/docshell/impex.cxx235
-rw-r--r--sc/source/ui/docshell/servobj.cxx2
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx29
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx27
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx6
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx4
-rw-r--r--sc/source/ui/drawfunc/fupoor.cxx5
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx6
-rw-r--r--sc/source/ui/drawfunc/fusel2.cxx3
-rw-r--r--sc/source/ui/drawfunc/futext.cxx4
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx2
-rw-r--r--sc/source/ui/formdlg/formula.cxx7
-rw-r--r--sc/source/ui/inc/AccessibleContextBase.hxx2
-rw-r--r--sc/source/ui/inc/attrdlg.hxx12
-rw-r--r--sc/source/ui/inc/cellsh.hxx3
-rw-r--r--sc/source/ui/inc/condfrmt.hrc4
-rw-r--r--sc/source/ui/inc/condfrmt.hxx4
-rw-r--r--sc/source/ui/inc/docfunc.hxx13
-rw-r--r--sc/source/ui/inc/docsh.hxx4
-rw-r--r--sc/source/ui/inc/filtdlg.hxx49
-rw-r--r--sc/source/ui/inc/filter.hrc7
-rw-r--r--sc/source/ui/inc/formula.hxx1
-rw-r--r--sc/source/ui/inc/gridwin.hxx9
-rw-r--r--sc/source/ui/inc/impex.hxx14
-rw-r--r--sc/source/ui/inc/inputhdl.hxx4
-rw-r--r--sc/source/ui/inc/instbdlg.hxx5
-rw-r--r--sc/source/ui/inc/mvtabdlg.hxx4
-rw-r--r--sc/source/ui/inc/printfun.hxx2
-rw-r--r--sc/source/ui/inc/protectiondlg.hrc47
-rw-r--r--sc/source/ui/inc/protectiondlg.hxx85
-rw-r--r--sc/source/ui/inc/pvlaydlg.hxx22
-rw-r--r--sc/source/ui/inc/retypepassdlg.hrc74
-rw-r--r--sc/source/ui/inc/retypepassdlg.hxx177
-rw-r--r--sc/source/ui/inc/scui_def.hxx2
-rw-r--r--sc/source/ui/inc/sortdlg.hrc8
-rw-r--r--sc/source/ui/inc/sortdlg.hxx33
-rw-r--r--sc/source/ui/inc/strindlg.hxx4
-rw-r--r--sc/source/ui/inc/tabview.hxx1
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx5
-rw-r--r--sc/source/ui/inc/tpsort.hxx19
-rw-r--r--sc/source/ui/inc/undoblk.hxx30
-rw-r--r--sc/source/ui/inc/undotab.hxx46
-rw-r--r--sc/source/ui/inc/viewfunc.hxx4
-rw-r--r--sc/source/ui/inc/viewutil.hxx8
-rw-r--r--sc/source/ui/miscdlgs/instbdlg.cxx22
-rw-r--r--sc/source/ui/miscdlgs/makefile.mk16
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx13
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.cxx164
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.src130
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.cxx547
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.src316
-rw-r--r--sc/source/ui/miscdlgs/strindlg.cxx8
-rw-r--r--sc/source/ui/src/condfrmt.src21
-rw-r--r--sc/source/ui/src/filter.src160
-rw-r--r--sc/source/ui/src/globstr.src4
-rw-r--r--sc/source/ui/src/popup.src6
-rw-r--r--sc/source/ui/src/scstring.src10
-rw-r--r--sc/source/ui/src/sortdlg.src44
-rw-r--r--sc/source/ui/undo/undoblk.cxx2
-rw-r--r--sc/source/ui/undo/undoblk3.cxx105
-rw-r--r--sc/source/ui/undo/undocell.cxx11
-rw-r--r--sc/source/ui/undo/undotab.cxx303
-rw-r--r--sc/source/ui/unoobj/addruno.cxx4
-rw-r--r--sc/source/ui/unoobj/afmtuno.cxx42
-rw-r--r--sc/source/ui/unoobj/appluno.cxx4
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx790
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx259
-rw-r--r--sc/source/ui/unoobj/confuno.cxx4
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx3192
-rw-r--r--sc/source/ui/unoobj/datauno.cxx170
-rw-r--r--sc/source/ui/unoobj/defltuno.cxx70
-rw-r--r--sc/source/ui/unoobj/docuno.cxx88
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx3
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx34
-rw-r--r--sc/source/ui/unoobj/fmtuno.cxx149
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx9
-rw-r--r--sc/source/ui/unoobj/linkuno.cxx4
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx4
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx20
-rw-r--r--sc/source/ui/unoobj/optuno.cxx227
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx2
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx113
-rw-r--r--sc/source/ui/unoobj/srchuno.cxx6
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx196
-rw-r--r--sc/source/ui/unoobj/targuno.cxx4
-rw-r--r--sc/source/ui/unoobj/textuno.cxx16
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx57
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx9
-rw-r--r--sc/source/ui/unoobj/warnpassword.cxx1
-rw-r--r--sc/source/ui/vba/vbacontrol.cxx9
-rw-r--r--sc/source/ui/vba/vbarange.cxx52
-rw-r--r--sc/source/ui/view/cellsh1.cxx108
-rw-r--r--sc/source/ui/view/cellsh2.cxx394
-rw-r--r--sc/source/ui/view/cellsh3.cxx38
-rw-r--r--sc/source/ui/view/dbfunc.cxx3
-rw-r--r--sc/source/ui/view/dbfunc3.cxx64
-rw-r--r--sc/source/ui/view/editsh.cxx46
-rw-r--r--sc/source/ui/view/formatsh.cxx7
-rw-r--r--sc/source/ui/view/gridwin.cxx257
-rw-r--r--sc/source/ui/view/gridwin5.cxx4
-rw-r--r--sc/source/ui/view/preview.cxx7
-rw-r--r--sc/source/ui/view/prevwsh.cxx4
-rw-r--r--sc/source/ui/view/printfun.cxx5
-rw-r--r--sc/source/ui/view/scextopt.cxx4
-rw-r--r--sc/source/ui/view/select.cxx23
-rw-r--r--sc/source/ui/view/tabcont.cxx43
-rw-r--r--sc/source/ui/view/tabview2.cxx20
-rw-r--r--sc/source/ui/view/tabview3.cxx84
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx227
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx44
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx5
-rw-r--r--sc/source/ui/view/tabvwsha.cxx13
-rw-r--r--sc/source/ui/view/tabvwshf.cxx18
-rw-r--r--sc/source/ui/view/tabvwshh.cxx21
-rw-r--r--sc/source/ui/view/viewfun2.cxx4
-rw-r--r--sc/source/ui/view/viewfun3.cxx34
-rw-r--r--sc/source/ui/view/viewfun4.cxx128
-rw-r--r--sc/source/ui/view/viewfun6.cxx6
-rw-r--r--sc/source/ui/view/viewfunc.cxx197
-rw-r--r--sc/source/ui/view/viewutil.cxx57
-rw-r--r--sc/uiconfig/layout/delzip1
-rw-r--r--sc/uiconfig/layout/insert-sheet.xml57
-rw-r--r--sc/uiconfig/layout/makefile.mk67
-rw-r--r--sc/uiconfig/layout/move-copy-sheet.xml21
-rw-r--r--sc/uiconfig/layout/sort-options.xml40
-rw-r--r--sc/uiconfig/layout/string-input.xml16
-rw-r--r--sc/util/makefile.mk12
-rw-r--r--scaddins/prj/build.lst2
-rw-r--r--scaddins/source/analysis/makefile.mk2
-rw-r--r--scaddins/source/datefunc/makefile.mk2
-rw-r--r--sccomp/prj/build.lst2
-rw-r--r--sccomp/source/solver/solver.cxx49
572 files changed, 22597 insertions, 11702 deletions
diff --git a/chart2/prj/build.lst b/chart2/prj/build.lst
index d9827dfee62e..2fc7889b3122 100644
--- a/chart2/prj/build.lst
+++ b/chart2/prj/build.lst
@@ -1,4 +1,4 @@
-ch chart2 : comphelper cppu cppuhelper sal svtools svx tools vcl toolkit unotools sfx2 goodies NULL
+ch chart2 : l10n comphelper cppu cppuhelper sal svtools svx tools vcl toolkit unotools sfx2 goodies 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/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
index 9a024cf309fc..7fd921e761dc 100644
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
@@ -32,7 +32,6 @@
#include "precompiled_chart2.hxx"
#include "AxisWrapper.hxx"
#include "AxisHelper.hxx"
-#include "Scaling.hxx"
#include "Chart2ModelContact.hxx"
#include "ContainerHelper.hxx"
#include "macros.hxx"
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
index 4b44b2e0593d..3d930f72f0af 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -177,6 +177,17 @@ sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForAxis(
, Reference< util::XNumberFormatsSupplier >( m_xChartModel.get(), uno::UNO_QUERY ) );
}
+sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForSeries(
+ const Reference< chart2::XDataSeries >& xSeries )
+{
+ return ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ uno::Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ),
+ xSeries,
+ -1 /*-1 for whole series*/,
+ ChartModelHelper::findDiagram( m_xChartModel )
+ );
+}
+
//-----------------------------------------------------------------------------
awt::Size Chart2ModelContact::GetPageSize() const
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
index b8ce668dff28..0cc8a16bafff 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XTitle.hpp>
#include <cppuhelper/weakref.hxx>
@@ -87,6 +88,9 @@ public:
sal_Int32 getExplicitNumberFormatKeyForAxis(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ sal_Int32 getExplicitNumberFormatKeyForSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries );
+
/** Returns the size of the page in logic coordinates. This value is used
for setting an appropriate "ReferencePageSize" for FontHeights.
*/
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
index ee7069338872..8cbb0c5af80c 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
@@ -37,7 +37,7 @@
#include "servicenames_charttypes.hxx"
#include "ContainerHelper.hxx"
#include "CommonFunctors.hxx"
-#include "InternalDataProvider.hxx"
+#include "ChartModelHelper.hxx"
#include "DataSeriesHelper.hxx"
#include "ControllerLockGuard.hxx"
#include "Chart2ModelContact.hxx"
@@ -580,7 +580,7 @@ void ChartDataWrapper::applyData( bool bSetValues, bool bSetRowDescriptions, boo
// create a data provider containing the new data
uno::Reference< chart2::data::XDataProvider > xTempDataProvider(
- new InternalDataProvider());
+ ChartModelHelper::createInternalDataProvider() );
if( ! xTempDataProvider.is())
throw uno::RuntimeException( C2U("Couldn't create temporary data provider"),
static_cast< ::cppu::OWeakObject * >( this ));
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 5869a1e4bdb0..fcc17fefeebc 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -43,7 +43,6 @@
#include "chartview/ExplicitValueProvider.hxx"
#include "chartview/DrawModelWrapper.hxx"
#include "Chart2ModelContact.hxx"
-#include "InternalDataProvider.hxx"
#include "DiagramHelper.hxx"
#include "DataSourceHelper.hxx"
@@ -56,6 +55,7 @@
#include "LegendWrapper.hxx"
#include "AreaWrapper.hxx"
#include "WrappedAddInProperty.hxx"
+#include "WrappedIgnoreProperty.hxx"
#include "ChartRenderer.hxx"
#include <com/sun/star/chart2/XTitled.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
@@ -70,6 +70,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/DateTime.hpp>
#include <vector>
#include <algorithm>
@@ -97,6 +98,7 @@ enum eServiceType
SERVICE_NAME_PIE_DIAGRAM,
SERVICE_NAME_STOCK_DIAGRAM,
SERVICE_NAME_XY_DIAGRAM,
+ SERVICE_NAME_BUBBLE_DIAGRAM,
SERVICE_NAME_DASH_TABLE,
SERVICE_NAME_GARDIENT_TABLE,
@@ -125,6 +127,7 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
( C2U( "com.sun.star.chart.PieDiagram" ), SERVICE_NAME_PIE_DIAGRAM )
( C2U( "com.sun.star.chart.StockDiagram" ), SERVICE_NAME_STOCK_DIAGRAM )
( C2U( "com.sun.star.chart.XYDiagram" ), SERVICE_NAME_XY_DIAGRAM )
+ ( C2U( "com.sun.star.chart.BubbleDiagram" ), SERVICE_NAME_BUBBLE_DIAGRAM )
( C2U( "com.sun.star.drawing.DashTable" ), SERVICE_NAME_DASH_TABLE )
( C2U( "com.sun.star.drawing.GradientTable" ), SERVICE_NAME_GARDIENT_TABLE )
@@ -151,7 +154,8 @@ enum
PROP_DOCUMENT_ADDIN,
PROP_DOCUMENT_BASEDIAGRAM,
PROP_DOCUMENT_ADDITIONAL_SHAPES,
- PROP_DOCUMENT_UPDATE_ADDIN
+ PROP_DOCUMENT_UPDATE_ADDIN,
+ PROP_DOCUMENT_NULL_DATE
};
void lcl_AddPropertiesToVector(
@@ -215,6 +219,13 @@ void lcl_AddPropertiesToVector(
PROP_DOCUMENT_UPDATE_ADDIN,
::getBooleanCppuType(),
beans::PropertyAttribute::BOUND ));
+
+ // table:null-date // i99104
+ rOutProperties.push_back(
+ Property( C2U( "NullDate" ),
+ PROP_DOCUMENT_NULL_DATE,
+ ::getCppuType( static_cast< const ::com::sun::star::util::DateTime * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
}
const uno::Sequence< Property > & lcl_GetPropertySequence()
@@ -696,7 +707,6 @@ Any WrappedHasSubTitleProperty::getPropertyDefault( const Reference< beans::XPro
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
-
ChartDocumentWrapper::ChartDocumentWrapper(
const Reference< uno::XComponentContext > & xContext ) :
m_spChart2ModelContact( new Chart2ModelContact( xContext ) ),
@@ -899,7 +909,7 @@ void SAL_CALL ChartDocumentWrapper::attachData( const Reference< XChartData >& x
// create a data provider containing the new data
Reference< chart2::data::XDataProvider > xTempDataProvider(
- new InternalDataProvider( xDataArray ));
+ ChartModelHelper::createInternalDataProvider( xDataArray ));
if( ! xTempDataProvider.is())
throw uno::RuntimeException( C2U("Couldn't create temporary data provider"),
@@ -1359,6 +1369,16 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
}
break;
+ case SERVICE_NAME_BUBBLE_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Bubble" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+
case SERVICE_NAME_DASH_TABLE:
case SERVICE_NAME_GARDIENT_TABLE:
case SERVICE_NAME_HATCH_TABLE:
@@ -1632,6 +1652,7 @@ const std::vector< WrappedProperty* > ChartDocumentWrapper::createWrappedPropert
aWrappedProperties.push_back( new WrappedBaseDiagramProperty( *this ) );
aWrappedProperties.push_back( new WrappedAdditionalShapesProperty( *this ) );
aWrappedProperties.push_back( new WrappedRefreshAddInAllowedProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U("NullDate"),Any() ) ); // i99104
return aWrappedProperties;
}
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index fc62b3b77223..ce417155dc4f 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -50,6 +50,8 @@
#include "WrappedDataCaptionProperties.hxx"
#include "WrappedSeriesAreaOrLineProperty.hxx"
#include "WrappedScaleTextProperties.hxx"
+#include "WrappedNumberFormatProperty.hxx"
+#include "WrappedTextRotationProperty.hxx"
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
// header for define DBG_ASSERT
@@ -87,10 +89,12 @@ enum
PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
PROP_SERIES_NUMBERFORMAT,
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
//other series properties
- PROP_SERIES_ATTACHED_AXIS
+ PROP_SERIES_ATTACHED_AXIS,
+ PROP_SERIES_DATAPOINT_TEXT_ROTATION
};
void lcl_AddPropertiesToVector_PointProperties(
@@ -145,6 +149,13 @@ void lcl_AddPropertiesToVector_PointProperties(
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_SERIES_DATAPOINT_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
}
void lcl_AddPropertiesToVector_SeriesOnly(
@@ -156,6 +167,13 @@ void lcl_AddPropertiesToVector_SeriesOnly(
::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LinkNumberFormatToSource" ),
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
}
const uno::Sequence< Property > & lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )
@@ -704,6 +722,10 @@ const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedPrope
{
WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) );
+
+ WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
+ aWrappedProperties.push_back( pWrappedNumberFormatProperty );
+ aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
}
WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
@@ -750,6 +772,8 @@ const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedPrope
aWrappedProperties.push_back( new WrappedSegmentOffsetProperty() );
aWrappedProperties.push_back( new WrappedProperty( C2U( "D3DPercentDiagonal" ), C2U( "PercentDiagonal" ) ) );
+ aWrappedProperties.push_back( new WrappedTextRotationProperty() );
+
return aWrappedProperties;
}
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index c8220254d94e..fe1359aab7f3 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -112,6 +112,7 @@ enum
PROP_DIAGRAM_DATAROW_SOURCE,
PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
PROP_DIAGRAM_SORT_BY_X_VALUES,
@@ -233,6 +234,13 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "IncludeHiddenCells" ),
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
//new for XY charts
rOutProperties.push_back(
Property( C2U( "SortByXValues" ),
@@ -541,6 +549,9 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
if( aName.indexOf( C2U("Stock") ) != -1 )
return C2U( "com.sun.star.chart.StockDiagram" );
+ if( aName.indexOf( C2U("Bubble") ) != -1 )
+ return C2U( "com.sun.star.chart.BubbleDiagram" );
+
// Note: this must be checked after Bar, Net and Scatter
// "Symbol" "StackedSymbol" "PercentStackedSymbol" "Line" "StackedLine"
@@ -586,6 +597,9 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" ) )
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" ) )
+
;
return g_aChartTypeNameMap;
}
@@ -1970,6 +1984,44 @@ Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XP
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
+//PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS
+class WrappedIncludeHiddenCellsProperty : public WrappedProperty
+{
+public:
+ WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedIncludeHiddenCellsProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("IncludeHiddenCells"),C2U("IncludeHiddenCells"))
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedIncludeHiddenCellsProperty::~WrappedIncludeHiddenCellsProperty()
+{
+}
+
+void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 );
+
+ ChartModelHelper::setIncludeHiddenCells( bNewValue, m_spChart2ModelContact->getChartModel() );
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
// ____ XDiagramProvider ____
Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram()
throw (uno::RuntimeException)
@@ -2025,6 +2077,8 @@ const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()
aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedBarsConnected" ), C2U( "ConnectBars" ) ) );
aWrappedProperties.push_back( new WrappedSolidTypeProperty( m_spChart2ModelContact ) );
aWrappedProperties.push_back( new WrappedAutomaticSizeProperty() );
+ aWrappedProperties.push_back( new WrappedIncludeHiddenCellsProperty( m_spChart2ModelContact ) );
+
return aWrappedProperties;
}
diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
index 11cf4cbb3102..7aebd872f870 100644
--- a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
@@ -34,7 +34,6 @@
#include "GridWrapper.hxx"
#include "macros.hxx"
#include "AxisHelper.hxx"
-#include "Scaling.hxx"
#include "Chart2ModelContact.hxx"
#include "ContainerHelper.hxx"
#include "AxisIndexDefines.hxx"
diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
index 7e9aa4c6aeb9..efda626e5fd6 100644
--- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
@@ -33,7 +33,6 @@
#include "WallFloorWrapper.hxx"
#include "macros.hxx"
-#include "Scaling.hxx"
#include "Chart2ModelContact.hxx"
#include "ContainerHelper.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
index 4110a6ef3b54..00101ef10f34 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
@@ -98,8 +98,15 @@ Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XProp
Any aRet( xInnerPropertySet->getPropertyValue( m_aInnerName ));
if( !aRet.hasValue() )
{
- Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
- sal_Int32 nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
+ sal_Int32 nKey = 0;
+ Reference< chart2::XDataSeries > xSeries( xInnerPropertySet, uno::UNO_QUERY );
+ if( xSeries.is() )
+ nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForSeries( xSeries );
+ else
+ {
+ Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
+ }
aRet <<= nKey;
}
return aRet;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
index 9c3330932fc1..ffbaac3a5eb0 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
@@ -33,7 +33,6 @@
#include "WrappedScaleProperty.hxx"
#include "macros.hxx"
-#include "Scaling.hxx"
#include "CommonConverters.hxx"
#include "AxisHelper.hxx"
#include <com/sun/star/chart2/XAxis.hpp>
@@ -280,7 +279,7 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons
if( (!bBool) != (!bWasLogarithm) )
{
if( bBool )
- aScaleData.Scaling = new LogarithmicScaling( 10.0 );
+ aScaleData.Scaling = AxisHelper::createLogarithmicScaling( 10.0 );
else
aScaleData.Scaling = 0;
bSetScaleData = true;
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
index 96067e01c510..e5f45408217e 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
@@ -54,23 +54,6 @@ void WrappedSceneProperty::addWrappedProperties( std::vector< WrappedProperty* >
, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
{
rList.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact ) );
- /*
- rList.push_back( new WrappedD3DSceneShadeModeProperty() );
- rList.push_back( new WrappedD3DScenePerspectiveProperty() );
- rList.push_back( new WrappedD3DSceneAmbientColorProperty() );
- for( sal_Int32 nN=1; nN<=8; nN++ )
- {
- rList.push_back( new WrappedD3DSceneLightColorProperty(nN) );
- rList.push_back( new WrappedD3DSceneLightDirectionProperty(nN) );
- rList.push_back( new WrappedD3DSceneLightOnProperty(nN) );
- }
-
- rList.push_back( new WrappedD3DSceneDistanceProperty() );
- rList.push_back( new WrappedD3DSceneFocalLengthProperty() );
- rList.push_back( new WrappedD3DSceneShadowSlantProperty() );
- rList.push_back( new WrappedD3DSceneTwoSidedLightingProperty() );
- rList.push_back( new WrappedD3DCameraGeometryProperty() );
- */
}
//----------------------------------------------------------------------------------------------------------------------
@@ -146,546 +129,6 @@ Any WrappedD3DTransformMatrixProperty::getPropertyDefault( const Reference< bean
return WrappedProperty::getPropertyDefault( xInnerPropertyState );
}
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-/*
-WrappedD3DSceneShadeModeProperty::WrappedD3DSceneShadeModeProperty()
- : WrappedProperty(C2U("D3DSceneShadeMode"),OUString())
-{
-}
-
-WrappedD3DSceneShadeModeProperty::~WrappedD3DSceneShadeModeProperty()
-{
-}
-
-void WrappedD3DSceneShadeModeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- drawing::ShadeMode aNewValue;
- if( !(rOuterValue >>= aNewValue) )
- throw lang::IllegalArgumentException( C2U("Property D3DSceneShadeMode requires value of type drawing::ShadeMode"), 0, 0 );
-
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneShadeMode" );
- return;
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
-
- if( aSceneDescriptor.aShadeMode != aNewValue )
- {
- aSceneDescriptor.aShadeMode = aNewValue;
- xInnerPropertySet->setPropertyValue( C2U( "SceneProperties" ), uno::makeAny( aSceneDescriptor ) );
- }
-}
-
-Any WrappedD3DSceneShadeModeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DTransformMatrix" );
- return Any();
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
- return uno::makeAny( aSceneDescriptor.aShadeMode );
-}
-
-Any WrappedD3DSceneShadeModeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return uno::makeAny( drawing::ShadeMode_SMOOTH );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DScenePerspectiveProperty::WrappedD3DScenePerspectiveProperty()
- : WrappedProperty(C2U("D3DScenePerspective"),OUString())
-{
-}
-
-WrappedD3DScenePerspectiveProperty::~WrappedD3DScenePerspectiveProperty()
-{
-}
-
-void WrappedD3DScenePerspectiveProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- drawing::ProjectionMode aNewValue;
- if( !(rOuterValue >>= aNewValue) )
- throw lang::IllegalArgumentException( C2U("Property D3DScenePerspective requires value of type drawing::ProjectionMode"), 0, 0 );
-
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DScenePerspective" );
- return;
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
-
- if( aSceneDescriptor.aProjectionMode != aNewValue )
- {
- aSceneDescriptor.aProjectionMode = aNewValue;
- xInnerPropertySet->setPropertyValue( C2U( "SceneProperties" ), uno::makeAny( aSceneDescriptor ) );
- }
-}
-
-Any WrappedD3DScenePerspectiveProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DTransformMatrix" );
- return Any();
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
- return uno::makeAny( aSceneDescriptor.aProjectionMode );
-}
-
-Any WrappedD3DScenePerspectiveProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return uno::makeAny( drawing::ProjectionMode_PERSPECTIVE );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DSceneAmbientColorProperty::WrappedD3DSceneAmbientColorProperty()
- : WrappedProperty(C2U("D3DSceneAmbientColor"),OUString())
-{
-}
-
-WrappedD3DSceneAmbientColorProperty::~WrappedD3DSceneAmbientColorProperty()
-{
-}
-
-void WrappedD3DSceneAmbientColorProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- sal_Int32 nNewColor;
- if( !(rOuterValue >>= nNewColor) )
- throw lang::IllegalArgumentException( C2U("Property D3DSceneAmbientColor requires value of type sal_Int32"), 0, 0 );
-
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneAmbientColor" );
- return;
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
-
- if( aSceneDescriptor.nAmbientLightColor != nNewColor )
- {
- aSceneDescriptor.nAmbientLightColor = nNewColor;
- xInnerPropertySet->setPropertyValue( C2U( "SceneProperties" ), uno::makeAny( aSceneDescriptor ) );
- }
-}
-
-Any WrappedD3DSceneAmbientColorProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneAmbientColor" );
- return Any();
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
- return uno::makeAny( aSceneDescriptor.nAmbientLightColor );
-}
-
-Any WrappedD3DSceneAmbientColorProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return uno::makeAny( sal_Int32(0x666666) ); // grey40
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DSceneLightColorProperty::WrappedD3DSceneLightColorProperty( sal_Int32 nLightNumber )
- : WrappedProperty(C2U("D3DSceneLightColor"),OUString())
- , m_nLightIndex( nLightNumber-1 )
-{
- if( m_nLightIndex < 0 )
- m_nLightIndex = 0;
-
- m_aOuterName += OUString::valueOf( nLightNumber );
-}
-
-WrappedD3DSceneLightColorProperty::~WrappedD3DSceneLightColorProperty()
-{
-}
-
-void WrappedD3DSceneLightColorProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- sal_Int32 nNewColor;
- if( !(rOuterValue >>= nNewColor) )
- throw lang::IllegalArgumentException( C2U("Property D3DSceneAmbientColor requires value of type sal_Int32"), 0, 0 );
-
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneAmbientColor" );
- return;
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
-
- if( aSceneDescriptor.aLightSources.getLength() <= m_nLightIndex )
- aSceneDescriptor.aLightSources.realloc(m_nLightIndex+1);
-
- if( aSceneDescriptor.aLightSources[m_nLightIndex].nDiffuseColor != nNewColor )
- {
- aSceneDescriptor.aLightSources[m_nLightIndex].nDiffuseColor = nNewColor;
- xInnerPropertySet->setPropertyValue( C2U( "SceneProperties" ), uno::makeAny( aSceneDescriptor ) );
- }
-}
-
-Any WrappedD3DSceneLightColorProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneAmbientColor" );
- return Any();
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
- if( aSceneDescriptor.aLightSources.getLength() <= m_nLightIndex )
- return getPropertyDefault( 0 );
-
- return uno::makeAny( aSceneDescriptor.aLightSources[m_nLightIndex].nDiffuseColor );
-}
-
-Any WrappedD3DSceneLightColorProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if(m_nLightIndex==1)
- return uno::makeAny( sal_Int32(0xcccccc) ); // grey80
- return uno::makeAny( sal_Int32(0xffffff) ); // white
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DSceneLightDirectionProperty::WrappedD3DSceneLightDirectionProperty( sal_Int32 nLightNumber )
- : WrappedProperty(C2U("D3DSceneLightDirection"),OUString())
- , m_nLightIndex( nLightNumber-1 )
-{
- if( m_nLightIndex < 0 )
- m_nLightIndex = 0;
-
- m_aOuterName += OUString::valueOf( nLightNumber );
-}
-
-WrappedD3DSceneLightDirectionProperty::~WrappedD3DSceneLightDirectionProperty()
-{
-}
-
-void WrappedD3DSceneLightDirectionProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- drawing::Direction3D aNewValue;
- if( !(rOuterValue >>= aNewValue) )
- throw lang::IllegalArgumentException( C2U("Property D3DSceneLightDirection requires value of type drawing::Direction3D"), 0, 0 );
-
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneLightDirection" );
- return;
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
-
- if( aSceneDescriptor.aLightSources.getLength() <= m_nLightIndex )
- aSceneDescriptor.aLightSources.realloc(m_nLightIndex+1);
-
- if( Direction3DToB3DPoint( aSceneDescriptor.aLightSources[m_nLightIndex].aDirection ) != Direction3DToB3DPoint( aNewValue ) )
- {
- aSceneDescriptor.aLightSources[m_nLightIndex].aDirection = aNewValue;
- xInnerPropertySet->setPropertyValue( C2U( "SceneProperties" ), uno::makeAny( aSceneDescriptor ) );
- }
-}
-
-Any WrappedD3DSceneLightDirectionProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneLightDirection" );
- return Any();
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
- if( aSceneDescriptor.aLightSources.getLength() <= m_nLightIndex )
- return getPropertyDefault( 0 );
-
- return uno::makeAny( aSceneDescriptor.aLightSources[m_nLightIndex].aDirection );
-}
-
-Any WrappedD3DSceneLightDirectionProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return uno::makeAny( drawing::Direction3D( 1, 1, 1 ) );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DSceneLightOnProperty::WrappedD3DSceneLightOnProperty( sal_Int32 nLightNumber )
- : WrappedProperty(C2U("D3DSceneLightOn"),OUString())
- , m_nLightIndex( nLightNumber-1 )
-{
- if( m_nLightIndex < 0 )
- m_nLightIndex = 0;
-
- m_aOuterName += OUString::valueOf( nLightNumber );
-}
-
-WrappedD3DSceneLightOnProperty::~WrappedD3DSceneLightOnProperty()
-{
-}
-
-void WrappedD3DSceneLightOnProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- sal_Bool bNewValue;
- if( !(rOuterValue >>= bNewValue) )
- throw lang::IllegalArgumentException( C2U("Property D3DSceneLightOn requires value of type sal_Bool"), 0, 0 );
-
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneLightOn" );
- return;
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
-
- if( aSceneDescriptor.aLightSources.getLength() <= m_nLightIndex )
- aSceneDescriptor.aLightSources.realloc(m_nLightIndex+1);
-
- if( aSceneDescriptor.aLightSources[m_nLightIndex].bIsEnabled != bNewValue )
- {
- aSceneDescriptor.aLightSources[m_nLightIndex].bIsEnabled = bNewValue;
- xInnerPropertySet->setPropertyValue( C2U( "SceneProperties" ), uno::makeAny( aSceneDescriptor ) );
- }
-}
-
-Any WrappedD3DSceneLightOnProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if( !xInnerPropertySet.is() )
- {
- DBG_ERROR( "need xInnerPropertySet to wrap property D3DSceneLightOn" );
- return Any();
- }
-
- chart2::SceneDescriptor aSceneDescriptor;
- xInnerPropertySet->getPropertyValue( C2U( "SceneProperties" ) )>>=aSceneDescriptor;
- if( aSceneDescriptor.aLightSources.getLength() <= m_nLightIndex )
- return getPropertyDefault( 0 );
-
- return uno::makeAny( aSceneDescriptor.aLightSources[m_nLightIndex].bIsEnabled );
-}
-
-Any WrappedD3DSceneLightOnProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if(m_nLightIndex==1)
- return uno::makeAny( sal_Bool(sal_True) );
- return uno::makeAny( sal_Bool(sal_False) );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DSceneDistanceProperty::WrappedD3DSceneDistanceProperty()
- : WrappedProperty(C2U("D3DSceneDistance"),OUString())
-{
-}
-
-WrappedD3DSceneDistanceProperty::~WrappedD3DSceneDistanceProperty()
-{
-}
-
-void WrappedD3DSceneDistanceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return; //this property is not supported anymore
-}
-
-Any WrappedD3DSceneDistanceProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return getPropertyDefault(0);//this property is not supported anymore
-}
-
-Any WrappedD3DSceneDistanceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- Any aRet;
- aRet <<= sal_Int32(419);
- return aRet;
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DSceneFocalLengthProperty::WrappedD3DSceneFocalLengthProperty()
- : WrappedProperty(C2U("D3DSceneFocalLength"),OUString())
-{
-}
-
-WrappedD3DSceneFocalLengthProperty::~WrappedD3DSceneFocalLengthProperty()
-{
-}
-
-void WrappedD3DSceneFocalLengthProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return; //this property is not supported anymore
-}
-
-Any WrappedD3DSceneFocalLengthProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return getPropertyDefault(0);//this property is not supported anymore
-}
-
-Any WrappedD3DSceneFocalLengthProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- Any aRet;
- aRet <<= sal_Int32(800);
- return aRet;
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DSceneShadowSlantProperty::WrappedD3DSceneShadowSlantProperty()
- : WrappedProperty(C2U("D3DSceneShadowSlant"),OUString())
-{
-}
-
-WrappedD3DSceneShadowSlantProperty::~WrappedD3DSceneShadowSlantProperty()
-{
-}
-
-void WrappedD3DSceneShadowSlantProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return; //this property is not supported anymore
-}
-
-Any WrappedD3DSceneShadowSlantProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return getPropertyDefault(0);//this property is not supported anymore
-}
-
-Any WrappedD3DSceneShadowSlantProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- Any aRet;
- aRet <<= sal_Int32(0);
- return aRet;
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DSceneTwoSidedLightingProperty::WrappedD3DSceneTwoSidedLightingProperty()
- : WrappedProperty(C2U("D3DSceneTwoSidedLighting"),OUString())
-{
-}
-
-WrappedD3DSceneTwoSidedLightingProperty::~WrappedD3DSceneTwoSidedLightingProperty()
-{
-}
-
-void WrappedD3DSceneTwoSidedLightingProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return; //this property is not supported anymore
-}
-
-Any WrappedD3DSceneTwoSidedLightingProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return getPropertyDefault(0);//this property is not supported anymore
-}
-
-Any WrappedD3DSceneTwoSidedLightingProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- Any aRet;
- aRet <<= sal_Bool(sal_False);
- return aRet;
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-WrappedD3DCameraGeometryProperty::WrappedD3DCameraGeometryProperty()
- : WrappedProperty(C2U("D3DCameraGeometry"),OUString())
-{
-}
-
-WrappedD3DCameraGeometryProperty::~WrappedD3DCameraGeometryProperty()
-{
-}
-
-void WrappedD3DCameraGeometryProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return; //this property is not supported anymore
-}
-
-Any WrappedD3DCameraGeometryProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return getPropertyDefault(0);//this property is not supported anymore
-}
-
-Any WrappedD3DCameraGeometryProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
- throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
-{
- return Any();
-}
-*/
-
} //namespace wrapper
} //namespace chart
//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
index f587954968bb..520524e7c4d3 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
@@ -77,240 +77,6 @@ private:
::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
};
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-/*
-class WrappedD3DSceneShadeModeProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneShadeModeProperty();
- virtual ~WrappedD3DSceneShadeModeProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DScenePerspectiveProperty : public WrappedProperty
-{
-public:
- WrappedD3DScenePerspectiveProperty();
- virtual ~WrappedD3DScenePerspectiveProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DSceneAmbientColorProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneAmbientColorProperty();
- virtual ~WrappedD3DSceneAmbientColorProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DSceneLightColorProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneLightColorProperty( sal_Int32 nLightNumber );
- virtual ~WrappedD3DSceneLightColorProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
-private:
- sal_Int32 m_nLightIndex;
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DSceneLightDirectionProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneLightDirectionProperty( sal_Int32 nLightNumber );
- virtual ~WrappedD3DSceneLightDirectionProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
-private:
- sal_Int32 m_nLightIndex;
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DSceneLightOnProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneLightOnProperty( sal_Int32 nLightNumber );
- virtual ~WrappedD3DSceneLightOnProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
-private:
- sal_Int32 m_nLightIndex;
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DSceneDistanceProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneDistanceProperty();
- virtual ~WrappedD3DSceneDistanceProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DSceneShadowSlantProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneShadowSlantProperty();
- virtual ~WrappedD3DSceneShadowSlantProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DSceneFocalLengthProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneFocalLengthProperty();
- virtual ~WrappedD3DSceneFocalLengthProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DSceneTwoSidedLightingProperty : public WrappedProperty
-{
-public:
- WrappedD3DSceneTwoSidedLightingProperty();
- virtual ~WrappedD3DSceneTwoSidedLightingProperty();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------------------------------------
-
-class WrappedD3DCameraGeometryProperty : public WrappedProperty
-{
-public:
- WrappedD3DCameraGeometryProperty ();
- virtual ~WrappedD3DCameraGeometryProperty ();
-
- virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
- throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-};
-*/
-
-
} //namespace wrapper
} //namespace chart
//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
index a090e670bc8b..226bfd14bf4d 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
@@ -208,7 +208,7 @@ protected:
if( !xErrorBarProperties.is() )
{
// todo: use a valid context
- xErrorBarProperties = new ::chart::ErrorBar( uno::Reference< uno::XComponentContext >() );
+ xErrorBarProperties = ::chart::createErrorBar( uno::Reference< uno::XComponentContext >() );
//default in new and old api are different
xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(sal_Bool(sal_False)) );
xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(sal_Bool(sal_False)) );
diff --git a/chart2/source/controller/dialogs/Bitmaps.hrc b/chart2/source/controller/dialogs/Bitmaps.hrc
index 58b1d540cc1a..07ed2eeec0d5 100644
--- a/chart2/source/controller/dialogs/Bitmaps.hrc
+++ b/chart2/source/controller/dialogs/Bitmaps.hrc
@@ -34,23 +34,28 @@
#include <svtools/solar.hrc>
#endif
-// next free: 100
-
#ifndef STD_MASKCOLOR
#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
#endif
//-----------------------------------------------------------------------------
// chart types
+// Images:
#define IMG_TYPE_COLUMN (RID_APP_START + 1)
#define IMG_TYPE_BAR (RID_APP_START + 2)
#define IMG_TYPE_PIE (RID_APP_START + 3)
-#define IMG_TYPE_LINE (RID_APP_START + 4)
-#define IMG_TYPE_AREA (RID_APP_START + 5)
-#define IMG_TYPE_NET (RID_APP_START + 6)
-#define IMG_TYPE_STOCK (RID_APP_START + 7)
-#define IMG_TYPE_COLUMN_LINE (RID_APP_START + 8)
+#define IMG_TYPE_AREA (RID_APP_START + 4)
+#define IMG_TYPE_LINE (RID_APP_START + 5)
+#define IMG_TYPE_XY (RID_APP_START + 6)
+#define IMG_TYPE_BUBBLE (RID_APP_START + 7)
+#define IMG_TYPE_NET (RID_APP_START + 8)
+#define IMG_TYPE_STOCK (RID_APP_START + 9)
+#define IMG_TYPE_COLUMN_LINE (RID_APP_START + 10)
+
+//-----------------------------------------------------------------------------
+//Chart Subtypes
+// Bitmaps:
//----------------------
// Column Chart Subtypes
@@ -185,7 +190,13 @@
#define BMP_COLUMN_LINE (RID_APP_START + 86)
#define BMP_COLUMN_LINE_STACKED (RID_APP_START + 87)
+//----------------------
+// Bubble Chart Subtypes
+#define BMP_BUBBLE_1 (RID_APP_START + 88)
+
//-----------------------------------------------------------------------------
+//further Images:
+
//SchStatisticTabPage and SchDataStatisticsDlg part 1
#define BMP_INDICATE_BOTH_VERTI (RID_APP_START + 89)
#define BMP_INDICATE_UP (RID_APP_START + 90)
@@ -201,9 +212,8 @@
#define BMP_REGRESSION_EXP (RID_APP_START + 95)
#define BMP_REGRESSION_POWER (RID_APP_START + 96)
-//-----------------------------------------------------------------------------
// hide-button for range-choosing
-#define IMG_SELECTRANGE (RID_APP_START + 9)
+#define IMG_SELECTRANGE (RID_APP_START + 100)
// CHART_BITMAPS_HRC
#endif
diff --git a/chart2/source/controller/dialogs/Bitmaps.src b/chart2/source/controller/dialogs/Bitmaps.src
index 2af607b6963c..35a897848fb1 100644
--- a/chart2/source/controller/dialogs/Bitmaps.src
+++ b/chart2/source/controller/dialogs/Bitmaps.src
@@ -49,6 +49,11 @@ Image IMG_TYPE_LINE
ImageBitmap = Bitmap { File = "typepointline_16.png" ; };
MaskColor = STD_MASKCOLOR;
};
+Image IMG_TYPE_XY
+{
+ ImageBitmap = Bitmap { File = "typexy_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
Image IMG_TYPE_AREA
{
ImageBitmap = Bitmap { File = "typearea_16.png" ; };
@@ -69,6 +74,15 @@ Image IMG_TYPE_COLUMN_LINE
ImageBitmap = Bitmap { File = "typecolumnline_16.png" ; };
MaskColor = STD_MASKCOLOR;
};
+Image IMG_TYPE_BUBBLE
+{
+ ImageBitmap = Bitmap { File = "typebubble_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Bitmap BMP_BUBBLE_1
+{
+ File = "bubble_52x60.png" ;
+};
Bitmap BMP_AREAS_2D
{
File = "areas_52x60.png" ;
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.hrc b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
index 0b65579973c5..84a23ba426bc 100644
--- a/chart2/source/controller/dialogs/Bitmaps_HC.hrc
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
@@ -41,15 +41,22 @@
//-----------------------------------------------------------------------------
// chart types
+// Images:
#define IMG_TYPE_COLUMN_HC (RID_SCH_START + 1)
#define IMG_TYPE_BAR_HC (RID_SCH_START + 2)
#define IMG_TYPE_PIE_HC (RID_SCH_START + 3)
-#define IMG_TYPE_LINE_HC (RID_SCH_START + 4)
-#define IMG_TYPE_AREA_HC (RID_SCH_START + 5)
-#define IMG_TYPE_NET_HC (RID_SCH_START + 6)
-#define IMG_TYPE_STOCK_HC (RID_SCH_START + 7)
-#define IMG_TYPE_COLUMN_LINE_HC (RID_SCH_START + 8)
+#define IMG_TYPE_AREA_HC (RID_SCH_START + 4)
+#define IMG_TYPE_LINE_HC (RID_SCH_START + 5)
+#define IMG_TYPE_XY_HC (RID_SCH_START + 6)
+#define IMG_TYPE_BUBBLE_HC (RID_SCH_START + 7)
+#define IMG_TYPE_NET_HC (RID_SCH_START + 8)
+#define IMG_TYPE_STOCK_HC (RID_SCH_START + 9)
+#define IMG_TYPE_COLUMN_LINE_HC (RID_SCH_START + 10)
+
+//-----------------------------------------------------------------------------
+//Chart Subtypes
+// Bitmaps:
//----------------------
// Column Chart Subtypes
@@ -183,7 +190,13 @@
#define BMP_COLUMN_LINE_HC (RID_SCH_START + 86)
#define BMP_COLUMN_LINE_STACKED_HC (RID_SCH_START + 87)
+//----------------------
+// Bubble Chart Subtypes
+#define BMP_BUBBLE_1_HC (RID_SCH_START + 88)
+
//-----------------------------------------------------------------------------
+//further Images:
+
//SchStatisticTabPage and SchDataStatisticsDlg part 1
#define BMP_INDICATE_BOTH_VERTI_HC (RID_SCH_START + 89)
#define BMP_INDICATE_UP_HC (RID_SCH_START + 90)
@@ -199,6 +212,5 @@
#define BMP_REGRESSION_EXP_HC (RID_SCH_START + 95)
#define BMP_REGRESSION_POWER_HC (RID_SCH_START + 96)
-//-----------------------------------------------------------------------------
// hide-button for range-choosing
-#define IMG_SELECTRANGE_HC (RID_SCH_START + 9)
+#define IMG_SELECTRANGE_HC (RID_SCH_START + 100)
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.src b/chart2/source/controller/dialogs/Bitmaps_HC.src
index 1e2fe5f4ba14..0fb7ef5e5a1a 100644
--- a/chart2/source/controller/dialogs/Bitmaps_HC.src
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.src
@@ -49,6 +49,11 @@ Image IMG_TYPE_LINE_HC
ImageBitmap = Bitmap { File = "typepointline_16.png" ; };
MaskColor = SC_HC_MASKCOLOR;
};
+Image IMG_TYPE_XY_HC
+{
+ ImageBitmap = Bitmap { File = "typexy_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
Image IMG_TYPE_AREA_HC
{
ImageBitmap = Bitmap { File = "typearea_16.png" ; };
@@ -69,6 +74,15 @@ Image IMG_TYPE_COLUMN_LINE_HC
ImageBitmap = Bitmap { File = "typecolumnline_16.png" ; };
MaskColor = SC_HC_MASKCOLOR;
};
+Image IMG_TYPE_BUBBLE_HC
+{
+ ImageBitmap = Bitmap { File = "typebubble_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Bitmap BMP_BUBBLE_1_HC
+{
+ File = "bubble_52x60_h.png" ;
+};
Bitmap BMP_AREAS_2D_HC
{
File = "areas_52x60_h.png" ;
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 79efe0b04919..de57e82e58da 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -808,7 +808,7 @@ String XYChartDialogController::getName()
}
Image XYChartDialogController::getImage( bool bIsHighContrast )
{
- return SELECT_IMAGE( IMG_TYPE_LINE );
+ return SELECT_IMAGE( IMG_TYPE_XY );
}
const tTemplateServiceChartTypeParameterMap& XYChartDialogController::getTemplateMap() const
{
@@ -1238,6 +1238,40 @@ void CombiColumnLineChartDialogController::adjustParameterToSubType( ChartTypePa
break;
}
}
+//--------------------------------------------------------------------------
+BubbleChartDialogController::BubbleChartDialogController()
+{
+}
+BubbleChartDialogController::~BubbleChartDialogController()
+{
+}
+String BubbleChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_BUBBLE ));
+}
+Image BubbleChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_BUBBLE );
+}
+const tTemplateServiceChartTypeParameterMap& BubbleChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Bubble" ), ChartTypeParameter(1,true) ) ;
+ return m_aTemplateMap;
+}
+void BubbleChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_BUBBLE_1 ) );
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_BUBBLE_1 )) );
+}
+void BubbleChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
index 0f6c7a8ae2c0..cdbda807813f 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
@@ -301,6 +301,19 @@ private:
MetricField* m_pMF_NumberOfLines;
};
+class BubbleChartDialogController : public ChartTypeDialogController
+{
+public:
+ BubbleChartDialogController();
+ virtual ~BubbleChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+};
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 6dbce3afac61..0a9b58758de6 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -101,33 +101,6 @@ using namespace ::svt;
namespace
{
-void lcl_setNumberFormat(
- SvNumberFormatter * pNumFormatter, long nFmt,
- double fData, String & rOutString )
-{
- short eType = pNumFormatter->GetType( nFmt );
-
- // change nFmt to an editable format (without loss of information)
- if( eType == NUMBERFORMAT_CURRENCY ) // for currencies just display decimals
- {
- nFmt = pNumFormatter->GetStandardIndex();
- }
- else
- {
- const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
- if( pFormat )
- {
- LanguageType eLanguage = pFormat->GetLanguage();
- nFmt = pNumFormatter->GetStandardFormat( nFmt, eType, eLanguage );
- }
- // else: format is 'standard'
- }
-
- // format string to an editable format (without loss of information)
- Color* pDummy = NULL;
- pNumFormatter->GetOutputString( fData, nFmt, rOutString, &pDummy );
-}
-
sal_Int32 lcl_getRowInData( long nRow )
{
return static_cast< sal_Int32 >( nRow );
@@ -218,7 +191,6 @@ public:
sal_Int32 GetEndColumn() const;
void Show();
- void Hide();
/** call this before destroying the class. This notifies the listeners to
changes of the edit field for the series name.
@@ -380,13 +352,6 @@ void SeriesHeader::Show()
m_spColorBar->Show();
}
-void SeriesHeader::Hide()
-{
- m_spSymbol->Hide();
- m_spSeriesName->Hide();
- m_spColorBar->Hide();
-}
-
void SeriesHeader::SetEditChangedHdl( const Link & rLink )
{
m_aChangeLink = rLink;
@@ -442,8 +407,7 @@ Image SeriesHeader::GetChartTypeImage(
}
else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ))
{
- // @todo: correct image for scatter chart type
- aResult = SELECT_IMAGE( IMG_TYPE_LINE, bHC );
+ aResult = SELECT_IMAGE( IMG_TYPE_XY, bHC );
}
else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_PIE ))
{
@@ -458,6 +422,10 @@ Image SeriesHeader::GetChartTypeImage(
// @todo: correct image for candle-stick type
aResult = SELECT_IMAGE( IMG_TYPE_STOCK, bHC );
}
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_BUBBLE, bHC );
+ }
return aResult;
}
@@ -1103,6 +1071,7 @@ sal_Bool DataBrowser::IsTabAllowed( sal_Bool bForward ) const
if( CellContainsNumbers( nRow, nCol ))
{
+ m_aNumberEditField.UseInputStringForFormatting();
m_aNumberEditField.SetFormatKey( GetNumberFormatKey( nRow, nCol ));
return m_rNumberEditController;
}
@@ -1313,12 +1282,10 @@ void DataBrowser::ImplAdjustHeaderControls()
{
(*aIt)->SetPixelPosX( nStartPos + 2 );
(*aIt)->SetPixelWidth( nCurrentPos - nStartPos - 3 );
-// (*aIt)->Show();
}
else
// do not hide, to get focus events. Move outside the dialog for "hiding"
(*aIt)->SetPixelPosX( nMaxPos + 42 );
-// (*aIt)->Hide();
++aIt;
}
}
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index f89171d4d55e..1db67c6721af 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -41,6 +41,8 @@
#include "macros.hxx"
#include "StatisticsHelper.hxx"
#include "ContainerHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
#include <com/sun/star/container/XIndexReplace.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
@@ -103,7 +105,7 @@ OUString lcl_getUIRoleName(
{
OUString aResult( lcl_getRole( xLSeq ));
if( aResult.getLength())
- aResult = chart::DialogModel::ConvertRoleFromInternalToUI( aResult );
+ aResult = ::chart::DialogModel::ConvertRoleFromInternalToUI( aResult );
return aResult;
}
@@ -279,8 +281,8 @@ struct DataBrowserModel::implColumnLess : public ::std::binary_function<
{
if( rLeft.m_xLabeledDataSequence.is() && rRight.m_xLabeledDataSequence.is())
{
- return chart::DialogModel::GetRoleIndexForSorting( lcl_getRole( rLeft.m_xLabeledDataSequence )) <
- chart::DialogModel::GetRoleIndexForSorting( lcl_getRole( rRight.m_xLabeledDataSequence ));
+ return DialogModel::GetRoleIndexForSorting( lcl_getRole( rLeft.m_xLabeledDataSequence )) <
+ DialogModel::GetRoleIndexForSorting( lcl_getRole( rRight.m_xLabeledDataSequence ));
}
return true;
}
@@ -329,6 +331,8 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
Reference< chart2::XDataSeries > xSeries;
if( static_cast< tDataColumnVector::size_type >( nAfterColumnIndex ) <= m_aColumns.size())
xSeries.set( m_aColumns[nAfterColumnIndex].m_xDataSeries );
+
+ sal_Int32 nSeriesNumberFormat = 0;
if( xSeries.is())
{
xChartType.set( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ));
@@ -337,6 +341,10 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
lcl_DataSeriesOfHeaderMatches( xSeries )));
if( aIt != m_aHeaders.end())
nStartCol = aIt->m_nEndColumn;
+
+ Reference< beans::XPropertySet > xSeriesProps( xSeries, uno::UNO_QUERY );
+ if( xSeriesProps.is() )
+ xSeriesProps->getPropertyValue( C2U( "NumberFormat" )) >>= nSeriesNumberFormat;
}
else
{
@@ -404,6 +412,14 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
}
}
}
+ if( nSeriesNumberFormat != 0 )
+ {
+ //give the new series the same number format as the former series especially for bubble charts thus the bubble size values can be edited with same format immidiately
+ Reference< beans::XPropertySet > xNewSeriesProps( xNewSeries, uno::UNO_QUERY );
+ if( xNewSeriesProps.is() )
+ xNewSeriesProps->setPropertyValue( C2U( "NumberFormat" ), uno::makeAny( nSeriesNumberFormat ) );
+ }
+
updateFromModel();
}
}
@@ -708,7 +724,7 @@ void DataBrowserModel::updateFromModel()
tDataColumn aCategories;
aCategories.m_xLabeledDataSequence.set( xCategories );
if( lcl_ShowCategoriesAsDataLabel( xDiagram ))
- aCategories.m_aUIRoleName = chart::DialogModel::GetRoleDataLabel();
+ aCategories.m_aUIRoleName = DialogModel::GetRoleDataLabel();
else
aCategories.m_aUIRoleName = lcl_getUIRoleName( xCategories );
aCategories.m_eCellType = TEXT;
@@ -724,11 +740,15 @@ void DataBrowserModel::updateFromModel()
{
Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ sal_Int32 nXAxisNumberFormat = DataSeriesHelper::getNumberFormatKeyFromAxis( 0, aCooSysSeq[nCooSysIdx], 0, 0 );
+
for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
{
Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY );
if( xSeriesCnt.is())
{
+ rtl::OUString aRoleForDataLabelNumberFormat = ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( aChartTypes[nCTIdx] );
+
Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries());
lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( aSeries ));
for( lcl_tSharedSeqVec::const_iterator aIt( aSharedSequences.begin());
@@ -741,16 +761,15 @@ void DataBrowserModel::updateFromModel()
// as the sequences are shared it should be ok to take the first series
// @todo: dimension index 0 for x-values used here. This is just a guess.
// Also, the axis index is 0, as there is usually only one x-axis
- aSharedSequence.m_nNumberFormatKey =
- DataSeriesHelper::getNumberFormatKeyFromAxis(
- aSeries[0], aCooSysSeq[nCooSysIdx], 0, 0 );
+ aSharedSequence.m_nNumberFormatKey = nXAxisNumberFormat;
m_aColumns.push_back( aSharedSequence );
++nHeaderStart;
}
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx )
{
tDataColumnVector::size_type nStartColIndex = m_aColumns.size();
- Reference< chart2::data::XDataSource > xSource( aSeries[nSeriesIdx], uno::UNO_QUERY );
+ Reference< chart2::XDataSeries > xSeries( aSeries[nSeriesIdx] );
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
if( xSource.is())
{
Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqs( xSource->getDataSequences());
@@ -768,9 +787,14 @@ void DataBrowserModel::updateFromModel()
{
sal_Int32 nSequenceNumberFormatKey = nYAxisNumberFormatKey;
OUString aRole = lcl_getRole( aLSeqs[nSeqIdx] );
- if( aRole.equals( C2U( "values-x" ) ) )
- nSequenceNumberFormatKey = DataSeriesHelper::getNumberFormatKeyFromAxis(
- aSeries[nSeriesIdx], aCooSysSeq[nCooSysIdx], 0, 0 );
+
+ if( aRole.equals( aRoleForDataLabelNumberFormat ) )
+ {
+ nSequenceNumberFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ), xSeries, -1, xDiagram );
+ }
+ else if( aRole.equals( C2U( "values-x" ) ) )
+ nSequenceNumberFormatKey = nXAxisNumberFormat;
if( ::std::find_if( aSharedSequences.begin(), aSharedSequences.end(),
lcl_RepresentationsOfLSeqMatch( aLSeqs[nSeqIdx] )) == aSharedSequences.end())
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 28d9f6420419..69e693911c22 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -40,8 +40,6 @@
#include "macros.hxx"
#include "Strings.hrc"
#include "ResId.hxx"
-#include "LabeledDataSequence.hxx"
-#include "CachedDataSequence.hxx"
#include "ContainerHelper.hxx"
#include "CommonFunctors.hxx"
#include "ControllerLockGuard.hxx"
@@ -110,6 +108,7 @@ OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI )
aTranslationMap[ C2U( "values-min" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_MIN )));
aTranslationMap[ C2U( "values-x" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X )));
aTranslationMap[ C2U( "values-y" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y )));
+ aTranslationMap[ C2U( "values-size" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_SIZE )));
}
if( bFromInternalToUI )
@@ -157,6 +156,7 @@ void lcl_createRoleIndexMap( lcl_tRoleIndexMap & rOutMap )
rOutMap[ C2U( "values-min" ) ] = ++nIndex;
rOutMap[ C2U( "values-max" ) ] = ++nIndex;
rOutMap[ C2U( "values-last" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-size" ) ] = ++nIndex;
}
struct lcl_DataSeriesContainerAppend : public
@@ -328,26 +328,26 @@ Reference< XDataSeries > lcl_CreateNewSeries(
{
if( aRoles[nI].equals( lcl_aLabelRole ))
continue;
- Reference< data::XDataSequence > xSeq( new ::chart::CachedDataSequence());
+ Reference< data::XDataSequence > xSeq( ::chart::DataSourceHelper::createCachedDataSequence() );
lcl_SetSequenceRole( xSeq, aRoles[nI] );
// assert that aRoleOfSeqForSeriesLabel is part of the mandatory roles
if( aRoles[nI].equals( aRoleOfSeqForSeriesLabel ))
{
- Reference< data::XDataSequence > xLabel( new ::chart::CachedDataSequence( aLabel ));
+ Reference< data::XDataSequence > xLabel( ::chart::DataSourceHelper::createCachedDataSequence( aLabel ));
lcl_SetSequenceRole( xLabel, lcl_aLabelRole );
- aNewSequences.push_back( new ::chart::LabeledDataSequence( xSeq, xLabel ));
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq, xLabel ));
}
else
- aNewSequences.push_back( new ::chart::LabeledDataSequence( xSeq ));
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq ));
}
for(nI=0; nI<aOptRoles.getLength(); ++nI)
{
if( aOptRoles[nI].equals( lcl_aLabelRole ))
continue;
- Reference< data::XDataSequence > xSeq( new ::chart::CachedDataSequence());
+ Reference< data::XDataSequence > xSeq( ::chart::DataSourceHelper::createCachedDataSequence());
lcl_SetSequenceRole( xSeq, aOptRoles[nI] );
- aNewSequences.push_back( new ::chart::LabeledDataSequence( xSeq ));
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq ));
}
xSink->setData( ContainerToSequence( aNewSequences ));
@@ -723,12 +723,6 @@ OUString DialogModel::ConvertRoleFromInternalToUI( const OUString & rRoleString
}
// static
-OUString DialogModel::ConvertRoleFromUIToInternal( const OUString & rRoleString )
-{
- return lcl_ConvertRole( rRoleString, false );
-}
-
-// static
OUString DialogModel::GetRoleDataLabel()
{
return OUString( String( ::chart::SchResId( STR_OBJECT_DATALABELS )));
@@ -750,43 +744,6 @@ sal_Int32 DialogModel::GetRoleIndexForSorting( const ::rtl::OUString & rInternal
return 0;
}
-// static
-bool DialogModel::isSeriesValid(
- const Reference< chart2::XDataSeries > & xSeries,
- const OUString & aRoleOfSequenceForLabel,
- const Reference< chart2::XChartType > & xChartType )
-{
- if( ! (xSeries.is() && xChartType.is()))
- return false;
-
- try
- {
- sal_Int32 nFoundRoles = 0;
- DialogModel::tRolesWithRanges aRolesWithRanges;
- Reference< data::XDataSource > xSource( xSeries, uno::UNO_QUERY_THROW );
- const Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
- ::std::copy( aSeq.getConstArray(), aSeq.getConstArray() + aSeq.getLength(),
- lcl_RolesWithRangeAppend( aRolesWithRanges, aRoleOfSequenceForLabel ));
- const Sequence< OUString > aRoles( xChartType->getSupportedMandatoryRoles());
- for( sal_Int32 nI = 0; nI < aRoles.getLength(); ++nI )
- if( !aRoles[nI].equals( lcl_aLabelRole ) && aRolesWithRanges.find( aRoles[nI] ) != aRolesWithRanges.end() )
- ++nFoundRoles;
- // strong condition: all mandatory roles exist (except the label)
-// if( !aRoles[nI].equals( lcl_aLabelRole ) && aRolesWithRanges.find( aRoles[nI] ) == aRolesWithRanges.end() )
-// return false;
- // weak condition: one mandatory role exists
- if( aRoles.getLength() > 0 && nFoundRoles == 0 )
- return false;
- }
- catch( uno::Exception & ex )
- {
- ASSERT_EXCEPTION( ex );
- return false;
- }
-
- return true;
-}
-
// private methods
void DialogModel::createBackup()
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx
index 65579ab652be..744262cbbd1f 100644
--- a/chart2/source/controller/dialogs/DialogModel.hxx
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -154,20 +154,12 @@ public:
void startControllerLockTimer();
static ::rtl::OUString ConvertRoleFromInternalToUI( const ::rtl::OUString & rRoleString );
- static ::rtl::OUString ConvertRoleFromUIToInternal( const ::rtl::OUString & rRoleString );
static ::rtl::OUString GetRoleDataLabel();
// pass a role string (not translated) and get an index that serves for
// relative ordering, to get e.g. x-values and y-values in the right order
static sal_Int32 GetRoleIndexForSorting( const ::rtl::OUString & rInternalRoleString );
- static bool isSeriesValid(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDataSeries > & xSeries,
- const ::rtl::OUString & aRoleOfSequenceForLabel,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XChartType > & xChartType );
-
private:
::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument >
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 7ee4ae67761d..1ed974814ea7 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -109,7 +109,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
Sequence< Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
- rtl::OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last;
+ rtl::OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last, a_Size;
double fValue = 0;
uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
@@ -170,6 +170,12 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
aY_Last = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
}
+ else if( aRole.equals(C2U("values-size")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ a_Size = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
}
catch( uno::Exception& e )
{
@@ -201,6 +207,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
lcl_addText( aRet, aSeparator, aY_Min );
lcl_addText( aRet, aSeparator, aY_Max );
lcl_addText( aRet, aSeparator, aY_Last );
+ lcl_addText( aRet, aSeparator, a_Size );
return aRet;
}
diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src
index 8da8700a4406..3b384915f2d0 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -156,6 +156,12 @@ String STR_PAGE_ILLUMINATION
{
Text [ en-US ] = "Illumination" ;
};
+
+String STR_PAGE_ASIAN
+{
+ Text [ en-US ] = "Asian Typography" ;
+};
+
String STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS
{
Text [ en-US ] = "Mean value line with value %AVERAGE_VALUE and standard deviation %STD_DEVIATION";
@@ -465,6 +471,11 @@ String STR_DATA_ROLE_Y
Text [ en-US ] = "Y-Values" ;
};
+String STR_DATA_ROLE_SIZE
+{
+ Text [ en-US ] = "Bubble Sizes" ;
+};
+
String STR_DATA_ROLE_X_ERROR
{
Text [ en-US ] = "X-Error-Bars" ;
diff --git a/chart2/source/controller/dialogs/Strings_ChartTypes.src b/chart2/source/controller/dialogs/Strings_ChartTypes.src
index 1e18f0e8724f..2234f04a3fcd 100644
--- a/chart2/source/controller/dialogs/Strings_ChartTypes.src
+++ b/chart2/source/controller/dialogs/Strings_ChartTypes.src
@@ -140,4 +140,13 @@ String STR_DEEP
Text [ en-US ] = "Deep" ;
};
//-----------------------------------------------------------------------------
+String STR_TYPE_BUBBLE
+{
+ Text [ en-US ] = "Bubble" ;
+};
+String STR_BUBBLE_1
+{
+ Text [ en-US ] = "Bubble Chart" ;
+};
+//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
diff --git a/chart2/source/controller/dialogs/Strings_Statistic.src b/chart2/source/controller/dialogs/Strings_Statistic.src
index a0f1a1811cd3..9f6572c6ae82 100644
--- a/chart2/source/controller/dialogs/Strings_Statistic.src
+++ b/chart2/source/controller/dialogs/Strings_Statistic.src
@@ -52,10 +52,6 @@ String STR_CONTROLTEXT_ERROR_BARS_FROM_DATA
//------------------------------------------------------------------------
//------------------------------------------------------------------------
-String STR_REGRESSION_NONE
-{
- Text [ en-US ] = "No Regression" ;
-};
String STR_REGRESSION_LINEAR
{
Text [ en-US ] = "Linear Regression" ;
diff --git a/chart2/source/controller/dialogs/TabPages.hrc b/chart2/source/controller/dialogs/TabPages.hrc
index d56534257500..8c92c062ad14 100644
--- a/chart2/source/controller/dialogs/TabPages.hrc
+++ b/chart2/source/controller/dialogs/TabPages.hrc
@@ -83,22 +83,6 @@
#define CTL_BITMAP_PREVIEW 6
*/
-//#define TP_OPTIONS 908
-#define GRP_OPT_AXIS 1
-#define RBT_OPT_AXIS_1 2
-#define RBT_OPT_AXIS_2 3
-#define MT_GAP 4
-#define MT_OVERLAP 5
-#define FT_GAP 6
-#define FT_OVERLAP 7
-#define GB_BAR 8
-#define CB_CONNECTOR 9
-#define CB_BARS_SIDE_BY_SIDE 10
-#define FL_PLOT_MISSING_VALUES 11
-#define RB_DONT_PAINT 12
-#define RB_ASSUME_ZERO 13
-#define RB_CONTINUE_LINE 14
-
//------------
//from old chart tplabel.hrc
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
index 79f4bf52d05b..638a8f5f2994 100644
--- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
@@ -47,7 +47,7 @@ DataLabelsDialog::DataLabelsDialog(Window* pWindow, const SfxItemSet& rInAttrs,
m_aBtnOK(this, SchResId(BTN_OK)),
m_aBtnCancel(this, SchResId(BTN_CANCEL)),
m_aBtnHelp(this, SchResId(BTN_HELP)),
- m_apDataLabelResources( new DataLabelResources(this,rInAttrs,false) ),
+ m_apDataLabelResources( new DataLabelResources(this,rInAttrs) ),
m_rInAttrs(rInAttrs)
{
FreeResource();
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.src b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src
index b11b2102ecef..091628a2c73e 100644
--- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.src
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src
@@ -38,8 +38,8 @@ ModalDialog DLG_DATA_DESCR
HelpID = SID_INSERT_DESCRIPTION ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 200 , 136 ) ;
+ Size = MAP_APPFONT ( 316 , 185 ) ;
Moveable = TRUE ;
- BUTTONS_OK_CANCEL_HELP_STACKED(144)
+ BUTTONS_OK_CANCEL_HELP_STACKED(260)
RESOURCE_DATALABEL( 6, 7 )
};
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index 2087df6deb9e..fdc7c3766644 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -82,6 +82,8 @@
#include <svx/flagsdef.hxx>
#include <svx/numinf.hxx>
+#include <svtools/cjkoptions.hxx>
+
//.............................................................................
namespace chart
{
@@ -345,6 +347,8 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
this->SetText( pDialogParameter->getLocalizedName() );
+ SvtCJKOptions aCJKOptions;
+
switch (eObjectType)
{
case OBJECTTYPE_TITLE:
@@ -354,6 +358,8 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL);
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
break;
case OBJECTTYPE_LEGEND:
@@ -363,6 +369,8 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL);
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
break;
case OBJECTTYPE_DATA_SERIES:
@@ -377,6 +385,8 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
}
AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
// if( m_pParameter->HasStatisticProperties() )
// AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
@@ -401,6 +411,8 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
break;
}
diff --git a/chart2/source/controller/dialogs/hidother.src b/chart2/source/controller/dialogs/hidother.src
index 8707088c4337..4f409d14094b 100644
--- a/chart2/source/controller/dialogs/hidother.src
+++ b/chart2/source/controller/dialogs/hidother.src
@@ -91,6 +91,8 @@ hidspecial HID_SCH_DATALABEL_PLACEMENT {HelpId= HID_SCH_DATALABEL_PLACEMENT; };
hidspecial HID_SCH_TEXTDIRECTION {HelpId= HID_SCH_TEXTDIRECTION; };
hidspecial HID_SCH_TEXTDIRECTION_TITLE {HelpId= HID_SCH_TEXTDIRECTION_TITLE; };
hidspecial HID_SCH_TEXTDIRECTION_EQUATION {HelpId= HID_SCH_TEXTDIRECTION_EQUATION; };
+hidspecial HID_SCH_DATALABEL_ROTATION_KNOB {HelpId= HID_SCH_DATALABEL_ROTATION_KNOB; };
+hidspecial HID_SCH_DATALABEL_ROTATION_EDIT {HelpId= HID_SCH_DATALABEL_ROTATION_EDIT; };
hidspecial HID_SCH_TITLE_MAIN {HelpId= HID_SCH_TITLE_MAIN; };
hidspecial HID_SCH_TITLE_SUB {HelpId= HID_SCH_TITLE_SUB; };
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index ff92fe45f385..c6129629a51a 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -112,7 +112,7 @@ void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, USHORT nWhichId, Che
}//end anonymous namespace
-DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs, bool bShowTextDirectionListBox )
+DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs )
: m_aCBNumber(pWindow, SchResId(CB_VALUE_AS_NUMBER)),
m_aPB_NumberFormatForValue(pWindow, SchResId(PB_NUMBERFORMAT)),
m_aCBPercent(pWindow, SchResId(CB_VALUE_AS_PERCENTAGE)),
@@ -122,6 +122,10 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt
m_aSeparatorResources(pWindow),
m_aFT_LabelPlacement(pWindow, SchResId(FT_LABEL_PLACEMENT)),
m_aLB_LabelPlacement(pWindow, SchResId(LB_LABEL_PLACEMENT)),
+ m_aFL_Rotate(pWindow, SchResId(FL_LABEL_ROTATE)),
+ m_aDC_Dial(pWindow, SchResId(CT_LABEL_DIAL)),
+ m_aFT_Degrees(pWindow, SchResId(FT_LABEL_DEGREES)),
+ m_aNF_Degrees(pWindow, SchResId(NF_LABEL_DEGREES)),
m_aFT_TextDirection(pWindow, SchResId(FT_LABEL_TEXTDIR)),
m_aLB_TextDirection(pWindow, SchResId(LB_LABEL_TEXTDIR), &m_aFT_TextDirection),
m_pNumberFormatter(0),
@@ -136,6 +140,7 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt
m_pWindow(pWindow),
m_pPool(rInAttrs.GetPool())
{
+ //fill label placement list
std::map< sal_Int32, XubString > aPlacementToStringMap;
for( sal_Int32 nEnum=0; nEnum<m_aLB_LabelPlacement.GetEntryCount(); ++nEnum )
aPlacementToStringMap[nEnum]=m_aLB_LabelPlacement.GetEntry(static_cast<USHORT>(nEnum));
@@ -146,7 +151,6 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt
aAvailabelPlacementList =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence();
m_aLB_LabelPlacement.Clear();
-
for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN )
{
USHORT nListBoxPos = static_cast<USHORT>( nN );
@@ -155,55 +159,52 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt
m_aListBoxToPlacementMap[nListBoxPos]=nPlacement;
m_aLB_LabelPlacement.InsertEntry( aPlacementToStringMap[nPlacement] );
}
-
m_aLB_LabelPlacement.SetDropDownLineCount(m_aLB_LabelPlacement.GetEntryCount());
- Size aPBSize( m_aPB_NumberFormatForPercent.GetSizePixel() );
- long nMinWidth = ::std::max( m_aPB_NumberFormatForPercent.CalcMinimumSize().getWidth(), m_aPB_NumberFormatForValue.CalcMinimumSize().getWidth() );
- aPBSize.setWidth( nMinWidth+20 );//the min with is to small to fit, hm... so add alittle
+ //replace&resize push buttons and resize checkboxes
+ Size aControlDistance( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
+ long nPBWidth = ::std::max( m_aPB_NumberFormatForPercent.CalcMinimumSize().getWidth(), m_aPB_NumberFormatForValue.CalcMinimumSize().getWidth() )
+ + 20; //the min with is to small to fit, hm... so add alittle
+ long nCBXWidth = ::std::max( m_aCBNumber.CalcMinimumSize().getWidth(), m_aCBPercent.CalcMinimumSize().getWidth() );
+ long nNewPBXPos = m_aCBNumber.GetPosPixel().X() + nCBXWidth + aControlDistance.Width();
+ long nPageWidth = pWindow->LogicToPixel( Size(260,185), MapMode(MAP_APPFONT) ).getWidth();
+ if( nNewPBXPos + nPBWidth > nPageWidth )
+ {
+ if( nPBWidth > nPageWidth/2 )
+ nPBWidth = nPageWidth/2;
+ nNewPBXPos = nPageWidth-nPBWidth;
+ nCBXWidth = nPageWidth-m_aCBNumber.GetPosPixel().X()-nPBWidth-aControlDistance.Width();
+ }
+ m_aPB_NumberFormatForValue.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForValue.GetPosPixel().Y() ) );
+ m_aPB_NumberFormatForPercent.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForPercent.GetPosPixel().Y() ) );
+ Size aPBSize( m_aPB_NumberFormatForPercent.GetSizePixel() );
+ aPBSize.setWidth( nPBWidth );
m_aPB_NumberFormatForValue.SetSizePixel( aPBSize );
m_aPB_NumberFormatForPercent.SetSizePixel( aPBSize );
- long nWantedMinRightBorder = m_aPB_NumberFormatForPercent.GetPosPixel().X() + m_aPB_NumberFormatForPercent.GetSizePixel().Width() - 1;
+ Size aCBSize( m_aCBNumber.GetSizePixel() );
+ aCBSize.setWidth(nCBXWidth);
+ m_aCBNumber.SetSizePixel( aCBSize );
+ m_aCBPercent.SetSizePixel( aCBSize );
+ //place and align separator and label placement listboxes
Size aSize( m_aFT_LabelPlacement.GetSizePixel() );
aSize.setWidth( m_aFT_LabelPlacement.CalcMinimumSize().getWidth() );
m_aFT_LabelPlacement.SetSizePixel(aSize);
- Size aControlDistance( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
- long nWantedMinLeftBorder = m_aFT_LabelPlacement.GetPosPixel().X() + aSize.getWidth () + aControlDistance.Width();;
+ long nWantedMinLeftBorder = m_aFT_LabelPlacement.GetPosPixel().X() + aSize.getWidth () + aControlDistance.Width();
m_aSeparatorResources.PositionBelowControl(m_aCBSymbol);
- m_aSeparatorResources.AlignListBoxWidthAndXPos( nWantedMinLeftBorder, nWantedMinRightBorder, m_aLB_LabelPlacement.CalcMinimumSize().getWidth() );
+ m_aSeparatorResources.AlignListBoxWidthAndXPos( nWantedMinLeftBorder, -1, m_aLB_LabelPlacement.CalcMinimumSize().getWidth() );
m_aSeparatorResources.Show(true);
aSize = m_aLB_LabelPlacement.GetSizePixel();
aSize.setWidth( m_aSeparatorResources.GetCurrentListBoxSize().getWidth() );
m_aLB_LabelPlacement.SetSizePixel(aSize);
+ m_aLB_LabelPlacement.SetPosPixel( Point( m_aSeparatorResources.GetCurrentListBoxPosition().X(), m_aLB_LabelPlacement.GetPosPixel().Y() ) );
- long nYDiff = m_aFT_LabelPlacement.GetPosPixel().Y() - m_aLB_LabelPlacement.GetPosPixel().Y();
- Point aPos( m_aSeparatorResources.GetCurrentListBoxPosition() );
- aPos.Y() = m_aSeparatorResources.GetBottom();
- aPos.Y() += aControlDistance.Height();
- m_aLB_LabelPlacement.SetPosPixel(aPos);
-
- aPos.X() = m_aFT_LabelPlacement.GetPosPixel().X();
- aPos.Y() += nYDiff;
- m_aFT_LabelPlacement.SetPosPixel(aPos);
-
- // hide "text direction" listbox is specified by caller
- if( !bShowTextDirectionListBox )
- {
- m_aFT_TextDirection.Hide();
- m_aLB_TextDirection.Hide();
- }
- // move "text direction" listbox down below "label placement" listbox
- long nNewY = m_aLB_LabelPlacement.GetPosPixel().Y() + m_aLB_LabelPlacement.GetSizePixel().Height() + aControlDistance.Height();
- nYDiff = nNewY - m_aLB_TextDirection.GetPosPixel().Y();
- m_aFT_TextDirection.SetPosPixel( m_aFT_TextDirection.GetPosPixel() + Point( 0, nYDiff ) );
- m_aLB_TextDirection.SetPosPixel( m_aLB_TextDirection.GetPosPixel() + Point( 0, nYDiff ) );
-
+ //some click handler
m_aPB_NumberFormatForValue.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
m_aPB_NumberFormatForPercent.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
m_aCBNumber.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
@@ -213,6 +214,15 @@ 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 )
+ {
+ bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() );
+ if( bForbidPercentValue )
+ m_aCBPercent.Enable(false);
+ }
+
+ m_aDC_Dial.SetLinkedField( &m_aNF_Degrees );
}
DataLabelResources::~DataLabelResources()
@@ -283,14 +293,14 @@ IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox )
void DataLabelResources::EnableControls()
{
- m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
+ m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() );
//enable separator
{
long nNumberOfCheckedLabelParts = 0;
if( m_aCBNumber.IsChecked() )
++nNumberOfCheckedLabelParts;
- if( m_aCBPercent.IsChecked() )
+ if( m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() )
++nNumberOfCheckedLabelParts;
if( m_aCBCategory.IsChecked() )
++nNumberOfCheckedLabelParts;
@@ -304,7 +314,13 @@ void DataLabelResources::EnableControls()
}
m_aPB_NumberFormatForValue.Enable( m_pNumberFormatter && m_aCBNumber.IsChecked() );
- m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() );
+ m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() );
+
+ bool bEnableRotation = ( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
+ m_aFL_Rotate.Enable( bEnableRotation );
+ m_aDC_Dial.Enable( bEnableRotation );
+ m_aFT_Degrees.Enable( bEnableRotation );
+ m_aNF_Degrees.Enable( bEnableRotation );
}
BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
@@ -344,6 +360,12 @@ BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
if( m_aLB_TextDirection.GetSelectEntryCount() > 0 )
rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLB_TextDirection.GetSelectEntryValue() ) );
+ if( m_aDC_Dial.IsVisible() )
+ {
+ sal_Int32 nDegrees = m_aDC_Dial.GetRotation();
+ rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+ }
+
return TRUE;
}
@@ -384,6 +406,14 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
m_aLB_TextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
+ if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ m_aDC_Dial.SetRotation( nDegrees );
+ }
+ else
+ m_aDC_Dial.SetRotation( 0 );
+
EnableControls();
}
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
index cadbf1230c45..e560eed9f573 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.hxx
@@ -37,6 +37,8 @@
#include <svtools/itemset.hxx>
#include "TextDirectionListBox.hxx"
+#include <svx/dialcontrol.hxx>
+
class SvNumberFormatter;
//.............................................................................
@@ -47,7 +49,7 @@ namespace chart
class DataLabelResources
{
public:
- DataLabelResources( Window* pParent, const SfxItemSet& rInAttrs, bool bShowTextDirectionListBox );
+ DataLabelResources( Window* pParent, const SfxItemSet& rInAttrs );
virtual ~DataLabelResources();
BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
@@ -68,6 +70,11 @@ private:
FixedText m_aFT_LabelPlacement;
ListBox m_aLB_LabelPlacement;
+ FixedLine m_aFL_Rotate;
+ svx::DialControl m_aDC_Dial;
+ FixedText m_aFT_Degrees;
+ NumericField m_aNF_Degrees;
+
FixedText m_aFT_TextDirection;
TextDirectionListBox m_aLB_TextDirection;
diff --git a/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc b/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc
index 536b355980d0..31112bdc3340 100644
--- a/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc
+++ b/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc
@@ -42,3 +42,7 @@
#define FT_LABEL_TEXTDIR 31
#define LB_LABEL_TEXTDIR 32
+#define FL_LABEL_ROTATE 40
+#define CT_LABEL_DIAL 40
+#define FT_LABEL_DEGREES 40
+#define NF_LABEL_DEGREES 40
diff --git a/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc b/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc
index 70d03376b51f..bc21882dd841 100644
--- a/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc
+++ b/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc
@@ -65,14 +65,14 @@ PushButton PB_NUMBERFORMAT \
{ \
HelpID = HID_SCH_PB_NUMBERFORMAT; \
TabStop = TRUE ; \
- Pos = MAP_APPFONT ( xpos+8 , ypos+12 ) ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos-3 ) ; \
Size = MAP_APPFONT ( 100 , 14 ) ; \
Text [ en-US ] = "Number ~format..." ; \
}; \
CheckBox CB_VALUE_AS_PERCENTAGE \
{ \
HelpID = HID_SCH_DATALABEL_PERCENT; \
- Pos = MAP_APPFONT ( xpos , ypos+30 ) ; \
+ Pos = MAP_APPFONT ( xpos , ypos+17 ) ; \
Size = MAP_APPFONT ( 136 , 10 ) ; \
TabStop = TRUE ; \
Text [ en-US ] = "Show value as ~percentage" ; \
@@ -81,29 +81,29 @@ PushButton PB_PERCENT_NUMBERFORMAT \
{ \
HelpID = HID_SCH_PB_PERCENT_NUMBERFORMAT; \
TabStop = TRUE ; \
- Pos = MAP_APPFONT ( xpos+8 , ypos+42 ) ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos+17-3 ) ; \
Size = MAP_APPFONT ( 100 , 14 ) ; \
Text [ en-US ] = "Percentage f~ormat..." ; \
}; \
CheckBox CB_CATEGORY \
{ \
HelpID = HID_SCH_DATALABEL_TEXT; \
- Pos = MAP_APPFONT ( xpos , ypos+62 ); \
- Size = MAP_APPFONT ( 182 , 10 ); \
+ Pos = MAP_APPFONT ( xpos , ypos+33 ); \
+ Size = MAP_APPFONT ( 254 , 10 ); \
TabStop = TRUE; \
Text [ en-US ] = "Show ~category"; \
}; \
CheckBox CB_SYMBOL \
{ \
HelpID = HID_SCH_DATALABEL_SYMBOL; \
- Pos = MAP_APPFONT ( xpos , ypos+76 ) ; \
- Size = MAP_APPFONT ( 182 , 10 ) ; \
+ Pos = MAP_APPFONT ( xpos , ypos+49 ) ; \
+ Size = MAP_APPFONT ( 254 , 10 ) ; \
TabStop = TRUE ; \
Text [ en-US ] = "Show ~legend key" ; \
}; \
FixedText FT_LABEL_PLACEMENT \
{ \
- Pos = MAP_APPFONT ( xpos , ypos+104 ) ; \
+ Pos = MAP_APPFONT ( xpos , ypos+84 ) ; \
Size = MAP_APPFONT ( 182 , 10 ) ; \
TabStop = FALSE ; \
Text [ en-US ] = "Place~ment"; \
@@ -113,7 +113,7 @@ ListBox LB_LABEL_PLACEMENT \
HelpID = HID_SCH_DATALABEL_PLACEMENT; \
Border = TRUE ; \
AutoHScroll = TRUE ; \
- Pos = MAP_APPFONT ( xpos+100 , ypos+102 ) ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos+82 ) ; \
Size = MAP_APPFONT ( 89 , 12 ) ; \
TabStop = TRUE ; \
Group = TRUE ; \
@@ -121,16 +121,48 @@ ListBox LB_LABEL_PLACEMENT \
DDExtraWidth = TRUE ; \
WORKAROUND \
}; \
+FixedLine FL_LABEL_ROTATE \
+{ \
+ Pos = MAP_APPFONT ( xpos, ypos+103 ) ; \
+ Size = MAP_APPFONT ( 248, 8 ) ; \
+ Text [ en-US ] = "Rotate Text" ; \
+}; \
+Control CT_LABEL_DIAL \
+{ \
+ HelpId = HID_SCH_DATALABEL_ROTATION_KNOB ; \
+ Pos = MAP_APPFONT ( xpos+6 , ypos+116 ) ; \
+ Size = MAP_APPFONT ( 43 , 43 ) ; \
+ Text = "ABCD" ; \
+}; \
+FixedText FT_LABEL_DEGREES \
+{ \
+ Pos = MAP_APPFONT ( xpos+87 , ypos+133 ) ; \
+ Size = MAP_APPFONT ( 46, 8 ) ; \
+ Text [ en-US ] = "~Degrees" ; \
+}; \
+NumericField NF_LABEL_DEGREES \
+{ \
+ HelpId = HID_SCH_DATALABEL_ROTATION_EDIT ; \
+ Pos = MAP_APPFONT ( xpos+55 , ypos+131 ) ; \
+ Size = MAP_APPFONT ( 28 , 12 ) ; \
+ Border = TRUE ; \
+ TabStop = TRUE ; \
+ Repeat = TRUE ; \
+ Spin = TRUE ; \
+ Minimum = 0 ; \
+ Maximum = 359 ; \
+ SpinSize = 5 ; \
+}; \
FixedText FT_LABEL_TEXTDIR \
{ \
- Pos = MAP_APPFONT ( xpos , ypos+120 ) ; \
+ Pos = MAP_APPFONT ( xpos , ypos+162 ) ; \
Size = MAP_APPFONT ( 64 , 8 ) ; \
Text [ en-US ] = "Te~xt direction" ; \
}; \
ListBox LB_LABEL_TEXTDIR \
{ \
HelpID = HID_SCH_TEXTDIRECTION; \
- Pos = MAP_APPFONT ( xpos+66 , ypos+118 ) ; \
+ Pos = MAP_APPFONT ( xpos+66 , ypos+160 ) ; \
Size = MAP_APPFONT ( 170 , 100 ) ; \
Border = TRUE; \
TabStop = TRUE; \
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.cxx b/chart2/source/controller/dialogs/res_TextSeparator.cxx
index c01bf374f2b7..298499ed39d9 100644
--- a/chart2/source/controller/dialogs/res_TextSeparator.cxx
+++ b/chart2/source/controller/dialogs/res_TextSeparator.cxx
@@ -91,13 +91,6 @@ void TextSeparatorResources::PositionBelowControl( const Window& rWindow )
m_aLB_Separator.SetPosPixel( Point( aPoint.X()+m_aFT_Separator.GetSizePixel().Width()+aDistanceSize.Width(), aPoint.Y()-aDistanceSize.Height()-1) );
}
-long TextSeparatorResources::GetBottom() const
-{
- Point aPoint( m_aLB_Separator.GetPosPixel() );
- aPoint.Y() += m_aLB_Separator.GetSizePixel().Height();
- return aPoint.Y();
-}
-
void TextSeparatorResources::AlignListBoxWidthAndXPos( long nWantedLeftBorder /*use -1 to indicate that this can be automatic*/
, long nWantedRightBorder /*use -1 to indicate that this can be automatic*/
, long nMinimumListBoxWidth /*use -1 to indicate that this can be automatic*/ )
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.hxx b/chart2/source/controller/dialogs/res_TextSeparator.hxx
index a93cab0f95fe..fb8365206fb5 100644
--- a/chart2/source/controller/dialogs/res_TextSeparator.hxx
+++ b/chart2/source/controller/dialogs/res_TextSeparator.hxx
@@ -57,7 +57,6 @@ public:
, long nMinimumListBoxWidth /*use -1 to indicate that this can be automatic*/ );
Point GetCurrentListBoxPosition() const;
Size GetCurrentListBoxSize() const;
- long GetBottom() const;
::rtl::OUString GetValue() const;
void SetValue( const ::rtl::OUString& rSeparator );
diff --git a/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc b/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc
index 4bd41b4047d6..45fc55435594 100644
--- a/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc
+++ b/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc
@@ -120,7 +120,7 @@ CheckBox CB_SHOW_CORRELATION_COEFF \
Pos = MAP_APPFONT( 10, 134 + yoffset ); \
Size = MAP_APPFONT( availablewidth - 20, 10 ); \
TabStop = TRUE; \
- Text[ en-US ] = "Show ~correlation coefficient (R²)"; \
+ Text[ en-US ] = "Show ~coefficient of determination (R²)"; \
};
#endif
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index f60637af4c44..b2d64400ef98 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -862,6 +862,7 @@ ChartTypeTabPage::ChartTypeTabPage( Window* pParent
m_aChartTypeDialogControllerList.push_back(new AreaChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new LineChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new XYChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new BubbleChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new NetChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new StockChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new CombiColumnLineChartDialogController() );
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx
index 35712ebcc566..2da9778a4db8 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx
@@ -42,7 +42,7 @@ namespace chart
DataLabelsTabPage::DataLabelsTabPage(Window* pWindow, const SfxItemSet& rInAttrs) :
SfxTabPage(pWindow, SchResId(TP_DATA_DESCR), rInAttrs),
- m_aDataLabelResources(this, rInAttrs, true)
+ m_aDataLabelResources(this, rInAttrs)
{
FreeResource();
}
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.src b/chart2/source/controller/dialogs/tp_DataLabel.src
index de4434759812..32f5835295f7 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.src
+++ b/chart2/source/controller/dialogs/tp_DataLabel.src
@@ -41,5 +41,5 @@ TabPage TP_DATA_DESCR
HelpID = HID_SCH_DATA_DESCR ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 260 , 185 ) ;
- RESOURCE_DATALABEL( 12, 8 )
+ RESOURCE_DATALABEL( 6, 8 )
};
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 77c861d529e9..f499e2acc23a 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -42,7 +42,7 @@
#include "DataSeriesHelper.hxx"
#include "tp_DataSourceControls.hxx"
#include "ControllerLockGuard.hxx"
-#include "LabeledDataSequence.hxx"
+#include "DataSourceHelper.hxx"
#include <com/sun/star/sheet/XRangeSelection.hpp>
#include <com/sun/star/table/XCellRange.hpp>
#include <com/sun/star/chart2/XChartType.hpp>
@@ -890,7 +890,7 @@ bool DataSourceTabPage::updateModelFromControl( Edit * pField )
// create or change categories
if( !xLabeledSeq.is())
{
- xLabeledSeq.set( new ::chart::LabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
m_rDialogModel.setCategories( xLabeledSeq );
}
try
@@ -945,7 +945,7 @@ bool DataSourceTabPage::updateModelFromControl( Edit * pField )
if( ! xLabeledSeq.is())
{
// no corresponding labeled data sequence for label found
- xLabeledSeq.set( new ::chart::LabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
}
}
@@ -1009,7 +1009,7 @@ bool DataSourceTabPage::updateModelFromControl( Edit * pField )
xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
if( ! xLabeledSeq.is())
{
- xLabeledSeq.set( new ::chart::LabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
}
}
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index 4c626d1dfb37..38d36d032921 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -32,7 +32,6 @@
#include "tp_PolarOptions.hxx"
#include "tp_PolarOptions.hrc"
#include "ResId.hxx"
-#include "TabPages.hrc"
#include "chartview/ChartSfxItemIds.hxx"
#include "NoWarningThisInCTOR.hxx"
@@ -51,7 +50,9 @@ PolarOptionsTabPage::PolarOptionsTabPage( Window* pWindow,const SfxItemSet& rInA
m_aFL_StartingAngle( this, SchResId( FL_STARTING_ANGLE ) ),
m_aAngleDial( this, SchResId( CT_ANGLE_DIAL ) ),
m_aFT_Degrees( this, SchResId( FT_ROTATION_DEGREES ) ),
- m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) )
+ m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) ),
+ m_aFL_PlotOptions( this, SchResId( FL_PLOT_OPTIONS_POLAR ) ),
+ m_aCB_IncludeHiddenCells( this, SchResId( CB_INCLUDE_HIDDEN_CELLS_POLAR ) )
{
FreeResource();
@@ -78,6 +79,9 @@ BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
if( m_aCB_Clockwise.IsVisible() )
rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked()));
+ if (m_aCB_IncludeHiddenCells.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked()));
+
return TRUE;
}
@@ -108,6 +112,16 @@ void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
{
m_aCB_Clockwise.Show(FALSE);
}
+ if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ m_aCB_IncludeHiddenCells.Check(bVal);
+ }
+ else
+ {
+ m_aCB_IncludeHiddenCells.Show(FALSE);
+ m_aFL_PlotOptions.Show(FALSE);
+ }
}
//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hrc b/chart2/source/controller/dialogs/tp_PolarOptions.hrc
index a618616e1cfe..680c9d126211 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.hrc
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hrc
@@ -28,9 +28,13 @@
*
************************************************************************/
+#include "ResourceIds.hrc"
+
#define CB_CLOCKWISE 1
+#define CB_INCLUDE_HIDDEN_CELLS_POLAR 2
#define FL_STARTING_ANGLE 1
+#define FL_PLOT_OPTIONS_POLAR 2
#define CT_ANGLE_DIAL 1
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
index 5a816ab87385..02a5ec5ba25b 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.hxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
@@ -58,6 +58,9 @@ private:
svx::DialControl m_aAngleDial;
FixedText m_aFT_Degrees;
NumericField m_aNF_StartingAngle;
+
+ FixedLine m_aFL_PlotOptions;
+ CheckBox m_aCB_IncludeHiddenCells;
};
//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.src b/chart2/source/controller/dialogs/tp_PolarOptions.src
index 7c442c3ef12e..273c5f59dd5d 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.src
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.src
@@ -28,7 +28,6 @@
*
************************************************************************/
-#include "TabPages.hrc"
#include "tp_PolarOptions.hrc"
#include "HelpIds.hrc"
@@ -47,8 +46,8 @@ TabPage TP_POLAROPTIONS
};
FixedLine FL_STARTING_ANGLE
{
- Pos = MAP_APPFONT ( 12 , 21 ) ;
- Size = MAP_APPFONT ( 242 , 12 ) ;
+ Pos = MAP_APPFONT ( 6 , 21 ) ;
+ Size = MAP_APPFONT ( 248 , 12 ) ;
Text [ en-US ] = "Starting angle" ;
};
Control CT_ANGLE_DIAL
@@ -75,4 +74,17 @@ TabPage TP_POLAROPTIONS
Maximum = 359 ;
SpinSize = 5 ;
};
+ FixedLine FL_PLOT_OPTIONS_POLAR
+ {
+ Pos = MAP_APPFONT ( 6 , 90 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Plot options";
+ };
+ CheckBox CB_INCLUDE_HIDDEN_CELLS_POLAR
+ {
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Include ~values from hidden cells";
+ };
};
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index 855665f4fd02..cc8ac2139639 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -31,9 +31,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
#include "tp_SeriesToAxis.hxx"
+#include "tp_SeriesToAxis.hrc"
#include "ResId.hxx"
-#include "TabPages.hrc"
#include "chartview/ChartSfxItemIds.hxx"
#include "NoWarningThisInCTOR.hxx"
@@ -43,6 +43,8 @@
#include <svtools/intitem.hxx>
//SfxIntegerListItem
#include <svtools/ilstitem.hxx>
+#include <svtools/controldims.hrc>
+
#include <com/sun/star/chart/MissingValueTreatment.hpp>
//.............................................................................
@@ -63,10 +65,12 @@ SchOptionTabPage::SchOptionTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
aMTOverlap(this,SchResId(MT_OVERLAP)),
aCBConnect(this,SchResId(CB_CONNECTOR)),
aCBAxisSideBySide(this,SchResId(CB_BARS_SIDE_BY_SIDE)),
- m_aFL_EmptyCells(this,SchResId(FL_PLOT_MISSING_VALUES)),
+ m_aFL_PlotOptions(this,SchResId(FL_PLOT_OPTIONS)),
+ m_aFT_MissingValues(this,SchResId(FT_MISSING_VALUES)),
m_aRB_DontPaint(this,SchResId(RB_DONT_PAINT)),
m_aRB_AssumeZero(this,SchResId(RB_ASSUME_ZERO)),
m_aRB_ContinueLine(this,SchResId(RB_CONTINUE_LINE)),
+ m_aCBIncludeHiddenCells(this,SchResId(CB_INCLUDE_HIDDEN_CELLS)),
m_bProvidesSecondaryYAxis(true),
m_bProvidesOverlapAndGapWidth(false)
{
@@ -123,6 +127,9 @@ BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs)
else if(m_aRB_ContinueLine.IsChecked())
rOutAttrs.Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,::com::sun::star::chart::MissingValueTreatment::CONTINUE));
+ if (m_aCBIncludeHiddenCells.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCBIncludeHiddenCells.IsChecked()));
+
return TRUE;
}
@@ -212,13 +219,26 @@ void SchOptionTabPage::Reset(const SfxItemSet& rInAttrs)
}
else
{
+ m_aFT_MissingValues.Show(FALSE);
m_aRB_DontPaint.Show(FALSE);
m_aRB_AssumeZero.Show(FALSE);
m_aRB_ContinueLine.Show(FALSE);
- m_aFL_EmptyCells.Show(FALSE);
}
}
+ // Include hidden cells
+ if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ m_aCBIncludeHiddenCells.Check(bVal);
+ }
+ else
+ {
+ m_aCBIncludeHiddenCells.Show(FALSE);
+ if(!m_aFT_MissingValues.IsVisible())
+ m_aFL_PlotOptions.Show(FALSE);
+ }
+
AdaptControlPositionsAndVisibility();
}
@@ -231,6 +251,17 @@ void SchOptionTabPage::Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlap
AdaptControlPositionsAndVisibility();
}
+void lcl_offsetControl(Control& rCtrl, long nXOffset, long nYOffset )
+{
+ Point aPos = rCtrl.GetPosPixel();
+ rCtrl.SetPosPixel( Point(aPos.getX() + nXOffset, aPos.getY() + nYOffset) );
+}
+
+void lcl_optimzeRadioButtonSize( RadioButton& rCtrl )
+{
+ rCtrl.SetSizePixel( rCtrl.CalcMinimumSize() );
+}
+
void SchOptionTabPage::AdaptControlPositionsAndVisibility()
{
aRbtAxis1.Show(m_bProvidesSecondaryYAxis);
@@ -254,20 +285,30 @@ void SchOptionTabPage::AdaptControlPositionsAndVisibility()
else
aPos = aGrpBar.GetPosPixel();
- long nDiffX = aRbtAxis1.GetPosPixel().getX() - aGrpAxis.GetPosPixel().getX();
- long nDiffY = aRbtAxis1.GetPosPixel().getY() - aGrpAxis.GetPosPixel().getY();
- long nDiffY1 = aRbtAxis2.GetPosPixel().getY() - aRbtAxis1.GetPosPixel().getY();
-
- m_aFL_EmptyCells.SetPosPixel( aPos );
- m_aRB_DontPaint.SetPosPixel( Point( aPos.getX() + nDiffX, aPos.getY() + nDiffY ) );
- m_aRB_AssumeZero.SetPosPixel( Point( aPos.getX() + nDiffX, aPos.getY() + nDiffY + nDiffY1 ) );
- m_aRB_ContinueLine.SetPosPixel( Point( aPos.getX() + nDiffX, aPos.getY() + nDiffY + nDiffY1 * 2 ) );
+ long nYOffset = aPos.getY() - m_aFL_PlotOptions.GetPosPixel().getY();
+ lcl_offsetControl(m_aFL_PlotOptions, 0, nYOffset);
+ lcl_offsetControl(m_aFT_MissingValues, 0, nYOffset);
+ lcl_offsetControl(m_aRB_DontPaint, 0, nYOffset);
+ lcl_offsetControl(m_aRB_AssumeZero, 0, nYOffset);
+ lcl_offsetControl(m_aRB_ContinueLine, 0, nYOffset);
+ lcl_offsetControl(m_aCBIncludeHiddenCells, 0, nYOffset);
}
- if( !m_aRB_DontPaint.IsVisible() )
+ m_aFT_MissingValues.SetSizePixel( m_aFT_MissingValues.CalcMinimumSize() );
+ lcl_optimzeRadioButtonSize( m_aRB_DontPaint );
+ lcl_optimzeRadioButtonSize( m_aRB_AssumeZero );
+ lcl_optimzeRadioButtonSize( m_aRB_ContinueLine );
+
+ Size aControlDistance( m_aFT_MissingValues.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
+ long nXOffset = m_aFT_MissingValues.GetPosPixel().getX() + m_aFT_MissingValues.GetSizePixel().getWidth() + aControlDistance.getWidth() - m_aRB_DontPaint.GetPosPixel().getX();
+ lcl_offsetControl(m_aRB_DontPaint, nXOffset, 0);
+ lcl_offsetControl(m_aRB_AssumeZero, nXOffset, 0);
+ lcl_offsetControl(m_aRB_ContinueLine, nXOffset, 0);
+
+ if( !m_aFT_MissingValues.IsVisible() )
{
- m_aRB_ContinueLine.SetPosPixel( m_aRB_AssumeZero.GetPosPixel() );
- m_aRB_AssumeZero.SetPosPixel( m_aRB_DontPaint.GetPosPixel() );
+ //for example for stock charts
+ m_aCBIncludeHiddenCells.SetPosPixel( m_aFT_MissingValues.GetPosPixel() );
}
}
//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc b/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc
new file mode 100644
index 000000000000..2a39c313ca3c
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define GRP_OPT_AXIS 1
+#define RBT_OPT_AXIS_1 2
+#define RBT_OPT_AXIS_2 3
+#define MT_GAP 4
+#define MT_OVERLAP 5
+#define FT_GAP 6
+#define FT_OVERLAP 7
+#define GB_BAR 8
+#define CB_CONNECTOR 9
+#define CB_BARS_SIDE_BY_SIDE 10
+#define FL_PLOT_OPTIONS 11
+#define FT_MISSING_VALUES 12
+#define RB_DONT_PAINT 13
+#define RB_ASSUME_ZERO 14
+#define RB_CONTINUE_LINE 15
+#define CB_INCLUDE_HIDDEN_CELLS 16
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
index c066e637fb2e..10fcae66c1e3 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -74,11 +74,14 @@ private: //member
CheckBox aCBConnect;
CheckBox aCBAxisSideBySide;
- FixedLine m_aFL_EmptyCells;
+ FixedLine m_aFL_PlotOptions;
+ FixedText m_aFT_MissingValues;
RadioButton m_aRB_DontPaint;
RadioButton m_aRB_AssumeZero;
RadioButton m_aRB_ContinueLine;
+ CheckBox m_aCBIncludeHiddenCells;
+
DECL_LINK(EnableHdl, RadioButton * );
sal_Int32 m_nAllSeriesAxisIndex;
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.src b/chart2/source/controller/dialogs/tp_SeriesToAxis.src
index f79028488230..0686e45f25b3 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.src
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.src
@@ -28,7 +28,7 @@
*
************************************************************************/
#include "HelpIds.hrc"
-#include "TabPages.hrc"
+#include "tp_SeriesToAxis.hrc"
TabPage TP_OPTIONS
{
@@ -120,7 +120,7 @@ TabPage TP_OPTIONS
Pos = MAP_APPFONT ( 12 , 97 ) ;
Size = MAP_APPFONT ( 200 , 10 ) ;
TabStop = TRUE ;
- Text [ en-US ] = "Connection Lines";
+ Text [ en-US ] = "Connection lines";
};
CheckBox CB_BARS_SIDE_BY_SIDE
@@ -131,16 +131,23 @@ TabPage TP_OPTIONS
Text [ en-US ] = "Show ~bars side by side";
};
- FixedLine FL_PLOT_MISSING_VALUES
+ FixedLine FL_PLOT_OPTIONS
{
Pos = MAP_APPFONT ( 6 , 113 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Plot options";
+ };
+
+ FixedText FT_MISSING_VALUES
+ {
+ Pos = MAP_APPFONT ( 12 , 127 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
Text [ en-US ] = "Plot missing values";
};
RadioButton RB_DONT_PAINT
{
- Pos = MAP_APPFONT ( 12 , 127 ) ;
+ Pos = MAP_APPFONT ( 82 , 127 ) ;
Size = MAP_APPFONT ( 80 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Leave gap";
@@ -148,7 +155,7 @@ TabPage TP_OPTIONS
RadioButton RB_ASSUME_ZERO
{
- Pos = MAP_APPFONT ( 12 , 141 ) ;
+ Pos = MAP_APPFONT ( 82 , 141 ) ;
Size = MAP_APPFONT ( 80 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Assume zero";
@@ -156,9 +163,17 @@ TabPage TP_OPTIONS
RadioButton RB_CONTINUE_LINE
{
- Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Pos = MAP_APPFONT ( 82 , 155 ) ;
Size = MAP_APPFONT ( 80 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Continue line";
};
+
+ CheckBox CB_INCLUDE_HIDDEN_CELLS
+ {
+ Pos = MAP_APPFONT ( 12 , 172 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Include ~values from hidden cells";
+ };
};
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 7ed9a93073bd..fa285f98d991 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -321,7 +321,7 @@ SfxItemSet DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const
0);
SfxItemSet aGeoSet( E3dView::GetGeoAttrFromMarked() );
aFullSet.Put( aGeoSet );
- aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC,static_cast< sal_uInt16 >( ConfigurationAccess::getConfigurationAccess()->getFieldUnit())));
+ aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC,static_cast< sal_uInt16 >( ConfigurationAccess::getFieldUnit())));
return aFullSet;
}
diff --git a/chart2/source/controller/inc/ChartRenderer.hxx b/chart2/source/controller/inc/ChartRenderer.hxx
index 3b2c3b90b35d..0a2ec2cde87c 100644
--- a/chart2/source/controller/inc/ChartRenderer.hxx
+++ b/chart2/source/controller/inc/ChartRenderer.hxx
@@ -53,12 +53,10 @@ class ChartRenderer : public ::cppu::WeakImplHelper2<
{
public:
ChartRenderer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
- ChartRenderer( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext);
virtual ~ChartRenderer();
// ___lang::XServiceInfo___
APPHELPER_XSERVICEINFO_DECL()
- APPHELPER_SERVICE_FACTORY_HELPER(ChartRenderer)
// ____ XUnoTunnel ___
virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier )
diff --git a/chart2/source/controller/inc/ConfigurationAccess.hxx b/chart2/source/controller/inc/ConfigurationAccess.hxx
index 3866d00feb65..02bdb7da8082 100644
--- a/chart2/source/controller/inc/ConfigurationAccess.hxx
+++ b/chart2/source/controller/inc/ConfigurationAccess.hxx
@@ -43,15 +43,8 @@ namespace chart
/**
*/
-class CalcConfigItem;
-class ConfigurationAccess
+namespace ConfigurationAccess
{
-public:
- // use this to get the singleton ConfigurationAccess (CTOR is private)
- static ConfigurationAccess * getConfigurationAccess();
-
- ~ConfigurationAccess();
-
/** @descr Retrieve the FieldUnit to be used for the UI. This unit is retrieved
from the registry settings of the Calc application.
@@ -61,13 +54,7 @@ public:
@return the FieldUnit enum. See <vcl/fldunit.hxx> for definition
*/
FieldUnit getFieldUnit();
-
-private:
- ConfigurationAccess();
-
- static ConfigurationAccess * m_pThis;
- CalcConfigItem* m_pCalcConfigItem;
-};
+}
//.............................................................................
} //namespace chart
diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx
index a59170f4d699..4eec81bd20b5 100644
--- a/chart2/source/controller/inc/DataPointItemConverter.hxx
+++ b/chart2/source/controller/inc/DataPointItemConverter.hxx
@@ -103,6 +103,7 @@ private:
sal_Int32 m_nNumberFormat;
sal_Int32 m_nPercentNumberFormat;
::com::sun::star::uno::Sequence< sal_Int32 > m_aAvailableLabelPlacements;
+ bool m_bForbidPercentValue;
};
} // namespace wrapper
diff --git a/chart2/source/controller/inc/HelpIds.hrc b/chart2/source/controller/inc/HelpIds.hrc
index 68edcdc54dd5..ccff9e913f97 100644
--- a/chart2/source/controller/inc/HelpIds.hrc
+++ b/chart2/source/controller/inc/HelpIds.hrc
@@ -31,7 +31,7 @@
#define CHART_HELPIDS_HRC
#include <svtools/solar.hrc>
-//next is 118
+//next is 120
//see old chart: schhids.h
@@ -142,6 +142,8 @@
#define HID_SCH_TEXTDIRECTION (HID_SCH_START + 115)
#define HID_SCH_TEXTDIRECTION_TITLE (HID_SCH_START + 116)
#define HID_SCH_TEXTDIRECTION_EQUATION (HID_SCH_START + 117)
+#define HID_SCH_DATALABEL_ROTATION_KNOB (HID_SCH_START + 118)
+#define HID_SCH_DATALABEL_ROTATION_EDIT (HID_SCH_START + 119)
#define HID_SCH_TITLE_MAIN (HID_SCH_START + 80)
#define HID_SCH_TITLE_SUB (HID_SCH_START + 81)
diff --git a/chart2/source/controller/inc/ItemConverter.hxx b/chart2/source/controller/inc/ItemConverter.hxx
index 9f21d00dd0a1..e55456519cd1 100644
--- a/chart2/source/controller/inc/ItemConverter.hxx
+++ b/chart2/source/controller/inc/ItemConverter.hxx
@@ -38,8 +38,6 @@
// for pair
#include <utility>
-struct SfxItemPropertyMap;
-
namespace comphelper
{
diff --git a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
index 1702673a6462..0f4a9869fcc9 100644
--- a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
+++ b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
@@ -93,6 +93,9 @@ private:
::com::sun::star::uno::Sequence< sal_Int32 > m_aSupportedMissingValueTreatments;
sal_Int32 m_nMissingValueTreatment;
+
+ bool m_bSupportingPlottingOfHiddenCells;
+ bool m_bIncludeHiddenCells;
};
} // namespace wrapper
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
index f1bc4ce4097c..0c7ff467a91b 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -38,7 +38,6 @@
#include "chartview/ExplicitValueProvider.hxx"
#include "SchWhichPairs.hxx"
#include "macros.hxx"
-#include "Scaling.hxx"
#include "ChartModelHelper.hxx"
#include "AxisHelper.hxx"
#include "CommonConverters.hxx"
@@ -180,45 +179,42 @@ void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemS
{
case SCHATTR_AXIS_AUTO_MAX:
// if the any has no value => auto is on
- rOutItemSet.Put( SfxBoolItem( nWhichId, ( ! aScale.Maximum.hasValue())));
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aScale.Maximum) ) );
break;
case SCHATTR_AXIS_MAX:
- if( aScale.Maximum.hasValue())
{
- OSL_ASSERT( aScale.Maximum.getValueTypeClass() == uno::TypeClass_DOUBLE );
- rOutItemSet.Put(
- SvxDoubleItem(
- *reinterpret_cast< const double * >( aScale.Maximum.getValue()), nWhichId ));
- }
- else
- {
- double fExplicitMax = 10.0;
- if( m_pExplicitScale )
- fExplicitMax = m_pExplicitScale->Maximum;
-
- rOutItemSet.Put(
- SvxDoubleItem( fExplicitMax, nWhichId ));
+ double fMax = 10.0;
+ if( aScale.Maximum >>= fMax )
+ {
+ rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
+ }
+ else
+ {
+ if( m_pExplicitScale )
+ fMax = m_pExplicitScale->Maximum;
+ rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
+ }
}
break;
case SCHATTR_AXIS_AUTO_MIN:
// if the any has no value => auto is on
- rOutItemSet.Put( SfxBoolItem( nWhichId, ( ! aScale.Minimum.hasValue())));
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aScale.Minimum) ) );
break;
case SCHATTR_AXIS_MIN:
- if( aScale.Minimum.hasValue())
- {
- OSL_ASSERT( aScale.Minimum.getValueTypeClass() == uno::TypeClass_DOUBLE );
- rOutItemSet.Put(
- SvxDoubleItem(
- *reinterpret_cast< const double * >( aScale.Minimum.getValue()), nWhichId ));
- }
- else
{
- if( m_pExplicitScale )
- rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId ));
+ double fMin = 0.0;
+ if( aScale.Minimum >>= fMin )
+ {
+ rOutItemSet.Put( SvxDoubleItem( fMin, nWhichId ) );
+ }
+ else
+ {
+ if( m_pExplicitScale )
+ rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId ));
+ }
}
break;
@@ -236,21 +232,21 @@ void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemS
// Increment
case SCHATTR_AXIS_AUTO_STEP_MAIN:
// if the any has no value => auto is on
- rOutItemSet.Put( SfxBoolItem( nWhichId, ( ! aInc.Distance.hasValue())));
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aInc.Distance) ) );
break;
case SCHATTR_AXIS_STEP_MAIN:
- if( aInc.Distance.hasValue())
- {
- OSL_ASSERT( aInc.Distance.getValueTypeClass() == uno::TypeClass_DOUBLE );
- rOutItemSet.Put(
- SvxDoubleItem(
- *reinterpret_cast< const double * >( aInc.Distance.getValue()), nWhichId ));
- }
- else
{
- if( m_pExplicitIncrement )
- rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId ));
+ double fDistance = 1.0;
+ if( aInc.Distance >>= fDistance )
+ {
+ rOutItemSet.Put( SvxDoubleItem(fDistance, nWhichId ));
+ }
+ else
+ {
+ if( m_pExplicitIncrement )
+ rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId ));
+ }
}
break;
@@ -478,7 +474,7 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI
// logarithm is true
if( ! bWasLogarithm )
{
- aScale.Scaling = new LogarithmicScaling( 10.0 );
+ aScale.Scaling = AxisHelper::createLogarithmicScaling( 10.0 );
bSetScale = true;
}
}
@@ -487,7 +483,7 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI
// logarithm is false => linear scaling
if( bWasLogarithm )
{
- aScale.Scaling = new LinearScaling( 1.0, 0.0 );
+ aScale.Scaling = AxisHelper::createLinearScaling();
bSetScale = true;
}
}
diff --git a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
index a6f20f53fcf3..ad2aab714757 100644
--- a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
@@ -78,7 +78,7 @@ namespace
// IPM_MAP_ENTRY( EE_CHAR_WEIGHT_CTL, "CharWeightComplex", 0 )
// IPM_MAP_ENTRY( EE_CHAR_ITALIC_CJK, "CharPostureAsian", 0 )
// IPM_MAP_ENTRY( EE_CHAR_ITALIC_CTL, "CharPostureComplex", 0 )
-
+ IPM_MAP_ENTRY( EE_PARA_ASIANCJKSPACING, "ParaIsCharacterDistance", 0 )
);
return aCharacterPropertyMap;
@@ -290,6 +290,11 @@ void CharacterPropertyItemConverter::FillSpecialItem(
rOutItemSet.Put( SfxStringItem( nWhichId, C2U( "" ) ) );
}
break;
+
+ case EE_PARA_FORBIDDENRULES:
+ case EE_PARA_HANGINGPUNCTUATION:
+ rOutItemSet.DisableItem( nWhichId );
+ break;
}
}
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 4593230d65cc..af062cf3b93c 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -239,7 +239,8 @@ DataPointItemConverter::DataPointItemConverter(
m_nSpecialFillColor(nSpecialFillColor),
m_nNumberFormat(nNumberFormat),
m_nPercentNumberFormat(nPercentNumberFormat),
- m_aAvailableLabelPlacements()
+ m_aAvailableLabelPlacements(),
+ m_bForbidPercentValue(true)
{
m_aConverters.push_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo ));
@@ -257,6 +258,8 @@ DataPointItemConverter::DataPointItemConverter(
bool bAmbiguous = false;
sal_Bool bSwapXAndY = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
m_aAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements( xChartType, DiagramHelper::getDimension( xDiagram ), bSwapXAndY, xSeries );
+
+ m_bForbidPercentValue = AxisType::CATEGORY != ChartTypeHelper::getAxisType( xChartType, 0 );
}
DataPointItemConverter::~DataPointItemConverter()
@@ -521,6 +524,24 @@ bool DataPointItemConverter::ApplySpecialItem(
}
}
break;
+
+ case SCHATTR_TEXT_DEGREES:
+ {
+ double fValue = static_cast< double >(
+ static_cast< const SfxInt32Item & >(
+ rItemSet.Get( nWhichId )).GetValue()) / 100.0;
+ double fOldValue = 0.0;
+ bool bPropExisted =
+ ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldValue );
+
+ if( ! bPropExisted ||
+ ( bPropExisted && fOldValue != fValue ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fValue ));
+ bChanged = true;
+ }
+ }
+ break;
}
return bChanged;
@@ -630,6 +651,12 @@ void DataPointItemConverter::FillSpecialItem(
}
break;
+ case SCHATTR_DATADESCR_NO_PERCENTVALUE:
+ {
+ rOutItemSet.Put( SfxBoolItem( nWhichId, m_bForbidPercentValue ));
+ }
+ break;
+
case SCHATTR_STYLE_SYMBOL:
{
chart2::Symbol aSymbol;
@@ -657,6 +684,18 @@ void DataPointItemConverter::FillSpecialItem(
}
}
break;
+
+ case SCHATTR_TEXT_DEGREES:
+ {
+ double fValue = 0;
+
+ if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fValue )
+ {
+ rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
+ ::rtl::math::round( fValue * 100.0 ) ) ));
+ }
+ }
+ break;
}
}
diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
index 9f300e8febc1..4b626e1be839 100644
--- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
+++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
@@ -141,9 +141,8 @@ AllDataLabelItemConverter::AllDataLabelItemConverter(
uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
uno::Reference< uno::XComponentContext> xContext(0);//do not need Context for label properties
- sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForLabel( xObjectProperties, *aIt, -1/*nPointIndex*/,
- uno::Reference< beans::XPropertySet >( DiagramHelper::getAttachedAxis( *aIt, ChartModelHelper::findDiagram( xChartModel ) ), uno::UNO_QUERY ) );
- sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForLabel(
+ sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties, *aIt, -1/*nPointIndex*/, ChartModelHelper::findDiagram( xChartModel ) );
+ sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
m_aConverters.push_back( new ::chart::wrapper::DataPointItemConverter(
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
index 00a535fe5eaf..dbefb0e7f025 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -128,8 +128,8 @@ const USHORT nDataLabelWhichPairs[] =
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_DATADESCR_PLACEMENT, SCHATTR_DATADESCR_PLACEMENT,
- SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS,
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES,
+ EE_PARA_WRITINGDIR,EE_PARA_WRITINGDIR,
0
};
@@ -143,8 +143,7 @@ const USHORT nDataLabelWhichPairs[] =
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_DATADESCR_PLACEMENT, SCHATTR_DATADESCR_PLACEMENT, \
- SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, \
+ 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*/ \
@@ -163,7 +162,8 @@ const USHORT nDataPointWhichPairs[] =
SCHATTR_STARTING_ANGLE,SCHATTR_STARTING_ANGLE, \
SCHATTR_CLOCKWISE,SCHATTR_CLOCKWISE, \
SCHATTR_MISSING_VALUE_TREATMENT,SCHATTR_MISSING_VALUE_TREATMENT, \
- SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS
+ SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, \
+ SCHATTR_INCLUDE_HIDDEN_CELLS,SCHATTR_INCLUDE_HIDDEN_CELLS
const USHORT nSeriesOptionsWhichPairs[] =
{
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index de4fe9f2d745..f30bb4aeda57 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -93,6 +93,8 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
, m_bClockwise(false)
, m_aSupportedMissingValueTreatments()
, m_nMissingValueTreatment(0)
+ , m_bSupportingPlottingOfHiddenCells(false)
+ , m_bIncludeHiddenCells(true)
{
try
{
@@ -159,6 +161,23 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
m_aSupportedMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType );
m_nMissingValueTreatment = DiagramHelper::getCorrectedMissingValueTreatment(
ChartModelHelper::findDiagram(m_xChartModel), xChartType );
+
+ uno::Reference< XChartDocument > xChartDoc( m_xChartModel, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProp( xChartDoc->getDataProvider(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ //test whether the data provider offers this property
+ xProp->getPropertyValue(C2U("IncludeHiddenCells"));
+ //if not exception is thrown the property is offered
+ m_bSupportingPlottingOfHiddenCells = true;
+ xDiagramProperties->getPropertyValue( C2U("IncludeHiddenCells") ) >>= m_bIncludeHiddenCells;
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ }
+ }
}
catch( uno::Exception ex )
{
@@ -341,6 +360,16 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxIte
}
}
break;
+ case SCHATTR_INCLUDE_HIDDEN_CELLS:
+ {
+ if( m_bSupportingPlottingOfHiddenCells )
+ {
+ bool bIncludeHiddenCells = static_cast<const SfxBoolItem &>(rItemSet.Get(nWhichId)).GetValue();
+ if (bIncludeHiddenCells != m_bIncludeHiddenCells)
+ bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, m_xChartModel );
+ }
+ }
+ break;
}
return bChanged;
}
@@ -412,6 +441,12 @@ void SeriesOptionsItemConverter::FillSpecialItem(
rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) );
break;
}
+ case SCHATTR_INCLUDE_HIDDEN_CELLS:
+ {
+ if( m_bSupportingPlottingOfHiddenCells )
+ rOutItemSet.Put( SfxBoolItem(nWhichId, m_bIncludeHiddenCells) );
+ break;
+ }
default:
break;
}
diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
index 4ee0ca2f1f51..eed9235aff9b 100644
--- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
@@ -108,7 +108,7 @@ uno::Reference< beans::XPropertySet > lcl_GetDefaultErrorBar()
{
// todo: use a valid context
return uno::Reference< beans::XPropertySet >(
- new ::chart::ErrorBar( uno::Reference< uno::XComponentContext >()));
+ ::chart::createErrorBar( uno::Reference< uno::XComponentContext >()));
}
void lcl_getErrorValues( const uno::Reference< beans::XPropertySet > & xErrorBarProp,
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 8368e76baa82..7728104afc0f 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -468,7 +468,7 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent
{
//the view has become dirty, we should repaint it if we have a window
if( m_pChartWindow )
- m_pChartWindow->Invalidate();
+ m_pChartWindow->ForceInvalidate();
}
else if( rEvent.NewMode.equals(C2U("invalid")) )
{
@@ -478,8 +478,11 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent
if( m_pDrawViewWrapper && m_pDrawViewWrapper->IsTextEdit() )
this->EndTextEdit();
if( m_pDrawViewWrapper )
+ {
m_pDrawViewWrapper->UnmarkAll();
//m_pDrawViewWrapper->hideMarkHandles(); todo??
+ m_pDrawViewWrapper->HideSdrPage();
+ }
}
else
{
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index 3b5b3d6fa7ba..530cd6f0aeb8 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -240,9 +240,8 @@ namespace
}
}
}
- sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForLabel( xObjectProperties, xSeries, nPointIndex,
- uno::Reference< beans::XPropertySet >( DiagramHelper::getAttachedAxis( xSeries, xDiagram ), uno::UNO_QUERY ) );
- sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForLabel(
+ sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties, xSeries, nPointIndex, xDiagram );
+ sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
pItemConverter = new wrapper::DataPointItemConverter( xChartModel, xContext,
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index 27cfc441be8a..e1f83550bd5d 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -39,11 +39,10 @@
#include "macros.hxx"
#include "ControllerLockGuard.hxx"
#include "AccessibleTextHelper.hxx"
+#include "chartview/DrawModelWrapper.hxx"
#include <svx/svdotext.hxx>
-// header for class SvxCharacterMap
-#include <svx/charmap.hxx>
// header for define RET_OK
#include <vcl/msgbox.hxx>
// header for class SdrOutliner
@@ -55,6 +54,8 @@
#include <vcl/svapp.hxx>
#include <vos/mutex.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <svtools/stritem.hxx>
+#include <svx/fontitem.hxx>
//.............................................................................
namespace chart
@@ -174,16 +175,26 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT( pFact, "No dialog factory" );
- AbstractSvxCharacterMap * pDlg = pFact->CreateSvxCharacterMap( m_pChartWindow, RID_SVXDLG_CHARMAP, FALSE );
- DBG_ASSERT( pDlg, "Couldn't create SvxCharacterMap dialog" );
+
+ SfxAllItemSet aSet( m_pDrawModelWrapper->GetItemPool() );
+ aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
//set fixed current font
- pDlg->SetFont( m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont() );
- pDlg->DisableFontSelection(); //maybe not necessary in future
+ aSet.Put( SfxBoolItem( FN_PARAM_2, TRUE ) ); //maybe not necessary in future
+ Font aCurFont = m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont();
+ aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) );
+
+ SfxAbstractDialog * pDlg = pFact->CreateSfxDialog( m_pChartWindow, aSet, getFrame(), RID_SVXDLG_CHARMAP );
+ DBG_ASSERT( pDlg, "Couldn't create SvxCharacterMap dialog" );
if( pDlg->Execute() == RET_OK )
{
- String aString( pDlg->GetCharacters() );
+ const SfxItemSet* pSet = pDlg->GetOutputItemSet();
+ const SfxPoolItem* pItem=0;
+ String aString;
+ if ( pSet && pSet->GetItemState( SID_CHARMAP, TRUE, &pItem) == SFX_ITEM_SET &&
+ pItem->ISA(SfxStringItem) )
+ aString = dynamic_cast<const SfxStringItem*>(pItem)->GetValue();
OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
diff --git a/chart2/source/controller/main/ChartRenderer.cxx b/chart2/source/controller/main/ChartRenderer.cxx
index 00e69082db00..60d13981c00f 100644
--- a/chart2/source/controller/main/ChartRenderer.cxx
+++ b/chart2/source/controller/main/ChartRenderer.cxx
@@ -59,11 +59,6 @@ ChartRenderer::ChartRenderer( const Reference< frame::XModel >& xChartModel )
{
}
-ChartRenderer::ChartRenderer( const Reference< uno::XComponentContext >& /*xContext*/)
- : m_xChartModel()
-{
-}
-
ChartRenderer::~ChartRenderer()
{
}
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 5c9e201aebd8..10b999df8f43 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -60,6 +60,7 @@ namespace chart
ChartWindow::ChartWindow( WindowController* pWindowController, Window* pParent, WinBits nStyle )
: Window(pParent, nStyle)
, m_pWindowController( pWindowController )
+ , m_bInPaint(false)
{
this->SetSmartHelpId( SmartId( HID_SCH_WIN_DOCUMENT ) );
this->SetMapMode( MapMode(MAP_100TH_MM) );
@@ -67,7 +68,7 @@ ChartWindow::ChartWindow( WindowController* pWindowController, Window* pParent,
// chart does not depend on exact pixel painting => enable antialiased drawing
SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | GetAntialiasing() );
EnableRTL( FALSE );
- if( pParent )
+ if( pParent )
pParent->EnableRTL( FALSE );// #i96215# necessary for a correct position of the context menu in rtl mode
}
@@ -92,10 +93,12 @@ void ChartWindow::PrePaint()
void ChartWindow::Paint( const Rectangle& rRect )
{
+ m_bInPaint = true;
if( m_pWindowController )
m_pWindowController->execute_Paint( rRect );
else
Window::Paint( rRect );
+ m_bInPaint = false;
}
void ChartWindow::MouseButtonDown(const MouseEvent& rMEvt)
@@ -243,6 +246,29 @@ void ChartWindow::adjustHighContrastMode()
SetDrawMode( bUseContrast ? nContrastMode : DRAWMODE_DEFAULT );
}
+void ChartWindow::ForceInvalidate()
+{
+ ::Window::Invalidate();
+}
+void ChartWindow::Invalidate( USHORT nFlags )
+{
+ if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
+ return;
+ ::Window::Invalidate( nFlags );
+}
+void ChartWindow::Invalidate( const Rectangle& rRect, USHORT nFlags )
+{
+ if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
+ return;
+ ::Window::Invalidate( rRect, nFlags );
+}
+void ChartWindow::Invalidate( const Region& rRegion, USHORT nFlags )
+{
+ if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
+ return;
+ ::Window::Invalidate( rRegion, nFlags );
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx
index 41cc7b514a07..543c0b13ffdc 100644
--- a/chart2/source/controller/main/ChartWindow.hxx
+++ b/chart2/source/controller/main/ChartWindow.hxx
@@ -70,10 +70,16 @@ public:
virtual void DataChanged( const DataChangedEvent& rDCEvt );
virtual void RequestHelp( const HelpEvent& rHEvt );
+ void ForceInvalidate();
+ virtual void Invalidate( USHORT nFlags = 0 );
+ virtual void Invalidate( const Rectangle& rRect, USHORT nFlags = 0 );
+ virtual void Invalidate( const Region& rRegion, USHORT nFlags = 0 );
+
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
private:
WindowController* m_pWindowController;
+ bool m_bInPaint;
void adjustHighContrastMode();
};
diff --git a/chart2/source/controller/main/ConfigurationAccess.cxx b/chart2/source/controller/main/ConfigurationAccess.cxx
index f3de96cfc844..f71d26b7b3c2 100644
--- a/chart2/source/controller/main/ConfigurationAccess.cxx
+++ b/chart2/source/controller/main/ConfigurationAccess.cxx
@@ -38,6 +38,8 @@
#include <svtools/syslocale.hxx>
// header for class ConfigItem
#include <unotools/configitem.hxx>
+// header for rtl::Static
+#include <rtl/instance.hxx>
//.............................................................................
@@ -96,37 +98,20 @@ FieldUnit CalcConfigItem::getFieldUnit()
return eResult;
}
-// ----------------------------------------
-
-ConfigurationAccess * ConfigurationAccess::m_pThis = 0;
-
-// private, use static getConfigurationAccess method
-ConfigurationAccess::ConfigurationAccess()
- : m_pCalcConfigItem(0)
-{
- m_pCalcConfigItem = new CalcConfigItem();
-}
-
-// static
-ConfigurationAccess * ConfigurationAccess::getConfigurationAccess()
-{
- // note: not threadsafe
- if( !m_pThis )
- m_pThis = new ConfigurationAccess();
- return m_pThis;
-}
-
-ConfigurationAccess::~ConfigurationAccess()
+namespace
{
- delete m_pCalcConfigItem;
+ //a CalcConfigItem Singleton
+ struct theCalcConfigItem : public rtl::Static< CalcConfigItem, theCalcConfigItem > {};
}
-FieldUnit ConfigurationAccess::getFieldUnit()
+namespace ConfigurationAccess
{
- OSL_ASSERT( m_pCalcConfigItem );
- FieldUnit aUnit( m_pCalcConfigItem->getFieldUnit() );
- return aUnit;
-}
+ FieldUnit getFieldUnit()
+ {
+ FieldUnit aUnit( theCalcConfigItem::get().getFieldUnit() );
+ return aUnit;
+ }
+} //namespace ConfigurationAccess
//.............................................................................
} //namespace chart
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index d572ec2b2f42..bde946fac5b6 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -52,6 +52,7 @@
#include <com/sun/star/chart2/XChartType.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/XRegressionCurve.hpp>
+#include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
// only needed until #i68864# is fixed
#include <com/sun/star/frame/XLayoutManager.hpp>
diff --git a/chart2/source/controller/makefile.mk b/chart2/source/controller/makefile.mk
index 38eaec110f74..d2d399d22cff 100644
--- a/chart2/source/controller/makefile.mk
+++ b/chart2/source/controller/makefile.mk
@@ -93,7 +93,6 @@ SHL1STDLIBS= $(CHARTTOOLS) \
$(SVXLIB) \
$(TKLIB) \
$(TOOLSLIB) \
- $(I18NISOLANGLIB) \
$(VCLLIB) \
$(SFXLIB) \
$(UNOTOOLSLIB) \
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx
index a6b91481af8a..d6d7e14bc7d3 100644
--- a/chart2/source/inc/AxisHelper.hxx
+++ b/chart2/source/inc/AxisHelper.hxx
@@ -51,6 +51,9 @@ namespace chart
class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper
{
public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLinearScaling();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 );
+
static ::com::sun::star::chart2::ScaleData createDefaultScale();
static void removeExplicitScaling( ::com::sun::star::chart2::ScaleData& rScaleData );
@@ -95,14 +98,14 @@ public:
static sal_Bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
- static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ SAL_DLLPRIVATE static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
static void makeGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
- static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
- static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
+ SAL_DLLPRIVATE static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ SAL_DLLPRIVATE static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
- static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties );
- static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties );
+ SAL_DLLPRIVATE static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
static ::com::sun::star::uno::Reference<
@@ -187,7 +190,7 @@ public:
/** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
</TRUE> are returned
*/
- static std::vector<
+ SAL_DLLPRIVATE static std::vector<
::com::sun::star::uno::Reference<
::com::sun::star::chart2::XAxis > >
getAllAxesOfCoordinateSystem( const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/BaseGFXHelper.hxx b/chart2/source/inc/BaseGFXHelper.hxx
index 3544f5678462..675b2ff5acd5 100644
--- a/chart2/source/inc/BaseGFXHelper.hxx
+++ b/chart2/source/inc/BaseGFXHelper.hxx
@@ -68,17 +68,15 @@ OOO_DLLPUBLIC_CHARTTOOLS
com::sun::star::awt::Rectangle B2IRectangleToAWTRectangle(
const ::basegfx::B2IRectangle& rB2IRectangle );
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Direction3DToB3DVector(
+::basegfx::B3DVector Direction3DToB3DVector(
const com::sun::star::drawing::Direction3D& rDirection );
-OOO_DLLPUBLIC_CHARTTOOLS
com::sun::star::drawing::Direction3D B3DVectorToDirection3D(
const ::basegfx::B3DVector& rB3DVector );
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Position3DToB3DVector(
+::basegfx::B3DVector Position3DToB3DVector(
const com::sun::star::drawing::Position3D& rPosition );
-OOO_DLLPUBLIC_CHARTTOOLS
com::sun::star::drawing::Position3D B3DVectorToPosition3D(
const ::basegfx::B3DVector& rB3DVector );
@@ -95,7 +93,6 @@ OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetRotationFromMatrix(
OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetScaleFromMatrix(
const ::basegfx::B3DHomMatrix & rB3DMatrix );
-OOO_DLLPUBLIC_CHARTTOOLS
void ReduceToRotationMatrix( ::basegfx::B3DHomMatrix & rB3DMatrix );
OOO_DLLPUBLIC_CHARTTOOLS double Deg2Rad( double fDegrees );
diff --git a/chart2/source/inc/CachedDataSequence.hxx b/chart2/source/inc/CachedDataSequence.hxx
index c13c8883baf9..22b2c9311085 100644
--- a/chart2/source/inc/CachedDataSequence.hxx
+++ b/chart2/source/inc/CachedDataSequence.hxx
@@ -37,7 +37,6 @@
#include <comphelper/propertycontainer.hxx>
#include <comphelper/proparrhlp.hxx>
#include "ServiceMacros.hxx"
-#include "charttoolsdllapi.hxx"
// interfaces and types
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -69,7 +68,7 @@ typedef ::cppu::WeakComponentImplHelper7<
CachedDataSequence_Base;
}
-class OOO_DLLPUBLIC_CHARTTOOLS CachedDataSequence :
+class CachedDataSequence :
public ::comphelper::OMutexAndBroadcastHelper,
public ::comphelper::OPropertyContainer,
public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >,
@@ -84,25 +83,11 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > & xContext );
- /** creates a sequence and initializes it with the given vector of floating
- point numbers
- */
- explicit CachedDataSequence( const ::std::vector< double > & rVector );
-
- /** creates a sequence and initializes it with the given vector of strings
- */
- explicit CachedDataSequence( const ::std::vector< ::rtl::OUString > & rVector );
-
/** creates a sequence and initializes it with the given string. This is
especially useful for labels, which only have one element.
*/
explicit CachedDataSequence( const ::rtl::OUString & rSingleText );
- /** creates a sequence and initializes it with the given vector of arbitrary
- content
- */
- explicit CachedDataSequence( const ::std::vector< ::com::sun::star::uno::Any > & rVector );
-
/// Copy CTOR
explicit CachedDataSequence( const CachedDataSequence & rSource );
@@ -167,8 +152,6 @@ protected:
// <properties>
sal_Int32 m_nNumberFormatKey;
::rtl::OUString m_sRole;
- sal_Bool m_bIsHidden;
- ::com::sun::star::uno::Sequence< sal_Int32 > m_aHiddenValues;
// </properties>
enum DataType
@@ -183,6 +166,7 @@ protected:
*/
void registerProperties();
+private:
/** is used by interface method getNumericalData().
*/
::com::sun::star::uno::Sequence< double > Impl_getNumericalData() const;
diff --git a/chart2/source/inc/CharacterProperties.hxx b/chart2/source/inc/CharacterProperties.hxx
index 092f614846b7..ae32f29ba20f 100644
--- a/chart2/source/inc/CharacterProperties.hxx
+++ b/chart2/source/inc/CharacterProperties.hxx
@@ -121,6 +121,7 @@ public:
PROP_CHAR_COMPLEX_WEIGHT,
PROP_CHAR_COMPLEX_POSTURE,
PROP_CHAR_COMPLEX_LOCALE,
+ PROP_PARA_IS_CHARACTER_DISTANCE,
PROP_WRITING_MODE,
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
index c6ff89d59c12..fa80d00413f7 100644
--- a/chart2/source/inc/ChartModelHelper.hxx
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -34,6 +34,12 @@
#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/chart/XChartDataArray.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include "charttoolsdllapi.hxx"
@@ -52,6 +58,19 @@ namespace chart
class OOO_DLLPUBLIC_CHARTTOOLS ChartModelHelper
{
public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > createUndoManager();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeHighlighter > createRangeHighlighter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier >& xSelectionSupplier );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > createInternalDataProvider();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > createInternalDataProvider(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataArray >& xDataToCopy );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > createInternalDataProvider(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram >
findDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
@@ -60,7 +79,7 @@ public:
::com::sun::star::chart2::XDiagram >
findDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
- static ::std::vector< ::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE static ::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDataSeries > > getDataSeries(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDoc );
@@ -87,6 +106,12 @@ public:
static void triggerRangeHighlighting( const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xModel );
+
+ static bool isIncludeHiddenCells( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static bool setIncludeHiddenCells( bool bIncludeHiddenCells, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
};
//.............................................................................
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
index f99d39f63bcb..df43e24a9482 100644
--- a/chart2/source/inc/ChartTypeHelper.hxx
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -76,16 +76,27 @@ public:
static ::com::sun::star::uno::Sequence < sal_Int32 > getSupportedMissingValueTreatments(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
- static ::com::sun::star::drawing::Direction3D getDefaultSimpleLightDirection( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
- static ::com::sun::star::drawing::Direction3D getDefaultRealisticLightDirection( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
- static sal_Int32 getDefaultDirectLightColor( bool bSimple, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
- static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static ::com::sun::star::drawing::Direction3D getDefaultSimpleLightDirection( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static ::com::sun::star::drawing::Direction3D getDefaultRealisticLightDirection( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static sal_Int32 getDefaultDirectLightColor( bool bSimple, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
static sal_Int32 getNumberOfDisplayedSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries );
- static bool noBordersForSimpleScheme( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
static sal_Int32 //one of ::com::sun::star::chart2::AxisType
getAxisType( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
, sal_Int32 nDimensionIndex );
+
+ static rtl::OUString getRoleOfSequenceForYAxisNumberFormatDetection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static rtl::OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static bool shouldLabelNumberFormatKeyBeDetectedFromYAxis( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static bool isSupportingOnlyDeepStackingFor3D( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
};
//.............................................................................
diff --git a/chart2/source/inc/ColorPerPointHelper.hxx b/chart2/source/inc/ColorPerPointHelper.hxx
index a18757f4f8b7..c1391d9837cd 100644
--- a/chart2/source/inc/ColorPerPointHelper.hxx
+++ b/chart2/source/inc/ColorPerPointHelper.hxx
@@ -56,7 +56,7 @@ public:
// returns true if AttributedDataPoints contains nPointIndex and the
// property Color is DEFAULT
- static bool hasPointOwnProperties(
+ SAL_DLLPRIVATE static bool hasPointOwnProperties(
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >& xSeriesProperties
, sal_Int32 nPointIndex );
diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx
index f27bad5a719c..102ffde71918 100644
--- a/chart2/source/inc/CommonConverters.hxx
+++ b/chart2/source/inc/CommonConverters.hxx
@@ -101,23 +101,11 @@ OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D B3DVectorToDirecti
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint);
//-----------------------------------------------------------------------------
-/** Direction3D -> B3DPoint
-*/
-OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DPoint Direction3DToB3DPoint( const com::sun::star::drawing::Direction3D& rDirection);
-
-//-----------------------------------------------------------------------------
/** Direction3D -> B3DVector
*/
OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Direction3DToB3DVector( const com::sun::star::drawing::Direction3D& rDirection);
//-----------------------------------------------------------------------------
-/** two drawing::Position3D -> PolyPolygonShape3D
-*/
-OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::drawing::PolyPolygonShape3D
- MakeLine3D( const ::com::sun::star::drawing::Position3D & rStart,
- const ::com::sun::star::drawing::Position3D & rEnd );
-
-//-----------------------------------------------------------------------------
/** PolyPolygonShape3D + drawing::Position3D -> PolyPolygonShape3D
*/
OOO_DLLPUBLIC_CHARTTOOLS
@@ -168,21 +156,6 @@ OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D
, const com::sun::star::drawing::Direction3D& rDirection);
//-----------------------------------------------------------------------------
-/** Direction3D + Direction3D == Direction3D
-*/
-OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D
- operator+( const com::sun::star::drawing::Direction3D& rDirection
- , const com::sun::star::drawing::Direction3D& rDirectionAdd);
-
-//-----------------------------------------------------------------------------
-/** Position3D - Direction3D == Position3D
-*/
-OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D
- operator-( const com::sun::star::drawing::Position3D& rPos
- , const com::sun::star::drawing::Direction3D& rDirection);
-
-
-//-----------------------------------------------------------------------------
/** Position3D - Position3D == Direction3D
*/
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D
@@ -190,13 +163,6 @@ OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D
, const com::sun::star::drawing::Position3D& rPos2);
//-----------------------------------------------------------------------------
-/** Direction3D * double == Direction3D
-*/
-OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D
- operator*( const com::sun::star::drawing::Direction3D& rDirection
- , double fFraction);
-
-//-----------------------------------------------------------------------------
/** Position3D == Position3D ?
*/
OOO_DLLPUBLIC_CHARTTOOLS
@@ -242,13 +208,6 @@ OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::uno::Sequence< double >
Position3DToSequence( const com::sun::star::drawing::Position3D& rPosition );
//-----------------------------------------------------------------------------
-/** drawing::Direction3D / double
-*/
-
-OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D
- operator/( const com::sun::star::drawing::Direction3D& rDirection, double f );
-
-//-----------------------------------------------------------------------------
/** chart2::XDataSequence -> uno::Sequence< double >
*/
diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx
index 1c4a76efd229..2ec4efa41b8c 100644
--- a/chart2/source/inc/CommonFunctors.hxx
+++ b/chart2/source/inc/CommonFunctors.hxx
@@ -100,8 +100,11 @@ struct OOO_DLLPUBLIC_CHARTTOOLS AnyToString : public ::std::unary_function< ::co
::com::sun::star::uno::TypeClass eClass( rAny.getValueType().getTypeClass() );
if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE )
{
+ const double* pDouble = reinterpret_cast< const double * >( rAny.getValue() );
+ if( ::rtl::math::isNan(*pDouble) )
+ return ::rtl::OUString();
return ::rtl::math::doubleToUString(
- * reinterpret_cast< const double * >( rAny.getValue() ),
+ * pDouble,
rtl_math_StringFormat_Automatic,
-1, // use maximum decimal places available
sal_Char( '.' ), // decimal separator
diff --git a/chart2/source/inc/ConfigColorScheme.hxx b/chart2/source/inc/ConfigColorScheme.hxx
index 7a27f93f338c..3fe9355fd8cb 100644
--- a/chart2/source/inc/ConfigColorScheme.hxx
+++ b/chart2/source/inc/ConfigColorScheme.hxx
@@ -44,12 +44,17 @@
namespace chart
{
+
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > createConfigColorScheme(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
namespace impl
{
class ChartConfigItem;
}
-class OOO_DLLPUBLIC_CHARTTOOLS ConfigColorScheme :
+class ConfigColorScheme :
public ConfigItemListener,
public ::cppu::WeakImplHelper2<
::com::sun::star::chart2::XColorScheme,
@@ -59,7 +64,7 @@ public:
explicit ConfigColorScheme(
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > & xContext );
- virtual ~ConfigColorScheme();
+ SAL_DLLPRIVATE virtual ~ConfigColorScheme();
/// establish methods for factory instatiation
APPHELPER_SERVICE_FACTORY_HELPER( ConfigColorScheme )
@@ -68,14 +73,14 @@ public:
protected:
// ____ XColorScheme ____
- virtual ::sal_Int32 SAL_CALL getColorByIndex( ::sal_Int32 nIndex )
+ SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColorByIndex( ::sal_Int32 nIndex )
throw (::com::sun::star::uno::RuntimeException);
// ____ ConfigItemListener ____
- virtual void notify( const ::rtl::OUString & rPropertyName );
+ SAL_DLLPRIVATE virtual void notify( const ::rtl::OUString & rPropertyName );
private:
- void retrieveConfigColors();
+ SAL_DLLPRIVATE void retrieveConfigColors();
// member variables
::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/ControllerLockGuard.hxx b/chart2/source/inc/ControllerLockGuard.hxx
index b7bf17def1cb..0440018d2c72 100644
--- a/chart2/source/inc/ControllerLockGuard.hxx
+++ b/chart2/source/inc/ControllerLockGuard.hxx
@@ -67,8 +67,8 @@ public:
::com::sun::star::frame::XModel > & xModel );
~ControllerLockHelper();
- void lockControllers();
- void unlockControllers();
+ SAL_DLLPRIVATE void lockControllers();
+ SAL_DLLPRIVATE void unlockControllers();
private:
::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx
index 8e6173fa2ab9..ae179e5c5e83 100644
--- a/chart2/source/inc/DataSeriesHelper.hxx
+++ b/chart2/source/inc/DataSeriesHelper.hxx
@@ -42,6 +42,7 @@
#include <vector>
#include <functional>
+#include <hash_set>
namespace chart
{
@@ -49,7 +50,7 @@ namespace chart
namespace DataSeriesHelper
{
-OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString GetRole(
+::rtl::OUString GetRole(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence >& xLabeledDataSequence );
@@ -180,6 +181,13 @@ OOO_DLLPUBLIC_CHARTTOOLS bool areAllSeriesAttachedToSameAxis(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType,
sal_Int32 & rOutAxisIndex );
+OOO_DLLPUBLIC_CHARTTOOLS bool hasUnhiddenData( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence >& xDataSequence, bool bTranslate );
+
} // namespace DataSeriesHelper
} // namespace chart
diff --git a/chart2/source/inc/DataSource.hxx b/chart2/source/inc/DataSource.hxx
index 286e6b6116e1..555bbad847c4 100644
--- a/chart2/source/inc/DataSource.hxx
+++ b/chart2/source/inc/DataSource.hxx
@@ -37,12 +37,11 @@
#include <cppuhelper/implbase3.hxx>
#include <comphelper/uno3.hxx>
#include "ServiceMacros.hxx"
-#include "charttoolsdllapi.hxx"
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS DataSource : public
+class DataSource : public
::cppu::WeakImplHelper3<
::com::sun::star::lang::XServiceInfo,
::com::sun::star::chart2::data::XDataSource,
diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx
index 40b03034fcf7..c2f29e42c6ba 100644
--- a/chart2/source/inc/DataSourceHelper.hxx
+++ b/chart2/source/inc/DataSourceHelper.hxx
@@ -34,11 +34,11 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
-#ifndef _COM_SUN_STAR_CHART2_XLABELEDDATASEQUENCE_HPP_
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
-#endif
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
#include "charttoolsdllapi.hxx"
#include <vector>
@@ -55,6 +55,30 @@ namespace chart
class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper
{
public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >
+ createDataSource( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > > & rSequences );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createCachedDataSequence();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createCachedDataSequence( const ::rtl::OUString & rSingleText );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValues ,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xLabels );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValues );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
+
static ::com::sun::star::uno::Sequence<
::com::sun::star::beans::PropertyValue > createArguments(
bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories );
@@ -65,7 +89,7 @@ public:
const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping,
bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories );
- static void readArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArguments
+ SAL_DLLPRIVATE static void readArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArguments
, ::rtl::OUString & rRangeRepresentation, ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories );
@@ -79,7 +103,7 @@ public:
::com::sun::star::chart2::data::XLabeledDataSequence >& xLabeledDataSequence
, ::std::vector< ::rtl::OUString >& rOutRangeRepresentations );
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getUsedDataRanges(
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getUsedDataRanges(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram > & xDiagram );
@@ -127,11 +151,11 @@ public:
static bool allArgumentsForRectRangeDetected(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument );
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromLabeledDataSequence(
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromLabeledDataSequence(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence > & xLSeq );
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromDataSource(
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromDataSource(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSource > & xSource );
};
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index ae650e0a4898..119d206a2937 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -157,7 +157,7 @@ public:
/** Replaces all occurences of xCooSysToReplace in the tree with
xReplacement in the diagram's tree
*/
- static void replaceCoordinateSystem(
+ SAL_DLLPRIVATE static void replaceCoordinateSystem(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram > & xDiagram,
const ::com::sun::star::uno::Reference<
@@ -230,12 +230,12 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDoc );
- static ::com::sun::star::uno::Sequence< rtl::OUString >
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< rtl::OUString >
generateAutomaticCategories(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem > & xCooSys );
- static void generateAutomaticCategoriesFromChartType(
+ SAL_DLLPRIVATE static void generateAutomaticCategoriesFromChartType(
::com::sun::star::uno::Sequence< rtl::OUString >& rRet,
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
@@ -251,7 +251,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram > & xDiagram );
- static bool areChartTypesCompatible( const ::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE static bool areChartTypesCompatible( const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartType >& xFirstType,
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartType >& xSecondType );
diff --git a/chart2/source/inc/ErrorBar.hxx b/chart2/source/inc/ErrorBar.hxx
index 041e4aa6a5ab..4b586aefc8a9 100644
--- a/chart2/source/inc/ErrorBar.hxx
+++ b/chart2/source/inc/ErrorBar.hxx
@@ -50,6 +50,10 @@
namespace chart
{
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createErrorBar(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
namespace impl
{
typedef ::cppu::WeakImplHelper6<
@@ -62,7 +66,7 @@ typedef ::cppu::WeakImplHelper6<
ErrorBar_Base;
}
-class OOO_DLLPUBLIC_CHARTTOOLS ErrorBar :
+class ErrorBar :
public MutexContainer,
public impl::ErrorBar_Base,
public ::property::OPropertySet
diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx
index 12a98e4fca47..a6d8926d36ac 100644
--- a/chart2/source/inc/ExplicitCategoriesProvider.hxx
+++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx
@@ -49,10 +49,10 @@ class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider :
public:
ExplicitCategoriesProvider( const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel );
- virtual ~ExplicitCategoriesProvider();
+ SAL_DLLPRIVATE virtual ~ExplicitCategoriesProvider();
//XTextualDataSequence
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData()
+ SAL_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData()
throw (::com::sun::star::uno::RuntimeException);
static ::rtl::OUString getCategoryByIndex(
diff --git a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
index 20c58c31b458..fe7734730a45 100644
--- a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
@@ -31,12 +31,11 @@
#define CHART2_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX
#include "RegressionCurveCalculator.hxx"
-#include "charttoolsdllapi.hxx"
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS ExponentialRegressionCurveCalculator :
+class ExponentialRegressionCurveCalculator :
public RegressionCurveCalculator
{
public:
diff --git a/chart2/source/inc/InternalDataProvider.hxx b/chart2/source/inc/InternalDataProvider.hxx
index 5a7afc62c5fe..9bf598441b3a 100644
--- a/chart2/source/inc/InternalDataProvider.hxx
+++ b/chart2/source/inc/InternalDataProvider.hxx
@@ -41,7 +41,6 @@
#include <com/sun/star/util/XCloneable.hpp>
#include <cppuhelper/implbase6.hxx>
#include "ServiceMacros.hxx"
-#include "charttoolsdllapi.hxx"
#include "CachedDataSequence.hxx"
@@ -75,7 +74,7 @@ typedef ::cppu::WeakImplHelper6<
<p>The format for a complete range is "all". (Do we need more than
that?)</p>
*/
-class OOO_DLLPUBLIC_CHARTTOOLS InternalDataProvider :
+class InternalDataProvider :
public impl::InternalDataProvider_Base
{
public:
diff --git a/chart2/source/inc/LabeledDataSequence.hxx b/chart2/source/inc/LabeledDataSequence.hxx
index 23cfb7bb2743..3eba45bd2df9 100644
--- a/chart2/source/inc/LabeledDataSequence.hxx
+++ b/chart2/source/inc/LabeledDataSequence.hxx
@@ -31,7 +31,6 @@
#define CHART2_LABELEDDATASEQUENCE_HXX
#include "ServiceMacros.hxx"
#include "MutexContainer.hxx"
-#include "charttoolsdllapi.hxx"
#include <comphelper/uno3.hxx>
#include <cppuhelper/implbase4.hxx>
@@ -56,7 +55,7 @@ typedef cppu::WeakImplHelper4<
LabeledDataSequence_Base;
}
-class OOO_DLLPUBLIC_CHARTTOOLS LabeledDataSequence :
+class LabeledDataSequence :
public MutexContainer,
public impl::LabeledDataSequence_Base
{
diff --git a/chart2/source/inc/LifeTime.hxx b/chart2/source/inc/LifeTime.hxx
index 6b08c33b89da..26b9f09f7880 100644
--- a/chart2/source/inc/LifeTime.hxx
+++ b/chart2/source/inc/LifeTime.hxx
@@ -46,17 +46,17 @@ namespace apphelper
{
class LifeTimeGuard;
-class OOO_DLLPUBLIC_CHARTTOOLS LifeTimeManager
+class LifeTimeManager
{
friend class LifeTimeGuard;
protected:
mutable ::osl::Mutex m_aAccessMutex;
public:
- LifeTimeManager( ::com::sun::star::lang::XComponent* pComponent, sal_Bool bLongLastingCallsCancelable = sal_False );
- virtual ~LifeTimeManager();
+OOO_DLLPUBLIC_CHARTTOOLS LifeTimeManager( ::com::sun::star::lang::XComponent* pComponent, sal_Bool bLongLastingCallsCancelable = sal_False );
+OOO_DLLPUBLIC_CHARTTOOLS virtual ~LifeTimeManager();
- sal_Bool impl_isDisposed();
- sal_Bool dispose() throw(::com::sun::star::uno::RuntimeException);
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool impl_isDisposed();
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool dispose() throw(::com::sun::star::uno::RuntimeException);
public:
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer;
@@ -85,7 +85,7 @@ protected:
sal_Int32 volatile m_nLongLastingCallCount;
};
-class OOO_DLLPUBLIC_CHARTTOOLS CloseableLifeTimeManager : public LifeTimeManager
+class CloseableLifeTimeManager : public LifeTimeManager
{
protected:
::com::sun::star::util::XCloseable* m_pCloseable;
@@ -103,19 +103,19 @@ protected:
sal_Bool volatile m_bOwnershipIsWellKnown;
public:
- CloseableLifeTimeManager( ::com::sun::star::util::XCloseable* pCloseable
+OOO_DLLPUBLIC_CHARTTOOLS CloseableLifeTimeManager( ::com::sun::star::util::XCloseable* pCloseable
, ::com::sun::star::lang::XComponent* pComponent
, sal_Bool bLongLastingCallsCancelable = sal_False );
- virtual ~CloseableLifeTimeManager();
+OOO_DLLPUBLIC_CHARTTOOLS virtual ~CloseableLifeTimeManager();
- sal_Bool impl_isDisposedOrClosed();
- sal_Bool g_close_startTryClose(sal_Bool bDeliverOwnership)
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool impl_isDisposedOrClosed();
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_close_startTryClose(sal_Bool bDeliverOwnership)
throw ( ::com::sun::star::uno::Exception );
- sal_Bool g_close_isNeedToCancelLongLastingCalls( sal_Bool bDeliverOwnership, ::com::sun::star::util::CloseVetoException& ex )
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_close_isNeedToCancelLongLastingCalls( sal_Bool bDeliverOwnership, ::com::sun::star::util::CloseVetoException& ex )
throw ( ::com::sun::star::util::CloseVetoException );
- void g_close_endTryClose(sal_Bool bDeliverOwnership, sal_Bool bMyVeto );
- void g_close_endTryClose_doClose();
- sal_Bool g_addCloseListener( const ::com::sun::star::uno::Reference<
+OOO_DLLPUBLIC_CHARTTOOLS void g_close_endTryClose(sal_Bool bDeliverOwnership, sal_Bool bMyVeto );
+OOO_DLLPUBLIC_CHARTTOOLS void g_close_endTryClose_doClose();
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_addCloseListener( const ::com::sun::star::uno::Reference<
::com::sun::star::util::XCloseListener > & xListener )
throw(::com::sun::star::uno::RuntimeException);
diff --git a/chart2/source/inc/LineProperties.hxx b/chart2/source/inc/LineProperties.hxx
index 9a4a978c09ce..3cc60c5f3aa7 100644
--- a/chart2/source/inc/LineProperties.hxx
+++ b/chart2/source/inc/LineProperties.hxx
@@ -62,9 +62,9 @@ public:
static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
- static bool IsLineVisible( const ::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE static bool IsLineVisible( const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >& xLineProperties );
- static void SetLineVisible( const ::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE static void SetLineVisible( const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >& xLineProperties );
static void SetLineInvisible( const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >& xLineProperties );
diff --git a/chart2/source/inc/LinearRegressionCurveCalculator.hxx b/chart2/source/inc/LinearRegressionCurveCalculator.hxx
index 55147aa5874d..ad79a887c019 100644
--- a/chart2/source/inc/LinearRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/LinearRegressionCurveCalculator.hxx
@@ -31,12 +31,11 @@
#define CHART2_LINEARREGRESSIONCURVECALCULATOR_HXX
#include "RegressionCurveCalculator.hxx"
-#include "charttoolsdllapi.hxx"
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS LinearRegressionCurveCalculator :
+class LinearRegressionCurveCalculator :
public RegressionCurveCalculator
{
public:
diff --git a/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx
index 2913d9401b98..b0274600d543 100644
--- a/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx
@@ -31,12 +31,11 @@
#define CHART2_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX
#include "RegressionCurveCalculator.hxx"
-#include "charttoolsdllapi.hxx"
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS LogarithmicRegressionCurveCalculator :
+class LogarithmicRegressionCurveCalculator :
public RegressionCurveCalculator
{
public:
diff --git a/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx
index ea02d6a4fef5..8febb3d6078c 100644
--- a/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx
@@ -31,12 +31,11 @@
#define CHART2_MEANVALUEREGRESSIONCURVECALCULATOR_HXX
#include "RegressionCurveCalculator.hxx"
-#include "charttoolsdllapi.hxx"
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS MeanValueRegressionCurveCalculator :
+class MeanValueRegressionCurveCalculator :
public RegressionCurveCalculator
{
public:
diff --git a/chart2/source/inc/MediaDescriptorHelper.hxx b/chart2/source/inc/MediaDescriptorHelper.hxx
index 403c842fa45b..35cc90d30ca7 100644
--- a/chart2/source/inc/MediaDescriptorHelper.hxx
+++ b/chart2/source/inc/MediaDescriptorHelper.hxx
@@ -202,7 +202,7 @@ public:
sal_Bool ISSET_SetEmbedded;
protected:
- void impl_init();
+SAL_DLLPRIVATE void impl_init();
};
}
diff --git a/chart2/source/inc/ModifyListenerCallBack.hxx b/chart2/source/inc/ModifyListenerCallBack.hxx
index a664816930f8..92e7a778348c 100644
--- a/chart2/source/inc/ModifyListenerCallBack.hxx
+++ b/chart2/source/inc/ModifyListenerCallBack.hxx
@@ -53,11 +53,11 @@ public:
virtual ~ModifyListenerCallBack();
void startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >& xBroadcaster );
- void stopListening();
+ SAL_DLLPRIVATE void stopListening();
private: //methods
- ModifyListenerCallBack();
- ModifyListenerCallBack( const ModifyListenerCallBack& );
+ SAL_DLLPRIVATE ModifyListenerCallBack();
+ SAL_DLLPRIVATE ModifyListenerCallBack( const ModifyListenerCallBack& );
private: //member
ModifyListenerCallBack_impl* pModifyListener_impl;
diff --git a/chart2/source/inc/ModifyListenerHelper.hxx b/chart2/source/inc/ModifyListenerHelper.hxx
index 7c02d0356299..fa2977fd1b44 100644
--- a/chart2/source/inc/ModifyListenerHelper.hxx
+++ b/chart2/source/inc/ModifyListenerHelper.hxx
@@ -58,6 +58,8 @@ namespace chart
namespace ModifyListenerHelper
{
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > createModifyEventForwarder();
+
// ================================================================================
/** This helper class serves as forwarder of modify events. It can be used
@@ -68,7 +70,7 @@ namespace ModifyListenerHelper
life time of the listeners is independent of the broadcaster's lifetime in
this case.</p>
*/
-class OOO_DLLPUBLIC_CHARTTOOLS ModifyEventForwarder :
+class ModifyEventForwarder :
public MutexContainer,
public ::cppu::WeakComponentImplHelper2<
::com::sun::star::util::XModifyBroadcaster,
@@ -77,8 +79,6 @@ class OOO_DLLPUBLIC_CHARTTOOLS ModifyEventForwarder :
public:
ModifyEventForwarder();
- void FireEvent( const ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XWeak > & xSource );
void FireEvent( const ::com::sun::star::lang::EventObject & rEvent );
void AddListener(
diff --git a/chart2/source/inc/NameContainer.hxx b/chart2/source/inc/NameContainer.hxx
index 104fd941f217..9a55884d9535 100644
--- a/chart2/source/inc/NameContainer.hxx
+++ b/chart2/source/inc/NameContainer.hxx
@@ -45,6 +45,9 @@ namespace chart
{
//.............................................................................
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createNameContainer(
+ const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName );
+
namespace impl
{
typedef ::cppu::WeakImplHelper3<
@@ -54,7 +57,7 @@ typedef ::cppu::WeakImplHelper3<
NameContainer_Base;
}
-class OOO_DLLPUBLIC_CHARTTOOLS NameContainer : public impl::NameContainer_Base
+class NameContainer : public impl::NameContainer_Base
{
public:
NameContainer( const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName );
diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx
index c2e54d41da5f..00517f87c61a 100644
--- a/chart2/source/inc/OPropertySet.hxx
+++ b/chart2/source/inc/OPropertySet.hxx
@@ -80,6 +80,8 @@ public:
protected:
explicit OPropertySet( const OPropertySet & rOther, ::osl::Mutex & rMutex );
+ void SetNewValuesExplicitlyEvenIfTheyEqualDefault();
+
/** implement this method to provide default values for all properties
supporting defaults. If a property does not have a default value, you
may throw an UnknownPropertyException.
@@ -311,6 +313,7 @@ private:
/// pImpl idiom implementation
::std::auto_ptr< impl::ImplOPropertySet > m_pImplProperties;
+ bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault;
};
} // namespace property
diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx
index 973e896f846a..7793cd57d21e 100644
--- a/chart2/source/inc/ObjectIdentifier.hxx
+++ b/chart2/source/inc/ObjectIdentifier.hxx
@@ -124,13 +124,7 @@ public:
::com::sun::star::frame::XModel >& xChartModel
, sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc
- static rtl::OUString createClassifiedIdentifierForAxis(
- 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 rtl::OUString createParticleForDiagram(
+ SAL_DLLPRIVATE static rtl::OUString createParticleForDiagram(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram >& xDiagram
, const ::com::sun::star::uno::Reference<
@@ -195,7 +189,7 @@ public:
static rtl::OUString createDataCurveCID( const rtl::OUString& rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine );
static rtl::OUString createDataCurveEquationCID( const rtl::OUString& rSeriesParticle, sal_Int32 nCurveIndex );
- static rtl::OUString getObjectID( const rtl::OUString& rCID );
+ SAL_DLLPRIVATE static rtl::OUString getObjectID( const rtl::OUString& rCID );
static rtl::OUString getParticleID( const rtl::OUString& rCID );
static rtl::OUString getFullParentParticle( const rtl::OUString& rCID );
diff --git a/chart2/source/inc/PotentialRegressionCurveCalculator.hxx b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx
index ea3e621bf6e8..f5b8a7c7428f 100644
--- a/chart2/source/inc/PotentialRegressionCurveCalculator.hxx
+++ b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx
@@ -37,7 +37,7 @@ namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS PotentialRegressionCurveCalculator :
+class PotentialRegressionCurveCalculator :
public RegressionCurveCalculator
{
public:
diff --git a/chart2/source/inc/RangeHighlighter.hxx b/chart2/source/inc/RangeHighlighter.hxx
index fa464743ae0c..caa424dc4f05 100644
--- a/chart2/source/inc/RangeHighlighter.hxx
+++ b/chart2/source/inc/RangeHighlighter.hxx
@@ -31,7 +31,6 @@
#define CHART2_RANGEHIGHLIGHTER_HXX
#include "MutexContainer.hxx"
-#include "charttoolsdllapi.hxx"
#include <cppuhelper/compbase2.hxx>
#include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
@@ -56,7 +55,7 @@ typedef ::cppu::WeakComponentImplHelper2<
RangeHighlighter_Base;
}
-class OOO_DLLPUBLIC_CHARTTOOLS RangeHighlighter :
+class RangeHighlighter :
public MutexContainer,
public impl::RangeHighlighter_Base
{
@@ -111,6 +110,7 @@ private:
::com::sun::star::uno::Sequence< ::com::sun::star::chart2::data::HighlightedRange >
m_aSelectedRanges;
sal_Int32 m_nAddedListenerCount;
+ bool m_bIncludeHiddenCells;
};
} // namespace chart
diff --git a/chart2/source/inc/ReferenceSizeProvider.hxx b/chart2/source/inc/ReferenceSizeProvider.hxx
index 6d8612d79f73..c6505c4d3796 100644
--- a/chart2/source/inc/ReferenceSizeProvider.hxx
+++ b/chart2/source/inc/ReferenceSizeProvider.hxx
@@ -64,7 +64,6 @@ public:
::com::sun::star::chart2::XChartDocument > & xChartDoc );
::com::sun::star::awt::Size getPageSize() const;
- bool useAutoScale() const;
/** Retrieves the state auto-resize from all objects that support this
feature. If all objects return the same state, AUTO_RESIZE_YES or
@@ -78,11 +77,6 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDoc );
- /** Retrieves the current auto-resize state from the internally set chart
- document
- */
- AutoResizeState getAutoResizeState() const;
-
/** sets or resets the auto-resize at all objects that support this feature
for text to the opposite of the current setting. If the current state
is ambiguous, it is turned on. If the current state is unknown it stays
@@ -90,16 +84,12 @@ public:
*/
void toggleAutoResizeState();
- /** sets the auto-resize at all objects that support this feature for text.
- eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
- */
- void setAutoResizeState( AutoResizeState eNewState );
/** Sets the ReferencePageSize according to the internal settings of this
class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
is </TRUE>.
*/
- void setValuesAtPropertySet(
+ SAL_DLLPRIVATE void setValuesAtPropertySet(
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > & xProp,
bool bAdaptFontSizes = true );
@@ -108,7 +98,7 @@ public:
class at the XTitle, and the adapted font sizes at the contained
XFormattedStrings
*/
- void setValuesAtTitle(
+ SAL_DLLPRIVATE void setValuesAtTitle(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XTitle > & xTitle );
@@ -118,6 +108,14 @@ public:
*/
void setValuesAtAllDataSeries();
+private:
+ SAL_DLLPRIVATE bool useAutoScale() const;
+
+ /** sets the auto-resize at all objects that support this feature for text.
+ eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
+ */
+ SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState );
+
/** Retrieves the auto-resize state from the given propertyset. The result
will be put into eInOutState. If you initialize eInOutState with
AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any
@@ -125,23 +123,15 @@ public:
esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for
the current property set, or the other way round.
*/
- static void getAutoResizeFromPropSet(
+ SAL_DLLPRIVATE static void getAutoResizeFromPropSet(
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > & xProp,
AutoResizeState & rInOutState );
- /** calls getAutoResizeFromPropSet with the title's property set
- */
- static void getAutoResizeFromTitle(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XTitle > & xTitle,
- AutoResizeState & rInOutState );
-
-private:
- void impl_setValuesAtTitled(
+ SAL_DLLPRIVATE void impl_setValuesAtTitled(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XTitled > & xTitled );
- static void impl_getAutoResizeFromTitled(
+ SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XTitled > & xTitled,
AutoResizeState & rInOutState );
diff --git a/chart2/source/inc/RegressionCurveCalculator.hxx b/chart2/source/inc/RegressionCurveCalculator.hxx
index 8ca8849c6bf0..0168ca2f57ba 100644
--- a/chart2/source/inc/RegressionCurveCalculator.hxx
+++ b/chart2/source/inc/RegressionCurveCalculator.hxx
@@ -34,12 +34,11 @@
#include <com/sun/star/chart2/XRegressionCurveCalculator.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
-#include "charttoolsdllapi.hxx"
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS RegressionCurveCalculator : public
+class RegressionCurveCalculator : public
::cppu::WeakImplHelper1< ::com::sun::star::chart2::XRegressionCurveCalculator >
{
public:
diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx
index 8cfe8b6f9ac8..3f18fa6c46c8 100644
--- a/chart2/source/inc/RegressionCurveHelper.hxx
+++ b/chart2/source/inc/RegressionCurveHelper.hxx
@@ -49,14 +49,14 @@ class OOO_DLLPUBLIC_CHARTTOOLS RegressionCurveHelper
{
public:
/// returns a model mean-value line
- static ::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XRegressionCurve >
createMeanValueLine(
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > & xContext );
/// returns a model regression curve
- static ::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XRegressionCurve >
createRegressionCurveByServiceName(
const ::com::sun::star::uno::Reference<
@@ -187,7 +187,7 @@ public:
If false, the sequence (1, 2, 3, ...) will always be used, even if
there is a data-sequence with role "values-x"
*/
- static void initializeCurveCalculator(
+ SAL_DLLPRIVATE static void initializeCurveCalculator(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XRegressionCurveCalculator > & xOutCurveCalculator,
const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/RelativePositionHelper.hxx b/chart2/source/inc/RelativePositionHelper.hxx
index 628fd0fdd017..e8e7dde535b5 100644
--- a/chart2/source/inc/RelativePositionHelper.hxx
+++ b/chart2/source/inc/RelativePositionHelper.hxx
@@ -77,7 +77,7 @@ public:
been changed to the given one. The passed object size is taken into
account for shifting the position.
*/
- static ::com::sun::star::chart2::RelativePosition
+ SAL_DLLPRIVATE static ::com::sun::star::chart2::RelativePosition
getReanchoredPosition(
const ::com::sun::star::chart2::RelativePosition & rPosition,
const ::com::sun::star::chart2::RelativeSize & rObjectSize,
diff --git a/chart2/source/inc/RessourceManager.hxx b/chart2/source/inc/RessourceManager.hxx
index a0d12cf2ed07..6cefa1a23d02 100644
--- a/chart2/source/inc/RessourceManager.hxx
+++ b/chart2/source/inc/RessourceManager.hxx
@@ -38,7 +38,7 @@ class ResMgr;
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS RessourceManager
+class RessourceManager
{
public:
static ::ResMgr & getRessourceManager();
diff --git a/chart2/source/inc/Scaling.hxx b/chart2/source/inc/Scaling.hxx
index 31b32cac65e9..8f5e83c5254e 100644
--- a/chart2/source/inc/Scaling.hxx
+++ b/chart2/source/inc/Scaling.hxx
@@ -30,7 +30,6 @@
#ifndef _CHART2_SCALING_HXX
#define _CHART2_SCALING_HXX
#include "ServiceMacros.hxx"
-#include "charttoolsdllapi.hxx"
#include <com/sun/star/chart2/XScaling.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
@@ -46,7 +45,7 @@ namespace chart
/**
*/
-class OOO_DLLPUBLIC_CHARTTOOLS LogarithmicScaling :
+class LogarithmicScaling :
public ::cppu::WeakImplHelper3 <
::com::sun::star::chart2::XScaling,
::com::sun::star::lang::XServiceName,
@@ -67,13 +66,12 @@ public:
APPHELPER_XSERVICEINFO_DECL()
// ____ XScaling ____
- virtual double SAL_CALL
- doScaling( double value )
+ virtual double SAL_CALL doScaling( double value )
throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
+ virtual ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XScaling > SAL_CALL
- getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
+ getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
// ____ XServiceName ____
virtual ::rtl::OUString SAL_CALL getServiceName()
@@ -88,7 +86,7 @@ private:
// ----------------------------------------
-class OOO_DLLPUBLIC_CHARTTOOLS ExponentialScaling :
+class ExponentialScaling :
public ::cppu::WeakImplHelper3 <
::com::sun::star::chart2::XScaling,
::com::sun::star::lang::XServiceName,
@@ -129,7 +127,7 @@ private:
// ----------------------------------------
-class OOO_DLLPUBLIC_CHARTTOOLS LinearScaling : public ::cppu::WeakImplHelper3 <
+class LinearScaling : public ::cppu::WeakImplHelper3 <
::com::sun::star::chart2::XScaling,
::com::sun::star::lang::XServiceName,
::com::sun::star::lang::XServiceInfo
@@ -150,13 +148,12 @@ public:
APPHELPER_XSERVICEINFO_DECL()
// ____ XScaling ____
- virtual double SAL_CALL
- doScaling( double value )
+ virtual double SAL_CALL doScaling( double value )
throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
+ virtual ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XScaling > SAL_CALL
- getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
+ getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
// ____ XServiceName ____
virtual ::rtl::OUString SAL_CALL getServiceName()
@@ -171,7 +168,7 @@ private:
// ----------------------------------------
-class OOO_DLLPUBLIC_CHARTTOOLS PowerScaling : public ::cppu::WeakImplHelper3 <
+class PowerScaling : public ::cppu::WeakImplHelper3 <
::com::sun::star::chart2::XScaling,
::com::sun::star::lang::XServiceName,
::com::sun::star::lang::XServiceInfo
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
index 78b53e9807f4..133f5bcc255b 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -33,7 +33,8 @@
// this includes no link dependency
#include <svtools/solar.hrc>
-//next is 281
+//next free is 285
+//single free is: 134
//#define RID_APP_START 30000
////#define STR_NULL (RID_APP_START + 1)
@@ -128,6 +129,9 @@
#define STR_STOCK_3 (RID_APP_START + 145)
#define STR_STOCK_4 (RID_APP_START + 146)
+#define STR_TYPE_BUBBLE (RID_APP_START + 282)
+#define STR_BUBBLE_1 (RID_APP_START + 283)
+
//-----------------------------------------------------------------------------
//additional controls for wizard:
@@ -149,7 +153,7 @@
#define STR_INDICATE_BOTH (RID_APP_START + 131)
#define STR_INDICATE_UP (RID_APP_START + 132)
#define STR_INDICATE_DOWN (RID_APP_START + 133)
-#define STR_REGRESSION_NONE (RID_APP_START + 134)
+
#define STR_REGRESSION_LINEAR (RID_APP_START + 135)
#define STR_REGRESSION_LOG (RID_APP_START + 136)
#define STR_REGRESSION_EXP (RID_APP_START + 137)
@@ -180,6 +184,7 @@
#define STR_DATA_ROLE_MIN (RID_APP_START + 248)
#define STR_DATA_ROLE_MAX (RID_APP_START + 249)
#define STR_DATA_ROLE_CATEGORIES (RID_APP_START + 260)
+#define STR_DATA_ROLE_SIZE (RID_APP_START + 284)
#define STR_DATA_UNNAMED_SERIES (RID_APP_START + 250)
#define STR_DATA_UNNAMED_SERIES_WITH_INDEX (RID_APP_START + 251)
@@ -287,6 +292,7 @@
#define STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE (RID_APP_START + 266)
#define STR_PAGE_POSITIONING (RID_APP_START + 277)
+#define STR_PAGE_ASIAN (RID_APP_START + 281)
//-----------------------------------------------------------------------------
//strings used as description for actions on toolbar icons, as tip help or for undo
diff --git a/chart2/source/inc/ThreeDHelper.hxx b/chart2/source/inc/ThreeDHelper.hxx
index cb860a193b73..62eaba4ffa77 100644
--- a/chart2/source/inc/ThreeDHelper.hxx
+++ b/chart2/source/inc/ThreeDHelper.hxx
@@ -105,7 +105,7 @@ public:
sal_Int32 nElevationDeg, sal_Int32 nRotationDeg
, double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
- static void convertXYZAngleRadToElevationRotationDeg(
+ SAL_DLLPRIVATE static void convertXYZAngleRadToElevationRotationDeg(
sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg
, double fXRad, double fYRad, double fZRad );
@@ -116,8 +116,8 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >& xSceneProperties
, double fCameraDistance );
- static void ensureCameraDistanceRange( double& rfCameraDistance );
- static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
+ SAL_DLLPRIVATE static void ensureCameraDistanceRange( double& rfCameraDistance );
+ SAL_DLLPRIVATE static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
static double CameraDistanceToPerspective( double fCameraDistance );
static double PerspectiveToCameraDistance( double fPerspective );
diff --git a/chart2/source/inc/UncachedDataSequence.hxx b/chart2/source/inc/UncachedDataSequence.hxx
index 6fedbdd1ba12..2a5e23602738 100644
--- a/chart2/source/inc/UncachedDataSequence.hxx
+++ b/chart2/source/inc/UncachedDataSequence.hxx
@@ -73,7 +73,7 @@ typedef ::cppu::WeakComponentImplHelper8<
UncachedDataSequence_Base;
}
-class OOO_DLLPUBLIC_CHARTTOOLS UncachedDataSequence :
+class UncachedDataSequence :
public ::comphelper::OMutexAndBroadcastHelper,
public ::comphelper::OPropertyContainer,
public ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >,
@@ -186,8 +186,6 @@ protected:
// <properties>
sal_Int32 m_nNumberFormatKey;
::rtl::OUString m_sRole;
- sal_Bool m_bIsHidden;
- ::com::sun::star::uno::Sequence< sal_Int32 > m_aHiddenValues;
::rtl::OUString m_aXMLRange;
// </properties>
diff --git a/chart2/source/inc/UndoGuard.hxx b/chart2/source/inc/UndoGuard.hxx
index 98cffab939af..cdefdcd44c41 100644
--- a/chart2/source/inc/UndoGuard.hxx
+++ b/chart2/source/inc/UndoGuard.hxx
@@ -41,7 +41,7 @@ namespace chart
{
/** Base Class for UndoGuard and UndoLiveUpdateGuard
*/
-class OOO_DLLPUBLIC_CHARTTOOLS UndoGuard_Base
+class UndoGuard_Base
{
public:
explicit UndoGuard_Base( const rtl::OUString & rUndoMessage
@@ -51,7 +51,7 @@ public:
::com::sun::star::frame::XModel > & xModel );
virtual ~UndoGuard_Base();
- void commitAction();
+OOO_DLLPUBLIC_CHARTTOOLS void commitAction();
protected:
::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/UndoManager.hxx b/chart2/source/inc/UndoManager.hxx
index d8c1690963ff..6c71e668a2b5 100644
--- a/chart2/source/inc/UndoManager.hxx
+++ b/chart2/source/inc/UndoManager.hxx
@@ -32,7 +32,6 @@
#include "ConfigItemListener.hxx"
#include "MutexContainer.hxx"
-#include "charttoolsdllapi.hxx"
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -82,7 +81,7 @@ typedef ::cppu::WeakComponentImplHelper3<
redo-stacks support the css::util::XCloneable interface, which is
implemented such that the entire model is cloned.
*/
-class OOO_DLLPUBLIC_CHARTTOOLS UndoManager :
+class UndoManager :
public MutexContainer,
public ConfigItemListener,
public impl::UndoManager_Base
diff --git a/chart2/source/inc/WeakListenerAdapter.hxx b/chart2/source/inc/WeakListenerAdapter.hxx
index cd5f472c12a0..936e6e4ab4cf 100644
--- a/chart2/source/inc/WeakListenerAdapter.hxx
+++ b/chart2/source/inc/WeakListenerAdapter.hxx
@@ -36,7 +36,6 @@
#include <com/sun/star/view/XSelectionChangeListener.hpp>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/implbase1.hxx>
-#include "charttoolsdllapi.hxx"
namespace chart
{
@@ -94,7 +93,7 @@ private:
// --------------------------------------------------------------------------------
-class OOO_DLLPUBLIC_CHARTTOOLS WeakModifyListenerAdapter :
+class WeakModifyListenerAdapter :
public WeakListenerAdapter< ::com::sun::star::util::XModifyListener >
{
public:
@@ -110,7 +109,7 @@ protected:
// --------------------------------------------------------------------------------
-class OOO_DLLPUBLIC_CHARTTOOLS WeakSelectionChangeListenerAdapter :
+class WeakSelectionChangeListenerAdapter :
public WeakListenerAdapter< ::com::sun::star::view::XSelectionChangeListener >
{
public:
diff --git a/chart2/source/inc/WrappedIgnoreProperty.hxx b/chart2/source/inc/WrappedIgnoreProperty.hxx
index 168967aa7fbf..db45c5291a9a 100644
--- a/chart2/source/inc/WrappedIgnoreProperty.hxx
+++ b/chart2/source/inc/WrappedIgnoreProperty.hxx
@@ -52,13 +52,13 @@ public:
virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+SAL_DLLPRIVATE virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+SAL_DLLPRIVATE virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+SAL_DLLPRIVATE virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
protected:
@@ -72,8 +72,8 @@ public:
static void addIgnoreLineProperties( std::vector< WrappedProperty* >& rList );
static void addIgnoreFillProperties( std::vector< WrappedProperty* >& rList );
- static void addIgnoreFillProperties_without_BitmapProperties( std::vector< WrappedProperty* >& rList );
- static void addIgnoreFillProperties_only_BitmapProperties( std::vector< WrappedProperty* >& rList );
+ SAL_DLLPRIVATE static void addIgnoreFillProperties_without_BitmapProperties( std::vector< WrappedProperty* >& rList );
+ SAL_DLLPRIVATE static void addIgnoreFillProperties_only_BitmapProperties( std::vector< WrappedProperty* >& rList );
};
//.............................................................................
diff --git a/chart2/source/inc/WrappedPropertySet.hxx b/chart2/source/inc/WrappedPropertySet.hxx
index 99aaadcd3c11..3a6f19b06473 100644
--- a/chart2/source/inc/WrappedPropertySet.hxx
+++ b/chart2/source/inc/WrappedPropertySet.hxx
@@ -116,11 +116,11 @@ protected: //methods
virtual ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > getInnerPropertySet() = 0;
- ::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertyState > getInnerPropertyState();
::cppu::IPropertyArrayHelper& getInfoHelper();
- tWrappedPropertyMap& getWrappedPropertyMap();
+ SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap();
const WrappedProperty* getWrappedProperty( const ::rtl::OUString& rOuterName );
const WrappedProperty* getWrappedProperty( sal_Int32 nHandle );
diff --git a/chart2/source/inc/XMLRangeHelper.hxx b/chart2/source/inc/XMLRangeHelper.hxx
index 3e948c4567fc..32bb08f4a552 100644
--- a/chart2/source/inc/XMLRangeHelper.hxx
+++ b/chart2/source/inc/XMLRangeHelper.hxx
@@ -65,10 +65,8 @@ struct OOO_DLLPUBLIC_CHARTTOOLS CellRange
::rtl::OUString aTableName;
};
-OOO_DLLPUBLIC_CHARTTOOLS
CellRange getCellRangeFromXMLString( const ::rtl::OUString & rXMLString );
-OOO_DLLPUBLIC_CHARTTOOLS
::rtl::OUString getXMLStringFromCellRange( const CellRange & rRange );
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
index 3b281f8118dd..e4afc0d9efbd 100644
--- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx
+++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
@@ -51,7 +51,8 @@
#define SCHATTR_DATADESCR_SEPARATOR (SCHATTR_DATADESCR_START + 4)
#define SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 5)
#define SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 6)
-#define SCHATTR_DATADESCR_END SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS
+#define SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 7) //percentage values should not be offered
+#define SCHATTR_DATADESCR_END SCHATTR_DATADESCR_NO_PERCENTVALUE
#define SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1)
#define SCHATTR_LEGEND_POS SCHATTR_LEGEND_START
@@ -209,8 +210,9 @@
#define SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 10)
#define SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 11)
#define SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 12)
+#define SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 13)
-#define SCHATTR_CHARTTYPE_END SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS
+#define SCHATTR_CHARTTYPE_END SCHATTR_INCLUDE_HIDDEN_CELLS
// items for transporting information to dialogs
#define SCHATTR_MISC_START (SCHATTR_CHARTTYPE_END + 1)
diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx
index 10ddc9657c7b..caec07d58a15 100644
--- a/chart2/source/inc/chartview/DrawModelWrapper.hxx
+++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx
@@ -62,15 +62,15 @@ private:
DrawModelWrapper();
public:
- DrawModelWrapper(::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE DrawModelWrapper(::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > const & xContext );
- virtual ~DrawModelWrapper();
+ SAL_DLLPRIVATE virtual ~DrawModelWrapper();
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getShapeFactory();
// the main page will contain the normal view objects
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getMainDrawPage();
- void clearMainDrawPage();
+ SAL_DLLPRIVATE void clearMainDrawPage();
// the extra page is not visible, but contains some extras like the symbols for data points
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getHiddenDrawPage();
@@ -80,25 +80,25 @@ public:
::com::sun::star::drawing::XDrawPage>& xPage );
- void lockControllers();
- void unlockControllers();
+ SAL_DLLPRIVATE void lockControllers();
+ SAL_DLLPRIVATE void unlockControllers();
/// tries to get an OutputDevice from the XParent of the model to use as reference device
- void attachParentReferenceDevice(
+ SAL_DLLPRIVATE void attachParentReferenceDevice(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel );
OutputDevice* getReferenceDevice() const;
SfxItemPool& GetItemPool();
- const SfxItemPool& GetItemPool() const;
+ SAL_DLLPRIVATE const SfxItemPool& GetItemPool() const;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ SAL_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
createUnoModel();
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
getUnoModel();
SdrModel& getSdrModel();
- void updateTablesFromChartModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+ SAL_DLLPRIVATE void updateTablesFromChartModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
XColorTable* GetColorTable() const;
XDashList* GetDashList() const;
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
index 645e25166594..ab94e7e1c337 100644
--- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx
+++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/drawing/XShape.hpp>
@@ -91,16 +92,16 @@ 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 );
- static sal_Int32 getPercentNumberFormat( const ::com::sun::star::uno::Reference<
+ SAL_DLLPRIVATE static sal_Int32 getPercentNumberFormat( const ::com::sun::star::uno::Reference<
::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
- static sal_Int32 getExplicitNumberFormatKeyForLabel(
+ static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries
, sal_Int32 nPointIndex /*-1 for whole series*/
- , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAttachedAxisProps );
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
- static sal_Int32 getExplicitPercentageNumberFormatKeyForLabel(
+ static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
};
diff --git a/chart2/source/inc/chartview/NumberFormatterWrapper.hxx b/chart2/source/inc/chartview/NumberFormatterWrapper.hxx
index 71a6f20acb0d..5077541abe2c 100644
--- a/chart2/source/inc/chartview/NumberFormatterWrapper.hxx
+++ b/chart2/source/inc/chartview/NumberFormatterWrapper.hxx
@@ -61,10 +61,11 @@ private: //private member
m_xNumberFormatsSupplier;
SvNumberFormatter* m_pNumberFormatter;
+ ::com::sun::star::uno::Any m_aNullDate;
};
-class OOO_DLLPUBLIC_CHARTVIEW FixedNumberFormatter
+class FixedNumberFormatter
{
public:
FixedNumberFormatter( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier
diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx
index 461483b46e0d..1c2782de3852 100644
--- a/chart2/source/inc/servicenames_charttypes.hxx
+++ b/chart2/source/inc/servicenames_charttypes.hxx
@@ -43,6 +43,7 @@ namespace chart
#define CHART2_SERVICE_NAME_CHARTTYPE_PIE ::rtl::OUString::createFromAscii("com.sun.star.chart2.PieChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.NetChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ::rtl::OUString::createFromAscii("com.sun.star.chart2.BubbleChartType")
//.............................................................................
} //namespace chart
diff --git a/chart2/source/model/inc/BaseCoordinateSystem.hxx b/chart2/source/model/inc/BaseCoordinateSystem.hxx
index afb0c5027f72..4afd4f6ff51f 100644
--- a/chart2/source/model/inc/BaseCoordinateSystem.hxx
+++ b/chart2/source/model/inc/BaseCoordinateSystem.hxx
@@ -33,7 +33,6 @@
#include "ServiceMacros.hxx"
#include "OPropertySet.hxx"
#include "MutexContainer.hxx"
-#include "ModifyListenerHelper.hxx"
#include <cppuhelper/implbase6.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
diff --git a/chart2/source/model/inc/Diagram.hxx b/chart2/source/model/inc/Diagram.hxx
index 283885866546..69e58bad0128 100644
--- a/chart2/source/model/inc/Diagram.hxx
+++ b/chart2/source/model/inc/Diagram.hxx
@@ -45,7 +45,6 @@
#include <com/sun/star/util/XModifyListener.hpp>
#include "ServiceMacros.hxx"
-#include "ModifyListenerHelper.hxx"
#include <map>
#include <vector>
diff --git a/chart2/source/model/inc/StockBar.hxx b/chart2/source/model/inc/StockBar.hxx
index 9f1b7aac9fc0..6db0c02b8959 100644
--- a/chart2/source/model/inc/StockBar.hxx
+++ b/chart2/source/model/inc/StockBar.hxx
@@ -37,7 +37,6 @@
#include "OPropertySet.hxx"
#include "ServiceMacros.hxx"
-#include "ModifyListenerHelper.hxx"
#include <cppuhelper/implbase3.hxx>
#include <comphelper/uno3.hxx>
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
index d4a1cdff49e8..2b119c633537 100644
--- a/chart2/source/model/main/Axis.cxx
+++ b/chart2/source/model/main/Axis.cxx
@@ -296,7 +296,7 @@ namespace chart
Axis::Axis( Reference< uno::XComponentContext > const & /* xContext */ ) :
::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_aScaleData( AxisHelper::createDefaultScale() ),
m_xGrid( new GridProperties() ),
m_aSubGridProperties(),
@@ -317,7 +317,7 @@ Axis::Axis( const Axis & rOther ) :
MutexContainer(),
impl::Axis_Base(),
::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_aScaleData( rOther.m_aScaleData )
{
m_xGrid.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xGrid ));
diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx
index 6384964e7738..ebbffe2ef1eb 100644
--- a/chart2/source/model/main/BaseCoordinateSystem.cxx
+++ b/chart2/source/model/main/BaseCoordinateSystem.cxx
@@ -113,7 +113,7 @@ BaseCoordinateSystem::BaseCoordinateSystem(
sal_Bool bSwapXAndYAxis /* = sal_False */ ) :
::property::OPropertySet( m_aMutex ),
m_xContext( xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_nDimensionCount( nDimensionCount )
{
m_aAllAxis.resize( m_nDimensionCount );
@@ -154,7 +154,7 @@ BaseCoordinateSystem::BaseCoordinateSystem(
MutexContainer(),
::property::OPropertySet( rSource, m_aMutex ),
m_xContext( rSource.m_xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_nDimensionCount( rSource.m_nDimensionCount ),
m_aOrigin( rSource.m_aOrigin )
{
diff --git a/chart2/source/model/main/ChartData.cxx b/chart2/source/model/main/ChartData.cxx
index b17c0e27bb16..af332f6c3c6e 100644
--- a/chart2/source/model/main/ChartData.cxx
+++ b/chart2/source/model/main/ChartData.cxx
@@ -32,7 +32,10 @@
#include "precompiled_chart2.hxx"
#include "ChartData.hxx"
-#include "InternalDataProvider.hxx"
+#include "ChartModelHelper.hxx"
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
using namespace ::com::sun::star;
@@ -45,7 +48,8 @@ namespace chart
ChartData::ChartData( const Reference< uno::XComponentContext > & xContext ) :
m_xContext( xContext ),
- m_pInternalDataProvider( 0 )
+ m_xDataProvider( 0 ),
+ m_xInternalDataProvider( 0 )
{}
ChartData::~ChartData()
@@ -55,7 +59,7 @@ void ChartData::setDataProvider(
const Reference< chart2::data::XDataProvider > & xDataProvider ) throw()
{
m_xDataProvider.set( xDataProvider );
- m_pInternalDataProvider = 0;
+ m_xInternalDataProvider.clear();
}
Reference< chart2::data::XDataProvider > ChartData::getDataProvider() const throw()
@@ -70,25 +74,32 @@ bool ChartData::createInternalData(
return false;
if( bCloneOldData )
- m_pInternalDataProvider = new InternalDataProvider( xChartDoc );
+ m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( xChartDoc );
else
- m_pInternalDataProvider = new InternalDataProvider();
+ m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider();
- m_xDataProvider.set( m_pInternalDataProvider );
+ m_xDataProvider.set( m_xInternalDataProvider );
return true;
}
bool ChartData::hasInternalData() const
{
- return (m_xDataProvider.is() && m_pInternalDataProvider != 0);
+ return (m_xDataProvider.is() && m_xInternalDataProvider.is());
}
bool ChartData::createDefaultData() throw()
{
if( hasInternalData() )
{
- m_pInternalDataProvider->createDefaultData();
- return true;
+ uno::Reference< lang::XInitialization > xIni(m_xInternalDataProvider,uno::UNO_QUERY);
+ if ( xIni.is() )
+ {
+ uno::Sequence< uno::Any > aArgs(1);
+ beans::NamedValue aParam(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDefaultData")),uno::makeAny(sal_True));
+ aArgs[0] <<= aParam;
+ xIni->initialize(aArgs);
+ return true;
+ }
}
return false;
}
diff --git a/chart2/source/model/main/ChartData.hxx b/chart2/source/model/main/ChartData.hxx
index f13971f67629..308db5ab0f6a 100644
--- a/chart2/source/model/main/ChartData.hxx
+++ b/chart2/source/model/main/ChartData.hxx
@@ -58,8 +58,6 @@ namespace com { namespace sun { namespace star {
namespace chart
{
-class InternalDataProvider;
-
class ChartData
{
public:
@@ -93,15 +91,12 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >
m_xDataProvider;
+
/** is only valid if m_xDataProvider is set. If m_xDataProvider is set to an
- external data provider this pointer must be set to 0
+ external data provider this reference must be set to 0
*/
- InternalDataProvider * m_pInternalDataProvider;
-
-// ::com::sun::star::uno::Reference<
-// ::com::sun::star::embed::XEmbeddedClient > m_xInternalData;
-// /// is only valid if m_xInternalData exists
-// InternalData * m_pInternalData;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >
+ m_xInternalDataProvider;
};
} // namespace chart
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 49551bf78c7c..4882ecef72de 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -39,10 +39,12 @@
#include "servicenames.hxx"
#include "DataSourceHelper.hxx"
#include "NoWarningThisInCTOR.hxx"
-#include "RangeHighlighter.hxx"
+#include "ChartModelHelper.hxx"
#include "DisposeHelper.hxx"
#include "ControllerLockGuard.hxx"
#include "ObjectIdentifier.hxx"
+#include "ChartModelHelper.hxx"
+
#include <comphelper/InlineContainer.hxx>
#include <comphelper/processfactory.hxx>
@@ -703,6 +705,19 @@ sal_Bool SAL_CALL ChartModel::hasInternalDataProvider()
{
// /--
MutexGuard aGuard( m_aModelMutex );
+ uno::Reference< beans::XPropertySet > xProp( xProvider, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ sal_Bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( Reference< frame::XModel >(this) );
+ xProp->setPropertyValue(C2U("IncludeHiddenCells"), uno::makeAny(bIncludeHiddenCells));
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ }
+ }
+
m_pImplChartModel->SetDataProvider( xProvider );
// \--
}
@@ -769,7 +784,7 @@ sal_Bool SAL_CALL ChartModel::hasInternalDataProvider()
{
uno::Reference< view::XSelectionSupplier > xSelSupp( this->getCurrentController(), uno::UNO_QUERY );
if( xSelSupp.is() )
- m_xRangeHighlighter.set( new RangeHighlighter( xSelSupp ));
+ m_xRangeHighlighter.set( ChartModelHelper::createRangeHighlighter( xSelSupp ));
}
return m_xRangeHighlighter;
}
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index d720443270d2..2e317ba7a0db 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -37,6 +37,7 @@
#include "ChartDebugTrace.hxx"
#include "macros.hxx"
#include "ChartViewHelper.hxx"
+#include "ChartModelHelper.hxx"
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XImporter.hpp>
@@ -407,6 +408,7 @@ void SAL_CALL ChartModel::initNew()
try
{
m_pImplChartModel->CreateDefaultChart();
+ ChartModelHelper::setIncludeHiddenCells( false, this );
}
catch( uno::Exception & ex )
{
diff --git a/chart2/source/model/main/DataPoint.cxx b/chart2/source/model/main/DataPoint.cxx
index 57680c4c15e7..983ba72080c1 100644
--- a/chart2/source/model/main/DataPoint.cxx
+++ b/chart2/source/model/main/DataPoint.cxx
@@ -90,17 +90,21 @@ namespace chart
DataPoint::DataPoint( const uno::Reference< beans::XPropertySet > & rParentProperties ) :
::property::OPropertySet( m_aMutex ),
m_xParentProperties( rParentProperties ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_bNoParentPropAllowed( false )
-{}
+{
+ SetNewValuesExplicitlyEvenIfTheyEqualDefault();
+}
DataPoint::DataPoint( const DataPoint & rOther ) :
MutexContainer(),
impl::DataPoint_Base(),
::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_bNoParentPropAllowed( true )
{
+ SetNewValuesExplicitlyEvenIfTheyEqualDefault();
+
// m_xParentProperties has to be set from outside, like in the method
// DataSeries::createClone
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
index 8e80bc1e8a47..a748d04d4b64 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -332,6 +332,13 @@ void DataPointProperties::AddPropertiesToVector(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_DATAPOINT_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
// statistics
rOutProperties.push_back(
Property( C2U( "ErrorBarX" ),
@@ -427,6 +434,8 @@ void DataPointProperties::AddDefaultsToMap(
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_ERROR_BAR_X, uno::Reference< beans::XPropertySet >());
PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_ERROR_BAR_Y, uno::Reference< beans::XPropertySet >());
PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_PERCENT_DIAGONAL, 0 );
+
+ PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_DATAPOINT_TEXT_ROTATION, 0.0 );
}
} // namespace chart
diff --git a/chart2/source/model/main/DataPointProperties.hxx b/chart2/source/model/main/DataPointProperties.hxx
index 02d41b734503..6482adaa8679 100644
--- a/chart2/source/model/main/DataPointProperties.hxx
+++ b/chart2/source/model/main/DataPointProperties.hxx
@@ -77,6 +77,7 @@ public:
PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT,
PROP_DATAPOINT_LABEL_PLACEMENT,
PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE,
+ PROP_DATAPOINT_TEXT_ROTATION,
// statistics
PROP_DATAPOINT_ERROR_BAR_X,
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 5324c1eaae5c..9f331ce2a215 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -136,7 +136,7 @@ namespace chart
DataSeries::DataSeries( const uno::Reference< uno::XComponentContext > & xContext ) :
::property::OPropertySet( m_aMutex ),
m_xContext( xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
}
@@ -145,7 +145,7 @@ DataSeries::DataSeries( const DataSeries & rOther ) :
impl::DataSeries_Base(),
::property::OPropertySet( rOther, m_aMutex ),
m_xContext( rOther.m_xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
if( ! rOther.m_aDataSequences.empty())
{
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 1718ddb1646d..3e8c8ea9cd24 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -78,6 +78,7 @@ enum
PROP_DIAGRAM_SORT_BY_X_VALUES,
PROP_DIAGRAM_CONNECT_BARS,
PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
PROP_DIAGRAM_STARTING_ANGLE,
PROP_DIAGRAM_RIGHT_ANGLED_AXES,
PROP_DIAGRAM_PERSPECTIVE,
@@ -125,6 +126,13 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
+ Property( C2U("IncludeHiddenCells"),
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
Property( C2U( "StartingAngle" ),
PROP_DIAGRAM_STARTING_ANGLE,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ),
@@ -170,6 +178,7 @@ void lcl_AddDefaultsToMap(
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_CONNECT_BARS, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
}
@@ -241,7 +250,7 @@ namespace chart
Diagram::Diagram( uno::Reference< uno::XComponentContext > const & xContext ) :
::property::OPropertySet( m_aMutex ),
m_xContext( xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
// Set camera position to a default position (that should be set hard, so
// that it will be exported. The property default is a camera looking
@@ -257,7 +266,7 @@ Diagram::Diagram( const Diagram & rOther ) :
impl::Diagram_Base(),
::property::OPropertySet( rOther, m_aMutex ),
m_xContext( rOther.m_xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
lcl_tCooSysMapping aCooSysMapping =
lcl_CloneCoordinateSystems( rOther.m_aCoordSystems, m_aCoordSystems );
@@ -352,7 +361,7 @@ Reference< chart2::XColorScheme > SAL_CALL Diagram::getDefaultColorScheme()
{
if( ! m_xColorScheme.is())
{
- m_xColorScheme.set( new ConfigColorScheme( m_xContext ));
+ m_xColorScheme.set( createConfigColorScheme( m_xContext ));
}
return m_xColorScheme;
}
diff --git a/chart2/source/model/main/FormattedString.cxx b/chart2/source/model/main/FormattedString.cxx
index a2175b68a1da..e0d565bdb187 100644
--- a/chart2/source/model/main/FormattedString.cxx
+++ b/chart2/source/model/main/FormattedString.cxx
@@ -91,7 +91,7 @@ FormattedString::FormattedString(
uno::Reference< uno::XComponentContext > const & /* xContext */ ) :
::property::OPropertySet( m_aMutex ),
m_aString(),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
FormattedString::FormattedString( const FormattedString & rOther ) :
@@ -99,7 +99,7 @@ FormattedString::FormattedString( const FormattedString & rOther ) :
impl::FormattedString_Base(),
::property::OPropertySet( rOther, m_aMutex ),
m_aString( rOther.m_aString ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
FormattedString::~FormattedString()
diff --git a/chart2/source/model/main/GridProperties.cxx b/chart2/source/model/main/GridProperties.cxx
index 590aed34339b..4f48d16886b1 100644
--- a/chart2/source/model/main/GridProperties.cxx
+++ b/chart2/source/model/main/GridProperties.cxx
@@ -128,20 +128,20 @@ namespace chart
GridProperties::GridProperties( Reference< uno::XComponentContext > const & /* xContext */ ) :
::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
}
GridProperties::GridProperties() :
::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
GridProperties::GridProperties( const GridProperties & rOther ) :
MutexContainer(),
impl::GridProperties_Base(),
::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
}
diff --git a/chart2/source/model/main/ImplChartModel.cxx b/chart2/source/model/main/ImplChartModel.cxx
index bd4ad5630cb2..87383dcf5817 100644
--- a/chart2/source/model/main/ImplChartModel.cxx
+++ b/chart2/source/model/main/ImplChartModel.cxx
@@ -40,7 +40,7 @@
#include "ModifyListenerHelper.hxx"
#include "DataSourceHelper.hxx"
#include "DisposeHelper.hxx"
-#include "UndoManager.hxx"
+#include "ChartModelHelper.hxx"
#include "ThreeDHelper.hxx"
#include "AxisHelper.hxx"
@@ -112,19 +112,19 @@ ImplChartModel::ImplChartModel(
m_spChartData( new ChartData( m_xContext )),
m_bIsDisposed( false ),
m_xPageBackground( new PageBackground( m_xContext )),
- m_xUndoManager( new UndoManager()),
- m_xDashTable( new NameContainer( ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)),
+ m_xUndoManager( ChartModelHelper::createUndoManager() ),
+ m_xDashTable( createNameContainer( ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)),
C2U( "com.sun.star.drawing.DashTable" ), C2U( "com.sun.star.comp.chart.DashTable" ) )),
- m_xGradientTable( new NameContainer( ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
+ m_xGradientTable( createNameContainer( ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
C2U( "com.sun.star.drawing.GradientTable" ), C2U( "com.sun.star.comp.chart.GradientTable" ) )),
- m_xHatchTable( new NameContainer( ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
+ m_xHatchTable( createNameContainer( ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
C2U( "com.sun.star.drawing.HatchTable" ), C2U( "com.sun.star.comp.chart.HatchTable" ) )),
- m_xBitmapTable( new NameContainer( ::getCppuType( reinterpret_cast< const OUString * >(0)), // URL
+ m_xBitmapTable( createNameContainer( ::getCppuType( reinterpret_cast< const OUString * >(0)), // URL
C2U( "com.sun.star.drawing.BitmapTable" ), C2U( "com.sun.star.comp.chart.BitmapTable" ) )),
- m_xTransparencyGradientTable( new NameContainer( ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
+ m_xTransparencyGradientTable( createNameContainer( ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
C2U( "com.sun.star.drawing.TransparencyGradientTable" ), C2U( "com.sun.star.comp.chart.TransparencyGradientTable" ) )),
- m_xXMLNamespaceMap( new NameContainer( ::getCppuType( (const OUString*) 0 ),
- C2U( "com.sun.star.xml.NamespaceMap" ), C2U( "com.sun.star.comp.chart.XMLNameSpaceMap" ) )),
+ m_xXMLNamespaceMap( createNameContainer( ::getCppuType( (const OUString*) 0 ),
+ C2U( "com.sun.star.xml.NamespaceMap" ), C2U( "com.sun.star.comp.chart.XMLNameSpaceMap" ) ), uno::UNO_QUERY),
m_xModifyListener( xListener )
{
ModifyListenerHelper::addListener( m_xPageBackground, m_xModifyListener );
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx
index 9f501b41ef63..3f7f66d23950 100644
--- a/chart2/source/model/main/Legend.cxx
+++ b/chart2/source/model/main/Legend.cxx
@@ -166,7 +166,7 @@ namespace chart
Legend::Legend( Reference< uno::XComponentContext > const & /* xContext */ ) :
::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
}
@@ -174,7 +174,7 @@ Legend::Legend( const Legend & rOther ) :
MutexContainer(),
impl::Legend_Base(),
::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
CloneHelper::CloneRefVector< Reference< chart2::XLegendEntry > >( rOther.m_aLegendEntries, m_aLegendEntries );
ModifyListenerHelper::addListenerToAllElements( m_aLegendEntries, m_xModifyEventForwarder );
diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx
index 5a16e30a3733..07def9bf496c 100644
--- a/chart2/source/model/main/PageBackground.cxx
+++ b/chart2/source/model/main/PageBackground.cxx
@@ -108,7 +108,7 @@ namespace chart
PageBackground::PageBackground( const uno::Reference< uno::XComponentContext > & xContext ) :
::property::OPropertySet( m_aMutex ),
m_xContext( xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
PageBackground::PageBackground( const PageBackground & rOther ) :
@@ -116,7 +116,7 @@ PageBackground::PageBackground( const PageBackground & rOther ) :
impl::PageBackground_Base(),
::property::OPropertySet( rOther, m_aMutex ),
m_xContext( rOther.m_xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
PageBackground::~PageBackground()
diff --git a/chart2/source/model/main/RectangularDataSource.cxx b/chart2/source/model/main/RectangularDataSource.cxx
deleted file mode 100644
index edd852927300..000000000000
--- a/chart2/source/model/main/RectangularDataSource.cxx
+++ /dev/null
@@ -1,297 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: RectangularDataSource.cxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_chart2.hxx"
-#include "RectangularDataSource.hxx"
-#include "CachedDataSequence.hxx"
-#include "StandardNaNHelper.hxx"
-#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
-#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-
-using namespace ::com::sun::star;
-
-using ::rtl::OUString;
-using ::osl::MutexGuard;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::beans::Property;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT;
-
-// necessary for MS compiler
-using ::comphelper::OPropertyContainer;
-using ::chart::impl::RectangularDataSource_Base;
-
-// ________________________________________
-
-// Property-Ids
-
-namespace
-{
-enum
-{
- PROP_SOURCE_RANGE,
- PROP_DATA_ROW_SOURCE
-};
-} // anonymous namespace
-
-
-// ________________________________________
-
-namespace chart
-{
-
-#define STANDARD_PROPERTY_ATTRIBUTES ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT
-
-RectangularDataSource::RectangularDataSource( uno::Reference< uno::XComponentContext > const & xContext )
- : OPropertyContainer( GetBroadcastHelper() ),
- RectangularDataSource_Base( GetMutex() ),
- m_aDataRowSource( ::com::sun::star::chart::ChartDataRowSource_COLUMNS )
-{
- registerProperty( C2U( "SourceRange" ),
- PROP_SOURCE_RANGE, // Handle for fast access
- 0, // PropertyAttributes
- & m_aSourceRange, // pointer to corresponding member
- ::getCppuType( & m_aSourceRange ) // Type of property
- );
-
- registerProperty( C2U( "DataRowSource" ),
- PROP_DATA_ROW_SOURCE, // Handle for fast access
- MAYBEDEFAULT, // PropertyAttributes
- & m_aDataRowSource, // pointer to corresponding member
- ::getCppuType( & m_aDataRowSource ) // Type of property
- );
-}
-
-RectangularDataSource::~RectangularDataSource()
-{}
-
-// base for XServiceInfo
-Sequence< OUString > RectangularDataSource::getSupportedServiceNames_Static()
-{
- Sequence< OUString > aServices( 4 );
- aServices[ 0 ] = C2U( "com.sun.star.chart2.RectangularDataSource" );
- aServices[ 1 ] = C2U( "com.sun.star.chart2.data.DataFilter" );
- aServices[ 2 ] = C2U( "com.sun.star.chart2.data.DataSource" );
- aServices[ 3 ] = C2U( "com.sun.star.chart2.data.DataSink" );
- return aServices;
-}
-
-// ____ XDataSink ____
-void SAL_CALL RectangularDataSource::setData( const uno::Sequence< Reference< chart2::data::XDataSequence > >& aData )
- throw (RuntimeException)
-{
- m_aDataSequences = aData;
-}
-
-// ____ XDataSource ____
-uno::Sequence< Reference< chart2::data::XDataSequence > > SAL_CALL RectangularDataSource::getDataSequences()
- throw (RuntimeException)
-{
- return m_aDataSequences;
-}
-
-double SAL_CALL RectangularDataSource::getNotANumber()
- throw (uno::RuntimeException)
-{
- return StandardNaNHelper::getNotANumber();
-}
-
-sal_Bool SAL_CALL RectangularDataSource::isNotANumber( double fNumber )
- throw (uno::RuntimeException)
-{
- return StandardNaNHelper::isNotANumber( fNumber );
-}
-
-// ____ XIndexAccess ____
- sal_Int32 SAL_CALL RectangularDataSource::getCount()
- throw (RuntimeException)
-{
- // /--
- MutexGuard aGuard( GetMutex() );
- return m_aDataSequences.getLength();
- // \--
-}
-
- Any SAL_CALL RectangularDataSource::getByIndex( sal_Int32 Index )
- throw (lang::IndexOutOfBoundsException,
- lang::WrappedTargetException,
- RuntimeException)
-{
- // /--
- MutexGuard aGuard( GetMutex() );
- return uno::makeAny( GetDataByIndex( Index ) );
- // \--
-}
-
-// ____ XElementAccess (base of XIndexAccess) ____
- uno::Type SAL_CALL RectangularDataSource::getElementType()
- throw (RuntimeException)
-{
- return ::getCppuType((const Reference< chart2::data::XDataSequence >*)0);
-}
-
-sal_Bool SAL_CALL RectangularDataSource::hasElements()
- throw (RuntimeException)
-{
- // /--
- MutexGuard aGuard( GetMutex() );
- return static_cast< sal_Bool >( m_aDataSequences.getLength() > 0 );
- // \--
-}
-
-Reference< chart2::data::XDataSequence > RectangularDataSource::GetDataByIndex( sal_Int32 Index ) const
- throw (lang::IndexOutOfBoundsException)
-{
- if( 0 > Index || Index >= m_aDataSequences.getLength() )
- throw lang::IndexOutOfBoundsException();
-
- return m_aDataSequences.getConstArray() [ Index ];
-}
-
-void SAL_CALL RectangularDataSource::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& rValue )
- throw (uno::Exception)
-{
- // at this point it is clear that rValue contains a different value than the
- // property currently still has, and that it will be overwritten by it in
- // the final base class call
-
- switch( nHandle )
- {
- case PROP_DATA_ROW_SOURCE:
- {
- ::com::sun::star::chart::ChartDataRowSource aRowSource;
- if( rValue >>= aRowSource )
- {
- if( aRowSource != m_aDataRowSource )
- {
- SwapData();
- }
- }
- }
- break;
- }
-
- OPropertyContainer::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-}
-
-// ================================================================================
-
-using impl::RectangularDataSource_Base;
-
-IMPLEMENT_FORWARD_XINTERFACE2( RectangularDataSource, RectangularDataSource_Base, OPropertyContainer )
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( RectangularDataSource, RectangularDataSource_Base, OPropertyContainer )
-
-// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL RectangularDataSource::getPropertySetInfo()
- throw(RuntimeException)
-{
- return Reference< beans::XPropertySetInfo >( createPropertySetInfo( getInfoHelper() ) );
-}
-
-// ____ ::comphelper::OPropertySetHelper ____
-// __________________________________________
-::cppu::IPropertyArrayHelper& RectangularDataSource::getInfoHelper()
-{
- return *getArrayHelper();
-}
-
-// ____ ::comphelper::OPropertyArrayHelper ____
-// ____________________________________________
-::cppu::IPropertyArrayHelper* RectangularDataSource::createArrayHelper() const
-{
- Sequence< Property > aProps;
- // describes all properties which have been registered in the ctor
- describeProperties( aProps );
-
- return new ::cppu::OPropertyArrayHelper( aProps );
-}
-
-// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
-APPHELPER_XSERVICEINFO_IMPL( RectangularDataSource,
- C2U( "com.sun.star.comp.chart.RectangularDataSource" ))
-
-void RectangularDataSource::SwapData()
-{
- try
- {
- // assume that there are always text labels
- Reference< chart2::data::XTextualDataSequence > xCategories( GetDataByIndex( 0 ), uno::UNO_QUERY );
-
- // -1: the first sequence contains labels
- sal_Int32 nNewSequenceSize = m_aDataSequences.getLength() - 1;
- if( nNewSequenceSize > 0 )
- {
- // +1: one series more for labels
- sal_Int32 nNewNumOfSequences = GetDataByIndex( 0 )->getData().getLength() + 1;
- Sequence< Reference< chart2::data::XDataSequence > > aResult( nNewNumOfSequences );
- ::std::vector< OUString > aCategoryVector( nNewSequenceSize );
- sal_Int32 nIdx = 0;
-
- // fill new categories consisting of former labels
- for( nIdx = 0; nIdx < nNewSequenceSize; ++nIdx )
- {
- aCategoryVector.push_back( GetDataByIndex( nIdx )->getLabel() );
- }
- aResult[ 0 ] = Reference< chart2::data::XDataSequence >(
- static_cast< chart2::data::XTextualDataSequence * >(
- new ::chart::CachedDataSequence( aCategoryVector )));
-
- // fill new data sequences. The label is set by the former categories
- for( sal_Int32 nSeqIdx = 1; nSeqIdx < nNewNumOfSequences; ++ nSeqIdx )
- {
- ::std::vector< double > aDataVector( nNewSequenceSize );
- for( nIdx = 0; nIdx < nNewSequenceSize; ++nIdx )
- {
- aDataVector.push_back(
- Reference< chart2::data::XNumericalDataSequence >(
- GetDataByIndex( nIdx ),
- uno::UNO_QUERY )->getNumericalData().getConstArray()[ nSeqIdx - 1 ] );
- }
- aResult[ nSeqIdx ] = Reference< chart2::data::XDataSequence >(
- static_cast< chart2::data::XNumericalDataSequence * >(
- new ::chart::CachedDataSequence( aDataVector )));
- }
-
- setData( aResult );
- }
- }
- catch( lang::IndexOutOfBoundsException aEx )
- {
- }
-}
-
-} // namespace chart
diff --git a/chart2/source/model/main/StockBar.cxx b/chart2/source/model/main/StockBar.cxx
index 68f4e8a6d4f0..5edaf6a606d8 100644
--- a/chart2/source/model/main/StockBar.cxx
+++ b/chart2/source/model/main/StockBar.cxx
@@ -38,6 +38,7 @@
#include "PropertyHelper.hxx"
#include "macros.hxx"
#include "ContainerHelper.hxx"
+#include "ModifyListenerHelper.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -110,7 +111,7 @@ namespace chart
StockBar::StockBar( bool bRisingCourse ) :
::property::OPropertySet( m_aMutex ),
m_bRisingCourse( bRisingCourse ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
if( ! m_bRisingCourse )
{
@@ -128,7 +129,7 @@ StockBar::StockBar( const StockBar & rOther ) :
impl::StockBar_Base(),
::property::OPropertySet( rOther, m_aMutex ),
m_bRisingCourse( rOther.m_bRisingCourse ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
StockBar::~StockBar()
diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx
index e2b9db4e6d2a..55fa2df663cd 100644
--- a/chart2/source/model/main/Title.cxx
+++ b/chart2/source/model/main/Title.cxx
@@ -225,14 +225,14 @@ namespace chart
Title::Title( uno::Reference< uno::XComponentContext > const & /* xContext */ ) :
::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
Title::Title( const Title & rOther ) :
MutexContainer(),
impl::Title_Base(),
::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
CloneHelper::CloneRefSequence< uno::Reference< chart2::XFormattedString > >(
rOther.m_aStrings, m_aStrings );
diff --git a/chart2/source/model/main/Wall.cxx b/chart2/source/model/main/Wall.cxx
index 6da6ff9bba3b..bd27e9fd733a 100644
--- a/chart2/source/model/main/Wall.cxx
+++ b/chart2/source/model/main/Wall.cxx
@@ -112,14 +112,14 @@ namespace chart
Wall::Wall() :
::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
Wall::Wall( const Wall & rOther ) :
MutexContainer(),
impl::Wall_Base(),
::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
Wall::~Wall()
diff --git a/chart2/source/model/makefile.mk b/chart2/source/model/makefile.mk
index 4d70f1048d68..8fb1e9dc3bed 100644
--- a/chart2/source/model/makefile.mk
+++ b/chart2/source/model/makefile.mk
@@ -75,7 +75,6 @@ SHL1LIBS= $(LIB1TARGET)
#Links import libraries.
SHL1STDLIBS= $(CHARTTOOLS) \
- $(BASEGFXLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(COMPHELPERLIB) \
@@ -84,7 +83,6 @@ SHL1STDLIBS= $(CHARTTOOLS) \
$(SVLLIB) \
$(SVTOOLLIB) \
$(GOODIESLIB) \
- $(SOTLIB) \
$(SALLIB) \
$(UCBHELPERLIB)
diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx
new file mode 100644
index 000000000000..09e629462d48
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartType.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "BubbleChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "AxisHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & /*rOutProperties*/ )
+{
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & /*rOutMap*/ )
+{
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+BubbleChartType::BubbleChartType(
+ const uno::Reference< uno::XComponentContext > & xContext )
+ : ChartType( xContext )
+{
+}
+
+BubbleChartType::BubbleChartType( const BubbleChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
+BubbleChartType::~BubbleChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL BubbleChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new BubbleChartType( *this ));
+}
+
+// ____ XChartType ____
+Reference< chart2::XCoordinateSystem > SAL_CALL
+ BubbleChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ Reference< chart2::XCoordinateSystem > xResult(
+ new CartesianCoordinateSystem(
+ GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
+
+ for( sal_Int32 i=0; i<DimensionCount; ++i )
+ {
+ Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ if( !xAxis.is() )
+ {
+ OSL_ENSURE(false,"a created coordinate system should have an axis for each dimension");
+ continue;
+ }
+
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
+
+ if( i == 2 )
+ aScaleData.AxisType = chart2::AxisType::SERIES;
+ else
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+
+ xAxis->setScaleData( aScaleData );
+ }
+
+ return xResult;
+}
+
+::rtl::OUString SAL_CALL BubbleChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< ::rtl::OUString > aMandRolesSeq;
+
+ if( aMandRolesSeq.getLength() == 0 )
+ {
+ aMandRolesSeq.realloc( 4 );
+ aMandRolesSeq[0] = C2U( "label" );
+ aMandRolesSeq[1] = C2U( "values-x" );
+ aMandRolesSeq[2] = C2U( "values-y" );
+ aMandRolesSeq[3] = C2U( "values-size" );
+ }
+
+ return aMandRolesSeq;
+}
+
+OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
+ throw (uno::RuntimeException)
+{
+ return C2U( "values-size" );
+}
+
+// ____ OPropertySet ____
+uno::Any BubbleChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ BubbleChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+uno::Sequence< ::rtl::OUString > BubbleChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( BubbleChartType,
+ C2U( "com.sun.star.comp.chart.BubbleChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleChartType.hxx b/chart2/source/model/template/BubbleChartType.hxx
new file mode 100644
index 000000000000..3694ac1c955c
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartType.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BUBBLECHARTTYPE_HXX
+#define CHART_BUBBLECHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+namespace chart
+{
+
+class BubbleChartType : public ChartType
+{
+public:
+ BubbleChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~BubbleChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( BubbleChartType )
+
+protected:
+ explicit BubbleChartType( const BubbleChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedMandatoryRoles()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
+ createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getRoleOfSequenceForSeriesLabel()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_BUBBLECHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
new file mode 100644
index 000000000000..0853cea6a5cb
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
@@ -0,0 +1,322 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "BubbleChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "BubbleDataInterpreter.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "Scaling.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.BubbleChartTypeTemplate" ));
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & /*rOutProperties*/ )
+{
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & /*rOutMap*/ )
+{
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+BubbleChartTypeTemplate::BubbleChartTypeTemplate(
+ Reference<
+ uno::XComponentContext > const & xContext,
+ const OUString & rServiceName ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex )
+{
+}
+
+BubbleChartTypeTemplate::~BubbleChartTypeTemplate()
+{}
+
+// ____ OPropertySet ____
+uno::Any BubbleChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ BubbleChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+sal_Int32 BubbleChartTypeTemplate::getDimension() const
+{
+ return 2;
+}
+
+StackMode BubbleChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ return StackMode_NONE;
+}
+
+bool BubbleChartTypeTemplate::supportsCategories() const
+{
+ return false;
+}
+
+
+void SAL_CALL BubbleChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XChartTypeTemplate ____
+Sequence< OUString > SAL_CALL BubbleChartTypeTemplate::getAvailableCreationParameterNames()
+ throw (uno::RuntimeException)
+{
+ return Sequence< OUString >();
+}
+
+sal_Bool SAL_CALL BubbleChartTypeTemplate::matchesTemplate(
+ const Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+
+ if( bResult )
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ {
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ // adapt curve style, spline order and resolution
+ if( bResult && bAdaptProperties )
+ {
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XChartType > BubbleChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+{
+ Reference< chart2::XChartType > xResult;
+
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
+ xResult.set( xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL BubbleChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > xResult;
+
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
+ xResult.set( xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
+
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XDataInterpreter > SAL_CALL BubbleChartTypeTemplate::getDataInterpreter()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xDataInterpreter.is())
+ m_xDataInterpreter.set( new BubbleDataInterpreter( GetComponentContext()) );
+
+ return m_xDataInterpreter;
+}
+
+// ----------------------------------------
+
+Sequence< OUString > BubbleChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( BubbleChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( BubbleChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( BubbleChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.hxx b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
new file mode 100644
index 000000000000..c094e38e28ac
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BUBBLECHARTTYPETEMPLATE_HXX
+#define CHART_BUBBLECHARTTYPETEMPLATE_HXX
+
+#include "ChartTypeTemplate.hxx"
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <comphelper/uno3.hxx>
+
+namespace chart
+{
+
+class BubbleChartTypeTemplate :
+ public MutexContainer,
+ public ChartTypeTemplate,
+ public ::property::OPropertySet
+{
+public:
+ explicit BubbleChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName );
+ virtual ~BubbleChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableCreationParameterNames()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataInterpreter > SAL_CALL getDataInterpreter()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+ virtual sal_Int32 getDimension() const;
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+
+ virtual bool supportsCategories() const;
+};
+
+} // namespace chart
+
+// CHART_BUBBLECHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx
new file mode 100644
index 000000000000..a5ebb6b1ec2f
--- /dev/null
+++ b/chart2/source/model/template/BubbleDataInterpreter.cxx
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "BubbleDataInterpreter.hxx"
+#include "DataSeries.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::std;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+BubbleDataInterpreter::BubbleDataInterpreter(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ DataInterpreter( xContext )
+{
+}
+
+BubbleDataInterpreter::~BubbleDataInterpreter()
+{
+}
+
+// ____ XDataInterpreter ____
+chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
+ const Reference< chart2::data::XDataSource >& xSource,
+ const Sequence< beans::PropertyValue >& aArguments,
+ const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ throw (uno::RuntimeException)
+{
+ if( ! xSource.is())
+ return InterpretedData();
+
+ Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+
+ Reference< data::XLabeledDataSequence > xValuesX;
+ vector< Reference< data::XLabeledDataSequence > > aYValuesVector;
+ vector< Reference< data::XLabeledDataSequence > > aSizeValuesVector;
+
+ Reference< data::XLabeledDataSequence > xCategories;
+ bool bHasCategories = HasCategories( aArguments, aData );
+
+ Sequence< Reference< data::XLabeledDataSequence > > aUnusedData;
+
+ bool bHasXValues = false;
+ sal_Int32 nDataSeqCount = aData.getLength();
+
+ bHasXValues = bHasCategories ? ( (nDataSeqCount-1) > 2 && (nDataSeqCount-1) % 2 != 0 )
+ :( nDataSeqCount > 2 && nDataSeqCount % 2 != 0 );
+
+ bool bCategoriesUsed = false;
+ bool bNextIsYValues = bHasCategories ? nDataSeqCount>2 : nDataSeqCount>1;
+ for( sal_Int32 nDataIdx = 0; nDataIdx < aData.getLength(); ++nDataIdx )
+ {
+ try
+ {
+ if( bHasCategories && !bCategoriesUsed )
+ {
+ xCategories.set( aData[nDataIdx] );
+ if( xCategories.is())
+ SetRole( xCategories->getValues(), C2U("categories"));
+ bCategoriesUsed = true;
+ }
+ else if( !xValuesX.is() && bHasXValues )
+ {
+ xValuesX.set( aData[nDataIdx] );
+ if( xValuesX.is())
+ SetRole( xValuesX->getValues(), C2U("values-x"));
+ }
+ else if( bNextIsYValues )
+ {
+ aYValuesVector.push_back( aData[nDataIdx] );
+ if( aData[nDataIdx].is())
+ SetRole( aData[nDataIdx]->getValues(), C2U("values-y"));
+ bNextIsYValues = false;
+ }
+ else if( !bNextIsYValues )
+ {
+ aSizeValuesVector.push_back( aData[nDataIdx] );
+ if( aData[nDataIdx].is())
+ SetRole( aData[nDataIdx]->getValues(), C2U("values-size"));
+ bNextIsYValues = true;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ // create DataSeries
+ sal_Int32 nSeriesIndex = 0;
+ vector< Reference< XDataSeries > > aSeriesVec;
+ aSeriesVec.reserve( aSizeValuesVector.size());
+
+ Reference< data::XLabeledDataSequence > xClonedXValues = xValuesX;
+ Reference< util::XCloneable > xCloneableX( xValuesX, uno::UNO_QUERY );
+
+ for( size_t nCount = 0; nCount < aSizeValuesVector.size(); ++nCount, ++nSeriesIndex )
+ {
+ sal_Int32 nDataSequenceCount = 2;
+ if( xValuesX.is() )
+ nDataSequenceCount = 3;
+ else if( aYValuesVector.empty() )
+ nDataSequenceCount = 1;
+
+ Sequence< Reference< data::XLabeledDataSequence > > aNewData( nDataSequenceCount );
+ sal_Int32 nDataIndex = 0;
+ if( xValuesX.is() )
+ {
+ if( nCount > 0 && xCloneableX.is() )
+ xClonedXValues.set( xCloneableX->createClone(), uno::UNO_QUERY );
+ aNewData[nDataIndex++] = xClonedXValues;
+ }
+ if( aYValuesVector.size() > nCount )
+ aNewData[nDataIndex++] = aYValuesVector[nCount];
+ if( aSizeValuesVector.size() > nCount )
+ aNewData[nDataIndex++] = aSizeValuesVector[nCount];
+
+ Reference< XDataSeries > xSeries;
+ if( nSeriesIndex < aSeriesToReUse.getLength())
+ xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ else
+ xSeries.set( new DataSeries( GetComponentContext() ) );
+ OSL_ASSERT( xSeries.is() );
+ Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
+ OSL_ASSERT( xSink.is() );
+ xSink->setData( aNewData );
+
+ aSeriesVec.push_back( xSeries );
+ }
+
+ Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
+ aSeries[0] = ContainerHelper::ContainerToSequence( aSeriesVec );
+ return InterpretedData( aSeries, xCategories, aUnusedData );
+}
+
+chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ InterpretedData aResult( aInterpretedData );
+ vector< Reference< data::XLabeledDataSequence > > aUnused(
+ ContainerHelper::SequenceToVector( aInterpretedData.UnusedData ));
+
+ sal_Int32 i=0;
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ const sal_Int32 nCount = aSeries.getLength();
+ for( ; i<nCount; ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSeriesSource( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aNewSequences;
+
+ Reference< data::XLabeledDataSequence > xValuesSize(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-size"), false ));
+ Reference< data::XLabeledDataSequence > xValuesY(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-y"), false ));
+ Reference< data::XLabeledDataSequence > xValuesX(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-x"), false ));
+
+ if( ! xValuesX.is() ||
+ ! xValuesY.is() ||
+ ! xValuesSize.is() )
+ {
+ vector< Reference< data::XLabeledDataSequence > > aValueSeqVec(
+ DataSeriesHelper::getAllDataSequencesByRole(
+ xSeriesSource->getDataSequences(), C2U("values"), true ));
+ if( xValuesX.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesX ));
+ if( xValuesY.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesY ));
+ if( xValuesSize.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesSize ));
+
+ size_t nIndex = 0;
+
+ if( ! xValuesSize.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesSize.set( aValueSeqVec[nIndex++] );
+ if( xValuesSize.is())
+ SetRole( xValuesSize->getValues(), C2U("values-size"));
+ }
+
+ if( ! xValuesY.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesY.set( aValueSeqVec[nIndex++] );
+ if( xValuesY.is())
+ SetRole( xValuesY->getValues(), C2U("values-y"));
+ }
+
+ if( ! xValuesX.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesX.set( aValueSeqVec[nIndex++] );
+ if( xValuesX.is())
+ SetRole( xValuesY->getValues(), C2U("values-x"));
+ }
+ }
+ if( xValuesSize.is())
+ {
+ if( xValuesY.is() )
+ {
+ if( xValuesX.is() )
+ {
+ aNewSequences.realloc(3);
+ aNewSequences[0] = xValuesX;
+ aNewSequences[1] = xValuesY;
+ aNewSequences[2] = xValuesSize;
+ }
+ else
+ {
+ aNewSequences.realloc(2);
+ aNewSequences[0] = xValuesY;
+ aNewSequences[1] = xValuesSize;
+ }
+ }
+ else
+ {
+ aNewSequences.realloc(1);
+ aNewSequences[0] = xValuesSize;
+ }
+ }
+
+ Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences());
+ if( aSeqs.getLength() != aNewSequences.getLength() )
+ {
+ sal_Int32 j=0;
+ for( ; j<aSeqs.getLength(); ++j )
+ {
+ if( aSeqs[j] != xValuesY &&
+ aSeqs[j] != xValuesX &&
+ aSeqs[j] != xValuesSize )
+ aUnused.push_back( aSeqs[j] );
+ }
+ Reference< data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY_THROW );
+ xSink->setData( aNewSequences );
+ aResult.UnusedData = ContainerHelper::ContainerToSequence( aUnused );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return aResult;
+}
+
+sal_Bool SAL_CALL BubbleDataInterpreter::isDataCompatible(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ for( sal_Int32 i=0; i<aSeries.getLength(); ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSrc( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
+ if( aSeq.getLength() != 3 )
+ return sal_False;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return sal_True;
+}
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleDataInterpreter.hxx b/chart2/source/model/template/BubbleDataInterpreter.hxx
new file mode 100644
index 000000000000..a173f801812c
--- /dev/null
+++ b/chart2/source/model/template/BubbleDataInterpreter.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BUBBLEDATAINTERPRETER_HXX
+#define CHART_BUBBLEDATAINTERPRETER_HXX
+
+#include "DataInterpreter.hxx"
+
+namespace chart
+{
+
+class BubbleDataInterpreter : public DataInterpreter
+{
+public:
+ explicit BubbleDataInterpreter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~BubbleDataInterpreter();
+
+protected:
+ // ____ XDataInterpreter ____
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL interpretDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aSeriesToReUse )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDataCompatible(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_BUBBLEDATAINTERPRETER_HXX
+#endif
diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx
index 35b40f3c3d76..2834d9354f95 100644
--- a/chart2/source/model/template/ChartType.cxx
+++ b/chart2/source/model/template/ChartType.cxx
@@ -35,7 +35,7 @@
#include "CommonFunctors.hxx"
#include "macros.hxx"
#include "CartesianCoordinateSystem.hxx"
-#include "Scaling.hxx"
+#include "AxisHelper.hxx"
#include "CloneHelper.hxx"
#include "AxisIndexDefines.hxx"
#include "ContainerHelper.hxx"
@@ -57,7 +57,7 @@ namespace chart
ChartType::ChartType(
const Reference< uno::XComponentContext > & xContext ) :
::property::OPropertySet( m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_xContext( xContext ),
m_bNotifyChanges( true )
{}
@@ -66,7 +66,7 @@ ChartType::ChartType( const ChartType & rOther ) :
MutexContainer(),
impl::ChartType_Base(),
::property::OPropertySet( rOther, m_aMutex ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_xContext( rOther.m_xContext ),
m_bNotifyChanges( true )
{
@@ -106,7 +106,7 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
chart2::ScaleData aScaleData = xAxis->getScaleData();
aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
- aScaleData.Scaling = new LinearScaling( 1.0, 0.0 );
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
switch( i )
{
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index a8eb36d6e5c8..0e4a3a119a02 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -35,7 +35,6 @@
#include "StackMode.hxx"
#include "ContainerHelper.hxx"
-#include "Scaling.hxx"
#include "CartesianCoordinateSystem.hxx"
#include "LineChartTypeTemplate.hxx"
@@ -46,6 +45,7 @@
#include "ScatterChartTypeTemplate.hxx"
#include "StockChartTypeTemplate.hxx"
#include "NetChartTypeTemplate.hxx"
+#include "BubbleChartTypeTemplate.hxx"
#include <cppuhelper/component_context.hxx>
#include <comphelper/InlineContainer.hxx>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
@@ -132,6 +132,7 @@ enum TemplateId
TEMPLATE_STOCKOPENLOWHIGHCLOSE,
TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
+ TEMPLATE_BUBBLE,
// TEMPLATE_SURFACE,
// TEMPLATE_ADDIN,
TEMPLATE_NOT_FOUND = 0xffff
@@ -203,6 +204,7 @@ const tTemplateMapType & lcl_DefaultChartTypeMap()
( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ), TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE )
+ ( C2U( "com.sun.star.chart2.template.Bubble" ), TEMPLATE_BUBBLE )
// ( C2U( "com.sun.star.chart2.template.Surface" ), TEMPLATE_SURFACE )
// ( C2U( "com.sun.star.chart2.template.Addin" ), TEMPLATE_ADDIN )
);
@@ -519,6 +521,11 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE, true ));
break;
+ //BubbleChart
+ case TEMPLATE_BUBBLE:
+ xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
+ break;
+
// case TEMPLATE_SURFACE:
// case TEMPLATE_ADDIN:
// break;
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index d328f3fb6921..1996cc12830e 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -39,7 +39,6 @@
#include "ContainerHelper.hxx"
#include "ChartTypeHelper.hxx"
-#include "Scaling.hxx"
#include "CartesianCoordinateSystem.hxx"
#include "AxisHelper.hxx"
#include "LegendHelper.hxx"
@@ -69,27 +68,6 @@ using ::com::sun::star::uno::Any;
namespace
{
-sal_Int32 lcl_getSeriesLength( const Reference< XDataSeries > & xSeries )
-{
- sal_Int32 nResult = 0;
- try
- {
- Reference< data::XDataSource > xDataSource( xSeries, uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aLabSeq( xDataSource->getDataSequences());
- if( aLabSeq.getLength())
- {
- Reference< data::XDataSequence > xSeq( aLabSeq[0]->getValues());
- if( xSeq.is())
- nResult = xSeq->getData().getLength();
- }
- }
- catch( const uno::Exception & ex )
- {
- ASSERT_EXCEPTION( ex );
- }
- return nResult;
-}
-
void lcl_applyDefaultStyle(
const Reference< XDataSeries > & xSeries,
sal_Int32 nIndex,
@@ -348,12 +326,9 @@ void SAL_CALL ChartTypeTemplate::changeDiagramData(
Sequence< Sequence< Reference< XDataSeries > > > aSeriesSeq( aData.Series );
sal_Int32 i, j, nIndex = 0;
- sal_Int32 nFirstSeriesLength = 0;
for( i=0; i<aSeriesSeq.getLength(); ++i )
for( j=0; j<aSeriesSeq[i].getLength(); ++j, ++nIndex )
{
- if( i==0 && j==0 )
- nFirstSeriesLength = lcl_getSeriesLength( aSeriesSeq[0][0] );
if( nIndex >= nFormerSeriesCount )
{
lcl_applyDefaultStyle( aSeriesSeq[i][j], nIndex, xDiagram );
diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx
index 6bfec80d2fa5..8073b7af04ef 100644
--- a/chart2/source/model/template/DataInterpreter.cxx
+++ b/chart2/source/model/template/DataInterpreter.cxx
@@ -33,7 +33,7 @@
#include "DataInterpreter.hxx"
#include "DataSeries.hxx"
-#include "DataSource.hxx"
+#include "DataSourceHelper.hxx"
#include "DataSeriesHelper.hxx"
#include "macros.hxx"
#include "CommonConverters.hxx"
@@ -355,7 +355,7 @@ Reference< data::XDataSource > SAL_CALL DataInterpreter::mergeInterpretedData(
// add unused data at end
copy( aUnusedDataVec.begin(), aUnusedDataVec.end(), back_inserter( aResultVec ));
- return Reference< data::XDataSource >( new DataSource( ContainerToSequence( aResultVec )));
+ return Reference< data::XDataSource >( DataSourceHelper::createDataSource( ContainerToSequence( aResultVec ) ) );
}
// convenience methods
diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx
index d36bb4331a46..9de315679223 100644
--- a/chart2/source/model/template/NetChartType.cxx
+++ b/chart2/source/model/template/NetChartType.cxx
@@ -34,10 +34,11 @@
#include "PropertyHelper.hxx"
#include "macros.hxx"
#include "PolarCoordinateSystem.hxx"
-#include "Scaling.hxx"
#include "servicenames_charttypes.hxx"
#include "ContainerHelper.hxx"
#include "AxisIndexDefines.hxx"
+#include "AxisHelper.hxx"
+
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
@@ -137,7 +138,7 @@ Reference< XCoordinateSystem > SAL_CALL
if( xAxis.is() )
{
ScaleData aScaleData = xAxis->getScaleData();
- aScaleData.Scaling = new LinearScaling( 1.0, 0.0 );
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
aScaleData.AxisType = AxisType::CATEGORY;
aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
xAxis->setScaleData( aScaleData );
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
index ab90f0f7ff42..e348b32b7bc6 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.cxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -33,7 +33,6 @@
#include "NetChartTypeTemplate.hxx"
#include "macros.hxx"
#include "PolarCoordinateSystem.hxx"
-#include "Scaling.hxx"
#include "DiagramHelper.hxx"
#include "servicenames_charttypes.hxx"
#include "DataSeriesHelper.hxx"
diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx
index 4cccd4bedcde..a4c98413fe7d 100644
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -34,7 +34,7 @@
#include "PropertyHelper.hxx"
#include "macros.hxx"
#include "PolarCoordinateSystem.hxx"
-#include "Scaling.hxx"
+#include "AxisHelper.hxx"
#include "servicenames_charttypes.hxx"
#include "ContainerHelper.hxx"
#include "AxisIndexDefines.hxx"
@@ -156,7 +156,7 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
//hhhh todo make axis invisible
chart2::ScaleData aScaleData = xAxis->getScaleData();
- aScaleData.Scaling = new LinearScaling( 1.0, 0.0 );
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
aScaleData.AxisType = chart2::AxisType::REALNUMBER;
if( i == 0 )
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index 774eafed625f..1ece7c5edb93 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -31,7 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
#include "PieChartTypeTemplate.hxx"
-#include "Scaling.hxx"
#include "macros.hxx"
#include "CommonConverters.hxx"
#include "DiagramHelper.hxx"
diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx
index 38249e3e72fe..50b1b4f0ac70 100644
--- a/chart2/source/model/template/ScatterChartType.cxx
+++ b/chart2/source/model/template/ScatterChartType.cxx
@@ -36,7 +36,7 @@
#include "servicenames_charttypes.hxx"
#include "ContainerHelper.hxx"
#include "CartesianCoordinateSystem.hxx"
-#include "Scaling.hxx"
+#include "AxisHelper.hxx"
#include "AxisIndexDefines.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
@@ -179,7 +179,7 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
chart2::ScaleData aScaleData = xAxis->getScaleData();
aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
- aScaleData.Scaling = new LinearScaling( 1.0, 0.0 );
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
if( i == 2 )
aScaleData.AxisType = chart2::AxisType::SERIES;
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index 6e5449d49f49..a87a82c05827 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -34,7 +34,6 @@
#include "macros.hxx"
#include "XYDataInterpreter.hxx"
#include "CartesianCoordinateSystem.hxx"
-#include "Scaling.hxx"
#include "DiagramHelper.hxx"
#include "servicenames_charttypes.hxx"
#include "ContainerHelper.hxx"
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index ae48f1cc932e..719decae49a7 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -35,7 +35,6 @@
#include "DataSeriesHelper.hxx"
#include "StockDataInterpreter.hxx"
#include "CartesianCoordinateSystem.hxx"
-#include "Scaling.hxx"
#include "AxisHelper.hxx"
#include "DiagramHelper.hxx"
#include "servicenames_charttypes.hxx"
diff --git a/chart2/source/model/template/_serviceregistration_charttypes.cxx b/chart2/source/model/template/_serviceregistration_charttypes.cxx
index b059eb24957a..6e5960410445 100644
--- a/chart2/source/model/template/_serviceregistration_charttypes.cxx
+++ b/chart2/source/model/template/_serviceregistration_charttypes.cxx
@@ -41,6 +41,7 @@
#include "NetChartType.hxx"
#include "PieChartType.hxx"
#include "ScatterChartType.hxx"
+#include "BubbleChartType.hxx"
namespace
{
@@ -110,6 +111,14 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_charttypes[] =
, 0
, 0
}
+ ,{
+ ::chart::BubbleChartType::create
+ , ::chart::BubbleChartType::getImplementationName_Static
+ , ::chart::BubbleChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
,{ 0, 0, 0, 0, 0, 0 }
};
diff --git a/chart2/source/model/template/makefile.mk b/chart2/source/model/template/makefile.mk
index 0913c42a89e2..ad8fcd552c8d 100644
--- a/chart2/source/model/template/makefile.mk
+++ b/chart2/source/model/template/makefile.mk
@@ -71,6 +71,9 @@ SLOFILES= \
$(SLO)$/PieChartTypeTemplate.obj \
$(SLO)$/ScatterChartType.obj \
$(SLO)$/ScatterChartTypeTemplate.obj \
+ $(SLO)$/BubbleChartType.obj \
+ $(SLO)$/BubbleChartTypeTemplate.obj \
+ $(SLO)$/BubbleDataInterpreter.obj \
$(SLO)$/StockChartTypeTemplate.obj \
$(SLO)$/StockDataInterpreter.obj \
$(SLO)$/XYDataInterpreter.obj \
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index b9778042baed..5e6c0bce8717 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -40,6 +40,7 @@
#include "ContainerHelper.hxx"
#include "servicenames_coosystems.hxx"
#include "DataSeriesHelper.hxx"
+#include "Scaling.hxx"
#include <svtools/saveopt.hxx>
@@ -66,6 +67,17 @@ using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
+//static
+Reference< chart2::XScaling > AxisHelper::createLinearScaling()
+{
+ return new LinearScaling( 1.0, 0.0 );
+}
+
+//static
+Reference< chart2::XScaling > AxisHelper::createLogarithmicScaling( double fBase )
+{
+ return new LogarithmicScaling( fBase );
+}
//static
ScaleData AxisHelper::createDefaultScale()
diff --git a/chart2/source/tools/CachedDataSequence.cxx b/chart2/source/tools/CachedDataSequence.cxx
index 68cbcb50caa7..09a814f277c8 100644
--- a/chart2/source/tools/CachedDataSequence.cxx
+++ b/chart2/source/tools/CachedDataSequence.cxx
@@ -68,9 +68,7 @@ enum
{
// PROP_SOURCE_IDENTIFIER,
PROP_NUMBERFORMAT_KEY,
- PROP_PROPOSED_ROLE,
- PROP_HIDDEN,
- PROP_HIDDEN_VALUES
+ PROP_PROPOSED_ROLE
};
} // anonymous namespace
@@ -82,67 +80,31 @@ namespace chart
CachedDataSequence::CachedDataSequence()
: OPropertyContainer( GetBroadcastHelper()),
CachedDataSequence_Base( GetMutex()),
- m_bIsHidden( true ),
m_eCurrentDataType( NUMERICAL ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
registerProperties();
}
CachedDataSequence::CachedDataSequence( const Reference< uno::XComponentContext > & /*xContext*/ )
: OPropertyContainer( GetBroadcastHelper()),
CachedDataSequence_Base( GetMutex()),
- m_bIsHidden( true ),
m_eCurrentDataType( MIXED ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder( ))
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder( ))
{
registerProperties();
}
-CachedDataSequence::CachedDataSequence( const ::std::vector< double > & rVector )
- : OPropertyContainer( GetBroadcastHelper()),
- CachedDataSequence_Base( GetMutex()),
- m_bIsHidden( true ),
- m_eCurrentDataType( NUMERICAL ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
-{
- m_aNumericalSequence = ContainerToSequence( rVector );
- registerProperties();
-}
-
-CachedDataSequence::CachedDataSequence( const ::std::vector< OUString > & rVector )
- : OPropertyContainer( GetBroadcastHelper()),
- CachedDataSequence_Base( GetMutex()),
- m_bIsHidden( true ),
- m_eCurrentDataType( TEXTUAL ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
-{
- m_aTextualSequence = ContainerToSequence( rVector );
- registerProperties();
-}
-
CachedDataSequence::CachedDataSequence( const OUString & rSingleText )
: OPropertyContainer( GetBroadcastHelper()),
CachedDataSequence_Base( GetMutex()),
- m_bIsHidden( true ),
m_eCurrentDataType( TEXTUAL ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
m_aTextualSequence.realloc(1);
m_aTextualSequence[0] = rSingleText;
registerProperties();
}
-CachedDataSequence::CachedDataSequence( const ::std::vector< Any > & rVector )
- : OPropertyContainer( GetBroadcastHelper()),
- CachedDataSequence_Base( GetMutex()),
- m_bIsHidden( true ),
- m_eCurrentDataType( MIXED ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
-{
- m_aMixedSequence = ContainerToSequence( rVector );
- registerProperties();
-}
-
CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource )
: OMutexAndBroadcastHelper(),
OPropertyContainer( GetBroadcastHelper()),
@@ -150,10 +112,8 @@ CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource )
CachedDataSequence_Base( GetMutex()),
m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
m_sRole( rSource.m_sRole ),
- m_bIsHidden( rSource.m_bIsHidden ),
- m_aHiddenValues( rSource.m_aHiddenValues ),
m_eCurrentDataType( rSource.m_eCurrentDataType ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
switch( m_eCurrentDataType )
{
@@ -187,18 +147,6 @@ void CachedDataSequence::registerProperties()
0, // PropertyAttributes
& m_sRole,
::getCppuType( & m_sRole ) );
-
- registerProperty( C2U( "IsHidden" ),
- PROP_HIDDEN,
- 0, // PropertyAttributes
- & m_bIsHidden,
- ::getCppuType( & m_bIsHidden ) );
-
- registerProperty( C2U( "HiddenValues" ),
- PROP_HIDDEN_VALUES,
- 0, // PropertyAttributes
- & m_aHiddenValues,
- ::getCppuType( & m_aHiddenValues ) );
}
Sequence< double > CachedDataSequence::Impl_getNumericalData() const
diff --git a/chart2/source/tools/CharacterProperties.cxx b/chart2/source/tools/CharacterProperties.cxx
index 937aec554215..e9893bae0a89 100644
--- a/chart2/source/tools/CharacterProperties.cxx
+++ b/chart2/source/tools/CharacterProperties.cxx
@@ -463,6 +463,13 @@ void CharacterProperties::AddPropertiesToVector(
::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), /*com::sun::star::text::WritingMode2*/
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ParaIsCharacterDistance" ),
+ PROP_PARA_IS_CHARACTER_DISTANCE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
}
void CharacterProperties::AddDefaultsToMap(
@@ -541,6 +548,7 @@ void CharacterProperties::AddDefaultsToMap(
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_PITCH, sal_Int16(aFontCTL.GetPitch()) );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_WRITING_MODE, sal_Int16( com::sun::star::text::WritingMode2::PAGE ) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PARA_IS_CHARACTER_DISTANCE, sal_True );
}
bool CharacterProperties::IsCharacterPropertyHandle( sal_Int32 nHandle )
diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx
index 4dcc452bf939..2d6ce7cbfd9d 100644
--- a/chart2/source/tools/ChartModelHelper.cxx
+++ b/chart2/source/tools/ChartModelHelper.cxx
@@ -33,6 +33,12 @@
#include "ChartModelHelper.hxx"
#include "macros.hxx"
#include "DiagramHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "UndoManager.hxx"
+#include "RangeHighlighter.hxx"
+#include "InternalDataProvider.hxx"
+
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
@@ -53,6 +59,39 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
//static
+uno::Reference< chart2::XUndoManager > ChartModelHelper::createUndoManager()
+{
+ return new UndoManager();
+}
+
+//static
+uno::Reference< chart2::data::XRangeHighlighter > ChartModelHelper::createRangeHighlighter(
+ const uno::Reference< view::XSelectionSupplier > & xSelectionSupplier )
+{
+ return new RangeHighlighter( xSelectionSupplier );
+}
+
+//static
+uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDataProvider()
+{
+ return new InternalDataProvider();
+}
+
+//static
+uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDataProvider(
+ const uno::Reference< ::com::sun::star::chart::XChartDataArray >& xDataToCopy )
+{
+ return new InternalDataProvider( xDataToCopy );
+}
+
+//static
+uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDataProvider(
+ const uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc )
+{
+ return new InternalDataProvider( xChartDoc );
+}
+
+//static
uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< frame::XModel >& xModel )
{
uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
@@ -137,6 +176,96 @@ void ChartModelHelper::triggerRangeHighlighting( const uno::Reference< frame::XM
}
}
+bool ChartModelHelper::isIncludeHiddenCells( const uno::Reference< frame::XModel >& xChartModel )
+{
+ bool bIncluded = true; // hidden cells are included by default.
+
+ uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
+ if (!xDiagram.is())
+ return bIncluded;
+
+ uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY );
+ if (!xProp.is())
+ return bIncluded;
+
+ try
+ {
+ xProp->getPropertyValue(C2U("IncludeHiddenCells")) >>= bIncluded;
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ }
+
+ return bIncluded;
+}
+
+bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, const uno::Reference< frame::XModel >& xChartModel )
+{
+ bool bChanged = false;
+ try
+ {
+ ControllerLockGuard aLockedControllers( xChartModel );
+
+ uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(xChartModel), uno::UNO_QUERY );
+ if (xDiagramProperties.is())
+ {
+ bool bOldValue = bIncludeHiddenCells;
+ xDiagramProperties->getPropertyValue( C2U("IncludeHiddenCells") ) >>= bOldValue;
+ if( bOldValue == bIncludeHiddenCells )
+ bChanged = true;
+
+ //set the property on all instances in all cases to get the different objects in sync!
+
+ uno::Any aNewValue = uno::makeAny(bIncludeHiddenCells);
+
+ try
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
+ if( xChartDoc.is() )
+ {
+ uno::Reference< beans::XPropertySet > xDataProviderProperties( xChartDoc->getDataProvider(), uno::UNO_QUERY );
+ if( xDataProviderProperties.is() )
+ xDataProviderProperties->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
+ }
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ //the property is optional!
+ }
+
+ try
+ {
+ uno::Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( xChartModel ) );
+ if( xUsedData.is() )
+ {
+ uno::Reference< beans::XPropertySet > xProp;
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences());
+ for( sal_Int32 i=0; i<aData.getLength(); ++i )
+ {
+ xProp.set( uno::Reference< beans::XPropertySet >( aData[i]->getValues(), uno::UNO_QUERY ) );
+ if(xProp.is())
+ xProp->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
+ xProp.set( uno::Reference< beans::XPropertySet >( aData[i]->getLabel(), uno::UNO_QUERY ) );
+ if(xProp.is())
+ xProp->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
+ }
+ }
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ //the property is optional!
+ }
+
+ xDiagramProperties->setPropertyValue( C2U("IncludeHiddenCells"), aNewValue);
+ }
+ }
+ catch (uno::Exception& e)
+ {
+ ASSERT_EXCEPTION(e);
+ }
+ return bChanged;
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index d7bb3a15bdf6..357cf5c43d92 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -108,6 +108,8 @@ sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference<
return sal_False;
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) //todo: BubbleChart support error bars and trend lines
+ return sal_False;
}
return sal_True;
}
@@ -281,6 +283,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
}
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER)
|| aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE)
)
{
aRet.realloc(5);
@@ -509,7 +512,8 @@ sal_Int32 ChartTypeHelper::getAxisType( const uno::Reference<
return AxisType::REALNUMBER;
if(0==nDimensionIndex)//x-axis
{
- if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
return AxisType::REALNUMBER;
return AxisType::CATEGORY;
}
@@ -558,7 +562,8 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
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_BUBBLE) )
{
aRet.realloc( 2 );
sal_Int32* pSeq = aRet.getArray();
@@ -604,6 +609,54 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
return aRet;
}
+rtl::OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+{
+ rtl::OUString aRet( C2U( "values-y" ) );
+ if( !xChartType.is() )
+ return aRet;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ aRet = xChartType->getRoleOfSequenceForSeriesLabel();
+ return aRet;
+}
+
+rtl::OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+{
+ rtl::OUString aRet( C2U( "values-y" ) );
+ if( !xChartType.is() )
+ return aRet;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ aRet = xChartType->getRoleOfSequenceForSeriesLabel();
+ return aRet;
+}
+
+bool ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( const uno::Reference< XChartType >& xChartType )
+{
+ bool bRet = true;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ bRet = false;
+ return bRet;
+}
+
+bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const uno::Reference< XChartType >& xChartType )
+{
+ bool bRet = false;
+ if( !xChartType.is() )
+ return bRet;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) )
+ {
+ bRet = true;
+ }
+ return bRet;
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx
index 787d79668ca3..692f6ee54a1b 100644
--- a/chart2/source/tools/CommonConverters.cxx
+++ b/chart2/source/tools/CommonConverters.cxx
@@ -155,15 +155,6 @@ drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint)
);
}
-::basegfx::B3DPoint Direction3DToB3DPoint( const drawing::Direction3D& rDirection)
-{
- return ::basegfx::B3DPoint(
- rDirection.DirectionX
- , rDirection.DirectionY
- , rDirection.DirectionZ
- );
-}
-
::basegfx::B3DVector Direction3DToB3DVector( const drawing::Direction3D& rDirection)
{
return ::basegfx::B3DVector(
@@ -173,39 +164,6 @@ drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint)
);
}
-drawing::PolyPolygonShape3D MakeLine3D(
- const drawing::Position3D & rStart,
- const drawing::Position3D & rEnd )
-{
- drawing::PolyPolygonShape3D aPP;
-
- aPP.SequenceX.realloc(1);
- aPP.SequenceY.realloc(1);
- aPP.SequenceZ.realloc(1);
-
- drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
- drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
- drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
-
- pOuterSequenceX->realloc(2);
- pOuterSequenceY->realloc(2);
- pOuterSequenceZ->realloc(2);
-
- double* pInnerSequenceX = pOuterSequenceX->getArray();
- double* pInnerSequenceY = pOuterSequenceY->getArray();
- double* pInnerSequenceZ = pOuterSequenceZ->getArray();
-
- *pInnerSequenceX++ = rStart.PositionX;
- *pInnerSequenceY++ = rStart.PositionY;
- *pInnerSequenceZ++ = rStart.PositionZ;
-
- *pInnerSequenceX++ = rEnd.PositionX;
- *pInnerSequenceY++ = rEnd.PositionY;
- *pInnerSequenceZ++ = rEnd.PositionZ;
-
- return aPP;
-}
-
void AddPointToPoly( drawing::PolyPolygonShape3D& rPoly, const drawing::Position3D& rPos, sal_Int32 nPolygonIndex )
{
if(nPolygonIndex<0)
@@ -298,110 +256,6 @@ void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonSh
}
}
-/*
-drawing::PolyPolygonShape3D operator+(
- const drawing::PolyPolygonShape3D& rPoly1
- , const drawing::PolyPolygonShape3D& rPoly2 )
-{
- drawing::PolyPolygonShape3D aRet;
-
- sal_Int32 nOuterCount = Max( rPoly1.SequenceX.getLength(), rPoly2.SequenceX.getLength() );
- aRet.SequenceX.realloc(nOuterCount);
- aRet.SequenceY.realloc(nOuterCount);
- aRet.SequenceZ.realloc(nOuterCount);
-
- for( sal_Int32 nOuter=0;nOuter<nOuterCount;nOuter++ )
- {
- sal_Int32 nPointCount_1 = 0;
- sal_Int32 nPointCount_2 = 0;
- if(nOuter<rPoly1.SequenceX.getLength())
- nPointCount_1 = rPoly1.SequenceX[nOuter].getLength();
- if(nOuter<rPoly2.SequenceX.getLength())
- nPointCount_2 = rPoly2.SequenceX[nOuter].getLength();
-
- sal_Int32 nPointCount = nPointCount_1 + nPointCount_2;
-
- aRet.SequenceX[nOuter].realloc(nPointCount);
- aRet.SequenceY[nOuter].realloc(nPointCount);
- aRet.SequenceZ[nOuter].realloc(nPointCount);
-
- sal_Int32 nPointTarget=0;
-
- {
- sal_Int32 nPointSourceCount = nPointCount_1;
- const drawing::PolyPolygonShape3D* pPoly = &rPoly1;
- for( sal_Int32 nPointSource=0; nPointSource<nPointSourceCount ; nPointSource++,nPointTarget++ )
- {
- aRet.SequenceX[nOuter][nPointTarget] = pPoly->SequenceX[nOuter][nPointSource];
- aRet.SequenceY[nOuter][nPointTarget] = pPoly->SequenceY[nOuter][nPointSource];
- aRet.SequenceZ[nOuter][nPointTarget] = pPoly->SequenceZ[nOuter][nPointSource];
- }
- }
- {
- sal_Int32 nPointSourceCount = nPointCount_2;
- const drawing::PolyPolygonShape3D* pPoly = &rPoly2;
- for( sal_Int32 nPointSource=nPointSourceCount; nPointSource-- ; nPointTarget++ )
- {
- aRet.SequenceX[nOuter][nPointTarget] = pPoly->SequenceX[nOuter][nPointSource];
- aRet.SequenceY[nOuter][nPointTarget] = pPoly->SequenceY[nOuter][nPointSource];
- aRet.SequenceZ[nOuter][nPointTarget] = pPoly->SequenceZ[nOuter][nPointSource];
- }
- }
- }
- return aRet;
-}
-*/
-/*
-drawing::PolyPolygonShape3D operator+(
- const drawing::PolyPolygonShape3D& rPoly1
- , const drawing::PolyPolygonShape3D& rPoly2 )
-{
- drawing::PolyPolygonShape3D aRet;
-
- sal_Int32 nOuterCount = rPoly1.SequenceX.getLength()+rPoly2.SequenceX.getLength();
- aRet.SequenceX.realloc(nOuterCount);
- aRet.SequenceY.realloc(nOuterCount);
- aRet.SequenceZ.realloc(nOuterCount);
-
- drawing::DoubleSequence* pOuterSequenceX = aRet.SequenceX.getArray();
- drawing::DoubleSequence* pOuterSequenceY = aRet.SequenceY.getArray();
- drawing::DoubleSequence* pOuterSequenceZ = aRet.SequenceZ.getArray();
-
- for( sal_Int32 nOuterTarget=0;nOuterTarget<nOuterCount;nOuterTarget++ )
- {
- const drawing::PolyPolygonShape3D* pPoly = &rPoly1;
- sal_Int32 nOuterSource = nOuterTarget;
- if(nOuterTarget>=rPoly1.SequenceX.getLength())
- {
- pPoly = &rPoly2;
- nOuterSource -= rPoly1.SequenceX.getLength();
- }
-
- sal_Int32 nPointCount = pPoly->SequenceX[nOuterSource].getLength();
-
- pOuterSequenceX->realloc(nPointCount);
- pOuterSequenceY->realloc(nPointCount);
- pOuterSequenceZ->realloc(nPointCount);
-
- double* pInnerSequenceX = pOuterSequenceX->getArray();
- double* pInnerSequenceY = pOuterSequenceY->getArray();
- double* pInnerSequenceZ = pOuterSequenceZ->getArray();
-
- for( sal_Int32 nPoint=0;nPoint<nPointCount;nPoint++ )
- {
- *pInnerSequenceX = pPoly->SequenceX[nOuterSource][nPoint];
- *pInnerSequenceY = pPoly->SequenceY[nOuterSource][nPoint];
- *pInnerSequenceZ = pPoly->SequenceZ[nOuterSource][nPoint];
-
- pInnerSequenceX++; pInnerSequenceY++; pInnerSequenceZ++;
- }
-
- pOuterSequenceX++; pOuterSequenceY++; pOuterSequenceZ++;
- }
- return aRet;
-}
-*/
-
drawing::PolyPolygonShape3D BezierToPoly(
const drawing::PolyPolygonBezierCoords& rBezier )
{
@@ -494,26 +348,6 @@ drawing::Position3D operator+( const drawing::Position3D& rPos
);
}
-drawing::Direction3D operator+( const drawing::Direction3D& rDirection
- , const drawing::Direction3D& rDirectionAdd)
-{
- return drawing::Direction3D(
- rDirection.DirectionX + rDirectionAdd.DirectionX
- , rDirection.DirectionY + rDirectionAdd.DirectionY
- , rDirection.DirectionZ + rDirectionAdd.DirectionZ
- );
-}
-
-drawing::Position3D operator-( const drawing::Position3D& rPos
- , const drawing::Direction3D& rDirection)
-{
- return drawing::Position3D(
- rPos.PositionX - rDirection.DirectionX
- , rPos.PositionY - rDirection.DirectionY
- , rPos.PositionZ - rDirection.DirectionZ
- );
-}
-
drawing::Direction3D operator-( const drawing::Position3D& rPos1
, const drawing::Position3D& rPos2)
{
@@ -524,16 +358,6 @@ drawing::Direction3D operator-( const drawing::Position3D& rPos1
);
}
-drawing::Direction3D operator*( const drawing::Direction3D& rDirection
- , double fFraction)
-{
- return drawing::Direction3D(
- fFraction*rDirection.DirectionX
- , fFraction*rDirection.DirectionY
- , fFraction*rDirection.DirectionZ
- );
-}
-
bool operator==( const drawing::Position3D& rPos1
, const drawing::Position3D& rPos2)
{
@@ -597,16 +421,6 @@ uno::Sequence< double > Position3DToSequence( const drawing::Position3D& rPositi
return aRet;
}
-drawing::Direction3D operator/( const drawing::Direction3D& rDirection, double f )
-{
- OSL_ENSURE(f,"a Direction3D is divided by NULL");
- return drawing::Direction3D(
- rDirection.DirectionX/f
- , rDirection.DirectionY/f
- , rDirection.DirectionZ/f
- );
-}
-
using namespace ::com::sun::star::chart2;
uno::Sequence< double > DataSequenceToDoubleSequence(
diff --git a/chart2/source/tools/ConfigColorScheme.cxx b/chart2/source/tools/ConfigColorScheme.cxx
index 7e418f04ab7b..835872aad8e4 100644
--- a/chart2/source/tools/ConfigColorScheme.cxx
+++ b/chart2/source/tools/ConfigColorScheme.cxx
@@ -56,6 +56,12 @@ static const OUString aSeriesPropName( RTL_CONSTASCII_USTRINGPARAM("Series"));
namespace chart
{
+
+uno::Reference< chart2::XColorScheme > createConfigColorScheme( const uno::Reference< uno::XComponentContext > & xContext )
+{
+ return new ConfigColorScheme( xContext );
+}
+
namespace impl
{
class ChartConfigItem : public ::utl::ConfigItem
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index 8c3431905699..61fecf18b5e7 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -644,5 +644,96 @@ bool areAllSeriesAttachedToSameAxis( const uno::Reference< chart2::XChartType >&
}
}
+namespace
+{
+
+bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
+{
+ if( !xDataSequence.is() )
+ return false;
+ uno::Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ uno::Sequence< sal_Int32 > aHiddenValues;
+ try
+ {
+ xProp->getPropertyValue( C2U( "HiddenValues" ) ) >>= aHiddenValues;
+ if( !aHiddenValues.getLength() )
+ return true;
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e; // avoid warning
+ return true;
+ }
+ }
+ if( xDataSequence->getData().getLength() )
+ return true;
+ return false;
+}
+
+}
+
+bool hasUnhiddenData( const uno::Reference< chart2::XDataSeries >& xSeries )
+{
+ uno::Reference< chart2::data::XDataSource > xDataSource =
+ uno::Reference< chart2::data::XDataSource >( xSeries, uno::UNO_QUERY );
+
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDataSequences = xDataSource->getDataSequences();
+
+ for(sal_Int32 nN = aDataSequences.getLength();nN--;)
+ {
+ if( !aDataSequences[nN].is() )
+ continue;
+ if( lcl_SequenceHasUnhiddenData( aDataSequences[nN]->getValues() ) )
+ return true;
+ if( lcl_SequenceHasUnhiddenData( aDataSequences[nN]->getLabel() ) )
+ return true;
+ }
+ return false;
+}
+
+struct lcl_LessIndex
+{
+ inline bool operator() ( const sal_Int32& first, const sal_Int32& second )
+ {
+ return ( first < second );
+ }
+};
+
+sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Reference< chart2::data::XDataSequence >& xDataSequence, bool bTranslate )
+{
+ if( !bTranslate )
+ return nIndex;
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> xProp( xDataSequence, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ Sequence<sal_Int32> aHiddenIndicesSeq;
+ xProp->getPropertyValue( C2U("HiddenValues") ) >>= aHiddenIndicesSeq;
+ if( aHiddenIndicesSeq.getLength() )
+ {
+ ::std::vector< sal_Int32 > aHiddenIndices( ContainerHelper::SequenceToVector( aHiddenIndicesSeq ) );
+ ::std::sort( aHiddenIndices.begin(), aHiddenIndices.end(), lcl_LessIndex() );
+
+ sal_Int32 nHiddenCount = static_cast<sal_Int32>(aHiddenIndices.size());
+ for( sal_Int32 nN = 0; nN < nHiddenCount; ++nN)
+ {
+ if( aHiddenIndices[nN] <= nIndex )
+ nIndex += 1;
+ else
+ break;
+ }
+ }
+ }
+ }
+ catch (const beans::UnknownPropertyException&)
+ {
+ }
+ return nIndex;
+}
+
} // namespace DataSeriesHelper
} // namespace chart
diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx
index 0de52f8a53ea..37c3a609ac9f 100644
--- a/chart2/source/tools/DataSourceHelper.cxx
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -40,6 +40,8 @@
#include "ContainerHelper.hxx"
#include "ControllerLockGuard.hxx"
#include "PropertyHelper.hxx"
+#include "CachedDataSequence.hxx"
+#include "LabeledDataSequence.hxx"
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
@@ -117,6 +119,41 @@ void lcl_addErrorBarRanges(
} // anonymous namespace
+Reference< chart2::data::XDataSource > DataSourceHelper::createDataSource(
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > >& rSequences )
+{
+ return new DataSource(rSequences);
+}
+
+Reference< chart2::data::XDataSequence > DataSourceHelper::createCachedDataSequence()
+{
+ return new ::chart::CachedDataSequence();
+}
+
+Reference< chart2::data::XDataSequence > DataSourceHelper::createCachedDataSequence( const ::rtl::OUString& rSingleText )
+{
+ return new ::chart::CachedDataSequence( rSingleText );
+}
+
+Reference< chart2::data::XLabeledDataSequence > DataSourceHelper::createLabeledDataSequence(
+ const Reference< chart2::data::XDataSequence >& xValues ,
+ const Reference< chart2::data::XDataSequence >& xLabels )
+{
+ return new ::chart::LabeledDataSequence( xValues, xLabels );
+}
+
+Reference< chart2::data::XLabeledDataSequence > DataSourceHelper::createLabeledDataSequence(
+ const Reference< chart2::data::XDataSequence >& xValues )
+{
+ return new ::chart::LabeledDataSequence( xValues );
+}
+
+Reference< chart2::data::XLabeledDataSequence > DataSourceHelper::createLabeledDataSequence(
+ const Reference< uno::XComponentContext >& xContext )
+{
+ return new ::chart::LabeledDataSequence( xContext );
+}
+
uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments(
bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories )
{
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 8af5b412c5c1..ac2a32f93298 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -503,8 +503,12 @@ void DiagramHelper::setDimension(
try
{
- //change all coordinate systems:
+ bool rbFound = false;
+ bool rbAmbiguous = true;
+ StackMode eStackMode = DiagramHelper::getStackMode( xDiagram, rbFound, rbAmbiguous );
+ bool bIsSupportingOnlyDeepStackingFor3D=false;
+ //change all coordinate systems:
Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY_THROW );
Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
@@ -520,6 +524,7 @@ void DiagramHelper::setDimension(
for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
{
Reference< XChartType > xChartType( aChartTypeList[nT], uno::UNO_QUERY );
+ bIsSupportingOnlyDeepStackingFor3D = ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( xChartType );
if(!xNewCooSys.is())
{
xNewCooSys = xChartType->createCoordinateSystem( nNewDimensionCount );
@@ -533,6 +538,12 @@ void DiagramHelper::setDimension(
// replace the old coordinate system at all places where it was used
DiagramHelper::replaceCoordinateSystem( xDiagram, xOldCooSys, xNewCooSys );
}
+
+ //correct stack mode if necessary
+ if( nNewDimensionCount==3 && eStackMode != StackMode_Z_STACKED && bIsSupportingOnlyDeepStackingFor3D )
+ DiagramHelper::setStackMode( xDiagram, StackMode_Z_STACKED );
+ else if( nNewDimensionCount==2 && eStackMode == StackMode_Z_STACKED )
+ DiagramHelper::setStackMode( xDiagram, StackMode_NONE );
}
catch( uno::Exception & ex )
{
@@ -556,6 +567,8 @@ void DiagramHelper::replaceCoordinateSystem(
{
try
{
+ Reference< chart2::data::XLabeledDataSequence > xCategories = DiagramHelper::getCategoriesFromDiagram( xDiagram );
+
// move chart types of xCooSysToReplace to xReplacement
Reference< XChartTypeContainer > xCTCntCooSys( xCooSysToReplace, uno::UNO_QUERY_THROW );
Reference< XChartTypeContainer > xCTCntReplacement( xReplacement, uno::UNO_QUERY_THROW );
@@ -563,6 +576,9 @@ void DiagramHelper::replaceCoordinateSystem(
xCont->removeCoordinateSystem( xCooSysToReplace );
xCont->addCoordinateSystem( xReplacement );
+
+ if( xCategories.is() )
+ DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram );
}
catch( uno::Exception & ex )
{
diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
index 6a704dbc54d8..a1b8b7c02106 100644
--- a/chart2/source/tools/ErrorBar.cxx
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -166,11 +166,16 @@ bool lcl_isInternalData( const uno::Reference< chart2::data::XLabeledDataSequenc
namespace chart
{
+uno::Reference< beans::XPropertySet > createErrorBar( const uno::Reference< uno::XComponentContext > & xContext )
+{
+ return new ErrorBar( xContext );
+}
+
ErrorBar::ErrorBar(
uno::Reference< uno::XComponentContext > const & xContext ) :
::property::OPropertySet( m_aMutex ),
m_xContext( xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
ErrorBar::ErrorBar( const ErrorBar & rOther ) :
@@ -178,7 +183,7 @@ ErrorBar::ErrorBar( const ErrorBar & rOther ) :
impl::ErrorBar_Base(),
::property::OPropertySet( rOther, m_aMutex ),
m_xContext( rOther.m_xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
if( ! rOther.m_aDataSequences.empty())
{
diff --git a/chart2/source/tools/ImplUndoManager.cxx b/chart2/source/tools/ImplUndoManager.cxx
index d5eab1b4b652..91d5f869bc53 100644
--- a/chart2/source/tools/ImplUndoManager.cxx
+++ b/chart2/source/tools/ImplUndoManager.cxx
@@ -37,6 +37,7 @@
#include "ControllerLockGuard.hxx"
#include "PropertyHelper.hxx"
#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
#include <com/sun/star/chart/XChartDataArray.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -170,6 +171,9 @@ void UndoElement::applyModelContentToModel(
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());
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 3257821e521f..880cd5c72984 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -138,13 +138,6 @@ public:
void setColumnLabels( const ::std::vector< OUString > & rNewColumnLabels );
::std::vector< OUString > getColumnLabels() const;
- /** returns whether the data source was created by putting sequence contents
- into columns (true) or rows (false)
- */
- bool setDataByDataSource(
- const Reference< chart2::data::XDataSource > & xDataSource,
- const Sequence< beans::PropertyValue > & rArgs );
-
#if OSL_DEBUG_LEVEL > 2
void traceData() const;
#endif
@@ -628,49 +621,6 @@ void InternalData::setColumnLabels( const ::std::vector< OUString > & rNewColumn
return m_aColumnLabels;
}
-bool InternalData::setDataByDataSource(
- const Reference< chart2::data::XDataSource > & xDataSource,
- const Sequence< beans::PropertyValue > & rArgs )
-{
- OUString aRangeRepresentation;
- uno::Sequence< sal_Int32 > aSequenceMapping; //yyyy todo...? InternalData::setDataByDataSource
- bool bUseColumns = true;
- bool bFirstCellAsLabel = true;
- bool bHasCategories = true;
-
- DataSourceHelper::readArguments( rArgs, aRangeRepresentation, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories );
-
- typedef ::std::vector< Reference< chart2::data::XLabeledDataSequence > > tLSeqCntType;
- tLSeqCntType aLSeqVec( ContainerHelper::SequenceToVector( xDataSource->getDataSequences()));
- tLSeqCntType::const_iterator aIt( aLSeqVec.begin());
- const tLSeqCntType::const_iterator aEndIt( aLSeqVec.end());
-
- if( bHasCategories && aIt != aEndIt )
- {
- if( bUseColumns )
- setRowLabels( ContainerHelper::SequenceToVector(
- DataSequenceToStringSequence( (*aIt)->getValues() )));
- else
- setColumnLabels( ContainerHelper::SequenceToVector(
- DataSequenceToStringSequence( (*aIt)->getValues() )));
- ++aIt;
- }
-
- ::std::vector< Sequence< double > > aDataVec;
- ::std::vector< OUString > aLabelVec;
- transform( aIt, aEndIt, back_inserter( aDataVec ), lcl_ValuesOfLabeledSequence());
- transform( aIt, aEndIt, back_inserter( aLabelVec ), lcl_LabelOfLabeledSequence());
-
- setData( ContainerHelper::ContainerToSequence( aDataVec ), bUseColumns );
-
- if( bUseColumns )
- setColumnLabels( aLabelVec );
- else
- setRowLabels( aLabelVec );
-
- return bUseColumns;
-}
-
#if OSL_DEBUG_LEVEL > 2
void InternalData::traceData() const
{
@@ -1049,8 +999,9 @@ Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createData
impl::InternalData & rData( getInternalData());
// categories
- aResultLSeqVec.push_back(
- new LabeledDataSequence( createDataSequenceAndAddToMap( lcl_aCategoriesRangeName, lcl_aCategoriesRoleName )));
+ if ( bHasCategories )
+ aResultLSeqVec.push_back(
+ new LabeledDataSequence( createDataSequenceAndAddToMap( lcl_aCategoriesRangeName, lcl_aCategoriesRoleName )));
// data with labels
::std::vector< Reference< chart2::data::XLabeledDataSequence > > aDataVec;
diff --git a/chart2/source/tools/LabeledDataSequence.cxx b/chart2/source/tools/LabeledDataSequence.cxx
index 83c3a1e5a059..bb0ec7053497 100644
--- a/chart2/source/tools/LabeledDataSequence.cxx
+++ b/chart2/source/tools/LabeledDataSequence.cxx
@@ -46,13 +46,13 @@ namespace chart
LabeledDataSequence::LabeledDataSequence( const Reference< uno::XComponentContext > & xContext ) :
m_xContext( xContext ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
LabeledDataSequence::LabeledDataSequence(
const uno::Reference< chart2::data::XDataSequence > & rValues ) :
m_xData( rValues ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
ModifyListenerHelper::addListener( m_xData, m_xModifyEventForwarder );
}
@@ -62,7 +62,7 @@ LabeledDataSequence::LabeledDataSequence(
const uno::Reference< chart2::data::XDataSequence > & rLabel ) :
m_xData( rValues ),
m_xLabel( rLabel ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
ModifyListenerHelper::addListener( m_xData, m_xModifyEventForwarder );
ModifyListenerHelper::addListener( m_xLabel, m_xModifyEventForwarder );
diff --git a/chart2/source/tools/ModifyListenerHelper.cxx b/chart2/source/tools/ModifyListenerHelper.cxx
index 42943d192c0f..722ecb82e155 100644
--- a/chart2/source/tools/ModifyListenerHelper.cxx
+++ b/chart2/source/tools/ModifyListenerHelper.cxx
@@ -106,6 +106,11 @@ namespace chart
namespace ModifyListenerHelper
{
+uno::Reference< util::XModifyListener > createModifyEventForwarder()
+{
+ return new ModifyEventForwarder();
+}
+
ModifyEventForwarder::ModifyEventForwarder() :
::cppu::WeakComponentImplHelper2<
::com::sun::star::util::XModifyBroadcaster,
@@ -114,11 +119,6 @@ ModifyEventForwarder::ModifyEventForwarder() :
{
}
-void ModifyEventForwarder::FireEvent( const Reference< uno::XWeak > & xSource )
-{
- lcl_fireModifyEvent( m_aModifyListeners, xSource, 0 );
-}
-
void ModifyEventForwarder::FireEvent( const lang::EventObject & rEvent )
{
lcl_fireModifyEvent( m_aModifyListeners, Reference< uno::XWeak >(), & rEvent );
diff --git a/chart2/source/tools/NameContainer.cxx b/chart2/source/tools/NameContainer.cxx
index 3fefe3a920df..815f72257490 100644
--- a/chart2/source/tools/NameContainer.cxx
+++ b/chart2/source/tools/NameContainer.cxx
@@ -50,6 +50,12 @@ namespace chart
{
//.............................................................................
+uno::Reference< container::XNameContainer > createNameContainer(
+ const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName )
+{
+ return new NameContainer( rType, rServicename, rImplementationName );
+}
+
NameContainer::NameContainer( const ::com::sun::star::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName )
: m_aType( rType )
, m_aServicename( rServicename )
diff --git a/chart2/source/tools/OPropertySet.cxx b/chart2/source/tools/OPropertySet.cxx
index d3988bb93671..4ba7f99edcc1 100644
--- a/chart2/source/tools/OPropertySet.cxx
+++ b/chart2/source/tools/OPropertySet.cxx
@@ -63,7 +63,8 @@ OPropertySet::OPropertySet( ::osl::Mutex & par_rMutex ) :
// the following causes a warning; there seems to be no way to avoid it
OPropertySetHelper( static_cast< OBroadcastHelper & >( *this )),
m_rMutex( par_rMutex ),
- m_pImplProperties( new impl::ImplOPropertySet() )
+ m_pImplProperties( new impl::ImplOPropertySet() ),
+ m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
{
}
@@ -71,7 +72,8 @@ OPropertySet::OPropertySet( const OPropertySet & rOther, ::osl::Mutex & par_rMut
OBroadcastHelper( par_rMutex ),
// the following causes a warning; there seems to be no way to avoid it
OPropertySetHelper( static_cast< OBroadcastHelper & >( *this )),
- m_rMutex( par_rMutex )
+ m_rMutex( par_rMutex ),
+ m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
{
// /--
MutexGuard aGuard( m_rMutex );
@@ -80,6 +82,11 @@ OPropertySet::OPropertySet( const OPropertySet & rOther, ::osl::Mutex & par_rMut
// \--
}
+void OPropertySet::SetNewValuesExplicitlyEvenIfTheyEqualDefault()
+{
+ m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault = true;
+}
+
OPropertySet::~OPropertySet()
{}
@@ -322,6 +329,8 @@ sal_Bool SAL_CALL OPropertySet::convertFastPropertyValue
}
}
rConvertedValue = rValue;
+ if( !m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault && rOldValue == rConvertedValue )
+ return sal_False;//no change necessary
return sal_True;
}
@@ -341,7 +350,20 @@ void SAL_CALL OPropertySet::setFastPropertyValue_NoBroadcast
}
#endif
+ Any aDefault;
+ try
+ {
+ aDefault = GetDefaultValue( nHandle );
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ aDefault.clear();
+ }
m_pImplProperties->SetPropertyValueByHandle( nHandle, rValue );
+ if( !m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault && aDefault.hasValue() && aDefault == rValue ) //#i98893# don't export defaults to file
+ m_pImplProperties->SetPropertyToDefault( nHandle );
+ else
+ m_pImplProperties->SetPropertyValueByHandle( nHandle, rValue );
}
void SAL_CALL OPropertySet::getFastPropertyValue
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index 57c8ef01d5d6..07f8d16efffd 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -439,14 +439,6 @@ OUString ObjectIdentifier::createParticleForGrid(
return aRet.makeStringAndClear();
}
-OUString ObjectIdentifier::createClassifiedIdentifierForAxis(
- const Reference< XAxis >& xAxis
- , const Reference< frame::XModel >& xChartModel )
-{
- rtl::OUString aAxisCID( createClassifiedIdentifierForObject( xAxis,xChartModel ) );
- return aAxisCID;
-}
-
//static
OUString ObjectIdentifier::createClassifiedIdentifierForGrid(
const Reference< XAxis >& xAxis
diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx
index 780a5ba373d9..bfbab86e9008 100644
--- a/chart2/source/tools/RangeHighlighter.cxx
+++ b/chart2/source/tools/RangeHighlighter.cxx
@@ -38,6 +38,7 @@
#include "ContainerHelper.hxx"
#include "macros.hxx"
#include "ObjectIdentifier.hxx"
+#include "DataSeriesHelper.hxx"
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
@@ -78,7 +79,8 @@ RangeHighlighter::RangeHighlighter(
const Reference< view::XSelectionSupplier > & xSelectionSupplier ) :
impl::RangeHighlighter_Base( m_aMutex ),
m_xSelectionSupplier( xSelectionSupplier ),
- m_nAddedListenerCount( 0 )
+ m_nAddedListenerCount( 0 ),
+ m_bIncludeHiddenCells(true)
{
}
@@ -104,6 +106,8 @@ void RangeHighlighter::determineRanges()
if( xController.is())
xChartModel.set( xController->getModel());
+ m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( xChartModel );
+
uno::Any aSelection( m_xSelectionSupplier->getSelection());
OUString aCID;
if(( aSelection >>= aCID ) &&
@@ -271,11 +275,13 @@ void RangeHighlighter::fillRangesForDataPoint( const Reference< uno::XInterface
-1,
nPreferredColor,
sal_False ));
+
+ sal_Int32 nUnhiddenIndex = DataSeriesHelper::translateIndexFromHiddenToFullSequence( nIndex, xValues, !m_bIncludeHiddenCells );
if( xValues.is())
aHilightedRanges.push_back(
chart2::data::HighlightedRange(
xValues->getSourceRangeRepresentation(),
- nIndex,
+ nUnhiddenIndex,
nPreferredColor,
sal_False ));
}
diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx
index 93ba4b43cfc3..ddddc7d71ee4 100644
--- a/chart2/source/tools/ReferenceSizeProvider.cxx
+++ b/chart2/source/tools/ReferenceSizeProvider.cxx
@@ -226,32 +226,18 @@ void ReferenceSizeProvider::getAutoResizeFromPropSet(
}
}
-void ReferenceSizeProvider::getAutoResizeFromTitle(
- const Reference< XTitle > & xTitle,
- ReferenceSizeProvider::AutoResizeState & rInOutState )
-{
- Reference< beans::XPropertySet > xProp( xTitle, uno::UNO_QUERY );
- if( xProp.is())
- getAutoResizeFromPropSet( xProp, rInOutState );
-}
-
void ReferenceSizeProvider::impl_getAutoResizeFromTitled(
const Reference< XTitled > & xTitled,
ReferenceSizeProvider::AutoResizeState & rInOutState )
{
if( xTitled.is())
{
- Reference< XTitle > xTitle( xTitled->getTitleObject());
- if( xTitle.is())
- getAutoResizeFromTitle( xTitle, rInOutState );
+ Reference< beans::XPropertySet > xProp( xTitled->getTitleObject(), uno::UNO_QUERY );
+ if( xProp.is())
+ getAutoResizeFromPropSet( xProp, rInOutState );
}
}
-ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState() const
-{
- return getAutoResizeState( m_xChartDoc );
-}
-
/** Retrieves the state auto-resize from all objects that support this
feature. If all objects return the same state, AUTO_RESIZE_YES or
AUTO_RESIZE_NO is returned.
diff --git a/chart2/source/tools/RegressionCurveModel.cxx b/chart2/source/tools/RegressionCurveModel.cxx
index 377f087315ae..dea90a312845 100644
--- a/chart2/source/tools/RegressionCurveModel.cxx
+++ b/chart2/source/tools/RegressionCurveModel.cxx
@@ -109,7 +109,7 @@ RegressionCurveModel::RegressionCurveModel(
::property::OPropertySet( m_aMutex ),
m_xContext( xContext ),
m_eRegressionCurveType( eCurveType ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
m_xEquationProperties( new RegressionEquation( xContext ))
{
// set 0 line width (default) hard, so that it is always written to XML,
@@ -125,7 +125,7 @@ RegressionCurveModel::RegressionCurveModel( const RegressionCurveModel & rOther
::property::OPropertySet( rOther, m_aMutex ),
m_xContext( rOther.m_xContext ),
m_eRegressionCurveType( rOther.m_eRegressionCurveType ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
m_xEquationProperties.set( CloneHelper::CreateRefClone< uno::Reference< beans::XPropertySet > >()( rOther.m_xEquationProperties ));
ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx
index 83f9cde5f783..f820fb78c89e 100644
--- a/chart2/source/tools/StatisticsHelper.cxx
+++ b/chart2/source/tools/StatisticsHelper.cxx
@@ -337,7 +337,7 @@ Reference< beans::XPropertySet > StatisticsHelper::addErrorBars(
if( !( xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar ) ||
!xErrorBar.is())
{
- xErrorBar.set( new ErrorBar( xContext ));
+ xErrorBar.set( createErrorBar( xContext ));
}
OSL_ASSERT( xErrorBar.is());
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
index 24e55ccfc90e..fe10c92e78cc 100644
--- a/chart2/source/tools/TitleHelper.cxx
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -36,6 +36,7 @@
#include "AxisHelper.hxx"
#include "DiagramHelper.hxx"
#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <rtl/ustrbuf.hxx>
//.............................................................................
namespace chart
@@ -191,7 +192,7 @@ uno::Reference< XTitle > TitleHelper::createTitle(
switch( eTitleType )
{
case TitleHelper::SUB_TITLE:
- chart::TitleHelper::setCompleteString(
+ TitleHelper::setCompleteString(
rTitleText, xTitle, xContext, & fDefaultCharHeightSub );
break;
case TitleHelper::X_AXIS_TITLE:
@@ -201,11 +202,11 @@ uno::Reference< XTitle > TitleHelper::createTitle(
case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION:
case TitleHelper::SECONDARY_X_AXIS_TITLE:
case TitleHelper::SECONDARY_Y_AXIS_TITLE:
- chart::TitleHelper::setCompleteString(
+ TitleHelper::setCompleteString(
rTitleText, xTitle, xContext, & fDefaultCharHeightAxis );
break;
default:
- chart::TitleHelper::setCompleteString( rTitleText, xTitle, xContext );
+ TitleHelper::setCompleteString( rTitleText, xTitle, xContext );
break;
}
@@ -269,13 +270,44 @@ void TitleHelper::setCompleteString( const rtl::OUString& rNewText
if(!xTitle.is())
return;
+ rtl::OUString aNewText = rNewText;
+
+ bool bStacked = false;
+ uno::Reference< beans::XPropertySet > xTitleProperties( xTitle, uno::UNO_QUERY );
+ if( xTitleProperties.is() )
+ xTitleProperties->getPropertyValue( C2U( "StackCharacters" ) ) >>= bStacked;
+
+ if( bStacked )
+ {
+ //#i99841# remove linebreaks that were added for vertical stacking
+ rtl::OUStringBuffer aUnstackedStr;
+ rtl::OUStringBuffer aSource(rNewText);
+
+ bool bBreakIgnored = false;
+ sal_Int32 nLen = rNewText.getLength();
+ for( sal_Int32 nPos = 0; nPos < nLen; ++nPos )
+ {
+ sal_Unicode aChar = aSource.charAt( nPos );
+ if( aChar != '\n' )
+ {
+ aUnstackedStr.append( aChar );
+ bBreakIgnored = false;
+ }
+ else if( aChar == '\n' && bBreakIgnored )
+ aUnstackedStr.append( aChar );
+ else
+ bBreakIgnored = true;
+ }
+ aNewText = aUnstackedStr.makeStringAndClear();
+ }
+
uno::Sequence< uno::Reference< XFormattedString > > aNewStringList(1);
uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText();
if( aOldStringList.getLength() )
{
aNewStringList[0].set( aOldStringList[0] );
- aNewStringList[0]->setString( rNewText );
+ aNewStringList[0]->setString( aNewText );
}
else
{
@@ -286,7 +318,7 @@ void TitleHelper::setCompleteString( const rtl::OUString& rNewText
if(xFormattedString.is())
{
- xFormattedString->setString( rNewText );
+ xFormattedString->setString( aNewText );
aNewStringList[0].set( xFormattedString );
if( pDefaultCharHeight != 0 )
{
diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx
index 9f265bd364ba..53a1f1d93c68 100644
--- a/chart2/source/tools/UncachedDataSequence.cxx
+++ b/chart2/source/tools/UncachedDataSequence.cxx
@@ -63,8 +63,6 @@ enum
// PROP_SOURCE_IDENTIFIER,
PROP_NUMBERFORMAT_KEY,
PROP_PROPOSED_ROLE,
- PROP_HIDDEN,
- PROP_HIDDEN_VALUES,
PROP_XML_RANGE
};
} // anonymous namespace
@@ -79,10 +77,10 @@ UncachedDataSequence::UncachedDataSequence(
const OUString & rRangeRepresentation )
: OPropertyContainer( GetBroadcastHelper()),
UncachedDataSequence_Base( GetMutex()),
- m_bIsHidden( true ),
+ m_nNumberFormatKey(0),
m_xDataProvider( xIntDataProv ),
m_aSourceRepresentation( rRangeRepresentation ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
registerProperties();
}
@@ -93,10 +91,10 @@ UncachedDataSequence::UncachedDataSequence(
const OUString & rRole )
: OPropertyContainer( GetBroadcastHelper()),
UncachedDataSequence_Base( GetMutex()),
- m_bIsHidden( true ),
+ m_nNumberFormatKey(0),
m_xDataProvider( xIntDataProv ),
m_aSourceRepresentation( rRangeRepresentation ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
registerProperties();
setFastPropertyValue_NoBroadcast( PROP_PROPOSED_ROLE, uno::makeAny( rRole ));
@@ -109,11 +107,9 @@ UncachedDataSequence::UncachedDataSequence( const UncachedDataSequence & rSource
UncachedDataSequence_Base( GetMutex()),
m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
m_sRole( rSource.m_sRole ),
- m_bIsHidden( rSource.m_bIsHidden ),
- m_aHiddenValues( rSource.m_aHiddenValues ),
m_xDataProvider( rSource.m_xDataProvider ),
m_aSourceRepresentation( rSource.m_aSourceRepresentation ),
- m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
registerProperties();
}
@@ -135,18 +131,6 @@ void UncachedDataSequence::registerProperties()
& m_sRole,
::getCppuType( & m_sRole ) );
- registerProperty( C2U( "IsHidden" ),
- PROP_HIDDEN,
- 0, // PropertyAttributes
- & m_bIsHidden,
- ::getCppuType( & m_bIsHidden ) );
-
- registerProperty( C2U( "HiddenValues" ),
- PROP_HIDDEN_VALUES,
- 0, // PropertyAttributes
- & m_aHiddenValues,
- ::getCppuType( & m_aHiddenValues ) );
-
registerProperty( C2U( "CachedXMLRange" ),
PROP_XML_RANGE,
0, // PropertyAttributes
@@ -266,7 +250,7 @@ Sequence< OUString > SAL_CALL UncachedDataSequence::generateLabel( chart2::data:
throw (lang::IndexOutOfBoundsException,
uno::RuntimeException)
{
- return 0;
+ return m_nNumberFormatKey;
}
// ____ XIndexReplace ____
diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx
index 29e4fc0d06da..5287ecbcdc13 100644
--- a/chart2/source/view/axes/ScaleAutomatism.cxx
+++ b/chart2/source/view/axes/ScaleAutomatism.cxx
@@ -33,7 +33,6 @@
#include "ScaleAutomatism.hxx"
#include "macros.hxx"
#include "TickmarkHelper.hxx"
-#include "Scaling.hxx"
#include "AxisHelper.hxx"
#include <rtl/math.hxx>
#include <tools/debug.hxx>
@@ -134,7 +133,7 @@ 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 scsaling or from plotter????
+ rExplicitScale.Minimum = 0.0; //@todo get Minimum from scaling or from plotter????
else
rExplicitScale.Minimum = m_fValueMinimum;
}
@@ -143,7 +142,7 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
if( bAutoMaximum )
{
if( m_aSourceScale.AxisType==AxisType::PERCENT )
- rExplicitScale.Minimum = 1.0;
+ rExplicitScale.Maximum = 1.0;
else if( ::rtl::math::isNan( m_fValueMaximum ) )
rExplicitScale.Maximum = 10.0; //@todo get Maximum from scaling or from plotter????
else
@@ -257,6 +256,9 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
{
// *** STEP 1: initialize the range data ***
+ const double fInputMinimum = rExplicitScale.Minimum;
+ const double fInputMaximum = rExplicitScale.Maximum;
+
double fSourceMinimum = rExplicitScale.Minimum;
double fSourceMaximum = rExplicitScale.Maximum;
@@ -269,7 +271,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
values. In the last step, the original values will be restored. */
uno::Reference< XScaling > xScaling = rExplicitScale.Scaling;
if( !xScaling.is() )
- xScaling.set( new LogarithmicScaling );
+ xScaling.set( AxisHelper::createLogarithmicScaling() );
uno::Reference< XScaling > xInverseScaling = xScaling->getInverseScaling();
fSourceMinimum = xScaling->doScaling( fSourceMinimum );
@@ -412,10 +414,38 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
// round to entire multiples of the distance and add additional space
if( bAutoMinimum && m_bExpandBorderToIncrementRhythm )
+ {
fAxisMinimum = TickmarkHelper::getMinimumAtIncrement( fAxisMinimum, rExplicitIncrement );
+
+ //ensure valid values after scaling #i100995#
+ if( !bAutoDistance )
+ {
+ double fCheck = xInverseScaling->doScaling( fAxisMinimum );
+ if( !::rtl::math::isFinite( fCheck ) || fCheck <= 0 )
+ {
+ bAutoDistance = true;
+ bHasCalculatedDistance = false;
+ continue;
+ }
+ }
+ }
if( bAutoMaximum && m_bExpandBorderToIncrementRhythm )
+ {
fAxisMaximum = TickmarkHelper::getMaximumAtIncrement( fAxisMaximum, rExplicitIncrement );
+ //ensure valid values after scaling #i100995#
+ if( !bAutoDistance )
+ {
+ double fCheck = xInverseScaling->doScaling( fAxisMaximum );
+ if( !::rtl::math::isFinite( fCheck ) || fCheck <= 0 )
+ {
+ bAutoDistance = true;
+ bHasCalculatedDistance = false;
+ continue;
+ }
+ }
+ }
+
// set the resulting limits (swap back to negative range if needed)
if( bSwapAndNegateRange )
{
@@ -440,6 +470,22 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
// convert limits back to logarithmic scale
rExplicitScale.Minimum = xInverseScaling->doScaling( rExplicitScale.Minimum );
rExplicitScale.Maximum = xInverseScaling->doScaling( rExplicitScale.Maximum );
+
+ //ensure valid values after scaling #i100995#
+ if( !::rtl::math::isFinite( rExplicitScale.Minimum ) || rExplicitScale.Minimum <= 0)
+ {
+ rExplicitScale.Minimum = fInputMinimum;
+ if( !::rtl::math::isFinite( rExplicitScale.Minimum ) || rExplicitScale.Minimum <= 0 )
+ rExplicitScale.Minimum = 1.0;
+ }
+ if( !::rtl::math::isFinite( rExplicitScale.Maximum) || rExplicitScale.Maximum <= 0 )
+ {
+ rExplicitScale.Maximum= fInputMaximum;
+ if( !::rtl::math::isFinite( rExplicitScale.Maximum) || rExplicitScale.Maximum <= 0 )
+ rExplicitScale.Maximum = 10.0;
+ }
+ if( rExplicitScale.Maximum < rExplicitScale.Minimum )
+ ::std::swap( rExplicitScale.Maximum, rExplicitScale.Minimum );
}
//---------------------------------------------------------------
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index c64102f6c984..0f18029254ef 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -64,193 +64,6 @@ using namespace ::com::sun::star::chart2;
using namespace ::rtl::math;
using ::com::sun::star::uno::Reference;
-void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection
- , double fAnglePositiveDegree, const awt::Size& aSize )
-{
- //correct label positions left of an axis with right centered alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
- if( fAnglePositiveDegree==0.0 )
- {
- }
- else if( fAnglePositiveDegree<= 90.0 )
- {
- rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
- }
- else if( fAnglePositiveDegree<= 180.0 )
- {
- double beta = fAnglePi-F_PI/2.0;
- rfXCorrection = -aSize.Width *rtl::math::sin( beta )
- -aSize.Height *rtl::math::cos( beta )/2.0;
- rfYCorrection = -aSize.Width *rtl::math::cos( beta );
- }
- else if( fAnglePositiveDegree<= 270.0 )
- {
- double beta = fAnglePi - F_PI;
- rfXCorrection = -aSize.Width *rtl::math::cos( beta )
- -aSize.Height*rtl::math::sin( beta )/2.0;
- rfYCorrection = aSize.Width *rtl::math::sin( beta );
- }
- else
- {
- double beta = 2*F_PI - fAnglePi;
- rfXCorrection = -aSize.Height*rtl::math::sin( beta )/2.0;
-
- }
-}
-
-void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection
- , double fAnglePositiveDegree, const awt::Size& aSize )
-{
- //correct label positions right of an axis with left centered alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
- if( fAnglePositiveDegree== 0.0 )
- {
- }
- else if( fAnglePositiveDegree<= 90.0 )
- {
- rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
- }
- else if( fAnglePositiveDegree<= 180.0 )
- {
- double beta = F_PI - fAnglePi;
- rfXCorrection = aSize.Width *rtl::math::cos( beta )
- + aSize.Height*rtl::math::sin( beta )/2.0;
- rfYCorrection = aSize.Width *rtl::math::sin( beta );
- }
- else if( fAnglePositiveDegree<= 270.0 )
- {
- double beta = 3*F_PI/2.0 - fAnglePi;
- rfXCorrection = aSize.Width *rtl::math::sin( beta )
- +aSize.Height*rtl::math::cos( beta )/2.0;
- rfYCorrection = -aSize.Width *rtl::math::cos( beta );
- }
- else
- {
- rfXCorrection = aSize.Height*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
- }
-}
-
-void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection
- , double fAnglePositiveDegree, const awt::Size& aSize )
-{
- //correct label positions on top of an axis with bottom centered alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
- if( fAnglePositiveDegree== 0.0 )
- {
- }
- else if( fAnglePositiveDegree<= 90.0 )
- {
- rfXCorrection = aSize.Width*rtl::math::cos( fAnglePi )/2.0
- +aSize.Height*rtl::math::sin( fAnglePi )/2.0;
- rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
- }
- else if( fAnglePositiveDegree<= 180.0 )
- {
- double beta = fAnglePi - F_PI/2.0;
- rfYCorrection = -aSize.Width*rtl::math::cos( beta )/2.0
- - aSize.Height*rtl::math::sin( beta );
- rfXCorrection = - aSize.Width*rtl::math::sin( beta )/2.0
- + aSize.Height*rtl::math::cos( beta )/2.0;
- }
- else if( fAnglePositiveDegree<= 270.0 )
- {
- double beta = fAnglePi - F_PI;
- rfXCorrection = +aSize.Width *rtl::math::cos( beta )/2.0
- -aSize.Height *rtl::math::sin( beta )/2.0; ;
- rfYCorrection = -aSize.Width *rtl::math::sin( beta )/2.0
- -aSize.Height *rtl::math::cos( beta );
- }
- else
- {
- rfXCorrection = -aSize.Width*rtl::math::cos( fAnglePi )/2.0
- +aSize.Height*rtl::math::sin( fAnglePi )/2.0;
- rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
- }
-}
-
-void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection
- , double fAnglePositiveDegree, const awt::Size& aSize )
-{
- //correct label positions below of an axis with top centered alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
- if( fAnglePositiveDegree==0.0 )
- {
- }
- else if( fAnglePositiveDegree<= 90.0 )
- {
- rfXCorrection = -aSize.Width *rtl::math::cos( fAnglePi )/2.0
- -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
- rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
- }
- else if( fAnglePositiveDegree<= 180.0 )
- {
- double beta = fAnglePi-F_PI/2.0;
- rfYCorrection = aSize.Width *rtl::math::cos( beta )/2.0
- +aSize.Height*rtl::math::sin( beta );
- rfXCorrection = aSize.Width *rtl::math::sin( beta )/2.0
- -aSize.Height*rtl::math::cos( beta )/2.0;
- }
- else if( fAnglePositiveDegree<= 270.0 )
- {
- double beta = 3*F_PI/2.0 - fAnglePi;
- rfXCorrection = -aSize.Width *rtl::math::sin( beta )/2.0
- +aSize.Height*rtl::math::cos( beta )/2.0;
- rfYCorrection = aSize.Height*rtl::math::sin( beta )
- +aSize.Width*rtl::math::cos( beta )/2.0;
- }
- else
- {
- double beta = 2*F_PI - fAnglePi;
- rfXCorrection = aSize.Height*rtl::math::sin( beta )/2.0
- +aSize.Width*rtl::math::cos( beta )/2.0;
- rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
- }
-}
-
-void lcl_correctPositionForRotation(
- const Reference< drawing::XShape >& xShape2DText
- , LabelAlignment eLabelAlignment
- , const double fRotationAngle )
-{
- if( !xShape2DText.is() )
- return;
-
- awt::Point aOldPos = xShape2DText->getPosition();
- awt::Size aSize = xShape2DText->getSize();
-
- double fYCorrection = 0.0;
- double fXCorrection = 0.0;
-
- double fAnglePositiveDegree = fRotationAngle;
- while(fAnglePositiveDegree<0.0)
- fAnglePositiveDegree+=360.0;
-
- switch(eLabelAlignment)
- {
- case LABEL_ALIGN_LEFT:
- case LABEL_ALIGN_LEFT_TOP:
- case LABEL_ALIGN_LEFT_BOTTOM:
- lcl_correctRotation_Left( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
- break;
- case LABEL_ALIGN_RIGHT:
- case LABEL_ALIGN_RIGHT_TOP:
- case LABEL_ALIGN_RIGHT_BOTTOM:
- lcl_correctRotation_Right( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
- break;
- case LABEL_ALIGN_TOP:
- lcl_correctRotation_Top( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
- break;
- case LABEL_ALIGN_BOTTOM:
- lcl_correctRotation_Bottom( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
- default: //LABEL_ALIGN_CENTER
- break;
- }
-
- xShape2DText->setPosition( awt::Point(
- static_cast<sal_Int32>(aOldPos.X + fXCorrection )
- , static_cast<sal_Int32>(aOldPos.Y + fYCorrection ) ) );
-}
-
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -299,9 +112,8 @@ Reference< drawing::XShape > createSingleLabel(
.createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation );
//correctPositionForRotation
- lcl_correctPositionForRotation( xShape2DText
- , rAxisProperties.m_aLabelAlignment
- , rAxisLabelProperties.fRotationAngleDegree );
+ LabelPositionHelper::correctPositionForRotation( xShape2DText
+ , rAxisProperties.m_aLabelAlignment, rAxisLabelProperties.fRotationAngleDegree, false );
return xShape2DText;
}
@@ -1424,9 +1236,8 @@ void SAL_CALL VCartesianAxis::updatePositions()
}
//correctPositionForRotation
- lcl_correctPositionForRotation( xShape2DText
- , m_aAxisProperties.m_aLabelAlignment
- , m_aAxisLabelProperties.fRotationAngleDegree );
+ LabelPositionHelper::correctPositionForRotation( xShape2DText
+ , m_aAxisProperties.m_aLabelAlignment, m_aAxisLabelProperties.fRotationAngleDegree, false );
}
}
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 1401ab43a159..0b1a17ca7701 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -89,7 +89,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
, m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder )
, m_nKeepAspectRatio(nKeepAspectRatio)
, m_aGivenAspectRatio(rAspectRatio)
- , m_eNanHandling( bCategoryXAxis ? NAN_AS_GAP : NAN_AS_INTERPOLATED )
, m_eCurveStyle(CurveStyle_LINES)
, m_nCurveResolution(20)
, m_nSplineOrder(3)
@@ -103,9 +102,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
PlotterBase::m_pPosHelper = m_pMainPosHelper;
VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
- if( m_bArea )
- m_eNanHandling = NAN_AS_ZERO;
-
try
{
if( m_xChartTypeModelProps.is() )
@@ -234,6 +230,12 @@ bool AreaChart::keepAspectRatio() const
void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
{
+ if( m_bArea && pSeries )
+ {
+ sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
+ if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
+ pSeries->setMissingValueTreatment( ::com::sun::star::chart::MissingValueTreatment::USE_ZERO );
+ }
if( m_nDimension == 3 && !m_bCategoryXAxis )
{
//3D xy always deep
@@ -351,9 +353,10 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
{
// do NOT connect last and first point, if one is NAN, and NAN handling is NAN_AS_GAP
- double fFirstY = pSeries->getY( 0 );
- double fLastY = pSeries->getY( VSeriesPlotter::getPointCount() - 1 );
- if( (m_eNanHandling != NAN_AS_GAP) || (::rtl::math::isFinite( fFirstY ) && ::rtl::math::isFinite( fLastY )) )
+ double fFirstY = pSeries->getYValue( 0 );
+ double fLastY = pSeries->getYValue( VSeriesPlotter::getPointCount() - 1 );
+ if( (pSeries->getMissingValueTreatment() != ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ || (::rtl::math::isFinite( fFirstY ) && ::rtl::math::isFinite( fLastY )) )
{
// connect last point in last polygon with first point in first polygon
::basegfx::B2DRectangle aScaledLogicClipDoubleRect( pPosHelper->getScaledLogicClipDoubleRect() );
@@ -573,13 +576,6 @@ void lcl_reorderSeries( ::std::vector< ::std::vector< VDataSeriesGroup > >& rZS
}//anonymous namespace
-void AreaChart::impl_maybeReplaceNanWithZero( double& rfValue )
-{
- if( m_eNanHandling == NAN_AS_ZERO &&
- ( ::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue) ) )
- rfValue = 0.0;
-}
-
//better performance for big data
struct FormerPoint
{
@@ -676,8 +672,7 @@ void AreaChart::createShapes()
pPosHelper = m_pMainPosHelper;
PlotterBase::m_pPosHelper = pPosHelper;
- double fAdd = pSeries->getY( nIndex );
- impl_maybeReplaceNanWithZero( fAdd );
+ double fAdd = pSeries->getYValue( nIndex );
if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) )
aLogicYSumMap[nAttachedAxisIndex] += fabs( fAdd );
}
@@ -709,23 +704,6 @@ void AreaChart::createShapes()
if(!pSeries)
continue;
- sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
- switch( nMissingValueTreatment )
- {
- case ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP:
- if( !m_bArea )
- m_eNanHandling = NAN_AS_GAP;
- break;
- case ::com::sun::star::chart::MissingValueTreatment::USE_ZERO:
- m_eNanHandling = NAN_AS_ZERO;
- break;
- case ::com::sun::star::chart::MissingValueTreatment::CONTINUE:
- m_eNanHandling = NAN_AS_INTERPOLATED;
- break;
- default:
- break;
- }
-
/* #i70133# ignore points outside of series length in standard area
charts. Stacked area charts will use missing points as zeros. In
standard charts, pSeriesList contains only one series. */
@@ -745,10 +723,8 @@ void AreaChart::createShapes()
(*aSeriesIter)->m_fLogicZPos = fLogicZ;
//collect data point information (logic coordinates, style ):
- double fLogicX = (*aSeriesIter)->getX(nIndex);
- double fLogicY = (*aSeriesIter)->getY(nIndex);
- impl_maybeReplaceNanWithZero( fLogicX );
- impl_maybeReplaceNanWithZero( fLogicY );
+ double fLogicX = (*aSeriesIter)->getXValue(nIndex);
+ double fLogicY = (*aSeriesIter)->getYValue(nIndex);
if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
fLogicY = fabs( fLogicY );
@@ -762,7 +738,7 @@ void AreaChart::createShapes()
|| ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY)
|| ::rtl::math::isNan(fLogicZ) || ::rtl::math::isInf(fLogicZ) )
{
- if( m_eNanHandling == NAN_AS_GAP )
+ if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
{
drawing::PolyPolygonShape3D& rPolygon = (*aSeriesIter)->m_aPolyPolygonShape3D;
sal_Int32& rIndex = (*aSeriesIter)->m_nPolygonIndex;
diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx
index 89790912893d..ec56d9e2390b 100644
--- a/chart2/source/view/charttypes/AreaChart.hxx
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -104,8 +104,6 @@ private: //methods
, ::com::sun::star::drawing::PolyPolygonShape3D* pSeriesPoly
, PlottingPositionHelper* pPosHelper );
- void impl_maybeReplaceNanWithZero( double& rfValue );
-
private: //member
PlottingPositionHelper* m_pMainPosHelper;
@@ -118,14 +116,6 @@ private: //member
sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic
::com::sun::star::drawing::Direction3D m_aGivenAspectRatio; //only used if nKeepAspectRatio==1
- enum tNanHandling
- {
- NAN_AS_ZERO,
- NAN_AS_GAP,
- NAN_AS_INTERPOLATED
- };
- tNanHandling m_eNanHandling;
-
//Properties for splines:
::com::sun::star::chart2::CurveStyle m_eCurveStyle;
sal_Int32 m_nCurveResolution;
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index baeac4a29cf1..41cef61561bb 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -45,7 +45,6 @@
#include "Clipping.hxx"
#include <com/sun/star/chart/DataLabelPlacement.hpp>
-#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
#include <tools/debug.hxx>
@@ -653,15 +652,10 @@ void BarChart::createShapes()
getSeriesGroupShape(*aSeriesIter, xSeriesTarget) );
//collect data point information (logic coordinates, style ):
- double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getX( nCatIndex ), fSlotX );
- double fLogicBarHeight = (*aSeriesIter)->getY( nCatIndex );
+ double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getXValue( nCatIndex ), fSlotX );
+ double fLogicBarHeight = (*aSeriesIter)->getYValue( nCatIndex );
if( ::rtl::math::isNan( fLogicBarHeight )) //no value at this category
- {
- if( pSeries->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::USE_ZERO )
- fLogicBarHeight = 0.0;
- else
- continue;
- }
+ continue;
double fLogicValueForLabeDisplay = fLogicBarHeight;
fLogicBarHeight-=fBaseValue;
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
new file mode 100644
index 000000000000..b63603ef403a
--- /dev/null
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -0,0 +1,420 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "BubbleChart.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "ObjectIdentifier.hxx"
+#include "Splines.hxx"
+#include "LabelPositionHelper.hxx"
+#include "Clipping.hxx"
+#include "Stripe.hxx"
+
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <tools/debug.hxx>
+#include <svx/unoprnms.hxx>
+#include <rtl/math.hxx>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::rtl::math;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+BubbleChart::BubbleChart( const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount )
+ : VSeriesPlotter( xChartTypeModel, nDimensionCount, false )
+ , m_bShowNegativeValues(false)
+ , m_bBubbleSizeAsArea(true)
+ , m_fBubbleSizeScaling(1.0)
+ , m_fMaxLogicBubbleSize( 0.0 )
+ , m_fBubbleSizeFactorToScreen( 1.0 )
+{
+ if( !m_pMainPosHelper )
+ m_pMainPosHelper = new PlottingPositionHelper();
+ PlotterBase::m_pPosHelper = m_pMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
+}
+
+BubbleChart::~BubbleChart()
+{
+ delete m_pMainPosHelper;
+}
+
+void BubbleChart::calculateMaximumLogicBubbleSize()
+{
+ double fMaxSize = 0.0;
+
+ sal_Int32 nStartIndex = 0;
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ double fSize = pSeries->getBubble_Size( nIndex );
+ if( m_bShowNegativeValues )
+ fSize = abs(fSize);
+ if( fSize > fMaxSize )
+ fMaxSize = fSize;
+ }
+ }
+ }
+ }
+
+ m_fMaxLogicBubbleSize = fMaxSize;
+}
+
+void BubbleChart::calculateBubbleSizeScalingFactor()
+{
+ double fLogicZ=0.5;
+ drawing::Position3D aSceneMinPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMinX(),m_pMainPosHelper->getLogicMinY(),fLogicZ, false ) );
+ drawing::Position3D aSceneMaxPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMaxX(),m_pMainPosHelper->getLogicMaxY(),fLogicZ, false ) );
+
+ awt::Point aScreenMinPos( LabelPositionHelper(m_pMainPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMinPos ) );
+ awt::Point aScreenMaxPos( LabelPositionHelper(m_pMainPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMaxPos ) );
+
+ sal_Int32 nWidth = abs( aScreenMaxPos.X - aScreenMinPos.X );
+ sal_Int32 nHeight = abs( aScreenMaxPos.Y - aScreenMinPos.Y );
+
+ sal_Int32 nMinExtend = std::min( nWidth, nHeight );
+ m_fBubbleSizeFactorToScreen = nMinExtend * 0.25;//max bubble size is 25 percent of diagram size
+}
+
+drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize )
+{
+ drawing::Direction3D aRet(0,0,0);
+
+ if( ::rtl::math::isNan(fLogicSize) || ::rtl::math::isInf(fLogicSize) )
+ return aRet;
+
+ if( m_bShowNegativeValues )
+ fLogicSize = abs(fLogicSize);
+
+ double fMaxSize = m_fMaxLogicBubbleSize;
+
+ double fMaxRadius = fMaxSize;
+ double fRaduis = fLogicSize;
+ if( m_bBubbleSizeAsArea )
+ {
+ fMaxRadius = sqrt( fMaxSize / F_PI );
+ fRaduis = sqrt( fLogicSize / F_PI );
+ }
+
+ aRet.DirectionX = m_fBubbleSizeScaling * m_fBubbleSizeFactorToScreen * fRaduis / fMaxRadius;
+ aRet.DirectionY = aRet.DirectionX;
+
+ return aRet;
+}
+
+bool BubbleChart::isExpandIfValuesCloseToBorder( sal_Int32 /*nDimensionIndex*/ )
+{
+ return true;
+}
+
+bool BubbleChart::isSeperateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ )
+{
+ return false;
+}
+
+//-----------------------------------------------------------------
+
+LegendSymbolStyle BubbleChart::getLegendSymbolStyle()
+{
+ return chart2::LegendSymbolStyle_CIRCLE;
+}
+
+drawing::Direction3D BubbleChart::getPreferredDiagramAspectRatio() const
+{
+ return drawing::Direction3D(-1,-1,-1);
+}
+
+void BubbleChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
+{
+ VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
+}
+
+//better performance for big data
+struct FormerPoint
+{
+ FormerPoint( double fX, double fY, double fZ )
+ : m_fX(fX), m_fY(fY), m_fZ(fZ)
+ {}
+ FormerPoint()
+ {
+ ::rtl::math::setNan( &m_fX );
+ ::rtl::math::setNan( &m_fY );
+ ::rtl::math::setNan( &m_fZ );
+ }
+
+ double m_fX;
+ double m_fY;
+ double m_fZ;
+};
+
+void BubbleChart::createShapes()
+{
+ if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ return;
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"BubbleChart is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return;
+
+ //therefore create an own group for the texts and the error bars to move them to front
+ //(because the text group is created after the series group the texts are displayed on top)
+ uno::Reference< drawing::XShapes > xSeriesTarget(
+ createGroupShape( m_xLogicTarget,rtl::OUString() ));
+ uno::Reference< drawing::XShapes > xTextTarget(
+ m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
+
+ //update/create information for current group
+ double fLogicZ = 0.5;//as defined
+
+ sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ if(nEndIndex<=0)
+ nEndIndex=1;
+
+ //better performance for big data
+ std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
+ m_bPointsWereSkipped = false;
+ sal_Int32 nSkippedPoints = 0;
+ sal_Int32 nCreatedPoints = 0;
+ //
+
+ calculateMaximumLogicBubbleSize();
+ calculateBubbleSizeScalingFactor();
+ if( m_fMaxLogicBubbleSize <= 0 || m_fBubbleSizeFactorToScreen <= 0 )
+ return;
+
+//=============================================================================
+ //iterate through all x values per indices
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+
+ aZSlotIter = m_aZSlots.begin();
+ for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ aXSlotIter = aZSlotIter->begin();
+ for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; aXSlotIter++, nX++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ //=============================================================================
+ //iterate through all series
+ for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; aSeriesIter++, nSeriesIndex++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(*aSeriesIter, xSeriesTarget);
+
+ sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
+ PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ if(m_nDimension==3)
+ fLogicZ = nZ+0.5;
+
+ //collect data point information (logic coordinates, style ):
+ double fLogicX = pSeries->getXValue(nIndex);
+ double fLogicY = pSeries->getYValue(nIndex);
+ double fBubbleSize = pSeries->getBubble_Size( nIndex );
+
+ if( !m_bShowNegativeValues && fBubbleSize<0.0 )
+ continue;
+
+ if( ::rtl::math::approxEqual( fBubbleSize, 0.0 ) || ::rtl::math::isNan(fBubbleSize) )
+ continue;
+
+ if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
+ || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) )
+ continue;
+
+ bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
+
+ drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
+ drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
+ pPosHelper->doLogicScaling( aScaledLogicPosition );
+
+ //transformation 3) -> 4)
+ drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
+
+ //better performance for big data
+ FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
+ pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
+ if( !pSeries->isAttributedDataPoint(nIndex)
+ &&
+ pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
+ , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
+ {
+ nSkippedPoints++;
+ m_bPointsWereSkipped = true;
+ continue;
+ }
+ aSeriesFormerPointMap[pSeries] = FormerPoint(aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ);
+
+ //create a single datapoint if point is visible
+ if( !bIsVisible )
+ continue;
+
+ //create a group shape for this point and add to the series shape:
+ rtl::OUString aPointCID = ObjectIdentifier::createPointCID(
+ pSeries->getPointCID_Stub(), nIndex );
+ uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
+ createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
+ uno::Reference<drawing::XShape> xPointGroupShape_Shape =
+ uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
+
+ {
+ nCreatedPoints++;
+
+ //create data point
+ drawing::Direction3D aSymbolSize = transformToScreenBubbleSize( fBubbleSize );
+ if(m_nDimension!=3)
+ {
+ uno::Reference<drawing::XShape> xShape;
+ xShape = m_pShapeFactory->createCircle2D( xPointGroupShape_Shapes
+ , aScenePosition, aSymbolSize );
+
+ this->setMappedProperties( xShape
+ , pSeries->getPropertiesOfPoint( nIndex )
+ , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+
+ //create data point label
+ if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
+ {
+ LabelAlignment eAlignment = LABEL_ALIGN_TOP;
+ drawing::Position3D aScenePosition3D( aScenePosition.PositionX
+ , aScenePosition.PositionY
+ , aScenePosition.PositionZ+this->getTransformedDepth() );
+
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
+
+ switch(nLabelPlacement)
+ {
+ case ::com::sun::star::chart::DataLabelPlacement::TOP:
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
+ aScenePosition3D.PositionY += (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_BOTTOM;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::LEFT:
+ aScenePosition3D.PositionX -= (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_LEFT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
+ aScenePosition3D.PositionX += (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_RIGHT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::CENTER:
+ eAlignment = LABEL_ALIGN_CENTER;
+ break;
+ default:
+ DBG_ERROR("this label alignment is not implemented yet");
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ }
+
+
+ awt::Point aScreenPosition2D( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ .transformSceneToScreenPosition( aScenePosition3D ) );
+ sal_Int32 nOffset = 0;
+ if(LABEL_ALIGN_CENTER!=eAlignment)
+ nOffset = 100;//add some spacing //@todo maybe get more intelligent values
+ this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
+ , fBubbleSize, fBubbleSize, aScreenPosition2D, eAlignment, nOffset );
+ }
+ }
+
+ //remove PointGroupShape if empty
+ if(!xPointGroupShape_Shapes->getCount())
+ xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
+
+ }//next series in x slot (next y slot)
+ }//next x slot
+ }//next z slot
+ }//next category
+//=============================================================================
+//=============================================================================
+//=============================================================================
+ OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< area chart :: createShapes():: skipped points: %d created points: %d", nSkippedPoints, nCreatedPoints );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/BubbleChart.hxx b/chart2/source/view/charttypes/BubbleChart.hxx
new file mode 100644
index 000000000000..4771a4cccee3
--- /dev/null
+++ b/chart2/source/view/charttypes/BubbleChart.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ,v $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_BUBBLECHART_HXX
+#define _CHART2_BUBBLECHART_HXX
+
+#include "VSeriesPlotter.hxx"
+#include <com/sun/star/drawing/Direction3D.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class BubbleChart : public VSeriesPlotter
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ BubbleChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount );
+ virtual ~BubbleChart();
+
+ //-------------------------------------------------------------------------
+ // chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ virtual void SAL_CALL createShapes();
+
+ virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
+
+ //-------------------
+ virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
+
+ //-------------------------------------------------------------------------
+ // MinimumAndMaximumSupplier
+ //-------------------------------------------------------------------------
+ virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+
+ //-------------------------------------------------------------------------
+
+ virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle();
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+private: //methods
+ //no default constructor
+ BubbleChart();
+
+ void calculateMaximumLogicBubbleSize();
+ void calculateBubbleSizeScalingFactor();
+
+ com::sun::star::drawing::Direction3D transformToScreenBubbleSize( double fLogicSize );
+
+private: //member
+
+ bool m_bShowNegativeValues;//input parameter
+ bool m_bBubbleSizeAsArea;//input parameter
+ double m_fBubbleSizeScaling;//input parameter
+
+ double m_fMaxLogicBubbleSize;//calculated values
+ double m_fBubbleSizeFactorToScreen;//calculated values
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx
index 46fdf3d8f04d..e19a44cdcda6 100644
--- a/chart2/source/view/charttypes/CandleStickChart.cxx
+++ b/chart2/source/view/charttypes/CandleStickChart.cxx
@@ -250,7 +250,7 @@ void CandleStickChart::createShapes()
for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
{
//collect data point information (logic coordinates, style ):
- double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getX( nIndex ), fSlotX );
+ 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 );
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 7759f3110cbd..608adb49290b 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -376,7 +376,7 @@ void PieChart::createShapes()
sal_Int32 nPointCount=pSeries->getTotalPointCount();
for( nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++ )
{
- double fY = pSeries->getY( nPointIndex );
+ double fY = pSeries->getYValue( nPointIndex );
if(fY<0.0)
{
//@todo warn somehow that negative values are treated as positive
@@ -402,7 +402,7 @@ void PieChart::createShapes()
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries, xSeriesTarget);
//collect data point information (logic coordinates, style ):
- double fLogicYValue = fabs(pSeries->getY( nPointIndex ));
+ double fLogicYValue = fabs(pSeries->getYValue( nPointIndex ));
if( ::rtl::math::isNan(fLogicYValue) )
continue;
if(fLogicYValue==0.0)//@todo: continue also if the resolution to small
diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
index a684b9a3228e..6d37d7444868 100644
--- a/chart2/source/view/charttypes/Splines.cxx
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -318,108 +318,133 @@ void SplineCalculater::CalculateCubicSplines(
, sal_Int32 nGranularity )
{
DBG_ASSERT( nGranularity > 0, "Granularity is invalid" );
+
rResult.SequenceX.realloc(0);
rResult.SequenceY.realloc(0);
rResult.SequenceZ.realloc(0);
- if( !rInput.SequenceX.getLength() )
+ sal_Int32 nOuterCount = rInput.SequenceX.getLength();
+ if( !nOuterCount )
return;
- if( rInput.SequenceX[0].getLength() <= 1 )
- return; //we need at least two points
-
- sal_Int32 nMaxIndexPoints = rInput.SequenceX[0].getLength()-1; // is >=1
- const double* pOldX = rInput.SequenceX[0].getConstArray();
- const double* pOldY = rInput.SequenceY[0].getConstArray();
- const double* pOldZ = rInput.SequenceZ[0].getConstArray();
-
- // #i13699# The curve gets a parameter and then for each coordinate a
- // separate spline will be calculated using the parameter as first argument
- // and the point coordinate as second argument. Therefore the points need
- // not to be sorted in its x-coordinates. The parameter is sorted by
- // construction.
-
- ::std::vector < double > aParameter(nMaxIndexPoints+1);
- aParameter[0]=0.0;
- for( sal_Int32 nIndex=1; nIndex<=nMaxIndexPoints; nIndex++ )
- {
- // The euclidian distance leads to curve loops for functions having single extreme points
-// aParameter[nIndex]=aParameter[nIndex-1]+
-// sqrt( (pOldX[nIndex]-pOldX[nIndex-1])*(pOldX[nIndex]-pOldX[nIndex-1])+
-// (pOldY[nIndex]-pOldY[nIndex-1])*(pOldY[nIndex]-pOldY[nIndex-1])+
-// (pOldZ[nIndex]-pOldZ[nIndex-1])*(pOldZ[nIndex]-pOldZ[nIndex-1]));
-
- // use increment of 1 instead
- aParameter[nIndex]=aParameter[nIndex-1]+1;
- }
- // Split the calculation to X, Y and Z coordinate
- tPointVecType aInputX;
- aInputX.resize(nMaxIndexPoints+1);
- tPointVecType aInputY;
- aInputY.resize(nMaxIndexPoints+1);
- tPointVecType aInputZ;
- aInputZ.resize(nMaxIndexPoints+1);
- for (sal_Int32 nN=0;nN<=nMaxIndexPoints; nN++ )
- {
- aInputX[ nN ].first=aParameter[nN];
- aInputX[ nN ].second=pOldX[ nN ];
- aInputY[ nN ].first=aParameter[nN];
- aInputY[ nN ].second=pOldY[ nN ];
- aInputZ[ nN ].first=aParameter[nN];
- aInputZ[ nN ].second=pOldZ[ nN ];
- }
- // generate a spline for each coordinate. It holds the complete
- // information to calculate each point of the curve
-
- // generate the kind "natural spline"
- double fInfty;
- ::rtl::math::setInf( &fInfty, sal_False );
- lcl_SplineCalculation aSplineX( aInputX, fInfty, fInfty );
- lcl_SplineCalculation aSplineY( aInputY, fInfty, fInfty );
- lcl_SplineCalculation aSplineZ( aInputZ, fInfty, fInfty );
-
- // fill result polygon with calculated values
- rResult.SequenceX.realloc(1);
- rResult.SequenceY.realloc(1);
- rResult.SequenceZ.realloc(1);
- rResult.SequenceX[0].realloc( nMaxIndexPoints*nGranularity + 1);
- rResult.SequenceY[0].realloc( nMaxIndexPoints*nGranularity + 1);
- rResult.SequenceZ[0].realloc( nMaxIndexPoints*nGranularity + 1);
-
- double* pNewX = rResult.SequenceX[0].getArray();
- double* pNewY = rResult.SequenceY[0].getArray();
- double* pNewZ = rResult.SequenceZ[0].getArray();
-
- sal_Int32 nNewPointIndex = 0; // Index in result points
- // needed for inner loop
- double fInc; // step for intermediate points
- sal_Int32 nj; // for loop
- double fParam; // a intermediate parameter value
-
- for( sal_Int32 ni = 0; ni < nMaxIndexPoints; ni++ )
- {
- // given point is surely a curve point
- pNewX[nNewPointIndex] = pOldX[ni];
- pNewY[nNewPointIndex] = pOldY[ni];
- pNewZ[nNewPointIndex] = pOldZ[ni];
- nNewPointIndex++;
-
- // calculate intermediate points
- fInc = ( aParameter[ ni+1 ] - aParameter[ni] ) / static_cast< double >( nGranularity );
- for(nj = 1; nj < nGranularity; nj++)
+ rResult.SequenceX.realloc(nOuterCount);
+ rResult.SequenceY.realloc(nOuterCount);
+ rResult.SequenceZ.realloc(nOuterCount);
+
+ for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
+ {
+ if( rInput.SequenceX[nOuter].getLength() <= 1 )
+ continue; //we need at least two points
+
+ sal_Int32 nMaxIndexPoints = rInput.SequenceX[nOuter].getLength()-1; // is >=1
+ const double* pOldX = rInput.SequenceX[nOuter].getConstArray();
+ const double* pOldY = rInput.SequenceY[nOuter].getConstArray();
+ const double* pOldZ = rInput.SequenceZ[nOuter].getConstArray();
+
+ // #i13699# The curve gets a parameter and then for each coordinate a
+ // separate spline will be calculated using the parameter as first argument
+ // and the point coordinate as second argument. Therefore the points need
+ // not to be sorted in its x-coordinates. The parameter is sorted by
+ // construction.
+
+ ::std::vector < double > aParameter(nMaxIndexPoints+1);
+ aParameter[0]=0.0;
+ for( sal_Int32 nIndex=1; nIndex<=nMaxIndexPoints; nIndex++ )
+ {
+ // The euclidian distance leads to curve loops for functions having single extreme points
+ //aParameter[nIndex]=aParameter[nIndex-1]+
+ //sqrt( (pOldX[nIndex]-pOldX[nIndex-1])*(pOldX[nIndex]-pOldX[nIndex-1])+
+ //(pOldY[nIndex]-pOldY[nIndex-1])*(pOldY[nIndex]-pOldY[nIndex-1])+
+ //(pOldZ[nIndex]-pOldZ[nIndex-1])*(pOldZ[nIndex]-pOldZ[nIndex-1]));
+
+ // use increment of 1 instead
+ aParameter[nIndex]=aParameter[nIndex-1]+1;
+ }
+ // Split the calculation to X, Y and Z coordinate
+ tPointVecType aInputX;
+ aInputX.resize(nMaxIndexPoints+1);
+ tPointVecType aInputY;
+ aInputY.resize(nMaxIndexPoints+1);
+ tPointVecType aInputZ;
+ aInputZ.resize(nMaxIndexPoints+1);
+ for (sal_Int32 nN=0;nN<=nMaxIndexPoints; nN++ )
{
- fParam = aParameter[ni] + ( fInc * static_cast< double >( nj ) );
+ aInputX[ nN ].first=aParameter[nN];
+ aInputX[ nN ].second=pOldX[ nN ];
+ aInputY[ nN ].first=aParameter[nN];
+ aInputY[ nN ].second=pOldY[ nN ];
+ aInputZ[ nN ].first=aParameter[nN];
+ aInputZ[ nN ].second=pOldZ[ nN ];
+ }
- pNewX[nNewPointIndex]=aSplineX.GetInterpolatedValue( fParam );
- pNewY[nNewPointIndex]=aSplineY.GetInterpolatedValue( fParam );
- pNewZ[nNewPointIndex]=aSplineZ.GetInterpolatedValue( fParam );
+ // generate a spline for each coordinate. It holds the complete
+ // information to calculate each point of the curve
+ double fXDerivation;
+ double fYDerivation;
+ double fZDerivation;
+ if( pOldX[ 0 ] == pOldX[nMaxIndexPoints] &&
+ pOldY[ 0 ] == pOldY[nMaxIndexPoints] &&
+ pOldZ[ 0 ] == pOldZ[nMaxIndexPoints] )
+ {
+ // #i101050# avoid a corner in closed lines, which are smoothed by spline
+ // This derivation are special for parameter of kind 0,1,2,3... If you
+ // change generating parameters (see above), then adapt derivations too.)
+ fXDerivation = 0.5 * (pOldX[1]-pOldX[nMaxIndexPoints-1]);
+ fYDerivation = 0.5 * (pOldY[1]-pOldY[nMaxIndexPoints-1]);
+ fZDerivation = 0.5 * (pOldZ[1]-pOldZ[nMaxIndexPoints-1]);
+ }
+ else // generate the kind "natural spline"
+ {
+ double fInfty;
+ ::rtl::math::setInf( &fInfty, sal_False );
+ fXDerivation = fInfty;
+ fYDerivation = fInfty;
+ fZDerivation = fInfty;
+ }
+ lcl_SplineCalculation aSplineX( aInputX, fXDerivation, fXDerivation );
+ lcl_SplineCalculation aSplineY( aInputY, fYDerivation, fYDerivation );
+ lcl_SplineCalculation aSplineZ( aInputZ, fZDerivation, fZDerivation );
+
+ // fill result polygon with calculated values
+ rResult.SequenceX[nOuter].realloc( nMaxIndexPoints*nGranularity + 1);
+ rResult.SequenceY[nOuter].realloc( nMaxIndexPoints*nGranularity + 1);
+ rResult.SequenceZ[nOuter].realloc( nMaxIndexPoints*nGranularity + 1);
+
+ double* pNewX = rResult.SequenceX[nOuter].getArray();
+ double* pNewY = rResult.SequenceY[nOuter].getArray();
+ double* pNewZ = rResult.SequenceZ[nOuter].getArray();
+
+ sal_Int32 nNewPointIndex = 0; // Index in result points
+ // needed for inner loop
+ double fInc; // step for intermediate points
+ sal_Int32 nj; // for loop
+ double fParam; // a intermediate parameter value
+
+ for( sal_Int32 ni = 0; ni < nMaxIndexPoints; ni++ )
+ {
+ // given point is surely a curve point
+ pNewX[nNewPointIndex] = pOldX[ni];
+ pNewY[nNewPointIndex] = pOldY[ni];
+ pNewZ[nNewPointIndex] = pOldZ[ni];
nNewPointIndex++;
+
+ // calculate intermediate points
+ fInc = ( aParameter[ ni+1 ] - aParameter[ni] ) / static_cast< double >( nGranularity );
+ for(nj = 1; nj < nGranularity; nj++)
+ {
+ fParam = aParameter[ni] + ( fInc * static_cast< double >( nj ) );
+
+ pNewX[nNewPointIndex]=aSplineX.GetInterpolatedValue( fParam );
+ pNewY[nNewPointIndex]=aSplineY.GetInterpolatedValue( fParam );
+ pNewZ[nNewPointIndex]=aSplineZ.GetInterpolatedValue( fParam );
+ nNewPointIndex++;
+ }
}
+ // add last point
+ pNewX[nNewPointIndex] = pOldX[nMaxIndexPoints];
+ pNewY[nNewPointIndex] = pOldY[nMaxIndexPoints];
+ pNewZ[nNewPointIndex] = pOldZ[nMaxIndexPoints];
}
- // add last point
- pNewX[nNewPointIndex] = pOldX[nMaxIndexPoints];
- pNewY[nNewPointIndex] = pOldY[nMaxIndexPoints];
- pNewZ[nNewPointIndex] = pOldZ[nMaxIndexPoints];
}
void SplineCalculater::CalculateBSplines(
@@ -436,80 +461,85 @@ void SplineCalculater::CalculateBSplines(
rResult.SequenceY.realloc(0);
rResult.SequenceZ.realloc(0);
- if( !rInput.SequenceX.getLength() )
+ sal_Int32 nOuterCount = rInput.SequenceX.getLength();
+ if( !nOuterCount )
return; // no input
- if( rInput.SequenceX[0].getLength() <= 1 )
- return; // need at least 2 control points
-
- sal_Int32 n = rInput.SequenceX[0].getLength()-1; // maximum index of control points
-
- double fCurveparam =0.0; // parameter for the curve
- // 0<= fCurveparam < fMaxCurveparam
- double fMaxCurveparam = 2.0+ n - k;
- if (fMaxCurveparam <= 0.0)
- return; // not enough control points for desired spline order
-
- if (nGranularity < 1)
- return; //need at least 1 line for each part beween the control points
-
- const double* pOldX = rInput.SequenceX[0].getConstArray();
- const double* pOldY = rInput.SequenceY[0].getConstArray();
- const double* pOldZ = rInput.SequenceZ[0].getConstArray();
-
- // keep this amount of steps to go well with old version
- sal_Int32 nNewSectorCount = nGranularity * n;
- double fCurveStep = fMaxCurveparam/static_cast< double >(nNewSectorCount);
-
- double *b = new double [n + k + 1]; // values of blending functions
-
- const double* t = createTVector(n, k); // knot vector
-
- rResult.SequenceX.realloc(1);
- rResult.SequenceY.realloc(1);
- rResult.SequenceZ.realloc(1);
- rResult.SequenceX[0].realloc(nNewSectorCount+1);
- rResult.SequenceY[0].realloc(nNewSectorCount+1);
- rResult.SequenceZ[0].realloc(nNewSectorCount+1);
- double* pNewX = rResult.SequenceX[0].getArray();
- double* pNewY = rResult.SequenceY[0].getArray();
- double* pNewZ = rResult.SequenceZ[0].getArray();
-
- // variables needed inside loop, when calculating one point of output
- sal_Int32 nPointIndex =0; //index of given contol points
- double fX=0.0;
- double fY=0.0;
- double fZ=0.0; //coordinates of a new BSpline point
-
- for(sal_Int32 nNewSector=0; nNewSector<nNewSectorCount; nNewSector++)
- { // in first looping fCurveparam has value 0.0
-
- // Calculate the values of the blending functions for actual curve parameter
- BVector(fCurveparam, n, k, b, t);
-
- // output point(fCurveparam) = sum over {input point * value of blending function}
- fX = 0.0;
- fY = 0.0;
- fZ = 0.0;
- for (nPointIndex=0;nPointIndex<=n;nPointIndex++)
- {
- fX +=pOldX[nPointIndex]*b[nPointIndex];
- fY +=pOldY[nPointIndex]*b[nPointIndex];
- fZ +=pOldZ[nPointIndex]*b[nPointIndex];
+ rResult.SequenceX.realloc(nOuterCount);
+ rResult.SequenceY.realloc(nOuterCount);
+ rResult.SequenceZ.realloc(nOuterCount);
+
+ for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
+ {
+ if( rInput.SequenceX[nOuter].getLength() <= 1 )
+ continue; // need at least 2 control points
+
+ sal_Int32 n = rInput.SequenceX[nOuter].getLength()-1; // maximum index of control points
+
+ double fCurveparam =0.0; // parameter for the curve
+ // 0<= fCurveparam < fMaxCurveparam
+ double fMaxCurveparam = 2.0+ n - k;
+ if (fMaxCurveparam <= 0.0)
+ return; // not enough control points for desired spline order
+
+ if (nGranularity < 1)
+ return; //need at least 1 line for each part beween the control points
+
+ const double* pOldX = rInput.SequenceX[nOuter].getConstArray();
+ const double* pOldY = rInput.SequenceY[nOuter].getConstArray();
+ const double* pOldZ = rInput.SequenceZ[nOuter].getConstArray();
+
+ // keep this amount of steps to go well with old version
+ sal_Int32 nNewSectorCount = nGranularity * n;
+ double fCurveStep = fMaxCurveparam/static_cast< double >(nNewSectorCount);
+
+ double *b = new double [n + k + 1]; // values of blending functions
+
+ const double* t = createTVector(n, k); // knot vector
+
+ rResult.SequenceX[nOuter].realloc(nNewSectorCount+1);
+ rResult.SequenceY[nOuter].realloc(nNewSectorCount+1);
+ rResult.SequenceZ[nOuter].realloc(nNewSectorCount+1);
+ double* pNewX = rResult.SequenceX[nOuter].getArray();
+ double* pNewY = rResult.SequenceY[nOuter].getArray();
+ double* pNewZ = rResult.SequenceZ[nOuter].getArray();
+
+ // variables needed inside loop, when calculating one point of output
+ sal_Int32 nPointIndex =0; //index of given contol points
+ double fX=0.0;
+ double fY=0.0;
+ double fZ=0.0; //coordinates of a new BSpline point
+
+ for(sal_Int32 nNewSector=0; nNewSector<nNewSectorCount; nNewSector++)
+ { // in first looping fCurveparam has value 0.0
+
+ // Calculate the values of the blending functions for actual curve parameter
+ BVector(fCurveparam, n, k, b, t);
+
+ // output point(fCurveparam) = sum over {input point * value of blending function}
+ fX = 0.0;
+ fY = 0.0;
+ fZ = 0.0;
+ for (nPointIndex=0;nPointIndex<=n;nPointIndex++)
+ {
+ fX +=pOldX[nPointIndex]*b[nPointIndex];
+ fY +=pOldY[nPointIndex]*b[nPointIndex];
+ fZ +=pOldZ[nPointIndex]*b[nPointIndex];
+ }
+ pNewX[nNewSector] = fX;
+ pNewY[nNewSector] = fY;
+ pNewZ[nNewSector] = fZ;
+
+ fCurveparam += fCurveStep; //for next looping
}
- pNewX[nNewSector] = fX;
- pNewY[nNewSector] = fY;
- pNewZ[nNewSector] = fZ;
+ // add last control point to BSpline curve
+ pNewX[nNewSectorCount] = pOldX[n];
+ pNewY[nNewSectorCount] = pOldY[n];
+ pNewZ[nNewSectorCount] = pOldZ[n];
- fCurveparam += fCurveStep; //for next looping
+ delete[] t;
+ delete[] b;
}
- // add last control point to BSpline curve
- pNewX[nNewSectorCount] = pOldX[n];
- pNewY[nNewSectorCount] = pOldY[n];
- pNewZ[nNewSectorCount] = pOldZ[n];
-
- delete[] t;
- delete[] b;
}
//.............................................................................
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 1f37ae7c3aea..73fa9039bf44 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -61,6 +61,7 @@
#include "PieChart.hxx"
#include "AreaChart.hxx"
#include "CandleStickChart.hxx"
+#include "BubbleChart.hxx"
//
#include <com/sun/star/chart/ErrorBarStyle.hpp>
@@ -76,6 +77,8 @@
#include <basegfx/vector/b2dvector.hxx>
#include <com/sun/star/util/XCloneable.hpp>
+#include <svx/unoshape.hxx>
+
#include <functional>
//.............................................................................
@@ -116,13 +119,6 @@ VDataSeriesGroup::VDataSeriesGroup( VDataSeries* pSeries )
{
}
-VDataSeriesGroup::VDataSeriesGroup( const ::std::vector< VDataSeries* >& rSeriesVector )
- : m_aSeriesVector(rSeriesVector)
- , m_bMaxPointCountDirty(true)
- , m_nMaxPointCount(0)
- , m_aListOfCachedYValues()
-{
-}
VDataSeriesGroup::~VDataSeriesGroup()
{
}
@@ -394,7 +390,7 @@ OUString VSeriesPlotter::getLabelTextForValue( VDataSeries& rDataSeries
}
else
{
- if( m_aAxesNumberFormats.hasFormat(1,rDataSeries.getAttachedAxisIndex()) ) //y-axis
+ if( rDataSeries.shouldLabelNumberFormatKeyBeDetectedFromYAxis() && m_aAxesNumberFormats.hasFormat(1,rDataSeries.getAttachedAxisIndex()) ) //y-axis
nNumberFormatKey = m_aAxesNumberFormats.getFormat(1,rDataSeries.getAttachedAxisIndex());
else
nNumberFormatKey = rDataSeries.detectNumberFormatKey( nPointIndex );
@@ -465,11 +461,15 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
//prepare text
::rtl::OUStringBuffer aText;
::rtl::OUString aSeparator(sal_Unicode(' '));
+ double fRotationDegrees = 0.0;
try
{
uno::Reference< beans::XPropertySet > xPointProps( rDataSeries.getPropertiesOfPoint( nPointIndex ) );
if(xPointProps.is())
+ {
xPointProps->getPropertyValue( C2U( "LabelSeparator" ) ) >>= aSeparator;
+ xPointProps->getPropertyValue( C2U( "TextRotation" ) ) >>= fRotationDegrees;
+ }
}
catch( uno::Exception& e )
{
@@ -537,8 +537,21 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
createText( xTarget_, aText.makeStringAndClear()
, *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) );
+ const awt::Point aUnrotatedTextPos( xTextShape->getPosition() );
+ if( fRotationDegrees != 0.0 )
+ {
+ const double fDegreesPi( fRotationDegrees * ( F_PI / -180.0 ) );
+ uno::Reference< beans::XPropertySet > xProp( xTextShape, uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U( "Transformation" ), ShapeFactory::makeTransformation( aScreenPosition2D, fDegreesPi ) );
+ LabelPositionHelper::correctPositionForRotation( xTextShape, eAlignment, fRotationDegrees, true /*bRotateAroundCenter*/ );
+ }
+
if( xSymbol.is() && xTextShape.is() )
{
+ const awt::Point aOldTextPos( xTextShape->getPosition() );
+ awt::Point aNewTextPos( aOldTextPos );
+
awt::Size aSymbolSize( xSymbol->getSize() );
awt::Size aTextSize( xTextShape->getSize() );
@@ -550,7 +563,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
aSymbolSize.Width = nXDiff * 75/100;
aSymbolSize.Height = nYDiff * 75/100;
- awt::Point aSymbolPosition( xTextShape->getPosition() );
+ awt::Point aSymbolPosition( aUnrotatedTextPos );
aSymbolPosition.Y += (nYDiff * 25/200);
if(LABEL_ALIGN_LEFT==eAlignment
@@ -563,39 +576,21 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
|| LABEL_ALIGN_RIGHT_TOP==eAlignment
|| LABEL_ALIGN_RIGHT_BOTTOM==eAlignment )
{
- aScreenPosition2D.X += nXDiff;
+ aNewTextPos.X += nXDiff;
}
else if(LABEL_ALIGN_TOP==eAlignment
|| LABEL_ALIGN_BOTTOM==eAlignment
|| LABEL_ALIGN_CENTER==eAlignment )
{
aSymbolPosition.X -= nXDiff/2;
- aScreenPosition2D.X += nXDiff/2;
+ aNewTextPos.X += nXDiff/2;
}
xSymbol->setSize( aSymbolSize );
xSymbol->setPosition( aSymbolPosition );
- /*
- ::basegfx::B2DHomMatrix aM;
- //As autogrow is active the rectangle is automatically expanded to that side
- //to which the text is not adjusted.
- aM.scale( aSymbolSize.Width, aSymbolSize.Height );
- aM.translate( aSymbolPosition.X, aSymbolPosition.Y );
- uno::Any aATransformation( uno::makeAny( B2DHomMatrixToHomogenMatrix3(aM) ) );
-
- //set position
- uno::Reference< beans::XPropertySet > xSymbolProp( xSymbol, uno::UNO_QUERY );
- if( xSymbolProp.is() )
- {
- xSymbolProp->setPropertyValue( C2U( "Transformation" ), aATransformation );
- }
- */
-
//set position
- uno::Reference< beans::XPropertySet > xProp( xTextShape, uno::UNO_QUERY );
- if( xProp.is() )
- xProp->setPropertyValue( C2U( "Transformation" ), ShapeFactory::makeTransformation( aScreenPosition2D ) );
+ xTextShape->setPosition( aNewTextPos );
}
}
catch( uno::Exception& e )
@@ -1415,7 +1410,7 @@ void VDataSeriesGroup::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaxi
sal_Int32 nPointCount = (*aSeriesIter)->getTotalPointCount();
for(sal_Int32 nN=0;nN<nPointCount;nN++)
{
- double fX = (*aSeriesIter)->getX( nN );
+ double fX = (*aSeriesIter)->getXValue( nN );
if( ::rtl::math::isNan(fX) )
continue;
if(rfMaximum<fX)
@@ -1447,12 +1442,12 @@ void VDataSeriesGroup::getMinimumAndMaximiumYInContinuousXRange( double& rfMinY,
if( nAxisIndex != (*aSeriesIter)->getAttachedAxisIndex() )
continue;
- double fX = (*aSeriesIter)->getX( nN );
+ double fX = (*aSeriesIter)->getXValue( nN );
if( ::rtl::math::isNan(fX) )
continue;
if( fX < fMinX || fX > fMaxX )
continue;
- double fY = (*aSeriesIter)->getY( nN );
+ double fY = (*aSeriesIter)->getYValue( nN );
if( ::rtl::math::isNan(fY) )
continue;
if(rfMaxY<fY)
@@ -2069,6 +2064,8 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter(
pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
pRet = new AreaChart(xChartTypeModel,nDimensionCount,false,true);
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ pRet = new BubbleChart(xChartTypeModel,nDimensionCount);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
pRet = new PieChart(xChartTypeModel,nDimensionCount);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
diff --git a/chart2/source/view/charttypes/makefile.mk b/chart2/source/view/charttypes/makefile.mk
index 434db9304788..1da5697fd25f 100644
--- a/chart2/source/view/charttypes/makefile.mk
+++ b/chart2/source/view/charttypes/makefile.mk
@@ -51,7 +51,8 @@ SLOFILES = $(SLO)$/Splines.obj \
$(SLO)$/BarChart.obj \
$(SLO)$/PieChart.obj \
$(SLO)$/AreaChart.obj \
- $(SLO)$/CandleStickChart.obj
+ $(SLO)$/CandleStickChart.obj \
+ $(SLO)$/BubbleChart.obj
# --- Targets -----------------------------------------------------------------
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index 70f930aa8623..5e0db2644cc5 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -553,13 +553,13 @@ void VDiagram::createShapes_3d()
CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
if( CuboidPlanePosition_Right==eLeftWallPos )
xPos = FIXED_SIZE_FOR_3D_CHART_VOLUME;
- Stripe aStripe( drawing::Position3D(xPos,0,0)
- , drawing::Direction3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ Stripe aStripe( drawing::Position3D(xPos,FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
, drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) );
uno::Reference< drawing::XShape > xShape =
m_pShapeFactory->createStripe( xWallGroup_Shapes, aStripe
- , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true );
+ , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true, true );
if( !bAddFloorAndWall )
{
//we always need this object as dummy object for correct scene dimensions
@@ -573,9 +573,9 @@ void VDiagram::createShapes_3d()
CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
if( CuboidPlanePosition_Front==eBackWallPos )
zPos = FIXED_SIZE_FOR_3D_CHART_VOLUME;
- Stripe aStripe( drawing::Position3D(0,0,zPos)
+ Stripe aStripe( drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,zPos)
, drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0)
- , drawing::Direction3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) );
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) );
uno::Reference< drawing::XShape > xShape =
m_pShapeFactory->createStripe(xWallGroup_Shapes, aStripe
diff --git a/chart2/source/view/inc/LabelPositionHelper.hxx b/chart2/source/view/inc/LabelPositionHelper.hxx
index 8b14869aa773..454be825305f 100644
--- a/chart2/source/view/inc/LabelPositionHelper.hxx
+++ b/chart2/source/view/inc/LabelPositionHelper.hxx
@@ -66,6 +66,9 @@ public:
, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisModelProps
, const ::com::sun::star::awt::Size& rNewReferenceSize );
+ static void correctPositionForRotation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape2DText
+ , LabelAlignment eLabelAlignment, const double fRotationAngle, bool bRotateAroundCenter );
+
private:
LabelPositionHelper();
diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx b/chart2/source/view/inc/PlottingPositionHelper.hxx
index 9c79e226b265..316ada70cac0 100644
--- a/chart2/source/view/inc/PlottingPositionHelper.hxx
+++ b/chart2/source/view/inc/PlottingPositionHelper.hxx
@@ -193,7 +193,9 @@ public:
using PlottingPositionHelper::transformScaledLogicToScene;
+#ifdef NOTYET
double getInnerLogicRadius() const;
+#endif
double getOuterLogicRadius() const;
inline bool isMathematicalOrientationAngle() const;
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 63a7c7558a5b..a03bbd3237d8 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -122,7 +122,7 @@ public:
, const Stripe& rStripe
, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap
- , sal_Bool bDoubleSided = true);
+ , sal_Bool bDoubleSided = true, bool bRotatedTexture=false );
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
@@ -159,6 +159,11 @@ public:
, const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
, const VLineProperties& rLineProperties );
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCircle2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize );
+
//------------------- create 2D elements:
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
diff --git a/chart2/source/view/inc/Stripe.hxx b/chart2/source/view/inc/Stripe.hxx
index fe3a728daa02..dc017fc7aaba 100644
--- a/chart2/source/view/inc/Stripe.hxx
+++ b/chart2/source/view/inc/Stripe.hxx
@@ -65,7 +65,7 @@ public:
::com::sun::star::uno::Any getPolyPolygonShape3D() const;
::com::sun::star::uno::Any getNormalsPolygon() const;
- ::com::sun::star::uno::Any getTexturePolygon() const;
+ ::com::sun::star::uno::Any getTexturePolygon( bool bRotatedTexture ) const;
::com::sun::star::drawing::Position3D GetPosition1() const { return m_aPoint1; }
::com::sun::star::drawing::Position3D GetPosition2() const { return m_aPoint2; }
diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx
index d3f14a9a1bdd..9426c1e9256c 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -59,7 +59,7 @@ class VDataSequence
{
public:
void init( const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::data::XDataSequence >& xModel);
+ ::com::sun::star::chart2::data::XDataSequence >& xModel );
bool is() const;
void clear();
double getValue( sal_Int32 index ) const;
@@ -89,14 +89,16 @@ public:
void setPageReferenceSize( const ::com::sun::star::awt::Size & rPageRefSize );
sal_Int32 getTotalPointCount() const;
- double getX( sal_Int32 index ) const;
- double getY( sal_Int32 index ) const;
+ double getXValue( sal_Int32 index ) const;
+ double getYValue( sal_Int32 index ) const;
double getY_Min( sal_Int32 index ) const;
double getY_Max( sal_Int32 index ) const;
double getY_First( sal_Int32 index ) const;
double getY_Last( sal_Int32 index ) const;
+ double getBubble_Size( sal_Int32 index ) const;
+
double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
double getMaximumofAllDifferentYValues( sal_Int32 index ) const;
@@ -108,6 +110,7 @@ public:
bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
+ bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const;
sal_Int32 getLabelPlacement( sal_Int32 nPointIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
, sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const;
@@ -141,6 +144,8 @@ public:
void setStartingAngle( sal_Int32 nStartingAngle );
sal_Int32 getStartingAngle() const;
+ void setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole );
+
//this is only temporarily here for area chart:
::com::sun::star::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D;
sal_Int32 m_nPolygonIndex;
@@ -174,7 +179,6 @@ public:
sal_Int32 getMissingValueTreatment() const;
private: //methods
- VDataSeries();
::com::sun::star::chart2::DataPointLabel*
getDataPointLabel( sal_Int32 index ) const;
void adaptPointCache( sal_Int32 nNewPointIndex ) const;
@@ -208,6 +212,10 @@ private: //member
VDataSequence m_aValues_Y_First;
VDataSequence m_aValues_Y_Last;
+ VDataSequence m_aValues_Bubble_Size;
+
+ VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
+
mutable double m_fYMeanValue;
::com::sun::star::uno::Sequence< sal_Int32 > m_aAttributedDataPointIndexList;
@@ -249,7 +257,8 @@ private: //member
::com::sun::star::awt::Size m_aReferenceSize;
//
- sal_Int32 m_nMissingValueTreatment;
+ sal_Int32 m_nMissingValueTreatment;
+ bool m_bAllowPercentValueInDataLabel;
};
//.............................................................................
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
index b5ea7f7c2bfd..eeb561b13f02 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -99,7 +99,6 @@ class VDataSeriesGroup
public:
VDataSeriesGroup();
VDataSeriesGroup( VDataSeries* pSeries );
- VDataSeriesGroup( const ::std::vector< VDataSeries* >& rSeriesVector );
virtual ~VDataSeriesGroup();
void addSeries( VDataSeries* pSeries );//takes ownership of pSeries
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 47eb3f59595f..f3024a10e958 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -66,6 +66,7 @@ ChartItemPool::ChartItemPool():
ppPoolDefaults[SCHATTR_DATADESCR_PLACEMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT,0);
SvULongs aTmp;
ppPoolDefaults[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS,aTmp);
+ ppPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE);
ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SvxChartLegendPosItem( CHLEGEND_RIGHT, SCHATTR_LEGEND_POS );
// ppPoolDefaults[SCHATTR_TEXT_ORIENT - SCHATTR_START] = new SvxChartTextOrientItem;
@@ -184,6 +185,7 @@ ChartItemPool::ChartItemPool():
ppPoolDefaults[SCHATTR_DIAGRAM_STYLE - SCHATTR_START] = new SvxChartStyleItem( CHSTYLE_2D_COLUMN, SCHATTR_DIAGRAM_STYLE );
ppPoolDefaults[SCHATTR_TEXTBREAK - SCHATTR_START] = new SfxBoolItem( SCHATTR_TEXTBREAK, FALSE );
ppPoolDefaults[SCHATTR_GROUP_BARS_PER_AXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, FALSE);
+ ppPoolDefaults[SCHATTR_INCLUDE_HIDDEN_CELLS - SCHATTR_START] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE);
ppPoolDefaults[SCHATTR_STARTING_ANGLE - SCHATTR_START] = new SfxInt32Item( SCHATTR_STARTING_ANGLE, 90 );
ppPoolDefaults[SCHATTR_CLOCKWISE - SCHATTR_START] = new SfxBoolItem( SCHATTR_CLOCKWISE, FALSE );
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index d9699afb059a..7098e150a175 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -86,7 +86,6 @@
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
@@ -631,6 +630,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
sal_Bool bSortByXValues = sal_False;
sal_Bool bConnectBars = sal_False;
sal_Bool bGroupBarsPerAxis = sal_True;
+ sal_Bool bIncludeHiddenCells = sal_True;
sal_Int32 nStartingAngle = 90;
try
{
@@ -638,6 +638,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
xDiaProp->getPropertyValue( C2U( "SortByXValues" ) ) >>= bSortByXValues;
xDiaProp->getPropertyValue( C2U( "ConnectBars" ) ) >>= bConnectBars;
xDiaProp->getPropertyValue( C2U( "GroupBarsPerAxis" ) ) >>= bGroupBarsPerAxis;
+ xDiaProp->getPropertyValue( C2U( "IncludeHiddenCells" ) ) >>= bIncludeHiddenCells;
xDiaProp->getPropertyValue( C2U( "StartingAngle" ) ) >>= nStartingAngle;
}
catch( const uno::Exception & ex )
@@ -703,6 +704,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
if(!xDataSeries.is())
continue;
+ if( !bIncludeHiddenCells && !DataSeriesHelper::hasUnhiddenData(xDataSeries) )
+ continue;
+
VDataSeries* pSeries = new VDataSeries( xDataSeries );
pSeries->setGlobalSeriesIndex(nGlobalSeriesIndex);
@@ -720,6 +724,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
rtl::OUString aSeriesParticle( ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCS, nT, nS ) );
pSeries->setParticle(aSeriesParticle);
+ OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) );
+ pSeries->setRoleOfSequenceForDataLabelNumberFormatDetection(aRole);
+
//ignore secondary axis for charttypes that do not suppoert them
if( pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX &&
!ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 ) )
@@ -1689,11 +1696,11 @@ bool lcl_getPropertySwapXAndYAxis( const uno::Reference< XDiagram >& xDiagram )
}
-//static
-sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+sal_Int32 lcl_getExplicitNumberFormatKeyForAxis(
const Reference< chart2::XAxis >& xAxis
, const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
- , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+ , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , bool bSearchForParallelAxisIfNothingIsFound )
{
sal_Int32 nNumberFormatKey(0);
Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
@@ -1720,13 +1727,15 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
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() )
{
- sal_Int32 nDimensionIndex = 1;
- sal_Int32 nAxisIndex = 0;
AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex );
::rtl::OUString aRoleToMatch;
if( nDimensionIndex == 0 )
@@ -1735,7 +1744,7 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
{
if( nDimensionIndex != 0 )
- aRoleToMatch = aChartTypes[nCTIdx]->getRoleOfSequenceForSeriesLabel();
+ 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 )
@@ -1796,16 +1805,39 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
if( (*aIt).second > nMaxFreq )
{
nNumberFormatKey = (*aIt).first;
+ bNumberFormatKeyFoundViaAttachedData = true;
nMaxFreq = (*aIt).second;
}
}
}
+
+ if( bSearchForParallelAxisIfNothingIsFound )
+ {
+ //no format is set to this axis and no data is set to this axis
+ //--> try to obtain the format from the parallel y-axis
+ if( !bNumberFormatKeyFoundViaAttachedData && nDimensionIndex == 1 )
+ {
+ sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1;
+ Reference< XAxis > xParallelAxis( AxisHelper::getAxis( 1, nParallelAxisIndex, xCorrespondingCoordinateSystem ) );
+ nNumberFormatKey = lcl_getExplicitNumberFormatKeyForAxis( xParallelAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier, false );
+ }
+ }
}
}
return nNumberFormatKey;
}
//static
+sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+ const Reference< chart2::XAxis >& xAxis
+ , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
+ , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+{
+ return lcl_getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier
+ , true /*bSearchForParallelAxisIfNothingIsFound*/ );
+}
+
+//static
sal_Int32 ExplicitValueProvider::getPercentNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
{
sal_Int32 nRet=-1;
@@ -1825,24 +1857,36 @@ sal_Int32 ExplicitValueProvider::getPercentNumberFormat( const Reference< util::
}
-sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForLabel(
+sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp,
const uno::Reference< XDataSeries >& xSeries,
sal_Int32 nPointIndex /*-1 for whole series*/,
- const uno::Reference< beans::XPropertySet >& xAttachedAxisProps
+ const uno::Reference< XDiagram >& xDiagram
)
{
sal_Int32 nFormat=0;
if( !xSeriesOrPointProp.is() )
return nFormat;
+
rtl::OUString aPropName( C2U( "NumberFormat" ) );
if( !(xSeriesOrPointProp->getPropertyValue(aPropName) >>= nFormat) )
{
- if( xAttachedAxisProps.is() && !( xAttachedAxisProps->getPropertyValue( aPropName ) >>= nFormat ) )
+ uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) );
+
+ bool bFormatFound = false;
+ if( ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( xChartType ) )
+ {
+ uno::Reference< beans::XPropertySet > xAttachedAxisProps( DiagramHelper::getAttachedAxis( xSeries, xDiagram ), uno::UNO_QUERY );
+ if( xAttachedAxisProps.is() && ( xAttachedAxisProps->getPropertyValue( aPropName ) >>= nFormat ) )
+ bFormatFound = true;
+ }
+ if( !bFormatFound )
{
Reference< chart2::data::XDataSource > xSeriesSource( xSeries, uno::UNO_QUERY );
+ OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) );
+
Reference< data::XLabeledDataSequence > xLabeledSequence(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-y"), false ));
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, aRole, false ));
if( xLabeledSequence.is() )
{
Reference< data::XDataSequence > xValues( xLabeledSequence->getValues() );
@@ -1856,7 +1900,7 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForLabel(
return nFormat;
}
-sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForLabel(
+sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp,
const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
{
diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx
index b5bf518770fa..e2784f488ab0 100644
--- a/chart2/source/view/main/LabelPositionHelper.cxx
+++ b/chart2/source/view/main/LabelPositionHelper.cxx
@@ -131,6 +131,361 @@ void LabelPositionHelper::doDynamicFontResize( tAnySequence& rPropValues
}
}
+namespace
+{
+
+void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
+{
+ //correct label positions for labels on a left side of something with a right centered alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = -aSize.Width *rtl::math::sin( beta )
+ -aSize.Height *rtl::math::cos( beta )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta )/2.0;
+ else
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = fAnglePi - F_PI;
+ rfXCorrection = -aSize.Width *rtl::math::cos( beta )
+ -aSize.Height*rtl::math::sin( beta )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = aSize.Width *rtl::math::sin( beta )/2.0;
+ else
+ rfYCorrection = aSize.Width *rtl::math::sin( beta );
+ }
+ else
+ {
+ double beta = 2*F_PI - fAnglePi;
+ rfXCorrection = -aSize.Height*rtl::math::sin( beta )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
+ }
+}
+
+void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
+{
+ //correct label positions for labels on a right side of something with a left centered alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree== 0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = F_PI - fAnglePi;
+ rfXCorrection = aSize.Width *rtl::math::cos( beta )
+ + aSize.Height*rtl::math::sin( beta )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = aSize.Width *rtl::math::sin( beta )/2.0;
+ else
+ rfYCorrection = aSize.Width *rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Width *rtl::math::sin( beta )
+ +aSize.Height*rtl::math::cos( beta )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta )/2.0;
+ else
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta );
+ }
+ else
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = -aSize.Width*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
+ }
+}
+
+void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
+{
+ //correct label positions for labels on top of something with a bottom centered alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree== 0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection += aSize.Width*rtl::math::cos( fAnglePi )/2.0;
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi - F_PI/2.0;
+ rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection -= aSize.Width*rtl::math::sin( beta )/2.0;
+ rfYCorrection = -aSize.Width*rtl::math::cos( beta )/2.0
+ - aSize.Height*rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = fAnglePi - F_PI;
+ rfXCorrection = -aSize.Height *rtl::math::sin( beta )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection += aSize.Width *rtl::math::cos( beta )/2.0;
+ rfYCorrection = -aSize.Width *rtl::math::sin( beta )/2.0
+ -aSize.Height *rtl::math::cos( beta );
+ }
+ else
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection -= aSize.Width*rtl::math::cos( fAnglePi )/2.0;
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+}
+
+void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
+{
+ //correct label positions for labels below something with a top centered alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection -= aSize.Width *rtl::math::cos( fAnglePi )/2.0;
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = -aSize.Height*rtl::math::cos( beta )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection += aSize.Width *rtl::math::sin( beta )/2.0;
+ rfYCorrection = aSize.Width *rtl::math::cos( beta )/2.0
+ +aSize.Height*rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection -= aSize.Width *rtl::math::sin( beta )/2.0;
+ rfYCorrection = aSize.Height*rtl::math::sin( beta )
+ +aSize.Width*rtl::math::cos( beta )/2.0;
+ }
+ else
+ {
+ double beta = 2*F_PI - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::sin( beta )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection += aSize.Width*rtl::math::cos( beta )/2.0;
+ rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
+ }
+}
+
+void lcl_correctRotation_Left_Top( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for labels at the left top corner of something with a bottom right alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = -aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = -aSize.Height*rtl::math::sin( beta )
+ -aSize.Width*rtl::math::cos( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = -aSize.Height*rtl::math::cos( beta )
+ -aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi );
+ }
+}
+
+void lcl_correctRotation_Left_Bottom( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for labels at the left bottom corner of something with a top right alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = -aSize.Width*rtl::math::sin( beta )
+ -aSize.Height*rtl::math::cos( beta );;
+ rfYCorrection = aSize.Height*rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = -aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = aSize.Width*rtl::math::cos( beta )
+ +aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+ }
+}
+
+void lcl_correctRotation_Right_Top( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for labels at the right top corner of something with a bottom left alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = aSize.Width*rtl::math::sin( beta )
+ +aSize.Height*rtl::math::cos( beta );
+ rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = -aSize.Width*rtl::math::cos( beta )
+ -aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi );
+ }
+}
+
+void lcl_correctRotation_Right_Bottom( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for labels at the right bottom corner of something with a top left alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = aSize.Height*rtl::math::sin( beta )
+ +aSize.Width*rtl::math::cos( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::cos( beta )
+ +aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+ }
+}
+
+}//end anonymous namespace
+
+//static
+void LabelPositionHelper::correctPositionForRotation( const uno::Reference< drawing::XShape >& xShape2DText
+ , LabelAlignment eLabelAlignment, const double fRotationAngle, bool bRotateAroundCenter )
+{
+ if( !xShape2DText.is() )
+ return;
+
+ awt::Point aOldPos = xShape2DText->getPosition();
+ awt::Size aSize = xShape2DText->getSize();
+
+ double fYCorrection = 0.0;
+ double fXCorrection = 0.0;
+
+ double fAnglePositiveDegree = fRotationAngle;
+ while(fAnglePositiveDegree<0.0)
+ fAnglePositiveDegree+=360.0;
+
+ switch(eLabelAlignment)
+ {
+ case LABEL_ALIGN_LEFT:
+ lcl_correctRotation_Left( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize, bRotateAroundCenter );
+ break;
+ case LABEL_ALIGN_RIGHT:
+ lcl_correctRotation_Right( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize, bRotateAroundCenter );
+ break;
+ case LABEL_ALIGN_TOP:
+ lcl_correctRotation_Top( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize, bRotateAroundCenter );
+ break;
+ case LABEL_ALIGN_BOTTOM:
+ lcl_correctRotation_Bottom( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize, bRotateAroundCenter );
+ break;
+ case LABEL_ALIGN_LEFT_TOP:
+ lcl_correctRotation_Left_Top( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
+ break;
+ case LABEL_ALIGN_LEFT_BOTTOM:
+ lcl_correctRotation_Left_Bottom( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
+ break;
+ case LABEL_ALIGN_RIGHT_TOP:
+ lcl_correctRotation_Right_Top( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
+ break;
+ case LABEL_ALIGN_RIGHT_BOTTOM:
+ lcl_correctRotation_Right_Bottom( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
+ break;
+ default: //LABEL_ALIGN_CENTER
+ break;
+ }
+
+ xShape2DText->setPosition( awt::Point(
+ static_cast<sal_Int32>(aOldPos.X + fXCorrection )
+ , static_cast<sal_Int32>(aOldPos.Y + fYCorrection ) ) );
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/view/main/NumberFormatterWrapper.cxx b/chart2/source/view/main/NumberFormatterWrapper.cxx
index a36f13793a2b..2a01d2f1cde3 100644
--- a/chart2/source/view/main/NumberFormatterWrapper.cxx
+++ b/chart2/source/view/main/NumberFormatterWrapper.cxx
@@ -40,6 +40,7 @@
#include <tools/color.hxx>
#include <i18npool/mslangid.hxx>
#include <tools/debug.hxx>
+#include <com/sun/star/util/DateTime.hpp>
//.............................................................................
namespace chart
@@ -83,6 +84,10 @@ NumberFormatterWrapper::NumberFormatterWrapper( const uno::Reference< util::XNum
, m_pNumberFormatter(NULL)
{
+ uno::Reference<beans::XPropertySet> xProp(m_xNumberFormatsSupplier,uno::UNO_QUERY);
+ rtl::OUString sNullDate( RTL_CONSTASCII_USTRINGPARAM("NullDate"));
+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sNullDate) )
+ m_aNullDate = xProp->getPropertyValue(sNullDate);
SvNumberFormatsSupplierObj* pSupplierObj = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
if( pSupplierObj )
m_pNumberFormatter = pSupplierObj->GetNumberFormatter();
@@ -108,8 +113,27 @@ rtl::OUString NumberFormatterWrapper::getFormattedString(
DBG_ERROR("Need a NumberFormatter");
return aText;
}
+ // i99104 handle null date correctly
+ USHORT nYear = 1899,nDay = 30,nMonth = 12;
+ if ( m_aNullDate.hasValue() )
+ {
+ Date* pDate = m_pNumberFormatter->GetNullDate();
+ if ( pDate )
+ {
+ nYear = pDate->GetYear();
+ nMonth = pDate->GetMonth();
+ nDay = pDate->GetDay();
+ } // if ( pDate )
+ util::DateTime aNewNullDate;
+ m_aNullDate >>= aNewNullDate;
+ m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year);
+ }
m_pNumberFormatter->GetOutputString(
fValue, nNumberFormatKey, aText, &pTextColor);
+ if ( m_aNullDate.hasValue() )
+ {
+ m_pNumberFormatter->ChangeNullDate(nDay,nMonth,nYear);
+ }
rtl::OUString aRet( aText );
if(pTextColor)
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
index c975519d9628..e99c260c6d04 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -142,19 +142,6 @@ uno::Reference< XTransformation > PlottingPositionHelper::getTransformationScale
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;
@@ -163,9 +150,24 @@ uno::Reference< XTransformation > PlottingPositionHelper::getTransformationScale
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);
+ double fScaleX = fScaleDirectionX*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthX;
+ double fScaleY = fScaleDirectionY*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthY;
+ double fScaleZ = fScaleDirectionZ*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthZ;
+
+ aMatrix.scale(fScaleX, fScaleY, fScaleZ);
+
+ if( AxisOrientation_MATHEMATICAL==nXAxisOrientation )
+ aMatrix.translate(-MinX*fScaleX, 0.0, 0.0);
+ else
+ aMatrix.translate(-MaxX*fScaleX, 0.0, 0.0);
+ if( AxisOrientation_MATHEMATICAL==nYAxisOrientation )
+ aMatrix.translate(0.0, -MinY*fScaleY, 0.0);
+ else
+ aMatrix.translate(0.0, -MaxY*fScaleY, 0.0);
+ if( AxisOrientation_MATHEMATICAL==nZAxisOrientation )
+ aMatrix.translate(0.0, 0.0, -MaxZ*fScaleZ);//z direction in draw is reverse mathematical direction
+ else
+ aMatrix.translate(0.0, 0.0, -MinZ*fScaleZ);
aMatrix = m_aMatrixScreenToScene*aMatrix;
@@ -612,6 +614,7 @@ drawing::Position3D PolarPlottingPositionHelper::transformAngleRadiusToScene( do
return transformUnitCircleToScene( fUnitAngleDegree, fUnitRadius, fLogicZ, bDoScaling );
}
+#ifdef NOTYET
double PolarPlottingPositionHelper::getInnerLogicRadius() const
{
const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
@@ -620,6 +623,7 @@ double PolarPlottingPositionHelper::getInnerLogicRadius() const
else
return rScale.Maximum;
}
+#endif
double PolarPlottingPositionHelper::getOuterLogicRadius() const
{
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index 53a1b3673c81..04d95ce249a6 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -250,6 +250,7 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForCharacterProper
// ( C2U( "RubyAdjust" ), C2U("RubyAdjust") )
// ( C2U( "RubyCharStyleName" ), C2U("RubyStyleName") )
// ( C2U( "RubyIsAbove" ), C2U("RubyIsAbove") )
+ ( C2U( "ParaIsCharacterDistance" ), C2U("ParaIsCharacterDistance") )
;
return m_aShapePropertyMapForCharacterProperties;
}
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 21bf943c9899..8a19e66334fb 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -1023,7 +1023,8 @@ uno::Reference< drawing::XShape >
, const Stripe& rStripe
, const uno::Reference< beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap
- , sal_Bool bDoubleSided )
+ , sal_Bool bDoubleSided
+ , bool bRotatedTexture )
{
if( !xTarget.is() )
return 0;
@@ -1047,7 +1048,7 @@ uno::Reference< drawing::XShape >
//TexturePolygon
xProp->setPropertyValue( C2U( UNO_NAME_3D_TEXTUREPOLYGON3D )
- , rStripe.getTexturePolygon() );
+ , rStripe.getTexturePolygon( bRotatedTexture ) );
//Normals Polygon
@@ -1573,6 +1574,53 @@ uno::Reference< drawing::XShapes >
}
uno::Reference< drawing::XShape >
+ ShapeFactory::createCircle2D( const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::Position3D& rPosition
+ , const drawing::Direction3D& rSize )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.EllipseShape") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ try
+ {
+ drawing::Position3D aCenterPosition(
+ rPosition.PositionX - (rSize.DirectionX / 2.0),
+ rPosition.PositionY - (rSize.DirectionY / 2.0),
+ rPosition.PositionZ );
+ xShape->setPosition( Position3DToAWTPoint( aCenterPosition ));
+ xShape->setSize( Direction3DToAWTSize( rSize ));
+ }
+ catch( const uno::Exception & e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ drawing::CircleKind eKind = drawing::CircleKind_FULL;
+ xProp->setPropertyValue( C2U( UNO_NAME_CIRCKIND )
+ , uno::makeAny( eKind ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference< drawing::XShape >
ShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >& xTarget
, const drawing::PolyPolygonShape3D& rPoints
, const VLineProperties& rLineProperties )
diff --git a/chart2/source/view/main/Stripe.cxx b/chart2/source/view/main/Stripe.cxx
index 67b2396682aa..cb35e0e010b9 100644
--- a/chart2/source/view/main/Stripe.cxx
+++ b/chart2/source/view/main/Stripe.cxx
@@ -161,7 +161,7 @@ uno::Any Stripe::getNormalsPolygon() const
return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
}
-uno::Any Stripe::getTexturePolygon() const
+uno::Any Stripe::getTexturePolygon( bool bRotatedTexture ) const
{
drawing::PolyPolygonShape3D aPP;
@@ -181,21 +181,42 @@ uno::Any Stripe::getTexturePolygon() const
double* pInnerSequenceY = pOuterSequenceY->getArray();
double* pInnerSequenceZ = pOuterSequenceZ->getArray();
- *pInnerSequenceX++ = 0.0;
- *pInnerSequenceY++ = 0.0;
- *pInnerSequenceZ++ = 0.0;
+ if( !bRotatedTexture )
+ {
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
- *pInnerSequenceX++ = 1.0;
- *pInnerSequenceY++ = 0.0;
- *pInnerSequenceZ++ = 0.0;
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
- *pInnerSequenceX++ = 1.0;
- *pInnerSequenceY++ = 1.0;
- *pInnerSequenceZ++ = 0.0;
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else
+ {
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
- *pInnerSequenceX++ = 0.0;
- *pInnerSequenceY++ = 1.0;
- *pInnerSequenceZ++ = 0.0;
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
}
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index f648b7510cec..d2456110b79b 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -37,7 +37,8 @@
#include "LabelPositionHelper.hxx"
#include "ChartTypeHelper.hxx"
#include "ContainerHelper.hxx"
-#include "MeanValueRegressionCurveCalculator.hxx"
+#include "DataSeriesHelper.hxx"
+#include "RegressionCurveHelper.hxx"
#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
@@ -61,87 +62,10 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
-namespace
-{
- struct lcl_LessIndex
- {
- inline bool operator() ( const sal_Int32& first,
- const sal_Int32& second )
- {
- return ( first < second );
- }
- };
-
- void lcl_removeIndices( uno::Sequence< double >& rValues, const uno::Sequence< sal_Int32 >& rIndicesToRemove )
- {
- if( !rIndicesToRemove.getLength() )
- return;
-
- ::std::vector< sal_Int32 > aIndicesToRemove( ContainerHelper::SequenceToVector( rIndicesToRemove) );
- ::std::sort( aIndicesToRemove.begin(), aIndicesToRemove.end(), lcl_LessIndex() );
-
- sal_Int32 nTarget=0;
- sal_Int32 nR = 0;
- sal_Int32 nRemove = aIndicesToRemove[nR];
- for( sal_Int32 nSource=0; nSource<rValues.getLength(); nSource++ )
- {
- if( nSource<nRemove || nRemove==-1 )
- {
- if( nTarget < nSource )
- rValues[nTarget]=rValues[nSource];
- nTarget++;
- continue;
- }
- if( nSource==nRemove )
- {
- ++nR;
- if( nR<static_cast<sal_Int32>(aIndicesToRemove.size()) )
- nRemove = aIndicesToRemove[nR];
- else
- nRemove = -1;
- }
- }
-
- if( nTarget>0 )
- rValues.realloc( nTarget );
- else
- rValues.realloc(0);
- }
-}
-
void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel )
{
- bool bDisplayHiddenCells = true; //todo: make this configurable in future
- bool bIsHidden = false;
- uno::Sequence< sal_Int32 > aHiddenValues;
- if( !bDisplayHiddenCells )
- {
- uno::Reference<beans::XPropertySet> xProp(xModel, uno::UNO_QUERY );
- if( xProp.is())
- {
- try
- {
- xProp->getPropertyValue( C2U( "IsHidden" ) ) >>= bIsHidden;
- xProp->getPropertyValue( C2U( "HiddenValues" ) ) >>= aHiddenValues;
- }
- catch( uno::Exception& e )
- {
- ASSERT_EXCEPTION( e );
- }
- }
- }
-
Model = xModel;
- if( bDisplayHiddenCells || !bIsHidden )
- Doubles = DataSequenceToDoubleSequence( xModel );
-
- if( !bDisplayHiddenCells )
- {
- if( bIsHidden )
- Doubles.realloc(0);
- else if( aHiddenValues.getLength() )
- lcl_removeIndices( Doubles, aHiddenValues );
- }
+ Doubles = DataSequenceToDoubleSequence( xModel );
}
bool VDataSequence::is() const
@@ -200,27 +124,37 @@ struct lcl_LessXOfPoint
}
};
-void lcl_clearIfTextIsContained( VDataSequence& rData, const uno::Reference<data::XDataSequence>& xDataSequence )
+void lcl_clearIfNoValuesButTextIsContained( VDataSequence& rData, const uno::Reference<data::XDataSequence>& xDataSequence )
{
+ //#i71686#, #i101968#, #i102428#
+ sal_Int32 nCount = rData.Doubles.getLength();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ if( !::rtl::math::isNan( rData.Doubles[i] ) )
+ return;
+ }
+ //no double value is countained
+ //is there any text?
uno::Sequence< rtl::OUString > aStrings( DataSequenceToStringSequence( xDataSequence ) );
- for( sal_Int32 i = 0; i < rData.Doubles.getLength(); ++i )
+ sal_Int32 nTextCount = aStrings.getLength();
+ for( sal_Int32 j = 0; j < nTextCount; ++j )
{
- if( ::rtl::math::isNan( rData.Doubles[i] ) )
+ if( aStrings[j].getLength() )
{
- if( i < aStrings.getLength() && aStrings[i].getLength() )
- {
- rData.clear();
- break;
- }
+ rData.clear();
+ return;
}
}
+ //no content at all
}
+void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatment )
+{
+ if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::USE_ZERO
+ && ::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue) )
+ rfValue = 0.0;
}
-VDataSeries::VDataSeries()
-{
- DBG_ERROR("not implemented");
}
VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
@@ -244,6 +178,8 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
, m_aValues_Y_Max()
, m_aValues_Y_First()
, m_aValues_Y_Last()
+ , m_aValues_Bubble_Size()
+ , m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y)
, m_fYMeanValue(1.0)
@@ -274,6 +210,7 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
, m_apSymbolProperties_InvisibleSymbolForSelection(NULL)
, m_nCurrentAttributedPoint(-1)
, m_nMissingValueTreatment(::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ , m_bAllowPercentValueInDataLabel(false)
{
::rtl::math::setNan( & m_fYMeanValue );
@@ -299,7 +236,7 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
if( aRole.equals(C2U("values-x")) )
{
m_aValues_X.init( xDataSequence );
- lcl_clearIfTextIsContained( m_aValues_X, xDataSequence );
+ lcl_clearIfNoValuesButTextIsContained( m_aValues_X, xDataSequence );
}
else if( aRole.equals(C2U("values-y")) )
m_aValues_Y.init( xDataSequence );
@@ -311,7 +248,8 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
m_aValues_Y_First.init( xDataSequence );
else if( aRole.equals(C2U("values-last")) )
m_aValues_Y_Last.init( xDataSequence );
- //@todo assign the other roles (+ error for unknown?)
+ else if( aRole.equals(C2U("values-size")) )
+ m_aValues_Bubble_Size.init( xDataSequence );
}
catch( uno::Exception& e )
{
@@ -323,13 +261,15 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
//determine the point count
m_nPointCount = m_aValues_Y.getLength();
{
+ if( m_nPointCount < m_aValues_Bubble_Size.getLength() )
+ m_nPointCount = m_aValues_Bubble_Size.getLength();
if( m_nPointCount < m_aValues_Y_Min.getLength() )
m_nPointCount = m_aValues_Y_Min.getLength();
- if( m_nPointCount < m_aValues_Y_Max.getLength() )
+ if( m_nPointCount < m_aValues_Y_Max.getLength() )
m_nPointCount = m_aValues_Y_Max.getLength();
- if( m_nPointCount < m_aValues_Y_First.getLength() )
+ if( m_nPointCount < m_aValues_Y_First.getLength() )
m_nPointCount = m_aValues_Y_First.getLength();
- if( m_nPointCount < m_aValues_Y_Last.getLength() )
+ if( m_nPointCount < m_aValues_Y_Last.getLength() )
m_nPointCount = m_aValues_Y_Last.getLength();
}
@@ -412,6 +352,7 @@ void VDataSeries::releaseShapes()
void VDataSeries::setCategoryXAxis()
{
m_aValues_X.clear();
+ m_bAllowPercentValueInDataLabel = true;
}
void VDataSeries::setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex )
@@ -526,27 +467,48 @@ sal_Int32 VDataSeries::getTotalPointCount() const
return m_nPointCount;
}
-double VDataSeries::getX( sal_Int32 index ) const
+double VDataSeries::getXValue( sal_Int32 index ) const
{
+ double fRet = 0.0;
if(m_aValues_X.is())
{
if( 0<=index && index<m_aValues_X.getLength() )
- return m_aValues_X.Doubles[index];
+ fRet = m_aValues_X.Doubles[index];
+ else
+ ::rtl::math::setNan( &fRet );
}
else
{
// #i70133# always return correct X position - needed for short data series
if( 0<=index /*&& index < m_nPointCount*/ )
- return index+1;//first category (index 0) matches with real number 1.0
+ fRet = index+1;//first category (index 0) matches with real number 1.0
+ else
+ ::rtl::math::setNan( &fRet );
}
- double fNan;
- ::rtl::math::setNan( & fNan );
- return fNan;
+ lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
+ return fRet;
}
-double VDataSeries::getY( sal_Int32 index ) const
+double VDataSeries::getYValue( sal_Int32 index ) const
{
- return m_aValues_Y.getValue( index );
+ double fRet = 0.0;
+ if(m_aValues_Y.is())
+ {
+ if( 0<=index && index<m_aValues_Y.getLength() )
+ fRet = m_aValues_Y.Doubles[index];
+ else
+ ::rtl::math::setNan( &fRet );
+ }
+ else
+ {
+ // #i70133# always return correct X position - needed for short data series
+ if( 0<=index /*&& index < m_nPointCount*/ )
+ fRet = index+1;//first category (index 0) matches with real number 1.0
+ else
+ ::rtl::math::setNan( &fRet );
+ }
+ lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
+ return fRet;
}
double VDataSeries::getY_Min( sal_Int32 index ) const
@@ -565,6 +527,10 @@ double VDataSeries::getY_Last( sal_Int32 index ) const
{
return m_aValues_Y_Last.getValue( index );
}
+double VDataSeries::getBubble_Size( sal_Int32 index ) const
+{
+ return m_aValues_Bubble_Size.getValue( index );
+}
bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const
{
@@ -585,9 +551,37 @@ sal_Int32 VDataSeries::getExplicitNumberFormat( sal_Int32 nPointIndex, bool bFor
xPointProp->getPropertyValue(aPropName) >>= nNumberFormat;
return nNumberFormat;
}
+void VDataSeries::setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole )
+{
+ if( rRole.equals(C2U("values-y")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y;
+ else if( rRole.equals(C2U("values-size")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Bubble_Size;
+ else if( rRole.equals(C2U("values-min")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Min;
+ else if( rRole.equals(C2U("values-max")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Max;
+ else if( rRole.equals(C2U("values-first")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_First;
+ else if( rRole.equals(C2U("values-last")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Last;
+ else if( rRole.equals(C2U("values-x")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_X;
+}
+bool VDataSeries::shouldLabelNumberFormatKeyBeDetectedFromYAxis() const
+{
+ if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_Bubble_Size )
+ return false;
+ else if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_X )
+ return false;
+ return true;
+}
sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 index ) const
{
- return m_aValues_Y.detectNumberFormatKey( index );
+ sal_Int32 nRet = 0;
+ if( m_pValueSequenceForDataLabelNumberFormatDetection )
+ nRet = m_pValueSequenceForDataLabelNumberFormatDetection->detectNumberFormatKey( index );
+ return nRet;
}
sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const
@@ -626,7 +620,7 @@ sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Refe
double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
{
- double fY = getY( index );
+ double fY = getYValue( index );
double fY_Min = getY_Min( index );
double fY_Max = getY_Max( index );
double fY_First = getY_First( index );
@@ -653,7 +647,7 @@ double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const
{
- double fY = getY( index );
+ double fY = getYValue( index );
double fY_Min = getY_Min( index );
double fY_Max = getY_Max( index );
double fY_First = getY_First( index );
@@ -693,6 +687,14 @@ uno::Sequence< double > VDataSeries::getAllX() const
uno::Sequence< double > VDataSeries::getAllY() const
{
+ if(!m_aValues_Y.is() && !m_aValues_Y.getLength() && m_nPointCount)
+ {
+ //init y values from indexes
+ //first y-value (index 0) matches with real number 1.0
+ m_aValues_Y.Doubles.realloc( m_nPointCount );
+ for(sal_Int32 nN=m_aValues_Y.getLength();nN--;)
+ m_aValues_Y.Doubles[nN] = nN+1;
+ }
return m_aValues_Y.Doubles;
}
@@ -700,7 +702,7 @@ double VDataSeries::getYMeanValue() const
{
if( ::rtl::math::isNan( m_fYMeanValue ) )
{
- uno::Reference< XRegressionCurveCalculator > xCalculator( new MeanValueRegressionCurveCalculator() );
+ uno::Reference< XRegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( C2U("com.sun.star.chart2.MeanValueRegressionCurve") ) );
uno::Sequence< double > aXValuesDummy;
xCalculator->recalculateRegression( aXValuesDummy, getAllY() );
double fXDummy = 1.0;
@@ -887,6 +889,11 @@ DataPointLabel* VDataSeries::getDataPointLabel( sal_Int32 index ) const
m_apLabel_Series = getDataPointLabelFromPropertySet( this->getPropertiesOfPoint( index ) );
pRet = m_apLabel_Series.get();
}
+ if( !m_bAllowPercentValueInDataLabel )
+ {
+ if( pRet )
+ pRet->ShowNumberInPercent = false;
+ }
return pRet;
}
diff --git a/chart2/source/view/makefile.mk b/chart2/source/view/makefile.mk
index 4f74241075fe..58229edf1217 100644
--- a/chart2/source/view/makefile.mk
+++ b/chart2/source/view/makefile.mk
@@ -79,15 +79,12 @@ SHL1STDLIBS= $(CHARTTOOLS) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(COMPHELPERLIB) \
- $(GOODIESLIB) \
$(SALLIB) \
$(SVLLIB) \
$(SVTOOLLIB) \
$(SVXLIB) \
- $(TKLIB) \
$(TOOLSLIB) \
$(UNOTOOLSLIB) \
- $(I18NISOLANGLIB) \
$(BASEGFXLIB) \
$(VCLLIB) \
$(SFXLIB) \
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 7b128b4b1abd..f1859be15fcf 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -434,6 +434,22 @@ inline size_t ScAddress::hash() const
(static_cast<size_t>(nCol) << 24) ^ static_cast<size_t>(nRow);
}
+struct ScAddressHashFunctor
+{
+ size_t operator()( const ScAddress & rAdr ) const
+ {
+ return rAdr.hash();
+ }
+};
+
+struct ScAddressEqualFunctor
+{
+ bool operator()( const ScAddress & rAdr1, const ScAddress & rAdr2 ) const
+ {
+ return rAdr1 == rAdr2;
+ }
+};
+
// === ScRange ===============================================================
@@ -521,7 +537,9 @@ public:
inline bool operator>( const ScRange& r ) const;
inline bool operator>=( const ScRange& r ) const;
- inline size_t hash() const;
+ /// Hash 2D area ignoring table number.
+ inline size_t hashArea() const;
+ /// Hash start column and start and end rows.
inline size_t hashStartColumn() const;
};
@@ -580,7 +598,7 @@ inline bool ScRange::In( const ScRange& r ) const
}
-inline size_t ScRange::hash() const
+inline size_t ScRange::hashArea() const
{
// Assume that there are not that many ranges with identical corners so we
// won't have too many collisions. Also assume that more lower row and
@@ -609,6 +627,23 @@ inline size_t ScRange::hashStartColumn() const
}
+struct ScRangeHashAreaFunctor
+{
+ size_t operator()( const ScRange & rRange ) const
+ {
+ return rRange.hashArea();
+ }
+};
+
+struct ScRangeEqualFunctor
+{
+ bool operator()( const ScRange & rRange1, const ScRange & rRange2 ) const
+ {
+ return rRange1 == rRange2;
+ }
+};
+
+
// === ScRangePair ===========================================================
class ScRangePair
@@ -756,12 +791,14 @@ template< typename T > void PutInOrder( T& nStart, T& nEnd )
bool ConvertSingleRef( ScDocument* pDoc, const String& rRefString,
SCTAB nDefTab, ScRefAddress& rRefAddress,
- const ScAddress::Details& rDetails = ScAddress::detailsOOOa1);
+ const ScAddress::Details& rDetails = ScAddress::detailsOOOa1,
+ ScAddress::ExternalInfo* pExtInfo = NULL );
bool ConvertDoubleRef(ScDocument* pDoc, const String& rRefString,
SCTAB nDefTab, ScRefAddress& rStartRefAddress,
ScRefAddress& rEndRefAddress,
- const ScAddress::Details& rDetails = ScAddress::detailsOOOa1);
+ const ScAddress::Details& rDetails = ScAddress::detailsOOOa1,
+ ScAddress::ExternalInfo* pExtInfo = NULL );
/// append alpha representation of column to buffer
SC_DLLPUBLIC void ScColToAlpha( rtl::OUStringBuffer& rBuffer, SCCOL nCol);
diff --git a/sc/inc/brdcst.hxx b/sc/inc/brdcst.hxx
index 4079a011d0ed..0d4b9aac9fa7 100644
--- a/sc/inc/brdcst.hxx
+++ b/sc/inc/brdcst.hxx
@@ -40,6 +40,7 @@ class ScBaseCell;
#define SC_HINT_DYING SFX_HINT_DYING
#define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED
#define SC_HINT_TABLEOPDIRTY SFX_HINT_USER00
+#define SC_HINT_CALCALL SFX_HINT_USER01
class ScHint : public SfxSimpleHint
{
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index b8a228ddfd09..10de035abf7c 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -102,7 +102,7 @@ public:
/** Returns a clone of this cell, clones cell note and caption object too
(unless SC_CLONECELL_NOCAPTION flag is set). Broadcaster will not be cloned. */
- ScBaseCell* CloneWithNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const;
+ ScBaseCell* CloneWithNote( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const;
/** Due to the fact that ScBaseCell does not have a vtable, this function
deletes the cell by calling the appropriate d'tor of the derived class. */
@@ -387,13 +387,23 @@ public:
inline USHORT GetSeenInIteration() const { return nSeenInIteration; }
BOOL HasOneReference( ScRange& r ) const;
+ /* Checks if the formula contains reference list that can be
+ expressed by one reference (like A1;A2;A3:A5 -> A1:A5). The
+ reference list is not required to be sorted (i.e. A3;A1;A2 is
+ still recognized as A1:A3), but no overlapping is allowed.
+ If one reference is recognized, the rRange is filled.
+
+ It is similar to HasOneReference(), but more general.
+ */
+ bool HasRefListExpressibleAsOneReference(ScRange& rRange) const;
BOOL HasRelNameReference() const;
BOOL HasColRowName() const;
void UpdateReference(UpdateRefMode eUpdateRefMode,
const ScRange& r,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
- ScDocument* pUndoDoc = NULL );
+ ScDocument* pUndoDoc = NULL,
+ const ScAddress* pUndoCellPos = NULL );
void TransposeReference();
void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
@@ -485,6 +495,9 @@ public:
inline BOOL IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); }
EditTextObject* CreateURLObject() ;
void GetURLResult( String& rURL, String& rCellText );
+
+ /** Determines whether or not the result string contains more than one paragraph */
+ bool IsMultilineResult();
};
// Iterator fuer Referenzen in einer Formelzelle
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 51822f6c75c9..2dd0bd6cc16e 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -112,7 +112,7 @@ class ScPatternAttr;
class SvxBorderLine;
class SvxBoxItem;
class SvxBoxInfoItem;
-
+class SvxItemPropertySet;
class ScLinkListener : public SvtListener
{
@@ -178,7 +178,7 @@ class SC_DLLPUBLIC ScCellRangesBase : public com::sun::star::beans::XPropertySet
friend class ooo::vba::ScVbaCellRangeAccess;
private:
- SfxItemPropertySet aPropSet;
+ const SfxItemPropertySet* pPropSet;
ScDocShell* pDocShell;
ScLinkListener* pValueListener;
ScPatternAttr* pCurrentFlat;
@@ -221,11 +221,11 @@ protected:
// GetItemPropertyMap for derived classes must contain all entries, including base class
virtual const SfxItemPropertyMap* GetItemPropertyMap();
virtual ::com::sun::star::beans::PropertyState GetOnePropertyState(
- USHORT nItemWhich, const SfxItemPropertyMap* pMap );
- virtual void GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ USHORT nItemWhich, const SfxItemPropertySimpleEntry* pEntry );
+ virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
::com::sun::star::uno::Any& )
throw(::com::sun::star::uno::RuntimeException);
- virtual void SetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
const ::com::sun::star::uno::Any& aValue )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
@@ -610,16 +610,16 @@ class SC_DLLPUBLIC ScCellRangeObj : public ScCellRangesBase,
public com::sun::star::table::XColumnRowRange
{
private:
- SfxItemPropertySet aRangePropSet;
+ const SfxItemPropertySet* pRangePropSet;
ScRange aRange;
protected:
const ScRange& GetRange() const { return aRange; }
virtual const SfxItemPropertyMap* GetItemPropertyMap();
- virtual void GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
::com::sun::star::uno::Any& )
throw(::com::sun::star::uno::RuntimeException);
- virtual void SetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
const ::com::sun::star::uno::Any& aValue )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
@@ -629,9 +629,10 @@ protected:
throw(::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException);
- void SetArrayFormula_Impl( const rtl::OUString& aFormula,
- const formula::FormulaGrammar::Grammar eGrammar )
- throw(::com::sun::star::uno::RuntimeException);
+ void SetArrayFormula_Impl( const rtl::OUString& rFormula,
+ const rtl::OUString& rFormulaNmsp,
+ const formula::FormulaGrammar::Grammar eGrammar )
+ throw(::com::sun::star::uno::RuntimeException);
public:
ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR);
@@ -650,7 +651,8 @@ public:
virtual void RefChanged();
// via getImplementation()
- virtual void SetArrayFormulaWithGrammar( const ::rtl::OUString& aFormula,
+ virtual void SetArrayFormulaWithGrammar( const ::rtl::OUString& rFormula,
+ const ::rtl::OUString& rFormulaNmsp,
const formula::FormulaGrammar::Grammar )
throw(::com::sun::star::uno::RuntimeException);
@@ -825,7 +827,7 @@ class ScCellObj : public ScCellRangeObj,
{
private:
SvxUnoText* pUnoText;
- SfxItemPropertySet aCellPropSet;
+ const SfxItemPropertySet* pCellPropSet;
ScAddress aCellPos;
sal_Int16 nActionLockCount;
@@ -839,16 +841,16 @@ private:
protected:
virtual const SfxItemPropertyMap* GetItemPropertyMap();
- virtual void GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
::com::sun::star::uno::Any& )
throw(::com::sun::star::uno::RuntimeException);
- virtual void SetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
const ::com::sun::star::uno::Any& aValue )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
public:
- static const SfxItemPropertyMap* GetEditPropertyMap();
+ static const SvxItemPropertySet* GetEditPropertySet();
static const SfxItemPropertyMap* GetCellPropertyMap();
ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
@@ -869,7 +871,7 @@ public:
void SetFormulaResultString( const ::rtl::OUString& rResult );
void SetFormulaResultDouble( double fResult );
void SetFormulaWithGrammar( const ::rtl::OUString& rFormula,
- const formula::FormulaGrammar::Grammar );
+ const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar );
const ScAddress& GetPosition() const { return aCellPos; }
// XText
@@ -980,7 +982,6 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual sal_Int16 SAL_CALL resetActionLocks() throw(::com::sun::star::uno::RuntimeException);
- static String GetInputString_Impl(ScDocument* pDoc, const ScAddress& aPos, BOOL bEnglish);
static String GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aPos);
};
@@ -1007,17 +1008,17 @@ class ScTableSheetObj : public ScCellRangeObj,
friend class ScTableSheetsObj; // fuer insertByName()
private:
- SfxItemPropertySet aSheetPropSet;
+ const SfxItemPropertySet* pSheetPropSet;
SCTAB GetTab_Impl() const;
void PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges );
protected:
virtual const SfxItemPropertyMap* GetItemPropertyMap();
- virtual void GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
::com::sun::star::uno::Any& )
throw(::com::sun::star::uno::RuntimeException);
- virtual void SetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
const ::com::sun::star::uno::Any& aValue )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
@@ -1241,14 +1242,14 @@ class ScTableColumnObj : public ScCellRangeObj,
public com::sun::star::container::XNamed
{
private:
- SfxItemPropertySet aColPropSet;
+ const SfxItemPropertySet* pColPropSet;
protected:
virtual const SfxItemPropertyMap* GetItemPropertyMap();
- virtual void GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
::com::sun::star::uno::Any& )
throw(::com::sun::star::uno::RuntimeException);
- virtual void SetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
const ::com::sun::star::uno::Any& aValue )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
@@ -1292,14 +1293,14 @@ public:
class ScTableRowObj : public ScCellRangeObj
{
private:
- SfxItemPropertySet aRowPropSet;
+ const SfxItemPropertySet* pRowPropSet;
protected:
virtual const SfxItemPropertyMap* GetItemPropertyMap();
- virtual void GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
::com::sun::star::uno::Any& )
throw(::com::sun::star::uno::RuntimeException);
- virtual void SetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
const ::com::sun::star::uno::Any& aValue )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx
index b0b34f200cdb..dc0244dfcdb8 100644
--- a/sc/inc/chart2uno.hxx
+++ b/sc/inc/chart2uno.hxx
@@ -35,6 +35,7 @@
#include "rangelst.hxx"
#include "externalrefmgr.hxx"
#include "token.hxx"
+#include "chartlis.hxx"
#include <svtools/lstner.hxx>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
@@ -54,7 +55,6 @@
// #include <com/sun/star/lang/XUnoTunnel.hpp>
// #endif
#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase6.hxx>
#include <cppuhelper/implbase7.hxx>
@@ -74,9 +74,10 @@ class ScDocument;
// DataProvider ==============================================================
class ScChart2DataProvider : public
- ::cppu::WeakImplHelper3<
+ ::cppu::WeakImplHelper4<
::com::sun::star::chart2::data::XDataProvider,
::com::sun::star::chart2::data::XRangeXMLConversion,
+ ::com::sun::star::beans::XPropertySet,
::com::sun::star::lang::XServiceInfo>,
SfxListener
{
@@ -125,6 +126,59 @@ public:
virtual ::rtl::OUString SAL_CALL convertRangeFromXML( const ::rtl::OUString& sXMLRange )
throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+ // XPropertySet ----------------------------------------------------------
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo> SAL_CALL
+ getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue)
+ throw( ::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw( ::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener>& xListener)
+ throw( ::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener>& rListener)
+ throw( ::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener>& rListener)
+ throw( ::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener>& rListener)
+ throw( ::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
// XServiceInfo ----------------------------------------------------------
virtual ::rtl::OUString SAL_CALL getImplementationName() throw(
@@ -158,6 +212,8 @@ private:
private:
ScDocument* m_pDocument;
+ SfxItemPropertySet m_aPropSet;
+ sal_Bool m_bIncludeHiddenCells;
};
@@ -287,7 +343,7 @@ class ScChart2DataSequence : public
public:
explicit ScChart2DataSequence( ScDocument* pDoc,
const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP,
- ::std::vector<ScSharedTokenRef>* pTokens);
+ ::std::vector<ScSharedTokenRef>* pTokens, bool bIncludeHiddenCells );
virtual ~ScChart2DataSequence();
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
@@ -404,6 +460,9 @@ public:
// static ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference<
// com::sun::star::uno::XInterface> xObj );
+private:
+ void setDataChangedHint(bool b);
+
// Implementation --------------------------------------------------------
void RefChanged();
@@ -461,12 +520,24 @@ private:
Item();
};
+ class HiddenRangeListener : public ScChartHiddenRangeListener
+ {
+ public:
+ HiddenRangeListener(ScChart2DataSequence& rParent);
+ virtual ~HiddenRangeListener();
+
+ virtual void notify();
+
+ private:
+ ScChart2DataSequence& mrParent;
+ };
+
::std::list<Item> m_aDataArray;
::com::sun::star::uno::Sequence<sal_Int32> m_aHiddenValues;
// properties
::com::sun::star::chart2::data::DataSequenceRole m_aRole;
- sal_Bool m_bHidden;
+ sal_Bool m_bIncludeHiddenCells;
// internals
typedef ::std::auto_ptr< ::std::vector<ScSharedTokenRef> > TokenListPtr;
@@ -481,6 +552,7 @@ private:
com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
SfxItemPropertySet m_aPropSet;
+ ::std::auto_ptr<HiddenRangeListener> m_pHiddenListener;
ScLinkListener* m_pValueListener;
XModifyListenerArr_Impl m_aValueListeners;
@@ -625,7 +697,7 @@ private:
// properties
::com::sun::star::chart2::data::DataSequenceRole m_aRole;
- sal_Bool m_bHidden;
+ sal_Bool m_bIncludeHiddenCells;
// internals
ScRangeListRef m_xRanges;
ScDocument* m_pDocument;
diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index 99332c65e3dc..490c62743fb4 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -41,6 +41,7 @@
#include <memory>
#include <vector>
+#include <list>
#include <hash_set>
class ScDocument;
@@ -131,9 +132,31 @@ public:
{ return !operator==( r ); }
};
+// ============================================================================
+
+class ScChartHiddenRangeListener
+{
+public:
+ ScChartHiddenRangeListener();
+ virtual ~ScChartHiddenRangeListener();
+ virtual void notify() = 0;
+};
+
+// ============================================================================
+
class ScChartListenerCollection : public ScStrCollection
{
+public:
+ struct RangeListenerItem
+ {
+ ScRange maRange;
+ ScChartHiddenRangeListener* mpListener;
+ explicit RangeListenerItem(const ScRange& rRange, ScChartHiddenRangeListener* p);
+ };
+
private:
+ ::std::list<RangeListenerItem> maHiddenListeners;
+
Timer aTimer;
ScDocument* pDoc;
@@ -173,6 +196,24 @@ public:
void UpdateChartsContainingTab( SCTAB nTab );
BOOL operator==( const ScChartListenerCollection& );
+
+ /**
+ * Start listening on hide/show change within specified cell range. A
+ * single listener may listen on multiple ranges when the caller passes
+ * the same pointer multiple times with different ranges.
+ *
+ * Note that the caller is responsible for managing the life-cycle of the
+ * listener instance.
+ */
+ void StartListeningHiddenRange( const ScRange& rRange,
+ ScChartHiddenRangeListener* pListener );
+
+ /**
+ * Remove all ranges associated with passed listener instance from the
+ * list of hidden range listeners. This does not delete the passed
+ * listener instance.
+ */
+ void EndListeningHiddenRange( ScChartHiddenRangeListener* pListener );
};
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index ba15daa3c4d9..54a6570c0f1d 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -1373,7 +1373,7 @@ public:
BOOL bAllFlat = FALSE ) const;
// Reject visible Action (und abhaengige)
- BOOL Reject( ScChangeAction* );
+ BOOL Reject( ScChangeAction*, bool bShared = false );
// Accept visible Action (und abhaengige)
SC_DLLPUBLIC BOOL Accept( ScChangeAction* );
@@ -1399,8 +1399,6 @@ public:
void NotifyModified( ScChangeTrackMsgType eMsgType,
ULONG nStartAction, ULONG nEndAction );
- SC_DLLPUBLIC BOOL Load( SvStream& rStrm, USHORT nVer );
- SC_DLLPUBLIC BOOL Store( SvStream& rStrm );
USHORT GetLoadedFileFormatVersion() const
{ return nLoadedFileFormatVersion; }
@@ -1426,7 +1424,7 @@ public:
{ return bTime100thSeconds; }
void AppendCloned( ScChangeAction* pAppend );
- ScChangeTrack* Clone( ScDocument* pDocument ) const;
+ SC_DLLPUBLIC ScChangeTrack* Clone( ScDocument* pDocument ) const;
void MergeActionState( ScChangeAction* pAct, const ScChangeAction* pOtherAct );
#if DEBUG_CHANGETRACK
String ToString() const;
diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx
index 855d436f2ff9..de6539b08311 100644
--- a/sc/inc/collect.hxx
+++ b/sc/inc/collect.hxx
@@ -53,8 +53,8 @@ class SC_DLLPUBLIC ScDataObject
{
public:
ScDataObject() {}
- virtual ~ScDataObject();
- virtual ScDataObject* Clone() const = 0;
+ virtual ~ScDataObject();
+ virtual ScDataObject* Clone() const = 0;
};
class SC_DLLPUBLIC ScCollection : public ScDataObject
@@ -65,29 +65,29 @@ protected:
USHORT nDelta;
ScDataObject** pItems;
public:
- ScCollection(USHORT nLim = 4, USHORT nDel = 4);
- ScCollection(const ScCollection& rCollection);
+ ScCollection(USHORT nLim = 4, USHORT nDel = 4);
+ ScCollection(const ScCollection& rCollection);
virtual ~ScCollection();
virtual ScDataObject* Clone() const;
- void AtFree(USHORT nIndex);
- void Free(ScDataObject* pScDataObject);
- void FreeAll();
+ void AtFree(USHORT nIndex);
+ void Free(ScDataObject* pScDataObject);
+ void FreeAll();
- BOOL AtInsert(USHORT nIndex, ScDataObject* pScDataObject);
+ BOOL AtInsert(USHORT nIndex, ScDataObject* pScDataObject);
virtual BOOL Insert(ScDataObject* pScDataObject);
- ScDataObject* At(USHORT nIndex) const;
+ ScDataObject* At(USHORT nIndex) const;
virtual USHORT IndexOf(ScDataObject* pScDataObject) const;
- USHORT GetCount() const { return nCount; }
+ USHORT GetCount() const { return nCount; }
ScDataObject* operator[]( const USHORT nIndex) const {return At(nIndex);}
ScCollection& operator=( const ScCollection& rCol );
};
-class SC_DLLPUBLIC ScSortedCollection : public ScCollection
+class SC_DLLPUBLIC ScSortedCollection : public ScCollection
{
private:
BOOL bDuplicates;
@@ -96,19 +96,19 @@ protected:
void SetDups( BOOL bVal ) { bDuplicates = bVal; }
BOOL IsDups() const { return bDuplicates; }
public:
- ScSortedCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE);
- ScSortedCollection(const ScSortedCollection& rScSortedCollection) :
+ ScSortedCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE);
+ ScSortedCollection(const ScSortedCollection& rScSortedCollection) :
ScCollection(rScSortedCollection),
bDuplicates(rScSortedCollection.bDuplicates) {}
virtual USHORT IndexOf(ScDataObject* pScDataObject) const;
virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const = 0;
virtual BOOL IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const;
- BOOL Search(ScDataObject* pScDataObject, USHORT& rIndex) const;
+ BOOL Search(ScDataObject* pScDataObject, USHORT& rIndex) const;
virtual BOOL Insert(ScDataObject* pScDataObject);
virtual BOOL InsertPos(ScDataObject* pScDataObject, USHORT& nIndex);
- BOOL operator==(const ScSortedCollection& rCmp) const;
+ BOOL operator==(const ScSortedCollection& rCmp) const;
};
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index c026e0cb5cf9..058b3b30f30a 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -311,9 +311,11 @@ private:
const CharClass* pCharClass; // which character classification is used for parseAnyToken
USHORT mnPredetectedReference; // reference when reading ODF, 0 (none), 1 (single) or 2 (double)
SCsTAB nMaxTab; // last sheet in document
+ sal_Int32 mnRangeOpPosInSymbol; // if and where a range operator is in symbol
const Convention *pConv;
bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE
bool mbExtendedErrorDetection;
+ bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis
BOOL NextNewToken(bool bInArray = false);
@@ -352,14 +354,14 @@ public:
const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO );
static BOOL EnQuote( String& rStr );
+ sal_Unicode GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const;
// Check if it is a valid english function name
bool IsEnglishSymbol( const String& rName );
//! _either_ CompileForFAP _or_ AutoCorrection, _not_ both
- void SetCompileForFAP( BOOL bVal )
- { bCompileForFAP = bVal; bIgnoreErrors = bVal; }
+ // #i101512# SetCompileForFAP is in formula::FormulaCompiler
void SetAutoCorrection( BOOL bVal )
{ bAutoCorrect = bVal; bIgnoreErrors = bVal; }
void SetCloseBrackets( bool bVal ) { mbCloseBrackets = bVal; }
@@ -394,6 +396,8 @@ public:
maExternalLinks = rLinks;
}
+ void CreateStringFromXMLTokenArray( String& rFormula, String& rFormulaNmsp );
+
void SetExtendedErrorDetection( bool bVal ) { mbExtendedErrorDetection = bVal; }
BOOL IsCorrected() { return bCorrected; }
@@ -401,6 +405,7 @@ public:
// Use convention from this->aPos by default
ScTokenArray* CompileString( const String& rFormula );
+ ScTokenArray* CompileString( const String& rFormula, const String& rFormulaNmsp );
const ScDocument* GetDoc() const { return pDoc; }
const ScAddress& GetPos() const { return aPos; }
diff --git a/sc/inc/compressedarray.hxx b/sc/inc/compressedarray.hxx
index f648a569a10f..ce7144008e2b 100644
--- a/sc/inc/compressedarray.hxx
+++ b/sc/inc/compressedarray.hxx
@@ -74,7 +74,7 @@ public:
DataEntry() {} //! uninitialized
};
- /** Contruct with nMaxAccess=MAXROW, for example. */
+ /** Construct with nMaxAccess=MAXROW, for example. */
ScCompressedArray( A nMaxAccess,
const D& rValue,
size_t nDelta = nScCompressedArrayDelta );
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 2ec655585cd4..edb0f9371788 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -84,7 +84,10 @@ class SC_DLLPUBLIC ScConditionEntry
double nVal2;
String aStrVal1; // eingegeben oder berechnet
String aStrVal2;
- formula::FormulaGrammar::Grammar eTempGrammar; // grammar to be used on (re)compilation, e.g. in XML import
+ String aStrNmsp1; // namespace to be used on (re)compilation, e.g. in XML import
+ String aStrNmsp2; // namespace to be used on (re)compilation, e.g. in XML import
+ formula::FormulaGrammar::Grammar eTempGrammar1; // grammar to be used on (re)compilation, e.g. in XML import
+ formula::FormulaGrammar::Grammar eTempGrammar2; // grammar to be used on (re)compilation, e.g. in XML import
BOOL bIsStr1; // um auch leere Strings zu erkennen
BOOL bIsStr2;
ScTokenArray* pFormula1; // eingegebene Formel
@@ -101,7 +104,10 @@ class SC_DLLPUBLIC ScConditionEntry
void MakeCells( const ScAddress& rPos );
void Compile( const String& rExpr1, const String& rExpr2,
- const formula::FormulaGrammar::Grammar eGrammar, BOOL bTextToReal );
+ const String& rExprNmsp1, const String& rExprNmsp2,
+ formula::FormulaGrammar::Grammar eGrammar1,
+ formula::FormulaGrammar::Grammar eGrammar2,
+ BOOL bTextToReal );
void Interpret( const ScAddress& rPos );
BOOL IsValid( double nArg ) const;
@@ -111,7 +117,9 @@ public:
ScConditionEntry( ScConditionMode eOper,
const String& rExpr1, const String& rExpr2,
ScDocument* pDocument, const ScAddress& rPos,
- const formula::FormulaGrammar::Grammar eGrammar );
+ const String& rExprNmsp1, const String& rExprNmsp2,
+ formula::FormulaGrammar::Grammar eGrammar1,
+ formula::FormulaGrammar::Grammar eGrammar2 );
ScConditionEntry( ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
ScDocument* pDocument, const ScAddress& rPos );
@@ -174,7 +182,10 @@ public:
const String& rExpr1, const String& rExpr2,
ScDocument* pDocument, const ScAddress& rPos,
const String& rStyle,
- const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
+ const String& rExprNmsp1 = EMPTY_STRING,
+ const String& rExprNmsp2 = EMPTY_STRING,
+ formula::FormulaGrammar::Grammar eGrammar1 = formula::FormulaGrammar::GRAM_DEFAULT,
+ formula::FormulaGrammar::Grammar eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT );
ScCondFormatEntry( ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
ScDocument* pDocument, const ScAddress& rPos,
@@ -188,6 +199,7 @@ public:
int operator== ( const ScCondFormatEntry& r ) const;
const String& GetStyle() const { return aStyleName; }
+ void UpdateStyleName(const String& rNew) { aStyleName=rNew; }
protected:
virtual void DataChanged( const ScRange* pModified ) const;
@@ -224,6 +236,7 @@ public:
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos );
+ void RenameCellStyle( const String& rOld, const String& rNew );
void SourceChanged( const ScAddress& rAddr );
@@ -278,6 +291,7 @@ public:
void CompileXML();
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+ void RenameCellStyle( const String& rOld, const String& rNew );
void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos );
void SourceChanged( const ScAddress& rAddr );
diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index 8fe665ae6130..341300228869 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -37,24 +37,27 @@
#include <svtools/lstner.hxx>
#include <svtools/itemprop.hxx>
-#include <com/sun/star/sheet/XDataPilotTable.hpp>
-#include <com/sun/star/sheet/XDataPilotTable2.hpp>
-#include <com/sun/star/sheet/XDataPilotTables.hpp>
-#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/sheet/GeneralFunction.hpp>
-#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
-#include <com/sun/star/sheet/XDataPilotField.hpp>
-#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
+#include <com/sun/star/sheet/DataPilotFieldGroupInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
+#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
#include <com/sun/star/sheet/DataPilotFieldReference.hpp>
#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
-#include <com/sun/star/sheet/DataPilotFieldGroupInfo.hpp>
+#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp>
+#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
+#include <com/sun/star/sheet/XDataPilotField.hpp>
+#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
+#include <com/sun/star/sheet/XDataPilotTable.hpp>
+#include <com/sun/star/sheet/XDataPilotTable2.hpp>
+#include <com/sun/star/sheet/XDataPilotTables.hpp>
+
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
@@ -81,20 +84,21 @@ class ScDataPilotTableObj;
class ScDataPilotFieldObj;
class ScDataPilotItemObj;
-#define SC_FIELDORIENT_ALL USHRT_MAX
-
class ScDataPilotConversion
{
public:
static com::sun::star::sheet::GeneralFunction FirstFunc( USHORT nBits );
static USHORT FunctionBit( com::sun::star::sheet::GeneralFunction eFunc );
-};
-
+ static void FillGroupInfo(
+ ::com::sun::star::sheet::DataPilotFieldGroupInfo& rInfo,
+ const ScDPNumGroupInfo& rGroupInfo );
+};
-// DataPilotTables Collection ist pro Tabelle
+// ============================================================================
+/** DataPilotTables collection per sheet. */
class ScDataPilotTablesObj : public cppu::WeakImplHelper4<
com::sun::star::sheet::XDataPilotTables,
com::sun::star::container::XEnumerationAccess,
@@ -106,7 +110,7 @@ private:
ScDocShell* pDocShell;
SCTAB nTab;
- ScDataPilotTableObj* GetObjectByIndex_Impl(SCSIZE nIndex);
+ ScDataPilotTableObj* GetObjectByIndex_Impl( sal_Int32 nIndex );
ScDataPilotTableObj* GetObjectByName_Impl(const ::rtl::OUString& aName);
public:
@@ -161,10 +165,12 @@ public:
throw(::com::sun::star::uno::RuntimeException);
};
+// ============================================================================
// ScDataPilotDescriptorBase is never instantiated directly
class ScDataPilotDescriptorBase : public com::sun::star::sheet::XDataPilotDescriptor,
public com::sun::star::beans::XPropertySet,
+ public com::sun::star::sheet::XDataPilotDataLayoutFieldSupplier,
public com::sun::star::lang::XServiceInfo,
public com::sun::star::lang::XUnoTunnel,
public com::sun::star::lang::XTypeProvider,
@@ -172,8 +178,8 @@ class ScDataPilotDescriptorBase : public com::sun::star::sheet::XDataPilotDescri
public SfxListener
{
private:
- SfxItemPropertySet aPropSet;
- ScDocShell* pDocShell;
+ SfxItemPropertySet maPropSet;
+ ScDocShell* pDocShell;
public:
ScDataPilotDescriptorBase(ScDocShell* pDocSh);
@@ -256,6 +262,11 @@ public:
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
+ // XDataPilotDataLayoutFieldSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >
+ SAL_CALL getDataLayoutField()
+ throw(::com::sun::star::uno::RuntimeException);
+
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
sal_Int8 >& aIdentifier )
@@ -274,6 +285,7 @@ public:
// XServiceInfo is in derived classes
};
+// ============================================================================
class ScDataPilotDescriptor : public ScDataPilotDescriptorBase
{
@@ -304,6 +316,7 @@ public:
throw(::com::sun::star::uno::RuntimeException);
};
+// ============================================================================
class ScDataPilotTableObj : public ScDataPilotDescriptorBase,
public com::sun::star::sheet::XDataPilotTable2
@@ -369,23 +382,77 @@ public:
throw(::com::sun::star::uno::RuntimeException);
};
+// ============================================================================
-class ScDataPilotFieldsObj : public cppu::WeakImplHelper4<
- com::sun::star::container::XEnumerationAccess,
- com::sun::star::container::XIndexAccess,
- com::sun::star::container::XNameAccess,
- com::sun::star::lang::XServiceInfo>
+struct ScFieldIdentifier
+{
+ ::rtl::OUString maFieldName; /// Source field name.
+ sal_Int32 mnFieldIdx; /// Field index (if several fields with same name exist).
+ bool mbDataLayout; /// True = data layout field collecting all data fields as items.
+
+ inline explicit ScFieldIdentifier() :
+ mnFieldIdx( 0 ), mbDataLayout( false ) {}
+
+ inline explicit ScFieldIdentifier( const ::rtl::OUString& rFieldName, sal_Int32 nFieldIdx, bool bDataLayout ) :
+ maFieldName( rFieldName ), mnFieldIdx( nFieldIdx ), mbDataLayout( bDataLayout ) {}
+};
+
+// ============================================================================
+
+/** Base class of all implementation objects based on a DataPilot descriptor
+ or DataPilot table object. Wraps acquiring and releasing the parent. */
+class ScDataPilotChildObjBase
{
+protected:
+ explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent );
+ explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
+ virtual ~ScDataPilotChildObjBase();
+
+ /** Returns the wrapped DataPilot object (calls GetDPObject() at parent). */
+ ScDPObject* GetDPObject() const;
+ /** Sets the passed DataPilot object (calls SetDPObject() at parent). */
+ void SetDPObject( ScDPObject* pDPObject );
+
+ /** Returns the DataPilot dimension object related to the field described by maFieldId. */
+ ScDPSaveDimension* GetDPDimension( ScDPObject** ppDPObject = 0 ) const;
+
+ /** Returns the number of members for the field described by maFieldId. */
+ sal_Int32 GetMemberCount() const;
+ /** Returns the collection of members for the field described by maFieldId. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ GetMembers() const;
+
+protected:
+ ScDataPilotDescriptorBase& mrParent;
+ ScFieldIdentifier maFieldId;
+
private:
- ScDataPilotDescriptorBase* pParent;
- USHORT nType; // DataPilotFieldOrientation oder SC_FIELDORIENT_ALL
+ ScDataPilotChildObjBase& operator=( const ScDataPilotChildObjBase& );
+};
- ScDataPilotFieldObj* GetObjectByIndex_Impl(SCSIZE nIndex) const;
- ScDataPilotFieldObj* GetObjectByName_Impl(const ::rtl::OUString& aName) const;
+// ============================================================================
+typedef ::cppu::WeakImplHelper4
+<
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo
+>
+ScDataPilotFieldsObjImpl;
+
+/** Collection of all DataPilot fields, or of all fields from a specific dimension. */
+class ScDataPilotFieldsObj : public ScDataPilotChildObjBase, public ScDataPilotFieldsObjImpl
+{
public:
- ScDataPilotFieldsObj(ScDataPilotDescriptorBase* pPar, USHORT nTy);
- virtual ~ScDataPilotFieldsObj();
+ explicit ScDataPilotFieldsObj(
+ ScDataPilotDescriptorBase& rParent );
+
+ explicit ScDataPilotFieldsObj(
+ ScDataPilotDescriptorBase& rParent,
+ ::com::sun::star::sheet::DataPilotFieldOrientation eOrient );
+
+ virtual ~ScDataPilotFieldsObj();
// XNameAccess
virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
@@ -420,51 +487,41 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException);
-};
-
-struct ScFieldGroup
-{
- ::rtl::OUString sName;
- ::std::vector < ::rtl::OUString > aMembers;
-};
-typedef ::std::vector < ScFieldGroup > ScFieldGroups;
+private:
+ ScDataPilotFieldObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
+ ScDataPilotFieldObj* GetObjectByName_Impl( const ::rtl::OUString& rName ) const;
+private:
+ ::com::sun::star::uno::Any maOrient; /// Field orientation, no value = all fields.
+};
-struct ScFieldIdentifier
-{
- String sFieldName; // source field name
- sal_Bool bDataLayoutField;
- sal_Int32 nRepeat; // to allow using one source column for several data fields
- // nRepeat always counts in all fields, not just of one orientation
+// ============================================================================
- ScFieldIdentifier() :
- bDataLayoutField( sal_False ), nRepeat( 0 ) {}
+typedef ::cppu::WeakImplHelper5
+<
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::sheet::XDataPilotField,
+ ::com::sun::star::sheet::XDataPilotFieldGrouping,
+ ::com::sun::star::lang::XServiceInfo
+>
+ScDataPilotFieldObjImpl;
- ScFieldIdentifier( const String& rName, sal_Bool bDataLayout, sal_Int32 nRep ) :
- sFieldName( rName ), bDataLayoutField( bDataLayout ), nRepeat( nRep ) {}
-};
-
-class ScDataPilotFieldObj : public cppu::WeakImplHelper5<
- com::sun::star::container::XNamed,
- com::sun::star::beans::XPropertySet,
- com::sun::star::sheet::XDataPilotField,
- com::sun::star::sheet::XDataPilotFieldGrouping,
- com::sun::star::lang::XServiceInfo>
+/** Implementation of a single DataPilot field. */
+class ScDataPilotFieldObj : public ScDataPilotChildObjBase, public ScDataPilotFieldObjImpl
{
-private:
- com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> xItems;
- SfxItemPropertySet aPropSet;
- ScDataPilotDescriptorBase* pParent;
- USHORT nSourceType;
- ScFieldIdentifier aSourceIdent;
- USHORT nLastFunc; // valid while type is HIDDEN (or PAGE)
+public:
+ ScDataPilotFieldObj(
+ ScDataPilotDescriptorBase& rParent,
+ const ScFieldIdentifier& rIdent );
+ ScDataPilotFieldObj(
+ ScDataPilotDescriptorBase& rParent,
+ const ScFieldIdentifier& rIdent,
+ const ::com::sun::star::uno::Any& rOrient );
-public:
- ScDataPilotFieldObj(ScDataPilotDescriptorBase* pPar,
- USHORT nST, const ScFieldIdentifier& rIdent);
- virtual ~ScDataPilotFieldObj();
+ virtual ~ScDataPilotFieldObj();
// XNamed
virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
@@ -521,6 +578,8 @@ public:
void setOrientation(com::sun::star::sheet::DataPilotFieldOrientation Orientation);
com::sun::star::sheet::GeneralFunction getFunction(void) const;
void setFunction(com::sun::star::sheet::GeneralFunction Function);
+ com::sun::star::uno::Sequence< com::sun::star::sheet::GeneralFunction > getSubtotals() const;
+ void setSubtotals(const com::sun::star::uno::Sequence< com::sun::star::sheet::GeneralFunction >& rFunctions);
rtl::OUString getCurrentPage() const;
void setCurrentPage(const rtl::OUString& sPage);
sal_Bool getUseCurrentPage() const;
@@ -536,10 +595,6 @@ public:
sal_Bool getShowEmpty() const;
void setShowEmpty(sal_Bool bShow);
- void SetGroupInfo(const ScDPNumGroupInfo& rGroupInfo,
- com::sun::star::sheet::DataPilotFieldGroupInfo& rInfo);
- void FillGroupInfo(const ScDPSaveGroupDimension* pGroupDim,
- const ScDPSaveNumGroupDimension* pNumGroupDim, com::sun::star::sheet::DataPilotFieldGroupInfo& rInfo);
sal_Bool hasGroupInfo();
com::sun::star::sheet::DataPilotFieldGroupInfo getGroupInfo();
void setGroupInfo(const com::sun::star::sheet::DataPilotFieldGroupInfo* pInfo);
@@ -562,20 +617,48 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
+ mxItems;
+ SfxItemPropertySet maPropSet;
+ ::com::sun::star::uno::Any maOrient;
};
-class ScDataPilotFieldGroupsObj : public cppu::WeakImplHelper4<
- com::sun::star::container::XEnumerationAccess,
- com::sun::star::container::XIndexAccess,
- com::sun::star::container::XNameContainer,
- com::sun::star::lang::XServiceInfo>
+// ============================================================================
+
+typedef ::std::vector< ::rtl::OUString > ScFieldGroupMembers;
+
+struct ScFieldGroup
{
-private:
- ScFieldGroups aGroups;
+ ::rtl::OUString maName;
+ ScFieldGroupMembers maMembers;
+};
+
+typedef ::std::vector< ScFieldGroup > ScFieldGroups;
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper4
+<
+ ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::lang::XServiceInfo
+>
+ScDataPilotFieldGroupsObjImpl;
+
+/** Implementation of all grouped items in a DataPilot field.
+ This is a stand-alone object without any connection to the base DataPilot
+ field. Grouping info has to be written back with the GroupInfo property of
+ the DataPilot field after modifying this object.
+ */
+class ScDataPilotFieldGroupsObj : public ScDataPilotFieldGroupsObjImpl
+{
public:
- ScDataPilotFieldGroupsObj(const ScFieldGroups& rGroups);
- virtual ~ScDataPilotFieldGroupsObj();
+ explicit ScDataPilotFieldGroupsObj( const ScFieldGroups& rGroups );
+ virtual ~ScDataPilotFieldGroupsObj();
// XNameAccess
virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
@@ -587,7 +670,7 @@ public:
virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
- // XNameReplace
+ // XNameReplace
virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName,
const ::com::sun::star::uno::Any& aElement )
throw (::com::sun::star::lang::IllegalArgumentException,
@@ -607,7 +690,7 @@ public:
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- // XIndexAccess
+ // XIndexAccess
virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
throw(::com::sun::star::lang::IndexOutOfBoundsException,
@@ -630,34 +713,35 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException);
-};
-class ScDataPilotFieldGroupObj : public cppu::WeakImplHelper5<
- com::sun::star::container::XEnumerationAccess,
- com::sun::star::container::XIndexAccess,
- com::sun::star::container::XNameContainer,
- com::sun::star::container::XNamed,
- com::sun::star::lang::XServiceInfo>
-{
+ // implementation
+ ScFieldGroup& getFieldGroup( const ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException);
+ void renameFieldGroup( const ::rtl::OUString& rOldName, const ::rtl::OUString& rNewName ) throw(::com::sun::star::uno::RuntimeException);
+
private:
- ScFieldGroup aGroup;
+ ScFieldGroups::iterator implFindByName( const ::rtl::OUString& rName );
-public:
- ScDataPilotFieldGroupObj(const ScFieldGroup& rGroup);
- virtual ~ScDataPilotFieldGroupObj();
+private:
+ ScFieldGroups maGroups;
+};
- // XNamed
- virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString& aName )
- throw(::com::sun::star::uno::RuntimeException);
+// ============================================================================
- // XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName,
- const ::com::sun::star::uno::Any& aElement )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
+typedef ::cppu::WeakImplHelper5
+<
+ ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo
+>
+ScDataPilotFieldGroupObjImpl;
+
+class ScDataPilotFieldGroupObj : public ScDataPilotFieldGroupObjImpl
+{
+public:
+ explicit ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, const ::rtl::OUString& rGroupName );
+ virtual ~ScDataPilotFieldGroupObj();
// XNameAccess
virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
@@ -669,7 +753,15 @@ public:
virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
- // XNameContainer
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName,
+ const ::com::sun::star::uno::Any& aElement )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XNameContainer
virtual void SAL_CALL insertByName( const ::rtl::OUString& aName,
const ::com::sun::star::uno::Any& aElement )
throw (::com::sun::star::lang::IllegalArgumentException,
@@ -681,7 +773,7 @@ public:
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- // XIndexAccess
+ // XIndexAccess
virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
throw(::com::sun::star::lang::IndexOutOfBoundsException,
@@ -697,6 +789,11 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::uno::RuntimeException);
+
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName()
throw(::com::sun::star::uno::RuntimeException);
@@ -704,18 +801,26 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException);
-};
-class ScDataPilotFieldGroupItemObj : public cppu::WeakImplHelper2<
- com::sun::star::container::XNamed,
- com::sun::star::lang::XServiceInfo>
-{
private:
- rtl::OUString sName;
+ ScDataPilotFieldGroupsObj& mrParent;
+ ::rtl::OUString maGroupName;
+};
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper2
+<
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo
+>
+ScDataPilotFieldGroupItemObjImpl;
+class ScDataPilotFieldGroupItemObj : public ScDataPilotFieldGroupItemObjImpl
+{
public:
- ScDataPilotFieldGroupItemObj(const rtl::OUString& rName);
- virtual ~ScDataPilotFieldGroupItemObj();
+ explicit ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, const ::rtl::OUString& rName );
+ virtual ~ScDataPilotFieldGroupItemObj();
// XNamed
virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
@@ -729,23 +834,28 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException);
-};
-class ScDataPilotItemsObj : public cppu::WeakImplHelper4<
- com::sun::star::container::XEnumerationAccess,
- com::sun::star::container::XIndexAccess,
- com::sun::star::container::XNameAccess,
- com::sun::star::lang::XServiceInfo>
-{
private:
- ScDataPilotDescriptorBase* pParent;
- ScFieldIdentifier aSourceIdent; // of the field
+ ScDataPilotFieldGroupObj& mrParent;
+ ::rtl::OUString maName;
+};
+
+// ============================================================================
- ScDataPilotItemObj* GetObjectByIndex_Impl(SCSIZE nIndex) const;
+typedef ::cppu::WeakImplHelper4
+<
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::lang::XServiceInfo
+>
+ScDataPilotItemsObjImpl;
+class ScDataPilotItemsObj : public ScDataPilotChildObjBase, public ScDataPilotItemsObjImpl
+{
public:
- ScDataPilotItemsObj(ScDataPilotDescriptorBase* pPar, const ScFieldIdentifier& rIdent);
- virtual ~ScDataPilotItemsObj();
+ explicit ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
+ virtual ~ScDataPilotItemsObj();
// XNameAccess
virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
@@ -780,23 +890,30 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException);
-};
-class ScDataPilotItemObj : public cppu::WeakImplHelper3<
- com::sun::star::container::XNamed,
- com::sun::star::beans::XPropertySet,
- com::sun::star::lang::XServiceInfo>
-{
private:
- SfxItemPropertySet aPropSet;
- ScDataPilotDescriptorBase* pParent;
- ScFieldIdentifier aSourceIdent;
- SCSIZE nIndex;
+ ScDataPilotItemObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
+};
+// ============================================================================
+typedef ::cppu::WeakImplHelper3
+<
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo
+>
+ScDataPilotItemObjImpl;
+
+class ScDataPilotItemObj : public ScDataPilotChildObjBase, public ScDataPilotItemObjImpl
+{
public:
- ScDataPilotItemObj(ScDataPilotDescriptorBase* pPar, const ScFieldIdentifier& rIdent, SCSIZE nI);
- virtual ~ScDataPilotItemObj();
+ explicit ScDataPilotItemObj(
+ ScDataPilotDescriptorBase& rParent,
+ const ScFieldIdentifier& rFieldId,
+ sal_Int32 nIndex );
+
+ virtual ~ScDataPilotItemObj();
// XNamed
virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
@@ -851,7 +968,13 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ SfxItemPropertySet maPropSet;
+ sal_Int32 mnIndex;
};
+// ============================================================================
+
#endif
diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index 405d49e2a6b2..a93bfc341573 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -50,6 +50,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
@@ -340,8 +341,9 @@ public:
// to uno, all three look the same
-class ScFilterDescriptorBase : public cppu::WeakImplHelper3<
+class ScFilterDescriptorBase : public cppu::WeakImplHelper4<
com::sun::star::sheet::XSheetFilterDescriptor,
+ com::sun::star::sheet::XSheetFilterDescriptor2,
com::sun::star::beans::XPropertySet,
com::sun::star::lang::XServiceInfo >,
public SfxListener
@@ -368,6 +370,13 @@ public:
::com::sun::star::sheet::TableFilterField >& aFilterFields )
throw(::com::sun::star::uno::RuntimeException);
+ // XSheetFilterDescriptor2
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TableFilterField2 > SAL_CALL
+ getFilterFields2() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFilterFields2( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::sheet::TableFilterField2 >& aFilterFields )
+ throw(::com::sun::star::uno::RuntimeException);
+
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
SAL_CALL getPropertySetInfo()
diff --git a/sc/inc/defltuno.hxx b/sc/inc/defltuno.hxx
index 676f9f7b8a00..2f33dcdb3f48 100644
--- a/sc/inc/defltuno.hxx
+++ b/sc/inc/defltuno.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <cppuhelper/implbase3.hxx>
+#include <svtools/itemprop.hxx>
class ScDocShell;
@@ -48,6 +49,7 @@ class ScDocDefaultsObj : public ::cppu::WeakImplHelper3<
{
private:
ScDocShell* pDocShell;
+ SfxItemPropertyMap aPropertyMap;
void ItemsChanged();
diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx
index e161e3e02428..325060f0c05a 100644
--- a/sc/inc/docoptio.hxx
+++ b/sc/inc/docoptio.hxx
@@ -33,6 +33,7 @@
#include <unotools/configitem.hxx>
#include <svtools/poolitem.hxx>
+#include <svtools/itemprop.hxx>
#include "scdllapi.h"
#include "optutil.hxx"
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f74d1b1f5753..16b6d2adc61e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -90,6 +90,7 @@ class ScDBData;
class ScDetOpData;
class ScDetOpList;
class ScDocOptions;
+class ScDocProtection;
class ScDocumentPool;
class ScDrawLayer;
class ScExtDocOptions;
@@ -108,6 +109,7 @@ class ScRangeName;
class ScStyleSheet;
class ScStyleSheetPool;
class ScTable;
+class ScTableProtection;
class ScTokenArray;
class ScValidationData;
class ScValidationDataList;
@@ -136,6 +138,8 @@ class ScAutoNameCache;
class ScTemporaryChartLock;
class ScLookupCache;
struct ScLookupCacheMapImpl;
+class SfxUndoManager;
+class ScFormulaParserPool;
namespace com { namespace sun { namespace star {
namespace lang {
@@ -232,6 +236,7 @@ friend class ScHorizontalCellIterator;
friend class ScHorizontalAttrIterator;
friend class ScDocAttrIterator;
friend class ScAttrRectIterator;
+friend class ScDocShell;
#if OLD_PIVOT_IMPLEMENTATION
friend class ScPivot;
#endif
@@ -241,6 +246,7 @@ private:
vos::ORef<ScPoolHelper> xPoolHelper;
+ SfxUndoManager* mpUndoManager;
ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper
ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper
SfxItemPool* pNoteItemPool; // SfxItemPool to be used if pDrawLayer not created.
@@ -283,9 +289,14 @@ private:
ScFieldEditEngine* pCacheFieldEditEngine;
- com::sun::star::uno::Sequence<sal_Int8> aProtectPass;
+ ::std::auto_ptr<ScDocProtection> pDocProtection;
::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
+
+ // mutable for lazy construction
+ mutable ::std::auto_ptr< ScFormulaParserPool >
+ mxFormulaParserPool; /// Pool for all external formula parsers used by this document.
+
String aDocName; // opt: Dokumentname
String aDocCodeName; // opt: Dokumentname
ScRangePairListRef xColNameRanges;
@@ -348,7 +359,6 @@ private:
ScLkUpdMode eLinkMode;
- BOOL bProtected;
BOOL bAutoCalc; // Automatisch Berechnen
BOOL bAutoCalcShellDisabled; // in/von/fuer ScDocShell disabled
// ob noch ForcedFormulas berechnet werden muessen,
@@ -408,7 +418,7 @@ private:
mutable BOOL bStyleSheetUsageInvalid;
- BOOL bUndoEnabled;
+ bool mbUndoEnabled;
bool mbAdjustHeightEnabled;
bool mbExecuteLinkEnabled;
bool mbChangeReadOnlyEnabled; // allow changes in read-only document (for API import filters)
@@ -532,13 +542,14 @@ public:
SC_DLLPUBLIC inline SCTAB GetTableCount() const { return nMaxTableNumber; }
SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
- SC_DLLPUBLIC void SetDocProtection( BOOL bProtect, const com::sun::star::uno::Sequence <sal_Int8>& aPass );
- SC_DLLPUBLIC void SetTabProtection( SCTAB nTab, BOOL bProtect, const com::sun::star::uno::Sequence <sal_Int8>& aPass );
+ SC_DLLPUBLIC ScDocProtection* GetDocProtection() const;
+ SC_DLLPUBLIC void SetDocProtection(const ScDocProtection* pProtect);
SC_DLLPUBLIC BOOL IsDocProtected() const;
BOOL IsDocEditable() const;
SC_DLLPUBLIC BOOL IsTabProtected( SCTAB nTab ) const;
- const com::sun::star::uno::Sequence <sal_Int8>& GetDocPassword() const;
- const com::sun::star::uno::Sequence <sal_Int8>& GetTabPassword( SCTAB nTab ) const;
+ SC_DLLPUBLIC ScTableProtection* GetTabProtection( SCTAB nTab ) const;
+ SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect);
+ void CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest);
void LockTable(SCTAB nTab);
void UnlockTable(SCTAB nTab);
@@ -580,6 +591,8 @@ public:
SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos);
SC_DLLPUBLIC void SetVisible( SCTAB nTab, BOOL bVisible );
SC_DLLPUBLIC BOOL IsVisible( SCTAB nTab ) const;
+ BOOL IsPendingRowHeights( SCTAB nTab ) const;
+ void SetPendingRowHeights( SCTAB nTab, BOOL bSet );
SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, BOOL bRTL );
SC_DLLPUBLIC BOOL IsLayoutRTL( SCTAB nTab ) const;
BOOL IsNegativePage( SCTAB nTab ) const;
@@ -593,7 +606,7 @@ public:
SC_DLLPUBLIC BOOL IsActiveScenario( SCTAB nTab ) const;
SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, BOOL bActive ); // nur fuer Undo etc.
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
- formula::FormulaGrammar::Grammar GetGrammar() const;
+ SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const;
void SetGrammar( formula::FormulaGrammar::Grammar eGram );
SC_DLLPUBLIC BYTE GetLinkMode( SCTAB nTab ) const;
BOOL IsLinked( SCTAB nTab ) const;
@@ -617,6 +630,10 @@ public:
void MarkUsedExternalReferences();
bool MarkUsedExternalReferences( ScTokenArray & rArr );
+ /** Returns the pool containing external formula parsers. Creates the pool
+ on first call. */
+ ScFormulaParserPool& GetFormulaParserPool() const;
+
BOOL HasDdeLinks() const;
BOOL HasAreaLinks() const;
void UpdateExternalRefLinks();
@@ -774,6 +791,12 @@ public:
SC_DLLPUBLIC ScPostIt* GetOrCreateNote( const ScAddress& rPos );
/** Deletes the note at the passed cell address. */
void DeleteNote( const ScAddress& rPos );
+ /** Creates the captions of all uninitialized cell notes in the specified sheet.
+ @param bForced True = always create all captions, false = skip when Undo is disabled. */
+ void InitializeNoteCaptions( SCTAB nTab, bool bForced = false );
+ /** Creates the captions of all uninitialized cell notes in all sheets.
+ @param bForced True = always create all captions, false = skip when Undo is disabled. */
+ void InitializeAllNoteCaptions( bool bForced = false );
BOOL ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark,
@@ -891,22 +914,26 @@ public:
BOOL InsertRow( SCCOL nStartCol, SCTAB nStartTab,
SCCOL nEndCol, SCTAB nEndTab,
- SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL );
+ SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
+ const ScMarkData* pTabMark = NULL );
SC_DLLPUBLIC BOOL InsertRow( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
void DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
SCCOL nEndCol, SCTAB nEndTab,
SCROW nStartRow, SCSIZE nSize,
- ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
+ ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
+ const ScMarkData* pTabMark = NULL );
void DeleteRow( const ScRange& rRange,
ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
BOOL InsertCol( SCROW nStartRow, SCTAB nStartTab,
SCROW nEndRow, SCTAB nEndTab,
- SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL );
+ SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
+ const ScMarkData* pTabMark = NULL );
SC_DLLPUBLIC BOOL InsertCol( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
void DeleteCol( SCROW nStartRow, SCTAB nStartTab,
SCROW nEndRow, SCTAB nEndTab,
SCCOL nStartCol, SCSIZE nSize,
- ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
+ ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
+ const ScMarkData* pTabMark = NULL );
void DeleteCol( const ScRange& rRange,
ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
@@ -919,8 +946,9 @@ public:
BOOL IsClipOrUndo() const { return bIsClip || bIsUndo; }
BOOL IsUndo() const { return bIsUndo; }
BOOL IsClipboard() const { return bIsClip; }
- BOOL IsUndoEnabled() const { return bUndoEnabled; }
- void EnableUndo( BOOL bVal ) { bUndoEnabled = bVal; }
+ bool IsUndoEnabled() const { return mbUndoEnabled; }
+ void EnableUndo( bool bVal );
+
bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; }
void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; }
bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled; }
@@ -1235,7 +1263,8 @@ public:
BOOL bShrink );
void UpdateAllRowHeights( OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY );
+ const Fraction& rZoomX, const Fraction& rZoomY,
+ const ScMarkData* pTabMark = NULL );
long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
OutputDevice* pDev,
double nPPTX, double nPPTY,
@@ -1472,7 +1501,8 @@ public:
private:
-//UNUSED2008-05 void SetAutoFilterFlags();
+ ScDocument(const ScDocument& r); // disabled with no definition
+
void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount,
SCCOL nX1, SCCOL nX2 ) const;
@@ -1683,6 +1713,7 @@ public:
formula::FormulaGrammar::Grammar GetStorageGrammar() const
{ return eStorageGrammar; }
+ SfxUndoManager* GetUndoManager();
private: // CLOOK-Impl-Methoden
void ImplCreateOptions(); // bei Gelegenheit auf on-demand umstellen?
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 36a152943782..defe627dd812 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -112,6 +112,8 @@ private:
ScMarkData& rMark, ScPrintSelectionStatus& rStatus ) const;
rtl::OUString maBuildId;
+protected:
+ const SfxItemPropertySet& GetPropertySet() const { return aPropSet; }
public:
ScModelObj(ScDocShell* pDocSh);
@@ -123,7 +125,7 @@ public:
ScDocument* GetDocument() const;
SfxObjectShell* GetEmbeddedObject() const;
- void UpdateAllRowHeights();
+ void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL );
ScDrawLayer* MakeDrawLayer();
void BeforeXMLLoading();
diff --git a/sc/inc/dpdimsave.hxx b/sc/inc/dpdimsave.hxx
index 076e35763d4e..4c711eb67eb7 100644
--- a/sc/inc/dpdimsave.hxx
+++ b/sc/inc/dpdimsave.hxx
@@ -32,6 +32,7 @@
#define SC_DPDIMSAVE_HXX
#include <vector>
+#include <map>
#include <tools/string.hxx>
#include "dpgroup.hxx" // for ScDPNumGroupInfo
#include "scdllapi.h"
@@ -50,6 +51,8 @@ class ScDPSaveGroupDimension;
// These have to be applied before the other ScDPSaveData settings.
//
+// ============================================================================
+
class SC_DLLPUBLIC ScDPSaveGroupItem
{
String aGroupName; // name of group
@@ -57,7 +60,6 @@ class SC_DLLPUBLIC ScDPSaveGroupItem
public:
ScDPSaveGroupItem( const String& rName );
- ScDPSaveGroupItem( const ScDPSaveGroupItem& r );
~ScDPSaveGroupItem();
void AddToData( ScDPGroupDimension& rDataDim, SvNumberFormatter* pFormatter ) const;
@@ -80,6 +82,8 @@ public:
typedef ::std::vector<ScDPSaveGroupItem> ScDPSaveGroupItemVec;
+// ============================================================================
+
class SC_DLLPUBLIC ScDPSaveGroupDimension
{
String aSourceDim; // always the real source from the original data
@@ -90,7 +94,7 @@ class SC_DLLPUBLIC ScDPSaveGroupDimension
public:
ScDPSaveGroupDimension( const String& rSource, const String& rName );
- ScDPSaveGroupDimension( const ScDPSaveGroupDimension& r );
+ ScDPSaveGroupDimension( const String& rSource, const String& rName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart );
~ScDPSaveGroupDimension();
void AddToData( ScDPGroupTableData& rData ) const;
@@ -119,7 +123,7 @@ public:
void Rename( const String& rNewName );
};
-typedef ::std::vector<ScDPSaveGroupDimension> ScDPSaveGroupDimensionVec;
+// ============================================================================
class SC_DLLPUBLIC ScDPSaveNumGroupDimension
{
@@ -130,7 +134,7 @@ class SC_DLLPUBLIC ScDPSaveNumGroupDimension
public:
ScDPSaveNumGroupDimension( const String& rName, const ScDPNumGroupInfo& rInfo );
- ScDPSaveNumGroupDimension( const ScDPSaveNumGroupDimension& r );
+ ScDPSaveNumGroupDimension( const String& rName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart );
~ScDPSaveNumGroupDimension();
void AddToData( ScDPGroupTableData& rData ) const;
@@ -145,46 +149,57 @@ public:
void SetDateInfo( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart );
};
-typedef ::std::vector<ScDPSaveNumGroupDimension> ScDPSaveNumGroupDimensionVec;
+// ============================================================================
class SC_DLLPUBLIC ScDPDimensionSaveData
{
- ScDPSaveGroupDimensionVec aGroupDimensions;
- ScDPSaveNumGroupDimensionVec aNumGroupDimensions;
-
-
- // not implemented
- ScDPDimensionSaveData& operator=( const ScDPDimensionSaveData& );
-
public:
ScDPDimensionSaveData();
- ScDPDimensionSaveData( const ScDPDimensionSaveData& r );
~ScDPDimensionSaveData();
bool operator==( const ScDPDimensionSaveData& r ) const;
void WriteToData( ScDPGroupTableData& rData ) const;
- String CreateGroupDimName( const String& rSourceName, const ScDPObject& rObject, bool bAllowSource,
- const std::vector<String>* pDeletedNames );
- void AddGroupDimension( const ScDPSaveGroupDimension& rGroup );
- void RemoveGroupDimension( const String& rDimensionName );
+ String CreateGroupDimName( const String& rSourceName, const ScDPObject& rObject, bool bAllowSource, const ::std::vector< String >* pDeletedNames );
+ String CreateDateGroupDimName( sal_Int32 nDatePart, const ScDPObject& rObject, bool bAllowSource, const ::std::vector< String >* pDeletedNames );
+
+ void AddGroupDimension( const ScDPSaveGroupDimension& rGroupDim );
+ void ReplaceGroupDimension( const ScDPSaveGroupDimension& rGroupDim );
+ void RemoveGroupDimension( const String& rGroupDimName );
- void AddNumGroupDimension( const ScDPSaveNumGroupDimension& rGroup );
- void RemoveNumGroupDimension( const String& rDimensionName );
+ void AddNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim );
+ void ReplaceNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim );
+ void RemoveNumGroupDimension( const String& rGroupDimName );
- const ScDPSaveGroupDimension* GetGroupDimForBase( const String& rBaseName ) const;
- const ScDPSaveGroupDimension* GetNamedGroupDim( const String& rGroupDim ) const;
- const ScDPSaveNumGroupDimension* GetNumGroupDim( const String& rName ) const;
+ const ScDPSaveGroupDimension* GetGroupDimForBase( const String& rBaseDimName ) const;
+ const ScDPSaveGroupDimension* GetNamedGroupDim( const String& rGroupDimName ) const;
+ const ScDPSaveGroupDimension* GetFirstNamedGroupDim( const String& rBaseDimName ) const;
+ const ScDPSaveGroupDimension* GetNextNamedGroupDim( const String& rGroupDimName ) const;
+ const ScDPSaveNumGroupDimension* GetNumGroupDim( const String& rGroupDimName ) const;
- ScDPSaveGroupDimension* GetGroupDimAccForBase( const String& rBaseName );
- ScDPSaveGroupDimension* GetNamedGroupDimAcc( const String& rGroupDim );
- ScDPSaveNumGroupDimension* GetNumGroupDimAcc( const String& rName );
+ ScDPSaveGroupDimension* GetGroupDimAccForBase( const String& rBaseDimName );
+ ScDPSaveGroupDimension* GetNamedGroupDimAcc( const String& rGroupDimName );
+ ScDPSaveGroupDimension* GetFirstNamedGroupDimAcc( const String& rBaseDimName );
+ ScDPSaveGroupDimension* GetNextNamedGroupDimAcc( const String& rGroupDimName );
+
+ ScDPSaveNumGroupDimension* GetNumGroupDimAcc( const String& rGroupDimName );
bool HasGroupDimensions() const;
sal_Int32 CollectDateParts( const String& rBaseDimName ) const;
+
+private:
+ typedef ::std::vector< ScDPSaveGroupDimension > ScDPSaveGroupDimVec;
+ typedef ::std::map< String, ScDPSaveNumGroupDimension > ScDPSaveNumGroupDimMap;
+
+ ScDPDimensionSaveData& operator=( const ScDPDimensionSaveData& );
+
+ ScDPSaveGroupDimVec maGroupDims;
+ ScDPSaveNumGroupDimMap maNumGroupDims;
};
+// ============================================================================
+
#endif
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 3ee9ea767386..cffe735f287a 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -107,7 +107,6 @@ private:
BOOL bSettingsChanged;
BOOL bAlive; // FALSE if only used to hold settings
BOOL bAllowMove;
- BOOL bInfoValid; // affects: nHeaderRows
long nHeaderRows; // page fields plus filter button
@@ -127,7 +126,8 @@ public:
void InvalidateData();
void InvalidateSource();
- void Output();
+
+ void Output( const ScAddress& rPos );
ScRange GetNewOutputRange( BOOL& rOverflow );
const ScRange GetOutputRangeByType( sal_Int32 nType );
diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index cf1c151fa05d..a0492d82a2f3 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -115,11 +115,7 @@ private:
void MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
SCsCOL nDx,SCsROW nDy );
- void RecalcPos( SdrObject* pObj,
- const ScDrawObjData& rData,
- const ScAddress& rOldStart,
- const ScAddress& rOldEnd,
- bool bNegativePage );
+ void RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage );
public:
ScDrawLayer( ScDocument* pDocument, const String& rName );
diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 3e1573ac7c89..b61bdf72ef7b 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -63,8 +63,13 @@ class ScEditUtil
public:
static String ModifyDelimiters( const String& rOld );
+
+ /// Retrieves string with paragraphs delimited by spaces
static String GetSpaceDelimitedString( const EditEngine& rEngine );
+ /// Retrieves string with paragraphs delimited by new lines ('\n').
+ static String GetMultilineString( const EditEngine& rEngine );
+
public:
ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
const Point& rScrPosPixel,
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index b4c63101ec70..9b12dba52f1f 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -132,15 +132,27 @@ public:
class Table
{
public:
+
+ enum ReferencedFlag
+ {
+ UNREFERENCED,
+ REFERENCED_MARKED, // marked as referenced during store to file
+ REFERENCED_PERMANENT // permanently marked, e.g. from within interpreter
+ };
+
Table();
~Table();
SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex = 0);
TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex = NULL) const;
bool hasRow( SCROW nRow ) const;
- /// A temporary state used only during store to file.
- bool isReferenced() const;
+ /** Set/clear referenced status flag only if current status is not
+ REFERENCED_PERMANENT. */
void setReferenced( bool bReferenced );
+ /// Unconditionally set the reference status flag.
+ void setReferencedFlag( ReferencedFlag eFlag );
+ ReferencedFlag getReferencedFlag() const;
+ bool isReferenced() const;
/// Obtain a sorted vector of rows.
void getAllRows(::std::vector<SCROW>& rRows) const;
/// Obtain a sorted vector of columns.
@@ -148,8 +160,8 @@ public:
void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const;
private:
- RowsDataType maRows;
- bool mbReferenced;
+ RowsDataType maRows;
+ ReferencedFlag meReferenced;
};
typedef ::boost::shared_ptr<Table> TableTypeRef;
@@ -173,7 +185,7 @@ public:
*/
ScExternalRefCache::TokenRef getCellData(
sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow,
- bool bEmptyCellOnNull, sal_uInt32* pnFmtIndex = NULL);
+ bool bEmptyCellOnNull, bool bWriteEmpty, sal_uInt32* pnFmtIndex);
/**
* Get a cached cell range data.
@@ -183,7 +195,7 @@ public:
* guaranteed if the TokenArrayRef is properly used..
*/
ScExternalRefCache::TokenArrayRef getCellRangeData(
- sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, bool bEmptyCellOnNull);
+ sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, bool bEmptyCellOnNull, bool bWriteEmpty);
ScExternalRefCache::TokenArrayRef getRangeNameTokens(sal_uInt16 nFileId, const String& rName);
void setRangeNameTokens(sal_uInt16 nFileId, const String& rName, TokenArrayRef pArray);
@@ -219,9 +231,16 @@ public:
* Set a table as referenced, used only during store-to-file.
* @returns <TRUE/> if ALL tables of ALL documents are marked.
*/
- bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName );
+ bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets, bool bPermanent );
void setAllCacheTableReferencedStati( bool bReferenced );
bool areAllCacheTablesReferenced() const;
+
+ /**
+ * Set a table as permanently referenced, to be called if not in
+ * mark-during-store-to-file cycle.
+ */
+ void setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets );
+
private:
struct ReferencedStatus
{
@@ -497,10 +516,16 @@ public:
* Set a table as referenced, used only during store-to-file.
* @returns <TRUE/> if ALL tables of ALL external documents are marked.
*/
- bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName );
+ bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets );
void setAllCacheTableReferencedStati( bool bReferenced );
/**
+ * Set a table as permanently referenced, to be called if not in
+ * mark-during-store-to-file cycle.
+ */
+ void setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets );
+
+ /**
* @returns <TRUE/> if setAllCacheTableReferencedStati(false) was called,
* <FALSE/> if setAllCacheTableReferencedStati(true) was called.
*/
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index d716e857188d..d4319bcba50e 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -138,7 +138,7 @@ class ScCellFieldObj : public ScMutexHelper,
public SfxListener
{
private:
- SfxItemPropertySet aPropSet;
+ const SfxItemPropertySet* pPropSet;
ScDocShell* pDocShell;
ScAddress aCellPos;
SvxEditSource* pEditSource;
@@ -337,7 +337,7 @@ class ScHeaderFieldObj : public ScMutexHelper,
public ::com::sun::star::lang::XServiceInfo
{
private:
- SfxItemPropertySet aPropSet;
+ const SfxItemPropertySet* pPropSet;
ScHeaderFooterContentObj* pContentObj;
USHORT nPart;
UINT16 nType;
diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx
index ba4e02041faa..6005a849fb0f 100644
--- a/sc/inc/fmtuno.hxx
+++ b/sc/inc/fmtuno.hxx
@@ -32,7 +32,8 @@
#define SC_FMTUNO_HXX
#include "address.hxx"
-#include "formula/grammar.hxx"
+#include "conditio.hxx"
+#include <formula/grammar.hxx>
#include <tools/list.hxx>
#include <svtools/itemprop.hxx>
#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
@@ -61,16 +62,19 @@ struct ScCondFormatEntryItem
{
::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > maTokens1;
::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > maTokens2;
- String maExpr1;
- String maExpr2;
- String maPosStr; // formula position as text
- String maStyle; // display name as stored in ScStyleSheet
- ScAddress maPos;
- formula::FormulaGrammar::Grammar meGrammar; // grammar used with maExpr1 and maExpr2
- USHORT mnMode; // stores enum ScConditionMode
+ String maExpr1;
+ String maExpr2;
+ String maExprNmsp1;
+ String maExprNmsp2;
+ String maPosStr; // formula position as text
+ String maStyle; // display name as stored in ScStyleSheet
+ ScAddress maPos;
+ formula::FormulaGrammar::Grammar meGrammar1; // grammar used with maExpr1
+ formula::FormulaGrammar::Grammar meGrammar2; // grammar used with maExpr2
+ ScConditionMode meMode;
// Make sure the grammar is initialized for API calls.
- ScCondFormatEntryItem() : meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ) {}
+ ScCondFormatEntryItem();
};
class ScTableConditionalFormat : public cppu::WeakImplHelper5<
@@ -89,11 +93,11 @@ private:
ScTableConditionalFormat(); // disable
public:
ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
- const formula::FormulaGrammar::Grammar eGrammar);
+ formula::FormulaGrammar::Grammar eGrammar);
virtual ~ScTableConditionalFormat();
- void FillFormat( ScConditionalFormat& rFormat,
- ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar ) const;
+ void FillFormat( ScConditionalFormat& rFormat, ScDocument* pDoc,
+ formula::FormulaGrammar::Grammar eGrammar) const;
void DataChanged();
// XSheetConditionalEntries
@@ -211,7 +215,10 @@ private:
USHORT nMode; // enum ScConditionMode
String aExpr1;
String aExpr2;
- formula::FormulaGrammar::Grammar meGrammar; // grammar used with aExpr1 and aExpr2
+ String maExprNmsp1;
+ String maExprNmsp2;
+ formula::FormulaGrammar::Grammar meGrammar1; // grammar used with aExpr1 and aExpr2
+ formula::FormulaGrammar::Grammar meGrammar2; // grammar used with aExpr1 and aExpr2
::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens1;
::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens2;
ScAddress aSrcPos;
diff --git a/sc/inc/formulaparserpool.hxx b/sc/inc/formulaparserpool.hxx
new file mode 100644
index 000000000000..af6b0ed3ebf1
--- /dev/null
+++ b/sc/inc/formulaparserpool.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formulaparserpool.hxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_FORMULAPARSERPOOL_HXX
+#define SC_FORMULAPARSERPOOL_HXX
+
+#include <hash_map>
+#include <com/sun/star/sheet/XFormulaParser.hpp>
+
+class ScDocument;
+
+// ============================================================================
+
+/** Stores the used instances of the FilterFormulaParser service
+ implementations, mapped by the formula namespace they support. */
+class ScFormulaParserPool
+{
+public:
+ explicit ScFormulaParserPool( const ScDocument& rDoc );
+ ~ScFormulaParserPool();
+
+ /** Returns true, if a formula parser is registered for the passed namespace. */
+ bool hasFormulaParser( const ::rtl::OUString& rNamespace );
+
+ /** Returns the formula parser that is registered for the passed namespace. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser >
+ getFormulaParser( const ::rtl::OUString& rNamespace );
+
+private:
+ typedef ::std::hash_map<
+ ::rtl::OUString,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser >,
+ ::rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > ParserMap;
+
+ const ScDocument& mrDoc;
+ ParserMap maParsers;
+};
+
+// ============================================================================
+
+#endif
+
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index e227dd1b7995..c8f50a92cd0b 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -38,6 +38,11 @@
and memory consumption. */
class ScFormulaResult
{
+ typedef unsigned char Multiline;
+ static const Multiline MULTILINE_UNKNOWN = 0;
+ static const Multiline MULTILINE_FALSE = 1;
+ static const Multiline MULTILINE_TRUE = 2;
+
union
{
double mfValue; // double result direct for performance and memory consumption
@@ -47,6 +52,7 @@ class ScFormulaResult
bool mbToken :1; // whether content of union is a token
bool mbEmpty :1; // empty cell result
bool mbEmptyDisplayedAsString :1; // only if mbEmpty
+ Multiline meMultiline :2; // result is multiline
/** Reset mnError, mbEmpty and mbEmptyDisplayedAsString to their defaults
prior to assigning other types */
@@ -69,12 +75,14 @@ public:
/** Effectively type svUnknown. */
ScFormulaResult()
: mpToken(NULL), mnError(0), mbToken(true),
- mbEmpty(false), mbEmptyDisplayedAsString(false) {}
+ mbEmpty(false), mbEmptyDisplayedAsString(false),
+ meMultiline(MULTILINE_UNKNOWN) {}
ScFormulaResult( const ScFormulaResult & r )
: mnError( r.mnError), mbToken( r.mbToken),
mbEmpty( r.mbEmpty),
- mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString)
+ mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString),
+ meMultiline( r.meMultiline)
{
if (mbToken)
{
@@ -99,7 +107,8 @@ public:
/** Same comments as for SetToken() apply! */
explicit ScFormulaResult( const formula::FormulaToken* p )
: mnError(0), mbToken(false),
- mbEmpty(false), mbEmptyDisplayedAsString(false)
+ mbEmpty(false), mbEmptyDisplayedAsString(false),
+ meMultiline(MULTILINE_UNKNOWN)
{
SetToken( p);
}
@@ -153,6 +162,10 @@ public:
details instead. */
inline bool IsValue() const;
+ /** Determines whether or not the result is a string containing more than
+ one paragraph */
+ inline bool IsMultiline() const;
+
/** Get error code if set or GetCellResultType() is formula::svError or svUnknown,
else 0. */
inline USHORT GetResultError() const;
@@ -211,6 +224,7 @@ inline void ScFormulaResult::ResetToDefaults()
mnError = 0;
mbEmpty = false;
mbEmptyDisplayedAsString = false;
+ meMultiline = MULTILINE_UNKNOWN;
}
@@ -232,17 +246,20 @@ inline void ScFormulaResult::ResolveToken( const formula::FormulaToken * p )
mbToken = false;
// set in case mnError is 0 now, which shouldn't happen but ...
mfValue = 0.0;
+ meMultiline = MULTILINE_FALSE;
break;
case formula::svEmptyCell:
mbEmpty = true;
mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString();
p->DecRef();
mbToken = false;
+ meMultiline = MULTILINE_FALSE;
break;
case formula::svDouble:
mfValue = p->GetDouble();
p->DecRef();
mbToken = false;
+ meMultiline = MULTILINE_FALSE;
break;
default:
mpToken = p;
@@ -270,6 +287,7 @@ inline void ScFormulaResult::Assign( const ScFormulaResult & r )
mbToken = false;
mbEmpty = true;
mbEmptyDisplayedAsString = r.mbEmptyDisplayedAsString;
+ meMultiline = r.meMultiline;
}
else if (r.mbToken)
{
@@ -352,6 +370,7 @@ inline void ScFormulaResult::SetDouble( double f )
mpToken->DecRef();
mfValue = f;
mbToken = false;
+ meMultiline = MULTILINE_FALSE;
}
}
@@ -404,6 +423,19 @@ inline bool ScFormulaResult::IsValue() const
return sv == formula::svDouble || sv == formula::svError || sv == formula::svEmptyCell;
}
+inline bool ScFormulaResult::IsMultiline() const
+{
+ if (meMultiline == MULTILINE_UNKNOWN)
+ {
+ const String& rStr = GetString();
+ if (rStr.Len() && rStr.Search( _LF ) != STRING_NOTFOUND)
+ const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_TRUE;
+ else
+ const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_FALSE;
+ }
+ return meMultiline == MULTILINE_TRUE;
+}
+
inline USHORT ScFormulaResult::GetResultError() const
{
@@ -537,6 +569,7 @@ inline void ScFormulaResult::SetHybridDouble( double f )
{
mfValue = f;
mbToken = false;
+ meMultiline = MULTILINE_FALSE;
}
}
diff --git a/sc/inc/funcuno.hxx b/sc/inc/funcuno.hxx
index 1ffcdb214ad2..2e5e167bc988 100644
--- a/sc/inc/funcuno.hxx
+++ b/sc/inc/funcuno.hxx
@@ -74,6 +74,7 @@ class ScFunctionAccess : public cppu::WeakImplHelper3<
private:
ScTempDocCache aDocCache;
ScDocOptions* pOptions;
+ SfxItemPropertyMap aPropertyMap;
BOOL bInvalid;
public:
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 45df07deaf6c..e329f477d824 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -238,6 +238,7 @@ const USHORT IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES;
const USHORT IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA;
const USHORT IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
const USHORT IDF_NOCAPTIONS = 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes.
+const USHORT IDF_ADDNOTES = 0x0400; /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
/// Copy flags for auto/series fill functions: do not touch notes and drawing objects.
const USHORT IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS);
@@ -727,7 +728,13 @@ enum ScQueryOp
SC_TOPVAL,
SC_BOTVAL,
SC_TOPPERC,
- SC_BOTPERC
+ SC_BOTPERC,
+ SC_CONTAINS,
+ SC_DOES_NOT_CONTAIN,
+ SC_BEGINS_WITH,
+ SC_DOES_NOT_BEGIN_WITH,
+ SC_ENDS_WITH,
+ SC_DOES_NOT_END_WITH
};
// -----------------------------------------------------------------------
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index db35cb50969e..97d77dc06fc5 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -84,7 +84,6 @@
#define STR_MSSG_PASTEFROMCLIP_0 48
#define STR_MSSG_PASTEFROMCLIP_1 49
#define STR_MSSG_MOVEBLOCKTO_0 50
-#define STR_MSSG_APPLYPATTLINES_0 51
#define STR_MSSG_INSERTCELLS_0 52
#define STR_MSSG_DELETECELLS_0 53
#define STR_MSSG_MERGECELLS_0 54
diff --git a/sc/inc/optuno.hxx b/sc/inc/optuno.hxx
index b454770ee450..648fc182a6a2 100644
--- a/sc/inc/optuno.hxx
+++ b/sc/inc/optuno.hxx
@@ -34,17 +34,32 @@
#include "docuno.hxx"
#include "docoptio.hxx"
+#define PROP_UNO_CALCASSHOWN 1
+#define PROP_UNO_DEFTABSTOP 2
+#define PROP_UNO_IGNORECASE 3
+#define PROP_UNO_ITERENABLED 4
+#define PROP_UNO_ITERCOUNT 5
+#define PROP_UNO_ITEREPSILON 6
+#define PROP_UNO_LOOKUPLABELS 7
+#define PROP_UNO_MATCHWHOLE 8
+#define PROP_UNO_NULLDATE 9
+#define PROP_UNO_SPELLONLINE 10
+#define PROP_UNO_STANDARDDEC 11
+#define PROP_UNO_REGEXENABLED 12
+
class ScDocOptionsHelper
{
public:
- static const SfxItemPropertyMap* GetPropertyMap();
+ static const SfxItemPropertyMapEntry* GetPropertyMap();
static sal_Bool setPropertyValue( ScDocOptions& rOptions,
+ const SfxItemPropertyMap& rPropMap,
const ::rtl::OUString& aPropertyName,
const ::com::sun::star::uno::Any& aValue );
static ::com::sun::star::uno::Any getPropertyValue(
const ScDocOptions& rOptions,
+ const SfxItemPropertyMap& rPropMap,
const ::rtl::OUString& PropertyName );
};
diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx
index db4e87d3cdb7..b905bb19db03 100644
--- a/sc/inc/pch/precompiled_sc.hxx
+++ b/sc/inc/pch/precompiled_sc.hxx
@@ -36,6 +36,7 @@
#include <algorithm>
#include <assert.h>
+#include <deque>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
@@ -49,6 +50,8 @@
#include <new>
#include <cfloat>
+#include <boost/bind.hpp>
+
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b3dpolygon.hxx>
#include <basegfx/polygon/b3dpolypolygon.hxx>
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 979fea65264f..ee90a71375b4 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -31,30 +31,42 @@
#ifndef SC_POSTIT_HXX
#define SC_POSTIT_HXX
+#include <boost/shared_ptr.hpp>
+#include <rtl/ustring.hxx>
#include <tools/gen.hxx>
#include "address.hxx"
#include "scdllapi.h"
class EditTextObject;
+class OutlinerParaObject;
class SdrCaptionObj;
class SdrPage;
class SfxItemSet;
class ScDocument;
+struct ScCaptionInitData;
// ============================================================================
+/** Internal data for a cell annotation. */
struct SC_DLLPUBLIC ScNoteData
{
- String maDate; /// Creation date of the note.
- String maAuthor; /// Author of the note.
+ typedef ::boost::shared_ptr< ScCaptionInitData > ScCaptionInitDataRef;
+
+ ::rtl::OUString maDate; /// Creation date of the note.
+ ::rtl::OUString maAuthor; /// Author of the note.
+ ScCaptionInitDataRef mxInitData; /// Initial data for invisible notes without SdrObject.
SdrCaptionObj* mpCaption; /// Drawing object representing the cell note.
bool mbShown; /// True = note is visible.
explicit ScNoteData( bool bShown = false );
+ ~ScNoteData();
};
// ============================================================================
+/** An additional class held by an ScBaseCell instance containing all
+ information for a cell annotation.
+ */
class SC_DLLPUBLIC ScPostIt
{
public:
@@ -65,76 +77,98 @@ public:
/** Copy constructor. Clones the note and its caption to a new document. */
explicit ScPostIt( ScDocument& rDoc, const ScAddress& rPos, const ScPostIt& rNote );
- /** Creates a note from the passed note data with existing caption object. */
- explicit ScPostIt( ScDocument& rDoc, const ScNoteData& rNoteData );
+ /** Creates a note from the passed note data with existing caption object.
+
+ @param bAlwaysCreateCaption Instead of a pointer to an existing
+ caption object, the passed note data structure may contain a
+ reference to an ScCaptionInitData structure containing information
+ about how to construct a missing caption object. If TRUE is passed,
+ the caption drawing object will be created immediately from that
+ data. If FALSE is passed and the note is not visible, it will
+ continue to cache that data until the caption object is requested.
+ */
+ explicit ScPostIt(
+ ScDocument& rDoc, const ScAddress& rPos,
+ const ScNoteData& rNoteData, bool bAlwaysCreateCaption );
/** Removes the caption object from drawing layer, if this note is its owner. */
~ScPostIt();
- /** Returns the data struct containing note settings. */
+ /** Clones this note and its caption object, if specified.
+
+ @param bCloneCaption If TRUE is passed, clones the caption object and
+ inserts it into the drawing layer of the destination document. If
+ FALSE is passed, the cloned note will refer to the old caption
+ object (used e.g. in Undo documents to restore the pointer to the
+ existing caption object).
+ */
+ ScPostIt* Clone(
+ const ScAddress& rOwnPos,
+ ScDocument& rDestDoc, const ScAddress& rDestPos,
+ bool bCloneCaption ) const;
+
+ /** Returns the data struct containing all note settings. */
inline const ScNoteData& GetNoteData() const { return maNoteData; }
/** Returns the creation date of this note. */
- inline const String& GetDate() const { return maNoteData.maDate; }
+ inline const ::rtl::OUString& GetDate() const { return maNoteData.maDate; }
/** Sets a new creation date for this note. */
- inline void SetDate( const String& rDate ) { maNoteData.maDate = rDate; }
+ inline void SetDate( const ::rtl::OUString& rDate ) { maNoteData.maDate = rDate; }
/** Returns the author date of this note. */
- inline const String& GetAuthor() const { return maNoteData.maAuthor; }
+ inline const ::rtl::OUString& GetAuthor() const { return maNoteData.maAuthor; }
/** Sets a new author date for this note. */
- inline void SetAuthor( const String& rAuthor ) { maNoteData.maAuthor = rAuthor; }
+ inline void SetAuthor( const ::rtl::OUString& rAuthor ) { maNoteData.maAuthor = rAuthor; }
/** Sets date and author from system settings. */
void AutoStamp();
+ /** Returns the pointer to the current outliner object, or null. */
+ const OutlinerParaObject* GetOutlinerObject() const;
/** Returns the pointer to the current edit text object, or null. */
const EditTextObject* GetEditTextObject() const;
+
/** Returns the caption text of this note. */
- String GetText() const;
+ ::rtl::OUString GetText() const;
/** Returns true, if the caption text of this note contains line breaks. */
bool HasMultiLineText() const;
/** Changes the caption text of this note. All text formatting will be lost. */
- void SetText( const String& rText );
+ void SetText( const ScAddress& rPos, const ::rtl::OUString& rText );
- /** Returns the note caption object. */
+ /** Returns an existing note caption object. returns null, if the note
+ contains initial caption data needed to construct a caption object. */
inline SdrCaptionObj* GetCaption() const { return maNoteData.mpCaption; }
- /** Returns and forgets the note caption object. */
- inline SdrCaptionObj* ForgetCaption() { SdrCaptionObj* pCapt = maNoteData.mpCaption; maNoteData.mpCaption = 0; return pCapt; }
+ /** Returns the caption object of this note. Creates the caption object, if
+ the note contains initial caption data instead of the caption. */
+ SdrCaptionObj* GetOrCreateCaption( const ScAddress& rPos ) const;
+ /** Forgets the pointer to the note caption object. */
+ void ForgetCaption();
/** Shows or hides the note caption object. */
- void ShowCaption( bool bShow = true );
- /** Hides the note caption object. */
- inline void HideCaption() { ShowCaption( false ); }
+ void ShowCaption( const ScAddress& rPos, bool bShow = true );
/** Returns true, if the caption object is visible. */
inline bool IsCaptionShown() const { return maNoteData.mbShown; }
/** Shows or hides the caption temporarily (does not change internal visibility state). */
- void ShowCaptionTemp( bool bShow = true );
- /** Hides caption if it has been shown temporarily (does not change internal visibility state). */
- inline void HideCaptionTemp() { ShowCaptionTemp( false ); }
+ void ShowCaptionTemp( const ScAddress& rPos, bool bShow = true );
/** Updates caption position according to position of the passed cell. */
void UpdateCaptionPos( const ScAddress& rPos );
- /** Sets caption itemset to default items. */
- void SetCaptionDefaultItems();
- /** Updates caption itemset according to the passed item set while removing shadow items. */
- void SetCaptionItems( const SfxItemSet& rItemSet );
-
private:
ScPostIt( const ScPostIt& );
ScPostIt& operator=( const ScPostIt& );
+ /** Creates the caption object from initial caption data if existing. */
+ void CreateCaptionFromInitData( const ScAddress& rPos ) const;
/** Creates a new caption object at the passed cell position, clones passed existing caption. */
void CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCaption = 0 );
/** Removes the caption object from the drawing layer, if this note is its owner. */
void RemoveCaption();
- /** Updates caption visibility. */
- void UpdateCaptionLayer( bool bShow );
private:
ScDocument& mrDoc; /// Parent document containing the note.
- ScNoteData maNoteData; /// Note data with pointer to caption object.
+ mutable ScNoteData maNoteData; /// Note data with pointer to caption object.
};
// ============================================================================
@@ -142,24 +176,89 @@ private:
class SC_DLLPUBLIC ScNoteUtil
{
public:
- /** Clones the note and its caption object, if specified.
- @param bCloneCaption True = clones the caption object and inserts it
- into the drawing layer of the destination document. False = the
- cloned note will refer to the old caption object. */
- static ScPostIt* CloneNote( ScDocument& rDoc, const ScAddress& rPos,
- const ScPostIt& rNote, bool bCloneCaption );
-
/** Tries to update the position of note caption objects in the specified range. */
static void UpdateCaptionPositions( ScDocument& rDoc, const ScRange& rRange );
/** Creates and returns a caption object for a temporary caption. */
static SdrCaptionObj* CreateTempCaption( ScDocument& rDoc, const ScAddress& rPos,
- SdrPage& rPage, const String& rUserText,
+ SdrPage& rDrawPage, const ::rtl::OUString& rUserText,
const Rectangle& rVisRect, bool bTailFront );
- /** Creates a cell note based on the passed string and inserts it into the document. */
- static ScPostIt* CreateNoteFromString( ScDocument& rDoc, const ScAddress& rPos,
- const String& rNoteText, bool bShown );
+ /** Creates a cell note using the passed caption drawing object.
+
+ This function is used in import filters to reuse the imported drawing
+ object as note caption object.
+
+ @param rCaption The drawing object for the cell note. This object MUST
+ be inserted into the document at the correct drawing page already.
+
+ @return Pointer to the new cell note object if insertion was
+ successful (i.e. the passed cell position was valid), null
+ otherwise. The Calc document is the owner of the note object. The
+ passed item set and outliner object are deleted automatically if
+ creation of the note was not successful.
+ */
+ static ScPostIt* CreateNoteFromCaption(
+ ScDocument& rDoc, const ScAddress& rPos,
+ SdrCaptionObj& rCaption, bool bShown );
+
+ /** Creates a cell note based on the passed caption object data.
+
+ This function is used in import filters to use an existing imported
+ item set and outliner object to create a note caption object. For
+ performance reasons, it is possible to specify that the caption drawing
+ object for the cell note is not created yet but the note caches the
+ passed data needed to create the caption object on demand (see
+ parameter bAlwaysCreateCaption).
+
+ @param pItemSet Pointer to an item set on heap memory containing all
+ formatting attributes of the caption object. This function takes
+ ownership of the passed item set.
+
+ @param pOutlinerObj Pointer to an outliner object on heap memory
+ containing (formatted) text for the caption object. This function
+ takes ownership of the passed outliner object.
+
+ @param rCaptionRect The absolute position and size of the caption
+ object. The rectangle may be empty, in this case the default
+ position and size is used.
+
+ @param bAlwaysCreateCaption If TRUE is passed, the caption drawing
+ object will be created immediately. If FALSE is passed, the caption
+ drawing object will not be created if the note is not visible
+ (bShown = FALSE), but the cell note will cache the passed data.
+ MUST be set to FALSE outside of import filter implementations!
+
+ @return Pointer to the new cell note object if insertion was
+ successful (i.e. the passed cell position was valid), null
+ otherwise. The Calc document is the owner of the note object.
+ */
+ static ScPostIt* CreateNoteFromObjectData(
+ ScDocument& rDoc, const ScAddress& rPos,
+ SfxItemSet* pItemSet, OutlinerParaObject* pOutlinerObj,
+ const Rectangle& rCaptionRect, bool bShown,
+ bool bAlwaysCreateCaption );
+
+ /** Creates a cell note based on the passed string and inserts it into the
+ document.
+
+ @param rNoteText The text used to create the note caption object. Must
+ not be empty.
+
+ @param bAlwaysCreateCaption If TRUE is passed, the caption drawing
+ object will be created immediately. If FALSE is passed, the caption
+ drawing object will not be created if the note is not visible
+ (bShown = FALSE), but the cell note will cache the passed data.
+ MUST be set to FALSE outside of import filter implementations!
+
+ @return Pointer to the new cell note object if insertion was
+ successful (i.e. the passed cell position was valid), null
+ otherwise. The Calc document is the owner of the note object.
+ */
+ static ScPostIt* CreateNoteFromString(
+ ScDocument& rDoc, const ScAddress& rPos,
+ const ::rtl::OUString& rNoteText, bool bShown,
+ bool bAlwaysCreateCaption );
};
// ============================================================================
diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx
index b30cf6d9dc70..c7706c2bc26b 100644
--- a/sc/inc/progress.hxx
+++ b/sc/inc/progress.hxx
@@ -36,6 +36,17 @@
class ScDocument;
+/*
+ * #i102566
+ * Drawing a progress bar update is not cheap, so if we draw it on every
+ * percentage change of 200 calculations we get one progress draw per 2
+ * calculations which is slower than doing the calculations themselves. So as a
+ * rough guide only do an update per MIN_NO_CODES_PER_PROGRESS_UPDATE
+ * calculations
+ */
+#define MIN_NO_CODES_PER_PROGRESS_UPDATE 100
+
+
class SC_DLLPUBLIC ScProgress
{
private:
diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 6a51d66fdc07..12f29943fce0 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -109,6 +109,8 @@ struct SC_DLLPUBLIC ScSingleRefData // Single reference (one address) int
inline BOOL IsRelName() const { return Flags.bRelName; }
inline BOOL Valid() const;
+ /// In external references nTab is -1
+ inline bool ValidExternal() const;
void SmartRelAbs( const ScAddress& rPos );
void CalcRelFromAbs( const ScAddress& rPos );
@@ -147,6 +149,13 @@ inline BOOL ScSingleRefData::Valid() const
nTab >= 0 && nTab <= MAXTAB;
}
+inline bool ScSingleRefData::ValidExternal() const
+{
+ return nCol >= 0 && nCol <= MAXCOL &&
+ nRow >= 0 && nRow <= MAXROW &&
+ nTab == -1;
+}
+
struct ScComplexRefData // Complex reference (a range) into the sheet
{
@@ -181,6 +190,10 @@ struct ScComplexRefData // Complex reference (a range) into the sheet
{ return Ref1.IsDeleted() || Ref2.IsDeleted(); }
inline BOOL Valid() const
{ return Ref1.Valid() && Ref2.Valid(); }
+ /** In external references nTab is -1 for the start tab and -1 for the end
+ tab if one sheet, or >=0 if more than one sheets. */
+ inline bool ValidExternal() const;
+
/// Absolute references have to be up-to-date when calling this!
void PutInOrder();
inline BOOL operator==( const ScComplexRefData& r ) const
@@ -192,4 +205,12 @@ struct ScComplexRefData // Complex reference (a range) into the sheet
ScComplexRefData& Extend( const ScComplexRefData & rRef, const ScAddress & rPos );
};
+inline bool ScComplexRefData::ValidExternal() const
+{
+ return Ref1.ValidExternal() &&
+ Ref2.nCol >= 0 && Ref2.nCol <= MAXCOL &&
+ Ref2.nRow >= 0 && Ref2.nRow <= MAXROW &&
+ Ref2.nTab >= Ref1.nTab;
+}
+
#endif
diff --git a/sc/inc/reftokenhelper.hxx b/sc/inc/reftokenhelper.hxx
index 37f82337f654..5b06450ea56f 100644
--- a/sc/inc/reftokenhelper.hxx
+++ b/sc/inc/reftokenhelper.hxx
@@ -56,7 +56,8 @@ public:
* The source range may consist of multiple ranges separated by ';'s.
*/
static void compileRangeRepresentation(
- ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc);
+ ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc,
+ ::formula::FormulaGrammar::Grammar eGrammar = ::formula::FormulaGrammar::GRAM_ENGLISH);
static bool getRangeFromToken(ScRange& rRange, const ScSharedTokenRef& pToken, bool bExternal = false);
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index d1bd0be467ca..8fb6b929337b 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -832,6 +832,7 @@
#define FID_TAB_APPEND (TAB_POPUP_START+5)
#define FID_TAB_INDEX (TAB_POPUP_START+6)
#define FID_TAB_RTL (TAB_POPUP_START+7)
+#define FID_TAB_DESELECTALL (TAB_POPUP_START+8)
#define TAB_POPUP_END (DATA_MENU_END + 20)
@@ -1305,6 +1306,8 @@
#define SCSTR_DPFUNCLISTBOX (STR_START + 92)
#define STR_PRINT_NOTHING (STR_START + 93)
#define SCSTR_ALLFILTER (STR_START + 94)
+#define SCSTR_MOREBTN_MOREOPTIONS (STR_START + 95)
+#define SCSTR_MOREBTN_FEWEROPTIONS (STR_START + 96)
// Items
@@ -1627,8 +1630,13 @@
#define RID_SCDLG_CONFLICTS (SC_DIALOGS_START + 145)
#define RID_SCDLG_SHAREDOCUMENT (SC_DIALOGS_START + 146)
+#define RID_SCDLG_SORT_WARNING (SC_DIALOGS_START + 147)
+#define RID_SCDLG_TABPROTECTION (SC_DIALOGS_START + 148)
+#define RID_SCDLG_DOCPROTECTION (SC_DIALOGS_START + 149)
+#define RID_SCDLG_RETYPEPASS (SC_DIALOGS_START + 150)
+#define RID_SCDLG_RETYPEPASS_INPUT (SC_DIALOGS_START + 151)
-#define SC_DIALOGS_END (SC_DIALOGS_START + 150)
+#define SC_DIALOGS_END (SC_DIALOGS_START + 152)
#ifndef STD_MASKCOLOR
#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index ec381ce2ef07..f9895ff15ebb 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -314,6 +314,7 @@ public:
const String& rStrLabel,
int nId,
BOOL bColDefault = TRUE ) = 0;
+ virtual VclAbstractDialog * CreateScSortWarningDlg ( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId ) = 0; //add for ScSortWarningDlg
virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ) = 0; //add for ScDataPilotDatabaseDlg
virtual AbstractScDataPilotSourceTypeDlg * CreateScDataPilotSourceTypeDlg ( Window* pParent, BOOL bEnableExternal, int nId ) = 0; //add for ScDataPilotSourceTypeDlg
diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx
index 5f60fdc0c676..9e779b0366ae 100644
--- a/sc/inc/scextopt.hxx
+++ b/sc/inc/scextopt.hxx
@@ -46,8 +46,6 @@ struct ScExtDocSettings
double mfTabBarWidth; /// Width of the tabbar, relative to frame window width (0.0 ... 1.0).
sal_uInt32 mnLinkCnt; /// Recursive counter for loading external documents.
SCTAB mnDisplTab; /// Index of displayed sheet.
- bool mbWinProtected; /// true = Window properties are protected.
- bool mbEncrypted; /// true = Imported file was encrypted.
explicit ScExtDocSettings();
};
diff --git a/sc/inc/shapeuno.hxx b/sc/inc/shapeuno.hxx
index f761207d23e6..fe8912b87257 100644
--- a/sc/inc/shapeuno.hxx
+++ b/sc/inc/shapeuno.hxx
@@ -37,9 +37,11 @@
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
-
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
-#include <cppuhelper/weak.hxx>
+
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase1.hxx>
namespace com { namespace sun { namespace star {
namespace uno {
@@ -59,13 +61,16 @@ class ShapeUnoEventAccessImpl;
// object which aggregates all svx shape objects,
// to add own properties
-class ScShapeObj : public ::cppu::OWeakObject,
- public ::com::sun::star::beans::XPropertySet,
- public ::com::sun::star::beans::XPropertyState,
- public ::com::sun::star::text::XTextContent,
- public ::com::sun::star::text::XText,
- public ::com::sun::star::lang::XTypeProvider,
- public ::com::sun::star::document::XEventsSupplier
+typedef ::cppu::WeakImplHelper5 < ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::beans::XPropertyState
+ , ::com::sun::star::text::XTextContent
+ , ::com::sun::star::document::XEventsSupplier
+ , ::com::sun::star::lang::XServiceInfo
+ > ScShapeObj_Base;
+typedef ::cppu::ImplHelper1 < ::com::sun::star::text::XText
+ > ScShapeObj_TextBase;
+class ScShapeObj :public ScShapeObj_Base
+ ,public ScShapeObj_TextBase
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg;
@@ -75,6 +80,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > mxPropSetInfo;
com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId;
BOOL bIsTextShape;
+ bool bInitializedNotifier;
SdrObject* GetSdrObject() const throw();
@@ -225,6 +231,14 @@ public:
// XEventsSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents()
throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw (::com::sun::star::uno::RuntimeException) ;
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
};
#endif
diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx
index 7c5da1d82f8f..5fb28db3239a 100644
--- a/sc/inc/styleuno.hxx
+++ b/sc/inc/styleuno.hxx
@@ -224,14 +224,15 @@ class ScStyleObj : public ::cppu::WeakImplHelper7<
public SfxListener
{
private:
- SfxItemPropertySet aPropSet;
+ const SfxItemPropertySet* pPropSet;
ScDocShell* pDocShell;
SfxStyleFamily eFamily; // Familie
String aStyleName;
SfxStyleSheetBase* GetStyle_Impl();
- const SfxItemSet* GetStyleItemSet_Impl( const String& rPropName, const SfxItemPropertyMap*& rpMapEntry );
- void SetOnePropertyValue( const SfxItemPropertyMap* pMap,
+ const SfxItemSet* GetStyleItemSet_Impl( const ::rtl::OUString& rPropName, const SfxItemPropertySimpleEntry*& rpEntry );
+ void SetOnePropertyValue( const ::rtl::OUString& rPropertyName,
+ const SfxItemPropertySimpleEntry* pEntry,
const ::com::sun::star::uno::Any* pValue )
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 03be8eca157f..baead8035746 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -32,6 +32,8 @@
#define SC_TABLE_HXX
#include <vector>
+#include <memory>
+#include <utility>
#include <tools/gen.hxx>
#include <tools/color.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -39,6 +41,8 @@
#include "sortparam.hxx"
#include "compressedarray.hxx"
+#include <memory>
+
namespace utl {
class SearchParam;
class TextSearch;
@@ -65,6 +69,7 @@ class ScRangeList;
class ScSortInfoArray;
class ScStyleSheet;
class ScTableLink;
+class ScTableProtection;
class ScUserListData;
class ScIndexMap;
struct RowInfo;
@@ -77,6 +82,10 @@ class ScTable
{
private:
typedef ::std::vector< ScRange > ScRangeVec;
+ typedef ::std::pair< SCCOL, SCROW > ScAddress2D;
+ typedef ::std::vector< ScAddress2D > ScAddress2DVec;
+ typedef ::std::auto_ptr< ScAddress2DVec > ScAddress2DVecPtr;
+
// Daten pro Tabelle ------------------
ScColumn aCol[MAXCOLCOUNT];
@@ -103,8 +112,7 @@ private:
SCROW nRepeatStartY;
SCROW nRepeatEndY;
- BOOL bProtected;
- com::sun::star::uno::Sequence<sal_Int8> aProtectPass;
+ ::std::auto_ptr<ScTableProtection> pTabProtection;
USHORT* pColWidth;
ScSummableCompressedArray< SCROW, USHORT>* pRowHeight;
@@ -120,6 +128,7 @@ private:
// interne Verwaltung ------------------
BOOL bVisible;
+ BOOL bPendingRowHeights;
SCTAB nTab;
USHORT nRecalcLvl; // Rekursionslevel Size-Recalc
@@ -129,6 +138,8 @@ private:
mutable String aUpperName; // #i62977# filled only on demand, reset in SetName
+ ScAddress2DVecPtr mxUninitNotes;
+
// SortierParameter um den Stackbedarf von Quicksort zu Minimieren
ScSortParam aSortParam;
CollatorWrapper* pSortCollator;
@@ -183,6 +194,9 @@ public:
BOOL IsVisible() const { return bVisible; }
void SetVisible( BOOL bVis );
+ BOOL IsPendingRowHeights() const { return bPendingRowHeights; }
+ void SetPendingRowHeights( BOOL bSet );
+
BOOL IsLayoutRTL() const { return bLayoutRTL; }
BOOL IsLoadingRTL() const { return bLoadingRTL; }
void SetLayoutRTL( BOOL bSet );
@@ -222,10 +236,9 @@ public:
void SetPageStyle( const String& rName );
void PageStyleModified( const String& rNewName );
- BOOL IsProtected() const { return bProtected; }
- const com::sun::star::uno::Sequence<sal_Int8>& GetPassword() const { return aProtectPass; }
- void SetProtection( BOOL bProtect, const com::sun::star::uno::Sequence<sal_Int8>& rPasswd )
- { bProtected = bProtect; aProtectPass = rPasswd; }
+ BOOL IsProtected() const;
+ void SetProtection(const ScTableProtection* pProtect);
+ ScTableProtection* GetProtection();
Size GetPageSize() const;
void SetPageSize( const Size& rSize );
@@ -258,16 +271,28 @@ public:
void GetString( SCCOL nCol, SCROW nRow, String& rString );
void GetInputString( SCCOL nCol, SCROW nRow, String& rString );
double GetValue( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetValue( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetValue( rPos.Row() ) :
+ 0.0;
+ }
double GetValue( SCCOL nCol, SCROW nRow );
void GetFormula( SCCOL nCol, SCROW nRow, String& rFormula,
BOOL bAsciiExport = FALSE );
CellType GetCellType( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetCellType( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetCellType( rPos.Row() ) :
+ CELLTYPE_NONE;
+ }
CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
ScBaseCell* GetCell( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetCell( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetCell( rPos.Row() ) :
+ NULL;
+ }
ScBaseCell* GetCell( SCCOL nCol, SCROW nRow ) const;
void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
@@ -280,6 +305,9 @@ public:
ScPostIt* ReleaseNote( SCCOL nCol, SCROW nRow );
/** Deletes the note at the passed cell address. */
void DeleteNote( SCCOL nCol, SCROW nRow );
+ /** Creates the captions of all uninitialized cell notes.
+ @param bForced True = always create all captions, false = skip when Undo is disabled. */
+ void InitializeNoteCaptions( bool bForced = false );
BOOL TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize );
void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
@@ -366,7 +394,11 @@ public:
SCCOL nEndCol, SCROW nEndRow ) const;
USHORT GetErrCode( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetErrCode( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
+ 0;
+ }
//UNUSED2008-05 USHORT GetErrCode( SCCOL nCol, SCROW nRow ) const;
void ResetChanged( const ScRange& rRange );
@@ -442,7 +474,11 @@ public:
const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
ULONG GetNumberFormat( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetNumberFormat( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) :
+ 0;
+ }
ULONG GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
void MergeSelectionPattern( ScMergePatternState& rState,
const ScMarkData& rMark, BOOL bDeep ) const;
@@ -461,7 +497,10 @@ public:
void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE )
- { aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool ); }
+ {
+ if (ValidColRow(rPos.Col(),rPos.Row()))
+ aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
+ }
void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE );
void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
const ScPatternAttr& rPattern, short nNewType );
diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx
new file mode 100644
index 000000000000..a11355833e4c
--- /dev/null
+++ b/sc/inc/tabprotection.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tabprotection.hxx,v $
+ * $Revision: 1.1.4.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_TAB_PROTECTION_HXX
+#define SC_TAB_PROTECTION_HXX
+
+#include "sal/types.h"
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include "global.hxx"
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+#define ENABLE_SHEET_PROTECTION 0
+
+class ScDocument;
+class ScTableProtectionImpl;
+
+enum ScPasswordHash
+{
+ PASSHASH_OOO = 0,
+ PASSHASH_XL
+};
+
+class ScPassHashHelper
+{
+public:
+ /** Check for the compatibility of all password hashes. If there is at
+ least one hash that needs to be regenerated, it returns true. If all
+ hash values are compatible with the specified hash type, then it
+ returns false. */
+ static bool needsPassHashRegen(const ScDocument& rDoc, ScPasswordHash eHash);
+
+private:
+ ScPassHashHelper();
+ ~ScPassHashHelper();
+};
+
+// ============================================================================
+
+class SAL_NO_VTABLE ScPassHashProtectable
+{
+public:
+ virtual ~ScPassHashProtectable() = 0;
+
+ virtual bool isProtected() const = 0;
+ virtual bool isProtectedWithPass() const = 0;
+ virtual void setProtected(bool bProtected) = 0;
+
+ virtual bool isPasswordEmpty() const = 0;
+ virtual bool hasPasswordHash(ScPasswordHash eHash) const = 0;
+ virtual void setPassword(const String& aPassText) = 0;
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const = 0;
+ virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword,
+ ScPasswordHash eHash = PASSHASH_OOO) = 0;
+ virtual bool verifyPassword(const String& aPassText) const = 0;
+};
+
+// ============================================================================
+
+class SC_DLLPUBLIC ScDocProtection : public ScPassHashProtectable
+{
+public:
+ enum Option
+ {
+ STRUCTURE = 0,
+ WINDOWS,
+ CONTENT,
+ NONE // last item - used to resize the vector
+ };
+
+ explicit ScDocProtection();
+ explicit ScDocProtection(const ScDocProtection& r);
+ virtual ~ScDocProtection();
+
+ virtual bool isProtected() const;
+ virtual bool isProtectedWithPass() const;
+ virtual void setProtected(bool bProtected);
+
+ virtual bool isPasswordEmpty() const;
+ virtual bool hasPasswordHash(ScPasswordHash eHash) const;
+ virtual void setPassword(const String& aPassText);
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const;
+ virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword,
+ ScPasswordHash eHash = PASSHASH_OOO);
+ virtual bool verifyPassword(const String& aPassText) const;
+
+ bool isOptionEnabled(Option eOption) const;
+ void setOption(Option eOption, bool bEnabled);
+
+private:
+ ::boost::shared_ptr<ScTableProtectionImpl> mpImpl;
+};
+
+// ============================================================================
+
+/** sheet protection state container
+
+ This class stores sheet's protection state: 1) whether the protection
+ is on, 2) password and/or password hash, and 3) any associated
+ protection options. This class is also used as a protection state
+ container for the undo/redo stack, in which case the password, hash and
+ the options need to be preserved even when the protection flag is
+ off. */
+class SC_DLLPUBLIC ScTableProtection : public ScPassHashProtectable
+{
+public:
+ enum Option
+ {
+ AUTOFILTER = 0,
+ DELETE_COLUMNS,
+ DELETE_ROWS,
+ FORMAT_CELLS,
+ FORMAT_COLUMNS,
+ FORMAT_ROWS,
+ INSERT_COLUMNS,
+ INSERT_HYPERLINKS,
+ INSERT_ROWS,
+ OBJECTS,
+ PIVOT_TABLES,
+ SCENARIOS,
+ SELECT_LOCKED_CELLS,
+ SELECT_UNLOCKED_CELLS,
+ SHEET,
+ SORT,
+ NONE // last item - used to resize the vector
+ };
+
+ explicit ScTableProtection();
+ explicit ScTableProtection(const ScTableProtection& r);
+ virtual ~ScTableProtection();
+
+ virtual bool isProtected() const;
+ virtual bool isProtectedWithPass() const;
+ virtual void setProtected(bool bProtected);
+
+ virtual bool isPasswordEmpty() const;
+ virtual bool hasPasswordHash(ScPasswordHash eHash) const;
+ virtual void setPassword(const String& aPassText);
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const;
+ virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword,
+ ScPasswordHash eHash = PASSHASH_OOO);
+ virtual bool verifyPassword(const String& aPassText) const;
+
+ bool isOptionEnabled(Option eOption) const;
+ void setOption(Option eOption, bool bEnabled);
+
+private:
+ ::boost::shared_ptr<ScTableProtectionImpl> mpImpl;
+};
+
+
+#endif
diff --git a/sc/inc/tokenuno.hxx b/sc/inc/tokenuno.hxx
index abb9d1d06a22..bcd3435668be 100644
--- a/sc/inc/tokenuno.hxx
+++ b/sc/inc/tokenuno.hxx
@@ -31,15 +31,14 @@
#ifndef SC_TOKENUNO_HXX
#define SC_TOKENUNO_HXX
-#include <svtools/lstner.hxx>
-#include <com/sun/star/sheet/FormulaToken.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/sheet/XFormulaParser.hpp>
-#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
+#include <com/sun/star/sheet/FormulaToken.hpp>
+#include <com/sun/star/sheet/XFormulaParser.hpp>
#include <cppuhelper/implbase3.hxx>
+#include <svtools/lstner.hxx>
#include <formula/FormulaOpCodeMapperObj.hxx>
#include "address.hxx"
#include "compiler.hxx"
@@ -47,6 +46,7 @@
class ScTokenArray;
class ScDocShell;
+// ============================================================================
class ScTokenConversion
{
@@ -61,6 +61,7 @@ public:
const ScTokenArray& rTokenArray );
};
+// ============================================================================
class ScFormulaParserObj : public ::cppu::WeakImplHelper3<
::com::sun::star::sheet::XFormulaParser,
@@ -73,7 +74,6 @@ private:
::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks;
ScCompiler::OpCodeMapPtr mxOpCodeMap;
ScDocShell* mpDocShell;
- ScAddress maRefPos;
sal_Int16 mnConv;
bool mbEnglish;
bool mbIgnoreSpaces;
@@ -89,10 +89,12 @@ public:
// XFormulaParser
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL parseFormula(
- const ::rtl::OUString& aFormula )
+ const ::rtl::OUString& aFormula,
+ const ::com::sun::star::table::CellAddress& rReferencePos )
throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL printFormula( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::sheet::FormulaToken >& aTokens )
+ ::com::sun::star::sheet::FormulaToken >& aTokens,
+ const ::com::sun::star::table::CellAddress& rReferencePos )
throw (::com::sun::star::uno::RuntimeException);
// XPropertySet
@@ -145,11 +147,15 @@ public:
throw(::com::sun::star::uno::RuntimeException);
};
+// ============================================================================
+
class ScFormulaOpCodeMapperObj : public formula::FormulaOpCodeMapperObj
{
public:
ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> _pCompiler);
};
+// ============================================================================
+
#endif
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 38f08d91d162..010e420feb42 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -239,6 +239,7 @@
// data pilot field
#define SC_UNONAME_FUNCTION "Function"
+#define SC_UNONAME_SUBTOTALS "Subtotals"
#define SC_UNONAME_SELPAGE "SelectedPage"
#define SC_UNONAME_USESELPAGE "UseSelectedPage"
#define SC_UNONAME_HASREFERENCE "HasReference"
@@ -317,7 +318,10 @@
#define SC_UNONAME_FORMULA2 "Formula2"
#define SC_UNONAME_SOURCEPOS "SourcePosition"
#define SC_UNONAME_SOURCESTR "SourcePositionAsString" // only for use in XML filter
-#define SC_UNONAME_GRAMMAR "Grammar" // only for use in XML filter
+#define SC_UNONAME_FORMULANMSP1 "FormulaNamespace1" // only for use in XML filter
+#define SC_UNONAME_FORMULANMSP2 "FormulaNamespace2" // only for use in XML filter
+#define SC_UNONAME_GRAMMAR1 "Grammar1" // only for use in XML filter
+#define SC_UNONAME_GRAMMAR2 "Grammar2" // only for use in XML filter
#define SC_UNONAME_STYLENAME "StyleName"
// validation
@@ -570,7 +574,6 @@
#define SC_UNO_DRILLDOWN "DrillDownOnDoubleClick"
#define SC_UNO_SHOWFILT "ShowFilterButton"
-
// range selection
#define SC_UNONAME_INITVAL "InitialValue"
#define SC_UNONAME_TITLE "Title"
@@ -599,7 +602,6 @@
// <--
// FormulaParser
-#define SC_UNO_REFERENCEPOS "ReferencePosition"
#define SC_UNO_COMPILEENGLISH "CompileEnglish"
#define SC_UNO_FORMULACONVENTION "FormulaConvention"
#define SC_UNO_IGNORELEADING "IgnoreLeadingSpaces"
@@ -608,8 +610,9 @@
#define SC_UNO_COMPILEFAP "CompileFAP"
// Chart2
-#define SC_UNONAME_ISHIDDEN "IsHidden"
-#define SC_UNONAME_ROLE "Role"
+#define SC_UNONAME_ROLE "Role"
+#define SC_UNONAME_HIDDENVALUES "HiddenValues"
+#define SC_UNONAME_INCLUDEHIDDENCELLS "IncludeHiddenCells"
#define SC_UNONAME_HIDDENVALUES "HiddenValues"
// Solver
diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index d3588c366a7c..cea9c154f04a 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -93,7 +93,9 @@ public:
ScValidationData( ScValidationMode eMode, ScConditionMode eOper,
const String& rExpr1, const String& rExpr2,
ScDocument* pDocument, const ScAddress& rPos,
- const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
+ const String& rExprNmsp1 = EMPTY_STRING, const String& rExprNmsp2 = EMPTY_STRING,
+ formula::FormulaGrammar::Grammar eGrammar1 = formula::FormulaGrammar::GRAM_DEFAULT,
+ formula::FormulaGrammar::Grammar eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT );
ScValidationData( ScValidationMode eMode, ScConditionMode eOper,
const ScTokenArray* pArr1, const ScTokenArray* pArr2,
ScDocument* pDocument, const ScAddress& rPos );
diff --git a/sc/prj/build.lst b/sc/prj/build.lst
index 066d2883d1f7..c893349232e7 100644
--- a/sc/prj/build.lst
+++ b/sc/prj/build.lst
@@ -1,4 +1,4 @@
-sc sc : oovbaapi svx stoc uui BOOST:boost formula oox NULL
+sc sc : l10n oovbaapi svx stoc uui BOOST:boost formula oox NULL
sc sc usr1 - all sc_mkout NULL
sc sc\inc nmake - all sc_inc NULL
sc sc\prj get - all sc_prj NULL
diff --git a/sc/prj/d.lst b/sc/prj/d.lst
index 63b2d7b8e978..b1e0dfde7a3d 100644
--- a/sc/prj/d.lst
+++ b/sc/prj/d.lst
@@ -39,3 +39,5 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\scalc\statusbar
..\uiconfig\scalc\accelerator\es\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\scalc\accelerator\es\*.xml
..\uiconfig\scalc\accelerator\fr\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\scalc\accelerator\fr\*.xml
..\uiconfig\scalc\statusbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\scalc\statusbar\*.xml
+
+..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
diff --git a/sc/qa/complex/calcPreview/makefile.mk b/sc/qa/complex/calcPreview/makefile.mk
index c0051be6a69b..76a6afb4edf0 100755
--- a/sc/qa/complex/calcPreview/makefile.mk
+++ b/sc/qa/complex/calcPreview/makefile.mk
@@ -88,7 +88,7 @@ $(CLASSDIR)$/$(PACKAGE)$/$(JAVAFILES:b).props : ALLDEP
RUN:
- +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTDOCS) $(CT_TESTBASE) $(CT_WORKDIR) $(CT_TIMEOUT) $(CT_TEST)
+ +java -cp "$(CLASSPATH)" $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTDOCS) $(CT_TESTBASE) $(CT_WORKDIR) $(CT_TIMEOUT) $(CT_TEST)
run: RUN
diff --git a/sc/qa/complex/cellRanges/makefile.mk b/sc/qa/complex/cellRanges/makefile.mk
index 027117401bcd..5af9bcf3b222 100755
--- a/sc/qa/complex/cellRanges/makefile.mk
+++ b/sc/qa/complex/cellRanges/makefile.mk
@@ -77,5 +77,5 @@ CT_APP = org.openoffice.Runner
RUN: run
run:
- +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST)
+ +java -cp "$(CLASSPATH)" $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST)
diff --git a/sc/qa/complex/sc/makefile.mk b/sc/qa/complex/sc/makefile.mk
index e3c7fec204b1..d25e004eb55b 100644
--- a/sc/qa/complex/sc/makefile.mk
+++ b/sc/qa/complex/sc/makefile.mk
@@ -58,4 +58,4 @@ JARCOMPRESS = TRUE
run:
- +java -cp $(CLASSPATH) org.openoffice.Runner -TimeOut 0 -tb java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b)
+ +java -cp "$(CLASSPATH)" org.openoffice.Runner -TimeOut 0 -tb java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b)
diff --git a/sc/sdi/prevwsh.sdi b/sc/sdi/prevwsh.sdi
index 484fd5fa8f22..70ca39a816c6 100644
--- a/sc/sdi/prevwsh.sdi
+++ b/sc/sdi/prevwsh.sdi
@@ -161,6 +161,7 @@ interface TablePrintPreview : View
SID_REPEAT [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_PRINTPREVIEW [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] // ole() api()
SID_PREVIEW_CLOSE [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
+ SID_CANCEL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
}
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 73b52bf11f3b..0be7ed5df204 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6870,6 +6870,31 @@ SfxVoidItem TableSelectAll FID_TAB_SELECTALL
]
//--------------------------------------------------------------------------
+SfxVoidItem TableDeselectAll FID_TAB_DESELECTALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
SfxVoidItem TextAttributes SID_DRAWTEXT_ATTR_DLG
()
[
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 3c0cd7c75b4d..227d91b47998 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -53,6 +53,7 @@ interface Tables
]
{
FID_TAB_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; ]
+ FID_TAB_DESELECTALL [ ExecMethod = Execute; StateMethod = GetState; ]
FID_TAB_MENU_RENAME [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
FID_TAB_APPEND [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
FID_INS_TABLE [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index fc33c75306cc..00992cbf962a 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -2104,9 +2104,8 @@ void ScAttrArray::InsertRow( SCROW nStartRow, SCSIZE nSize )
// im eingefuegten Bereich ist nichts zusammengefasst
}
- // Flags nicht duplizieren
- //! direkt am Pattern testen ??
- RemoveFlags( nStartRow, nStartRow+nSize-1, SC_MF_HOR | SC_MF_VER | SC_MF_AUTO );
+ // Don't duplicate the merge flags in the inserted row.
+ RemoveFlags( nStartRow, nStartRow+nSize-1, SC_MF_ALL );
}
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 34b19662debf..ff82d1fd362f 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -35,6 +35,7 @@
#include <sfx2/objsh.hxx>
#include <svtools/listener.hxx>
+#include <svtools/listeneriter.hxx>
#include "document.hxx"
#include "brdcst.hxx"
@@ -89,7 +90,7 @@ ScBroadcastAreaSlot::ScBroadcastAreaSlot( ScDocument* pDocument,
ScBroadcastAreaSlot::~ScBroadcastAreaSlot()
{
- for ( ScBroadcastAreas::iterator aIter = aBroadcastAreaTbl.begin();
+ for ( ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.begin());
aIter != aBroadcastAreaTbl.end(); ++aIter)
{
if (!(*aIter)->DecRef())
@@ -98,16 +99,10 @@ ScBroadcastAreaSlot::~ScBroadcastAreaSlot()
}
-// Only here new ScBroadcastArea objects are created, prevention of dupes.
-// If rpArea != NULL then no listeners are startet, only the area is inserted
-// and the reference count increased.
-void ScBroadcastAreaSlot::StartListeningArea( const ScRange& rRange,
- SvtListener* pListener, ScBroadcastArea*& rpArea
- )
+bool ScBroadcastAreaSlot::CheckHardRecalcStateCondition() const
{
- DBG_ASSERT(pListener, "StartListeningArea: pListener Null");
if ( pDoc->GetHardRecalcState() )
- return;
+ return true;
if (aBroadcastAreaTbl.size() >= aBroadcastAreaTbl.max_size())
{ // this is more hypothetical now, check existed for old SV_PTRARR_SORT
if ( !pDoc->GetHardRecalcState() )
@@ -118,48 +113,74 @@ void ScBroadcastAreaSlot::StartListeningArea( const ScRange& rRange,
DBG_ASSERT( pShell, "Missing DocShell :-/" );
if ( pShell )
- pShell->SetError( SCWARN_CORE_HARD_RECALC );
+ pShell->SetError( SCWARN_CORE_HARD_RECALC, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
pDoc->SetAutoCalc( FALSE );
pDoc->SetHardRecalcState( 2 );
}
- return;
+ return true;
}
+ return false;
+}
+
+
+bool ScBroadcastAreaSlot::StartListeningArea( const ScRange& rRange,
+ SvtListener* pListener, ScBroadcastArea*& rpArea )
+{
+ bool bNewArea = false;
+ DBG_ASSERT(pListener, "StartListeningArea: pListener Null");
+ if (CheckHardRecalcStateCondition())
+ return false;
if ( !rpArea )
{
- rpArea = new ScBroadcastArea( rRange );
- // Most times the area doesn't exist yet, immediately trying to insert
- // it saves an attempt to find it.
- if (aBroadcastAreaTbl.insert( rpArea).second)
- rpArea->IncRef();
+ // Even if most times the area doesn't exist yet and immediately trying
+ // to new and insert it would save an attempt to find it, on mass
+ // operations like identical large [HV]LOOKUP() areas the new/delete
+ // would add quite some penalty for all but the first formula cell.
+ ScBroadcastAreas::const_iterator aIter( FindBroadcastArea( rRange));
+ if (aIter != aBroadcastAreaTbl.end())
+ rpArea = *aIter;
else
{
- delete rpArea;
- ScBroadcastAreas::const_iterator aIter( FindBroadcastArea( rRange));
- if (aIter != aBroadcastAreaTbl.end())
- rpArea = *aIter;
+ rpArea = new ScBroadcastArea( rRange);
+ if (aBroadcastAreaTbl.insert( rpArea).second)
+ {
+ rpArea->IncRef();
+ bNewArea = true;
+ }
else
{
- DBG_ERRORFILE("BroadcastArea not inserted and not found?!?");
+ DBG_ERRORFILE("StartListeningArea: area not found and not inserted in slot?!?");
+ delete rpArea;
rpArea = 0;
}
}
if (rpArea)
- pListener->StartListening( rpArea->GetBroadcaster() );
+ pListener->StartListening( rpArea->GetBroadcaster());
}
else
{
- aBroadcastAreaTbl.insert( rpArea );
- rpArea->IncRef();
+ if (aBroadcastAreaTbl.insert( rpArea).second)
+ rpArea->IncRef();
}
+ return bNewArea;
+}
+
+
+void ScBroadcastAreaSlot::InsertListeningArea( ScBroadcastArea* pArea )
+{
+ DBG_ASSERT( pArea, "InsertListeningArea: pArea NULL");
+ if (CheckHardRecalcStateCondition())
+ return;
+ if (aBroadcastAreaTbl.insert( pArea).second)
+ pArea->IncRef();
}
// If rpArea != NULL then no listeners are stopped, only the area is removed
-// and the reference count decreased.
+// and the reference count decremented.
void ScBroadcastAreaSlot::EndListeningArea( const ScRange& rRange,
- SvtListener* pListener, ScBroadcastArea*& rpArea
- )
+ SvtListener* pListener, ScBroadcastArea*& rpArea )
{
DBG_ASSERT(pListener, "EndListeningArea: pListener Null");
if ( !rpArea )
@@ -186,6 +207,7 @@ void ScBroadcastAreaSlot::EndListeningArea( const ScRange& rRange,
ScBroadcastAreas::iterator aIter( FindBroadcastArea( rRange));
if (aIter == aBroadcastAreaTbl.end())
return;
+ DBG_ASSERT( *aIter == rpArea, "EndListeningArea: area pointer mismatch");
aBroadcastAreaTbl.erase( aIter);
if ( !rpArea->DecRef() )
{
@@ -211,9 +233,8 @@ BOOL ScBroadcastAreaSlot::AreaBroadcast( const ScHint& rHint) const
return FALSE;
BOOL bIsBroadcasted = FALSE;
const ScAddress& rAddress = rHint.GetAddress();
- // Unfortunately we can't search for the first matching entry.
- ScBroadcastAreas::const_iterator aIter( aBroadcastAreaTbl.begin());
- while (aIter != aBroadcastAreaTbl.end())
+ for (ScBroadcastAreas::const_iterator aIter( aBroadcastAreaTbl.begin());
+ aIter != aBroadcastAreaTbl.end(); /* increment in body */ )
{
ScBroadcastArea* pArea = *aIter;
// A Notify() during broadcast may call EndListeningArea() and thus
@@ -229,8 +250,6 @@ BOOL ScBroadcastAreaSlot::AreaBroadcast( const ScHint& rHint) const
bIsBroadcasted = TRUE;
}
}
- else if (rAddress < rAreaRange.aStart)
- break; // while loop, only ranges greater than rAddress follow
}
return bIsBroadcasted;
}
@@ -242,9 +261,8 @@ BOOL ScBroadcastAreaSlot::AreaBroadcastInRange( const ScRange& rRange,
if (aBroadcastAreaTbl.empty())
return FALSE;
BOOL bIsBroadcasted = FALSE;
- // Unfortunately we can't search for the first matching entry.
- ScBroadcastAreas::const_iterator aIter( aBroadcastAreaTbl.begin());
- while (aIter != aBroadcastAreaTbl.end())
+ for (ScBroadcastAreas::const_iterator aIter( aBroadcastAreaTbl.begin());
+ aIter != aBroadcastAreaTbl.end(); /* increment in body */ )
{
ScBroadcastArea* pArea = *aIter;
// A Notify() during broadcast may call EndListeningArea() and thus
@@ -260,8 +278,6 @@ BOOL ScBroadcastAreaSlot::AreaBroadcastInRange( const ScRange& rRange,
bIsBroadcasted = TRUE;
}
}
- else if (rRange.aEnd < rAreaRange.aStart)
- break; // while loop, only ranges greater than end address follow
}
return bIsBroadcasted;
}
@@ -271,14 +287,8 @@ void ScBroadcastAreaSlot::DelBroadcastAreasInRange( const ScRange& rRange )
{
if (aBroadcastAreaTbl.empty())
return;
- // Searching for areas bound completely within rRange, so it's fine to
- // exclude all upper left corners smaller than the upper left corner of
- // rRange and get a lower bound.
- aTmpSeekBroadcastArea.UpdateRange( ScRange( rRange.aStart));
- // Search for lower bound, inclusive, not less than.
- ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.lower_bound(
- &aTmpSeekBroadcastArea));
- for ( ; aIter != aBroadcastAreaTbl.end(); )
+ for (ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.begin());
+ aIter != aBroadcastAreaTbl.end(); /* increment in body */ )
{
const ScRange& rAreaRange = (*aIter)->GetRange();
if (rRange.In( rAreaRange))
@@ -290,12 +300,8 @@ void ScBroadcastAreaSlot::DelBroadcastAreasInRange( const ScRange& rRange )
pBASM->RemoveBulkArea( pArea);
delete pArea;
}
- ScBroadcastAreas::iterator aDel( aIter);
- ++aIter;
- aBroadcastAreaTbl.erase( aDel);
+ aBroadcastAreaTbl.erase( aIter++);
}
- else if (rRange.aEnd < rAreaRange.aStart)
- break; // for loop, only ranges greater than end address follow
else
++aIter;
}
@@ -303,8 +309,7 @@ void ScBroadcastAreaSlot::DelBroadcastAreasInRange( const ScRange& rRange )
void ScBroadcastAreaSlot::UpdateRemove( UpdateRefMode eUpdateRefMode,
- const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz
- )
+ const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
{
if (aBroadcastAreaTbl.empty())
return;
@@ -312,39 +317,24 @@ void ScBroadcastAreaSlot::UpdateRemove( UpdateRefMode eUpdateRefMode,
SCCOL nCol1, nCol2, theCol1, theCol2;
SCROW nRow1, nRow2, theRow1, theRow2;
SCTAB nTab1, nTab2, theTab1, theTab2;
- nCol1 = rRange.aStart.Col();
- nRow1 = rRange.aStart.Row();
- nTab1 = rRange.aStart.Tab();
- nCol2 = rRange.aEnd.Col();
- nRow2 = rRange.aEnd.Row();
- nTab2 = rRange.aEnd.Tab();
+ rRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
for ( ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.begin());
- aIter != aBroadcastAreaTbl.end(); )
+ aIter != aBroadcastAreaTbl.end(); /* increment in body */ )
{
ScBroadcastArea* pArea = *aIter;
- ScBroadcastAreas::iterator aDel( aIter);
- ++aIter;
if ( pArea->IsInUpdateChain() )
{
- aBroadcastAreaTbl.erase( aDel);
+ aBroadcastAreaTbl.erase( aIter++);
pArea->DecRef();
}
else
{
- const ScAddress& rAdr1 = pArea->GetStart();
- theCol1 = rAdr1.Col();
- theRow1 = rAdr1.Row();
- theTab1 = rAdr1.Tab();
- const ScAddress& rAdr2 = pArea->GetEnd();
- theCol2 = rAdr2.Col();
- theRow2 = rAdr2.Row();
- theTab2 = rAdr2.Tab();
+ pArea->GetRange().GetVars( theCol1, theRow1, theTab1, theCol2, theRow2, theTab2);
if ( ScRefUpdate::Update( pDoc, eUpdateRefMode,
nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz,
- theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 )
- )
+ theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 ))
{
- aBroadcastAreaTbl.erase( aDel);
+ aBroadcastAreaTbl.erase( aIter++);
pArea->DecRef();
if (pBASM->IsInBulkBroadcast())
pBASM->RemoveBulkArea( pArea);
@@ -356,6 +346,8 @@ void ScBroadcastAreaSlot::UpdateRemove( UpdateRefMode eUpdateRefMode,
pBASM->SetUpdateChain( pArea );
pBASM->SetEOUpdateChain( pArea );
}
+ else
+ ++aIter;
}
}
}
@@ -363,13 +355,48 @@ void ScBroadcastAreaSlot::UpdateRemove( UpdateRefMode eUpdateRefMode,
void ScBroadcastAreaSlot::UpdateInsert( ScBroadcastArea* pArea )
{
- aBroadcastAreaTbl.insert( pArea );
- pArea->IncRef();
+ ::std::pair< ScBroadcastAreas::iterator, bool > aPair =
+ aBroadcastAreaTbl.insert( pArea );
+ if (aPair.second)
+ pArea->IncRef();
+ else
+ {
+ // Identical area already exists, add listeners.
+ ScBroadcastArea* pTarget = *(aPair.first);
+ if (pArea != pTarget)
+ {
+ SvtBroadcaster& rTarget = pTarget->GetBroadcaster();
+ SvtListenerIter it( pArea->GetBroadcaster());
+ for (SvtListener* pListener = it.GetCurr(); pListener;
+ pListener = it.GoNext())
+ {
+ pListener->StartListening( rTarget);
+ }
+ }
+ }
}
// --- ScBroadcastAreaSlotMachine -------------------------------------
+ScBroadcastAreaSlotMachine::TableSlots::TableSlots()
+{
+ ppSlots = new ScBroadcastAreaSlot* [ BCA_SLOTS ];
+ memset( ppSlots, 0 , sizeof( ScBroadcastAreaSlot* ) * BCA_SLOTS );
+}
+
+
+ScBroadcastAreaSlotMachine::TableSlots::~TableSlots()
+{
+ for ( ScBroadcastAreaSlot** pp = ppSlots + BCA_SLOTS; --pp >= ppSlots; /* nothing */ )
+ {
+ if (*pp)
+ delete *pp;
+ }
+ delete [] ppSlots;
+}
+
+
ScBroadcastAreaSlotMachine::ScBroadcastAreaSlotMachine(
ScDocument* pDocument ) :
pBCAlways( NULL ),
@@ -378,20 +405,16 @@ ScBroadcastAreaSlotMachine::ScBroadcastAreaSlotMachine(
pEOUpdateChain( NULL ),
nInBulkBroadcast( 0 )
{
- ppSlots = new ScBroadcastAreaSlot* [ BCA_SLOTS ];
- memset( ppSlots, 0 , sizeof( ScBroadcastAreaSlot* ) * BCA_SLOTS );
+ for (TableSlotsMap::iterator iTab( aTableSlotsMap.begin());
+ iTab != aTableSlotsMap.end(); ++iTab)
+ {
+ delete (*iTab).second;
+ }
}
ScBroadcastAreaSlotMachine::~ScBroadcastAreaSlotMachine()
{
- for ( ScBroadcastAreaSlot** pp = ppSlots + BCA_SLOTS; --pp >= ppSlots; )
- {
- if ( *pp )
- delete *pp;
- }
- delete[] ppSlots;
-
delete pBCAlways;
}
@@ -414,8 +437,7 @@ inline SCSIZE ScBroadcastAreaSlotMachine::ComputeSlotOffset(
void ScBroadcastAreaSlotMachine::ComputeAreaPoints( const ScRange& rRange,
- SCSIZE& rStart, SCSIZE& rEnd, SCSIZE& rRowBreak
- ) const
+ SCSIZE& rStart, SCSIZE& rEnd, SCSIZE& rRowBreak ) const
{
rStart = ComputeSlotOffset( rRange.aStart );
rEnd = ComputeSlotOffset( rRange.aEnd );
@@ -426,8 +448,7 @@ void ScBroadcastAreaSlotMachine::ComputeAreaPoints( const ScRange& rRange,
void ScBroadcastAreaSlotMachine::StartListeningArea( const ScRange& rRange,
- SvtListener* pListener
- )
+ SvtListener* pListener )
{
if ( rRange == BCA_LISTEN_ALWAYS )
{
@@ -437,29 +458,48 @@ void ScBroadcastAreaSlotMachine::StartListeningArea( const ScRange& rRange,
}
else
{
- SCSIZE nStart, nEnd, nRowBreak;
- ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
- SCSIZE nOff = nStart;
- SCSIZE nBreak = nOff + nRowBreak;
- ScBroadcastAreaSlot** pp = ppSlots + nOff;
- ScBroadcastArea* pArea = NULL;
- while ( nOff <= nEnd )
+ bool bDone = false;
+ for (SCTAB nTab = rRange.aStart.Tab();
+ !bDone && nTab <= rRange.aEnd.Tab(); ++nTab)
{
- if ( !*pp )
- *pp = new ScBroadcastAreaSlot( pDoc, this );
- // the first call creates the ScBroadcastArea
- (*pp)->StartListeningArea( rRange, pListener, pArea );
- if ( nOff < nBreak )
+ TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab));
+ if (iTab == aTableSlotsMap.end())
+ iTab = aTableSlotsMap.insert( TableSlotsMap::value_type(
+ nTab, new TableSlots)).first;
+ ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ SCSIZE nStart, nEnd, nRowBreak;
+ ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
+ SCSIZE nOff = nStart;
+ SCSIZE nBreak = nOff + nRowBreak;
+ ScBroadcastAreaSlot** pp = ppSlots + nOff;
+ ScBroadcastArea* pArea = NULL;
+ while ( !bDone && nOff <= nEnd )
{
- ++nOff;
- ++pp;
- }
- else
- {
- nStart += BCA_SLOTS_ROW;
- nOff = nStart;
- pp = ppSlots + nOff;
- nBreak = nOff + nRowBreak;
+ if ( !*pp )
+ *pp = new ScBroadcastAreaSlot( pDoc, this );
+ if (!pArea)
+ {
+ // If the call to StartListeningArea didn't create the
+ // ScBroadcastArea, listeners were added to an already
+ // existing identical area that doesn't need to be inserted
+ // to slots again.
+ if (!(*pp)->StartListeningArea( rRange, pListener, pArea))
+ bDone = true;
+ }
+ else
+ (*pp)->InsertListeningArea( pArea);
+ if ( nOff < nBreak )
+ {
+ ++nOff;
+ ++pp;
+ }
+ else
+ {
+ nStart += BCA_SLOTS_ROW;
+ nOff = nStart;
+ pp = ppSlots + nOff;
+ nBreak = nOff + nRowBreak;
+ }
}
}
}
@@ -467,8 +507,7 @@ void ScBroadcastAreaSlotMachine::StartListeningArea( const ScRange& rRange,
void ScBroadcastAreaSlotMachine::EndListeningArea( const ScRange& rRange,
- SvtListener* pListener
- )
+ SvtListener* pListener )
{
if ( rRange == BCA_LISTEN_ALWAYS )
{
@@ -485,27 +524,47 @@ void ScBroadcastAreaSlotMachine::EndListeningArea( const ScRange& rRange,
}
else
{
- SCSIZE nStart, nEnd, nRowBreak;
- ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
- SCSIZE nOff = nStart;
- SCSIZE nBreak = nOff + nRowBreak;
- ScBroadcastAreaSlot** pp = ppSlots + nOff;
- ScBroadcastArea* pArea = NULL;
- while ( nOff <= nEnd )
+ SCTAB nEndTab = rRange.aEnd.Tab();
+ for (TableSlotsMap::iterator iTab( aTableSlotsMap.lower_bound( rRange.aStart.Tab()));
+ iTab != aTableSlotsMap.end() && (*iTab).first <= nEndTab; ++iTab)
{
- if ( *pp )
- (*pp)->EndListeningArea( rRange, pListener, pArea );
- if ( nOff < nBreak )
+ ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ SCSIZE nStart, nEnd, nRowBreak;
+ ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
+ SCSIZE nOff = nStart;
+ SCSIZE nBreak = nOff + nRowBreak;
+ ScBroadcastAreaSlot** pp = ppSlots + nOff;
+ ScBroadcastArea* pArea = NULL;
+ if (nOff == 0 && nEnd == BCA_SLOTS-1)
{
- ++nOff;
- ++pp;
+ // Slightly optimized for 0,0,MAXCOL,MAXROW calls as they
+ // happen for insertion and deletion of sheets.
+ ScBroadcastAreaSlot** const pStop = ppSlots + nEnd;
+ do
+ {
+ if ( *pp )
+ (*pp)->EndListeningArea( rRange, pListener, pArea );
+ } while (++pp < pStop);
}
else
{
- nStart += BCA_SLOTS_ROW;
- nOff = nStart;
- pp = ppSlots + nOff;
- nBreak = nOff + nRowBreak;
+ while ( nOff <= nEnd )
+ {
+ if ( *pp )
+ (*pp)->EndListeningArea( rRange, pListener, pArea );
+ if ( nOff < nBreak )
+ {
+ ++nOff;
+ ++pp;
+ }
+ else
+ {
+ nStart += BCA_SLOTS_ROW;
+ nOff = nStart;
+ pp = ppSlots + nOff;
+ nBreak = nOff + nRowBreak;
+ }
+ }
}
}
}
@@ -527,7 +586,11 @@ BOOL ScBroadcastAreaSlotMachine::AreaBroadcast( const ScHint& rHint ) const
}
else
{
- ScBroadcastAreaSlot* pSlot = ppSlots[ ComputeSlotOffset( rAddress ) ];
+ TableSlotsMap::const_iterator iTab( aTableSlotsMap.find( rAddress.Tab()));
+ if (iTab == aTableSlotsMap.end())
+ return FALSE;
+ ScBroadcastAreaSlot* pSlot = (*iTab).second->getAreaSlot(
+ ComputeSlotOffset( rAddress));
if ( pSlot )
return pSlot->AreaBroadcast( rHint );
else
@@ -540,26 +603,32 @@ BOOL ScBroadcastAreaSlotMachine::AreaBroadcastInRange( const ScRange& rRange,
const ScHint& rHint ) const
{
BOOL bBroadcasted = FALSE;
- SCSIZE nStart, nEnd, nRowBreak;
- ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
- SCSIZE nOff = nStart;
- SCSIZE nBreak = nOff + nRowBreak;
- ScBroadcastAreaSlot** pp = ppSlots + nOff;
- while ( nOff <= nEnd )
+ SCTAB nEndTab = rRange.aEnd.Tab();
+ for (TableSlotsMap::const_iterator iTab( aTableSlotsMap.lower_bound( rRange.aStart.Tab()));
+ iTab != aTableSlotsMap.end() && (*iTab).first <= nEndTab; ++iTab)
{
- if ( *pp )
- bBroadcasted |= (*pp)->AreaBroadcastInRange( rRange, rHint );
- if ( nOff < nBreak )
- {
- ++nOff;
- ++pp;
- }
- else
+ ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ SCSIZE nStart, nEnd, nRowBreak;
+ ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
+ SCSIZE nOff = nStart;
+ SCSIZE nBreak = nOff + nRowBreak;
+ ScBroadcastAreaSlot** pp = ppSlots + nOff;
+ while ( nOff <= nEnd )
{
- nStart += BCA_SLOTS_ROW;
- nOff = nStart;
- pp = ppSlots + nOff;
- nBreak = nOff + nRowBreak;
+ if ( *pp )
+ bBroadcasted |= (*pp)->AreaBroadcastInRange( rRange, rHint );
+ if ( nOff < nBreak )
+ {
+ ++nOff;
+ ++pp;
+ }
+ else
+ {
+ nStart += BCA_SLOTS_ROW;
+ nOff = nStart;
+ pp = ppSlots + nOff;
+ nBreak = nOff + nRowBreak;
+ }
}
}
return bBroadcasted;
@@ -567,126 +636,213 @@ BOOL ScBroadcastAreaSlotMachine::AreaBroadcastInRange( const ScRange& rRange,
void ScBroadcastAreaSlotMachine::DelBroadcastAreasInRange(
- const ScRange& rRange
- )
+ const ScRange& rRange )
{
- SCSIZE nStart, nEnd, nRowBreak;
- ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
- SCSIZE nOff = nStart;
- SCSIZE nBreak = nOff + nRowBreak;
- ScBroadcastAreaSlot** pp = ppSlots + nOff;
- while ( nOff <= nEnd )
+ SCTAB nEndTab = rRange.aEnd.Tab();
+ for (TableSlotsMap::iterator iTab( aTableSlotsMap.lower_bound( rRange.aStart.Tab()));
+ iTab != aTableSlotsMap.end() && (*iTab).first <= nEndTab; ++iTab)
{
- if ( *pp )
- (*pp)->DelBroadcastAreasInRange( rRange );
- if ( nOff < nBreak )
+ ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ SCSIZE nStart, nEnd, nRowBreak;
+ ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
+ SCSIZE nOff = nStart;
+ SCSIZE nBreak = nOff + nRowBreak;
+ ScBroadcastAreaSlot** pp = ppSlots + nOff;
+ if (nOff == 0 && nEnd == BCA_SLOTS-1)
{
- ++nOff;
- ++pp;
+ // Slightly optimized for 0,0,MAXCOL,MAXROW calls as they
+ // happen for insertion and deletion of sheets.
+ ScBroadcastAreaSlot** const pStop = ppSlots + nEnd;
+ do
+ {
+ if ( *pp )
+ (*pp)->DelBroadcastAreasInRange( rRange );
+ } while (++pp < pStop);
}
else
{
- nStart += BCA_SLOTS_ROW;
- nOff = nStart;
- pp = ppSlots + nOff;
- nBreak = nOff + nRowBreak;
+ while ( nOff <= nEnd )
+ {
+ if ( *pp )
+ (*pp)->DelBroadcastAreasInRange( rRange );
+ if ( nOff < nBreak )
+ {
+ ++nOff;
+ ++pp;
+ }
+ else
+ {
+ nStart += BCA_SLOTS_ROW;
+ nOff = nStart;
+ pp = ppSlots + nOff;
+ nBreak = nOff + nRowBreak;
+ }
+ }
}
}
}
-// for all affected: remove, chain, update range, insert
+// for all affected: remove, chain, update range, insert, and maybe delete
void ScBroadcastAreaSlotMachine::UpdateBroadcastAreas(
UpdateRefMode eUpdateRefMode,
- const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz
- )
+ const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
{
- SCSIZE nStart, nEnd, nRowBreak;
// remove affected and put in chain
- ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
- SCSIZE nOff = nStart;
- SCSIZE nBreak = nOff + nRowBreak;
- ScBroadcastAreaSlot** pp = ppSlots + nOff;
- while ( nOff <= nEnd )
+ SCTAB nEndTab = rRange.aEnd.Tab();
+ for (TableSlotsMap::iterator iTab( aTableSlotsMap.lower_bound( rRange.aStart.Tab()));
+ iTab != aTableSlotsMap.end() && (*iTab).first <= nEndTab; ++iTab)
{
- if ( *pp )
- (*pp)->UpdateRemove( eUpdateRefMode, rRange, nDx, nDy, nDz );
- if ( nOff < nBreak )
+ ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ SCSIZE nStart, nEnd, nRowBreak;
+ ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
+ SCSIZE nOff = nStart;
+ SCSIZE nBreak = nOff + nRowBreak;
+ ScBroadcastAreaSlot** pp = ppSlots + nOff;
+ if (nOff == 0 && nEnd == BCA_SLOTS-1)
{
- ++nOff;
- ++pp;
+ // Slightly optimized for 0,0,MAXCOL,MAXROW calls as they
+ // happen for insertion and deletion of sheets.
+ ScBroadcastAreaSlot** const pStop = ppSlots + nEnd;
+ do
+ {
+ if ( *pp )
+ (*pp)->UpdateRemove( eUpdateRefMode, rRange, nDx, nDy, nDz );
+ } while (++pp < pStop);
}
else
{
- nStart += BCA_SLOTS_ROW;
- nOff = nStart;
- pp = ppSlots + nOff;
- nBreak = nOff + nRowBreak;
+ while ( nOff <= nEnd )
+ {
+ if ( *pp )
+ (*pp)->UpdateRemove( eUpdateRefMode, rRange, nDx, nDy, nDz );
+ if ( nOff < nBreak )
+ {
+ ++nOff;
+ ++pp;
+ }
+ else
+ {
+ nStart += BCA_SLOTS_ROW;
+ nOff = nStart;
+ pp = ppSlots + nOff;
+ nBreak = nOff + nRowBreak;
+ }
+ }
}
}
+
+ // shift sheets
+ if (nDz)
+ {
+ if (nDz < 0)
+ {
+ TableSlotsMap::iterator iDel( aTableSlotsMap.lower_bound( rRange.aStart.Tab()));
+ TableSlotsMap::iterator iTab( aTableSlotsMap.lower_bound( rRange.aStart.Tab() - nDz));
+ // Remove sheets, if any, iDel or/and iTab may as well point to end().
+ while (iDel != iTab)
+ {
+ delete (*iDel).second;
+ aTableSlotsMap.erase( iDel++);
+ }
+ // shift remaining down
+ while (iTab != aTableSlotsMap.end())
+ {
+ SCTAB nTab = (*iTab).first + nDz;
+ aTableSlotsMap[nTab] = (*iTab).second;
+ aTableSlotsMap.erase( iTab++);
+ }
+ }
+ else
+ {
+ TableSlotsMap::iterator iStop( aTableSlotsMap.lower_bound( rRange.aStart.Tab()));
+ if (iStop != aTableSlotsMap.end())
+ {
+ bool bStopIsBegin = (iStop == aTableSlotsMap.begin());
+ if (!bStopIsBegin)
+ --iStop;
+ TableSlotsMap::iterator iTab( aTableSlotsMap.end());
+ --iTab;
+ while (iTab != iStop)
+ {
+ SCTAB nTab = (*iTab).first + nDz;
+ aTableSlotsMap[nTab] = (*iTab).second;
+ aTableSlotsMap.erase( iTab--);
+ }
+ // Shift the very first, iTab==iStop in this case.
+ if (bStopIsBegin)
+ {
+ SCTAB nTab = (*iTab).first + nDz;
+ aTableSlotsMap[nTab] = (*iTab).second;
+ aTableSlotsMap.erase( iStop);
+ }
+ }
+ }
+ }
+
// work off chain
SCCOL nCol1, nCol2, theCol1, theCol2;
SCROW nRow1, nRow2, theRow1, theRow2;
SCTAB nTab1, nTab2, theTab1, theTab2;
- nCol1 = rRange.aStart.Col();
- nRow1 = rRange.aStart.Row();
- nTab1 = rRange.aStart.Tab();
- nCol2 = rRange.aEnd.Col();
- nRow2 = rRange.aEnd.Row();
- nTab2 = rRange.aEnd.Tab();
+ rRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
while ( pUpdateChain )
{
- ScAddress aAdr;
- ScRange aRange;
ScBroadcastArea* pArea = pUpdateChain;
+ ScRange aRange( pArea->GetRange());
pUpdateChain = pArea->GetUpdateChainNext();
// update range
- aAdr = pArea->GetStart();
- theCol1 = aAdr.Col();
- theRow1 = aAdr.Row();
- theTab1 = aAdr.Tab();
- aAdr = pArea->GetEnd();
- theCol2 = aAdr.Col();
- theRow2 = aAdr.Row();
- theTab2 = aAdr.Tab();
+ aRange.GetVars( theCol1, theRow1, theTab1, theCol2, theRow2, theTab2);
if ( ScRefUpdate::Update( pDoc, eUpdateRefMode,
nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz,
- theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 )
- )
+ theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 ))
{
- aRange = ScRange( ScAddress( theCol1,theRow1,theTab1 ),
- ScAddress( theCol2,theRow2,theTab2 ) );
+ aRange = ScRange( theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 );
pArea->UpdateRange( aRange );
pArea->GetBroadcaster().Broadcast( ScAreaChangedHint( aRange ) ); // for DDE
}
- // insert in slot
- ComputeAreaPoints( aRange, nStart, nEnd, nRowBreak );
- nOff = nStart;
- nBreak = nOff + nRowBreak;
- pp = ppSlots + nOff;
- while ( nOff <= nEnd )
+ // insert to slots
+ for (SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); ++nTab)
{
- if ( *pp )
- (*pp)->UpdateInsert( pArea );
- if ( nOff < nBreak )
- {
- ++nOff;
- ++pp;
- }
- else
+ TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab));
+ if (iTab == aTableSlotsMap.end())
+ iTab = aTableSlotsMap.insert( TableSlotsMap::value_type(
+ nTab, new TableSlots)).first;
+ ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ SCSIZE nStart, nEnd, nRowBreak;
+ ComputeAreaPoints( aRange, nStart, nEnd, nRowBreak );
+ SCSIZE nOff = nStart;
+ SCSIZE nBreak = nOff + nRowBreak;
+ ScBroadcastAreaSlot** pp = ppSlots + nOff;
+ while ( nOff <= nEnd )
{
- nStart += BCA_SLOTS_ROW;
- nOff = nStart;
- pp = ppSlots + nOff;
- nBreak = nOff + nRowBreak;
+ if (!*pp)
+ *pp = new ScBroadcastAreaSlot( pDoc, this );
+ (*pp)->UpdateInsert( pArea );
+ if ( nOff < nBreak )
+ {
+ ++nOff;
+ ++pp;
+ }
+ else
+ {
+ nStart += BCA_SLOTS_ROW;
+ nOff = nStart;
+ pp = ppSlots + nOff;
+ nBreak = nOff + nRowBreak;
+ }
}
}
// unchain
pArea->SetUpdateChainNext( NULL );
pArea->SetInUpdateChain( FALSE );
+
+ // Delete if not inserted to any slot. RemoveBulkArea(pArea) was
+ // already executed in UpdateRemove().
+ if (!pArea->GetRef())
+ delete pArea;
}
pEOUpdateChain = NULL;
}
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 0d71db3427b0..da2de0b68099 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -148,7 +148,7 @@ ScBaseCell* ScBaseCell::CloneWithoutNote( ScDocument& rDestDoc, const ScAddress&
return lclCloneCell( *this, rDestDoc, rDestPos, nCloneFlags );
}
-ScBaseCell* ScBaseCell::CloneWithNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags ) const
+ScBaseCell* ScBaseCell::CloneWithNote( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags ) const
{
ScBaseCell* pNewCell = lclCloneCell( *this, rDestDoc, rDestPos, nCloneFlags );
if( mpNote )
@@ -156,7 +156,7 @@ ScBaseCell* ScBaseCell::CloneWithNote( ScDocument& rDestDoc, const ScAddress& rD
if( !pNewCell )
pNewCell = new ScNoteCell;
bool bCloneCaption = (nCloneFlags & SC_CLONECELL_NOCAPTION) == 0;
- pNewCell->TakeNote( ScNoteUtil::CloneNote( rDestDoc, rDestPos, *mpNote, bCloneCaption ) );
+ pNewCell->TakeNote( mpNote->Clone( rOwnPos, rDestDoc, rDestPos, bCloneCaption ) );
}
return pNewCell;
}
@@ -1016,15 +1016,15 @@ void ScFormulaCell::CompileXML( ScProgress& rProgress )
ScCompiler aComp( pDocument, aPos, *pCode);
aComp.SetGrammar(eTempGrammar);
- String aFormula;
- aComp.CreateStringFromTokenArray( aFormula );
+ String aFormula, aFormulaNmsp;
+ aComp.CreateStringFromXMLTokenArray( aFormula, aFormulaNmsp );
pDocument->DecXMLImportedFormulaCount( aFormula.Len() );
rProgress.SetStateCountDownOnPercent( pDocument->GetXMLImportedFormulaCount() );
// pCode darf fuer Abfragen noch nicht geloescht, muss aber leer sein
if ( pCode )
pCode->Clear();
ScTokenArray* pCodeOld = pCode;
- pCode = aComp.CompileString( aFormula );
+ pCode = aComp.CompileString( aFormula, aFormulaNmsp );
delete pCodeOld;
if( !pCode->GetCodeError() )
{
@@ -1701,7 +1701,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
// Reschedule verlangsamt das ganze erheblich, nur bei Prozentaenderung ausfuehren
ScProgress::GetInterpretProgress()->SetStateCountDownOnPercent(
- pDocument->GetFormulaCodeInTree() );
+ pDocument->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE );
}
else
{
@@ -1919,6 +1919,13 @@ void ScFormulaCell::GetURLResult( String& rURL, String& rCellText )
}
}
+bool ScFormulaCell::IsMultilineResult()
+{
+ if (!IsValue())
+ return aResult.IsMultiline();
+ return false;
+}
+
EditTextObject* ScFormulaCell::CreateURLObject()
{
String aCellText;
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 0dffbdefa0b7..2a1525b76401 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -34,6 +34,11 @@
// INCLUDE ---------------------------------------------------------------
+#include <algorithm>
+#include <deque>
+
+#include <boost/bind.hpp>
+
#include <vcl/mapmod.hxx>
#include <svx/editobj.hxx>
#include <svx/editstat.hxx>
@@ -129,7 +134,7 @@ void ScEditCell::GetString( String& rString ) const
// auch Text von URL-Feldern, Doc-Engine ist eine ScFieldEditEngine
EditEngine& rEngine = pDoc->GetEditEngine();
rEngine.SetText( *pData );
- rString = ScEditUtil::GetSpaceDelimitedString(rEngine); // space between paragraphs
+ rString = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs
// kurze Strings fuer Formeln merken
if ( rString.Len() < MAXSTRLEN )
((ScEditCell*)this)->pString = new String( rString ); //! non-const
@@ -175,6 +180,223 @@ void ScEditCell::SetTextObject( const EditTextObject* pObject,
// ============================================================================
+namespace
+{
+
+using std::deque;
+
+typedef SCCOLROW(*DimensionSelector)(const ScSingleRefData&);
+
+
+static SCCOLROW lcl_GetCol(const ScSingleRefData& rData)
+{
+ return rData.nCol;
+}
+
+
+static SCCOLROW lcl_GetRow(const ScSingleRefData& rData)
+{
+ return rData.nRow;
+}
+
+
+static SCCOLROW lcl_GetTab(const ScSingleRefData& rData)
+{
+ return rData.nTab;
+}
+
+
+/** Check if both references span the same range in selected dimension.
+ */
+static bool
+lcl_checkRangeDimension(
+ const SingleDoubleRefProvider& rRef1,
+ const SingleDoubleRefProvider& rRef2,
+ const DimensionSelector aWhich)
+{
+ return
+ aWhich(rRef1.Ref1) == aWhich(rRef2.Ref1)
+ && aWhich(rRef1.Ref2) == aWhich(rRef2.Ref2);
+}
+
+
+static bool
+lcl_checkRangeDimensions(
+ const SingleDoubleRefProvider& rRef1,
+ const SingleDoubleRefProvider& rRef2,
+ bool& bCol, bool& bRow, bool& bTab)
+{
+ const bool bSameCols(lcl_checkRangeDimension(rRef1, rRef2, lcl_GetCol));
+ const bool bSameRows(lcl_checkRangeDimension(rRef1, rRef2, lcl_GetRow));
+ const bool bSameTabs(lcl_checkRangeDimension(rRef1, rRef2, lcl_GetTab));
+
+ // Test if exactly two dimensions are equal
+ if (!(bSameCols ^ bSameRows ^ bSameTabs)
+ && (bSameCols || bSameRows || bSameTabs))
+ {
+ bCol = !bSameCols;
+ bRow = !bSameRows;
+ bTab = !bSameTabs;
+ return true;
+ }
+ return false;
+}
+
+
+/** Check if references in given reference list can possibly
+ form a range. To do that, two of their dimensions must be the same.
+ */
+static bool
+lcl_checkRangeDimensions(
+ const deque<ScToken*>::const_iterator aBegin,
+ const deque<ScToken*>::const_iterator aEnd,
+ bool& bCol, bool& bRow, bool& bTab)
+{
+ deque<ScToken*>::const_iterator aCur(aBegin);
+ ++aCur;
+ const SingleDoubleRefProvider aRef(**aBegin);
+ bool bOk(false);
+ {
+ const SingleDoubleRefProvider aRefCur(**aCur);
+ bOk = lcl_checkRangeDimensions(aRef, aRefCur, bCol, bRow, bTab);
+ }
+ while (bOk && aCur != aEnd)
+ {
+ const SingleDoubleRefProvider aRefCur(**aCur);
+ bool bColTmp(false);
+ bool bRowTmp(false);
+ bool bTabTmp(false);
+ bOk = lcl_checkRangeDimensions(aRef, aRefCur, bColTmp, bRowTmp, bTabTmp);
+ bOk = bOk && (bCol == bColTmp && bRow == bRowTmp && bTab == bTabTmp);
+ ++aCur;
+ }
+
+ if (bOk && aCur == aEnd)
+ {
+ bCol = bCol;
+ bRow = bRow;
+ bTab = bTab;
+ return true;
+ }
+ return false;
+}
+
+
+bool
+lcl_lessReferenceBy(
+ const ScToken* const pRef1, const ScToken* const pRef2,
+ const DimensionSelector aWhich)
+{
+ const SingleDoubleRefProvider rRef1(*pRef1);
+ const SingleDoubleRefProvider rRef2(*pRef2);
+ return aWhich(rRef1.Ref1) < aWhich(rRef2.Ref1);
+}
+
+
+/** Returns true if range denoted by token pRef2 starts immediately after
+ range denoted by token pRef1. Dimension, in which the comparison takes
+ place, is given by aWhich.
+ */
+bool
+lcl_isImmediatelyFollowing(
+ const ScToken* const pRef1, const ScToken* const pRef2,
+ const DimensionSelector aWhich)
+{
+ const SingleDoubleRefProvider rRef1(*pRef1);
+ const SingleDoubleRefProvider rRef2(*pRef2);
+ return aWhich(rRef2.Ref1) - aWhich(rRef1.Ref2) == 1;
+}
+
+
+static bool
+lcl_checkIfAdjacent(
+ const deque<ScToken*>& rReferences,
+ const DimensionSelector aWhich)
+{
+ typedef deque<ScToken*>::const_iterator Iter;
+ Iter aBegin(rReferences.begin());
+ Iter aEnd(rReferences.end());
+ Iter aBegin1(aBegin);
+ ++aBegin1, --aEnd;
+ return std::equal(
+ aBegin, aEnd, aBegin1,
+ boost::bind(lcl_isImmediatelyFollowing, _1, _2, aWhich));
+}
+
+
+static void
+lcl_fillRangeFromRefList(
+ const deque<ScToken*>& rReferences, ScRange& rRange)
+{
+ const ScSingleRefData aStart(
+ SingleDoubleRefProvider(*rReferences.front()).Ref1);
+ rRange.aStart.Set(aStart.nCol, aStart.nRow, aStart.nTab);
+ const ScSingleRefData aEnd(
+ SingleDoubleRefProvider(*rReferences.back()).Ref2);
+ rRange.aEnd.Set(aEnd.nCol, aEnd.nRow, aEnd.nTab);
+}
+
+
+static bool
+lcl_refListFormsOneRange(
+ const ScAddress& aPos, deque<ScToken*>& rReferences,
+ ScRange& rRange)
+{
+ std::for_each(
+ rReferences.begin(), rReferences.end(),
+ bind(&ScToken::CalcAbsIfRel, _1, aPos))
+ ;
+ if (rReferences.size() == 1) {
+ lcl_fillRangeFromRefList(rReferences, rRange);
+ return true;
+ }
+
+ bool bCell(false);
+ bool bRow(false);
+ bool bTab(false);
+ if (lcl_checkRangeDimensions(rReferences.begin(), rReferences.end(),
+ bCell, bRow, bTab))
+ {
+ DimensionSelector aWhich;
+ if (bCell)
+ {
+ aWhich = lcl_GetCol;
+ }
+ else if (bRow)
+ {
+ aWhich = lcl_GetRow;
+ }
+ else if (bTab)
+ {
+ aWhich = lcl_GetTab;
+ }
+ else
+ {
+ OSL_ENSURE(false, "lcl_checkRangeDimensions shouldn't allow that!");
+ aWhich = lcl_GetRow; // initialize to avoid warning
+ }
+ // Sort the references by start of range
+ std::sort(rReferences.begin(), rReferences.end(),
+ boost::bind(lcl_lessReferenceBy, _1, _2, aWhich));
+ if (lcl_checkIfAdjacent(rReferences, aWhich))
+ {
+ lcl_fillRangeFromRefList(rReferences, rRange);
+ return true;
+ }
+ }
+ return false;
+}
+
+
+bool lcl_isReference(const FormulaToken& rToken)
+{
+ return
+ rToken.GetType() == svSingleRef ||
+ rToken.GetType() == svDoubleRef;
+}
+
+}
+
BOOL ScFormulaCell::IsEmpty()
{
if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
@@ -449,6 +671,52 @@ BOOL ScFormulaCell::HasOneReference( ScRange& r ) const
return FALSE;
}
+bool
+ScFormulaCell::HasRefListExpressibleAsOneReference(ScRange& rRange) const
+{
+ /* If there appears just one reference in the formula, it's the same
+ as HasOneReference(). If there are more of them, they can denote
+ one range if they are (sole) arguments of one function.
+ Union of these references must form one range and their
+ intersection must be empty set.
+ */
+ pCode->Reset();
+ // Get first reference, if any
+ ScToken* const pFirstReference(
+ dynamic_cast<ScToken*>(pCode->GetNextReferenceRPN()));
+ if (pFirstReference)
+ {
+ // Collect all consecutive references, starting by the one
+ // already found
+ std::deque<ScToken*> aReferences;
+ aReferences.push_back(pFirstReference);
+ FormulaToken* pToken(pCode->NextRPN());
+ FormulaToken* pFunction(0);
+ while (pToken)
+ {
+ if (lcl_isReference(*pToken))
+ {
+ aReferences.push_back(dynamic_cast<ScToken*>(pToken));
+ pToken = pCode->NextRPN();
+ }
+ else
+ {
+ if (pToken->IsFunction())
+ {
+ pFunction = pToken;
+ }
+ break;
+ }
+ }
+ if (pFunction && !pCode->GetNextReferenceRPN()
+ && (pFunction->GetParamCount() == aReferences.size()))
+ {
+ return lcl_refListFormsOneRange(aPos, aReferences, rRange);
+ }
+ }
+ return false;
+}
+
BOOL ScFormulaCell::HasRelNameReference() const
{
pCode->Reset();
@@ -472,7 +740,7 @@ BOOL ScFormulaCell::HasColRowName() const
void ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode,
const ScRange& r,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
- ScDocument* pUndoDoc )
+ ScDocument* pUndoDoc, const ScAddress* pUndoCellPos )
{
SCCOL nCol1 = r.aStart.Col();
SCROW nRow1 = r.aStart.Row();
@@ -484,6 +752,8 @@ void ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode,
SCROW nRow = aPos.Row();
SCTAB nTab = aPos.Tab();
ScAddress aUndoPos( aPos ); // position for undo cell in pUndoDoc
+ if ( pUndoCellPos )
+ aUndoPos = *pUndoCellPos;
ScAddress aOldPos( aPos );
// BOOL bPosChanged = FALSE; // ob diese Zelle bewegt wurde
BOOL bIsInsert = FALSE;
@@ -706,10 +976,15 @@ void ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode,
// (InsertCells/DeleteCells - aPos is changed above) as well as when UpdateReference
// is called after moving the cells (MoveBlock/PasteFromClip - aOldPos is changed).
- ScFormulaCell* pFCell = new ScFormulaCell( pUndoDoc, aUndoPos,
- pOld, eTempGrammar, cMatrixFlag );
- pFCell->aResult.SetToken( NULL); // to recognize it as changed later (Cut/Paste!)
- pUndoDoc->PutCell( aUndoPos, pFCell );
+ // If there is already a formula cell in the undo document, don't overwrite it,
+ // the first (oldest) is the important cell.
+ if ( pUndoDoc->GetCellType( aUndoPos ) != CELLTYPE_FORMULA )
+ {
+ ScFormulaCell* pFCell = new ScFormulaCell( pUndoDoc, aUndoPos,
+ pOld, eTempGrammar, cMatrixFlag );
+ pFCell->aResult.SetToken( NULL); // to recognize it as changed later (Cut/Paste!)
+ pUndoDoc->PutCell( aUndoPos, pFCell );
+ }
}
bValChanged = FALSE;
if ( pRangeData )
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 68d378994c14..3238607fd613 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1272,11 +1272,14 @@ void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, BOOL bKee
{
int nCloneFlags = bCloneNoteCaptions ? SC_CLONECELL_DEFAULT : SC_CLONECELL_NOCAPTION;
rColumn.Resize( rColumn.GetCellCount() + nBlockCount );
- ScAddress aPos( rColumn.nCol, 0, rColumn.nTab );
+ ScAddress aOwnPos( nCol, 0, nTab );
+ ScAddress aDestPos( rColumn.nCol, 0, rColumn.nTab );
for (i = nStartIndex; i <= nEndIndex; i++)
{
- aPos.SetRow( pItems[i].nRow );
- rColumn.Append( aPos.Row(), pItems[i].pCell->CloneWithNote( *rColumn.pDocument, aPos, nCloneFlags ) );
+ aOwnPos.SetRow( pItems[i].nRow );
+ aDestPos.SetRow( pItems[i].nRow );
+ ScBaseCell* pNewCell = pItems[i].pCell->CloneWithNote( aOwnPos, *rColumn.pDocument, aDestPos, nCloneFlags );
+ rColumn.Append( aDestPos.Row(), pNewCell );
}
}
}
@@ -1376,16 +1379,18 @@ void ScColumn::UndoToColumn(SCROW nRow1, SCROW nRow2, USHORT nFlags, BOOL bMarke
void ScColumn::CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const
{
ScDocument& rDestDoc = *rDestCol.pDocument;
+ ScAddress aOwnPos( nCol, 0, nTab );
ScAddress aDestPos( rDestCol.nCol, 0, rDestCol.nTab );
SCSIZE nPosCount = rPosCol.nCount;
for (SCSIZE nPosIndex = 0; nPosIndex < nPosCount; nPosIndex++)
{
- aDestPos.SetRow( rPosCol.pItems[nPosIndex].nRow );
+ aOwnPos.SetRow( rPosCol.pItems[nPosIndex].nRow );
+ aDestPos.SetRow( aOwnPos.Row() );
SCSIZE nThisIndex;
if ( Search( aDestPos.Row(), nThisIndex ) )
{
- ScBaseCell* pNew = pItems[nThisIndex].pCell->CloneWithNote( rDestDoc, aDestPos );
+ ScBaseCell* pNew = pItems[nThisIndex].pCell->CloneWithNote( aOwnPos, rDestDoc, aDestPos );
rDestCol.Insert( aDestPos.Row(), pNew );
}
}
@@ -1673,7 +1678,10 @@ void ScColumn::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW
if( pCell->GetCellType() == CELLTYPE_FORMULA)
{
SCROW nRow = pItems[i].nRow;
- ((ScFormulaCell*)pCell)->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz, pUndoDoc );
+ // When deleting rows on several sheets, the formula's position may be updated with the first call,
+ // so the undo position must be passed from here.
+ ScAddress aUndoPos( nCol, nRow, nTab );
+ ((ScFormulaCell*)pCell)->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz, pUndoDoc, &aUndoPos );
if ( nRow != pItems[i].nRow )
Search( nRow, i ); // Listener removed/inserted?
}
@@ -2139,8 +2147,10 @@ BOOL ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const
while ( (nIndex < nCount) ? ((nRow=pItems[nIndex].nRow) <= nEndRow) : FALSE )
{
ScBaseCell* pCell = pItems[nIndex].pCell;
- if ( pCell->GetCellType() == CELLTYPE_EDIT ||
- IsAmbiguousScriptNonZero( pDocument->GetScriptType(nCol, nRow, nTab, pCell) ) )
+ CellType eCellType = pCell->GetCellType();
+ if ( eCellType == CELLTYPE_EDIT ||
+ IsAmbiguousScriptNonZero( pDocument->GetScriptType(nCol, nRow, nTab, pCell) ) ||
+ ((eCellType == CELLTYPE_FORMULA) && ((ScFormulaCell*)pCell)->IsMultilineResult()) )
{
rFirst = nRow;
return TRUE;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 97de46655741..a7a5ba39fc6a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -319,9 +319,12 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
}
BOOL bAddMargin = TRUE;
- BOOL bEditEngine = ( pCell->GetCellType() == CELLTYPE_EDIT ||
+ CellType eCellType = pCell->GetCellType();
+
+ BOOL bEditEngine = ( eCellType == CELLTYPE_EDIT ||
eOrient == SVX_ORIENTATION_STACKED ||
- IsAmbiguousScript( nScript ) );
+ IsAmbiguousScript( nScript ) ||
+ ((eCellType == CELLTYPE_FORMULA) && ((ScFormulaCell*)pCell)->IsMultilineResult()) );
if (!bEditEngine) // direkte Ausgabe
{
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 793229116fe2..5726862366cf 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -521,6 +521,15 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, USHORT nDelFla
for ( FormulaCellVector::iterator aIt = aDelCells.begin(), aEnd = aDelCells.end(); aIt != aEnd; ++aIt )
(*aIt)->EndListeningTo( pDocument );
+ // #i101869# if the note cell with the broadcaster was deleted in EndListening,
+ // forget the pointer to the broadcaster
+ for ( FormulaCellVector::iterator aIt = aDelCells.begin(), aEnd = aDelCells.end(); aIt != aEnd; ++aIt )
+ {
+ SCSIZE nIndex;
+ if ( !Search( (*aIt)->aPos.Row(), nIndex ) )
+ (*aIt)->ReleaseBroadcaster();
+ }
+
// broadcast SC_HINT_DYING for all cells and delete them
for ( FormulaCellVector::iterator aIt = aDelCells.begin(), aEnd = aDelCells.end(); aIt != aEnd; ++aIt )
{
@@ -739,6 +748,9 @@ void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
Resize( nNew );
}
+ // IDF_ADDNOTES must be passed without other content flags than IDF_NOTE
+ bool bAddNotes = (nInsFlag & (IDF_CONTENTS | IDF_ADDNOTES)) == (IDF_NOTE | IDF_ADDNOTES);
+
BOOL bAtEnd = FALSE;
for (SCSIZE i = 0; i < nColCount && !bAtEnd; i++)
{
@@ -751,12 +763,38 @@ void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
// nDestRow may be negative then
ScAddress aDestPos( nCol, (SCROW)nDestRow, nTab );
- ScBaseCell* pNew = bAsLink ?
- rColumn.CreateRefCell( pDocument, aDestPos, i, nInsFlag ) :
- rColumn.CloneCell( i, nInsFlag, *pDocument, aDestPos );
- if (pNew)
- Insert((SCROW)nDestRow, pNew);
+ /* #i102056# Paste from clipboard needs to paste the cell notes in
+ a second pass. This must not overwrite the existing cells
+ already copied to the destination position in the first pass.
+ To indicate this special case, the modifier IDF_ADDNOTES is
+ passed together with IDF_NOTE in nInsFlag. Of course, there is
+ still the need to create a new cell, if there is no cell at the
+ destination position at all. */
+ ScBaseCell* pAddNoteCell = bAddNotes ? GetCell( aDestPos.Row() ) : 0;
+ if (pAddNoteCell)
+ {
+ // do nothing if source cell does not contain a note
+ const ScBaseCell* pSourceCell = rColumn.pItems[i].pCell;
+ const ScPostIt* pSourceNote = pSourceCell ? pSourceCell->GetNote() : 0;
+ if (pSourceNote)
+ {
+ DBG_ASSERT( !pAddNoteCell->HasNote(), "ScColumn::CopyFromClip - unexpected note at destination cell" );
+ bool bCloneCaption = (nInsFlag & IDF_NOCAPTIONS) == 0;
+ // #i52342# if caption is cloned, the note must be constructed with the destination document
+ ScAddress aSourcePos( rColumn.nCol, rColumn.pItems[i].nRow, rColumn.nTab );
+ ScPostIt* pNewNote = pSourceNote->Clone( aSourcePos, *pDocument, aDestPos, bCloneCaption );
+ pAddNoteCell->TakeNote( pNewNote );
+ }
+ }
+ else
+ {
+ ScBaseCell* pNewCell = bAsLink ?
+ rColumn.CreateRefCell( pDocument, aDestPos, i, nInsFlag ) :
+ rColumn.CloneCell( i, nInsFlag, *pDocument, aDestPos );
+ if (pNewCell)
+ Insert( aDestPos.Row(), pNewCell );
+ }
}
}
}
@@ -846,7 +884,16 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestD
rForm.GetString( aString );
// #33224# do not clone empty string
if (aString.Len() > 0)
- pNew = new ScStringCell( aString );
+ {
+ if ( rForm.IsMultilineResult() )
+ {
+ pNew = new ScEditCell( aString, &rDestDoc );
+ }
+ else
+ {
+ pNew = new ScStringCell( aString );
+ }
+ }
}
}
break;
@@ -861,7 +908,8 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestD
{
bool bCloneCaption = (nFlags & IDF_NOCAPTIONS) == 0;
// #i52342# if caption is cloned, the note must be constructed with the destination document
- ScPostIt* pNewNote = ScNoteUtil::CloneNote( rDestDoc, rDestPos, *pNote, bCloneCaption );
+ ScAddress aOwnPos( nCol, pItems[nIndex].nRow, nTab );
+ ScPostIt* pNewNote = pNote->Clone( aOwnPos, rDestDoc, rDestPos, bCloneCaption );
if (!pNew)
pNew = new ScNoteCell( pNewNote );
else
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index b6b063002957..3c636d9049d4 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -130,7 +130,10 @@ ScConditionEntry::ScConditionEntry( const ScConditionEntry& r ) :
nVal2(r.nVal2),
aStrVal1(r.aStrVal1),
aStrVal2(r.aStrVal2),
- eTempGrammar(r.eTempGrammar),
+ aStrNmsp1(r.aStrNmsp1),
+ aStrNmsp2(r.aStrNmsp2),
+ eTempGrammar1(r.eTempGrammar1),
+ eTempGrammar2(r.eTempGrammar2),
bIsStr1(r.bIsStr1),
bIsStr2(r.bIsStr2),
pFormula1(NULL),
@@ -161,7 +164,10 @@ ScConditionEntry::ScConditionEntry( ScDocument* pDocument, const ScConditionEntr
nVal2(r.nVal2),
aStrVal1(r.aStrVal1),
aStrVal2(r.aStrVal2),
- eTempGrammar(r.eTempGrammar),
+ aStrNmsp1(r.aStrNmsp1),
+ aStrNmsp2(r.aStrNmsp2),
+ eTempGrammar1(r.eTempGrammar1),
+ eTempGrammar2(r.eTempGrammar2),
bIsStr1(r.bIsStr1),
bIsStr2(r.bIsStr2),
pFormula1(NULL),
@@ -187,14 +193,17 @@ ScConditionEntry::ScConditionEntry( ScDocument* pDocument, const ScConditionEntr
}
ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
- const String& rExpr1, const String& rExpr2,
- ScDocument* pDocument, const ScAddress& rPos,
- const FormulaGrammar::Grammar eGrammar ) :
+ const String& rExpr1, const String& rExpr2, ScDocument* pDocument, const ScAddress& rPos,
+ const String& rExprNmsp1, const String& rExprNmsp2,
+ FormulaGrammar::Grammar eGrammar1, FormulaGrammar::Grammar eGrammar2 ) :
eOp(eOper),
nOptions(0), // spaeter...
nVal1(0.0),
nVal2(0.0),
- eTempGrammar(eGrammar),
+ aStrNmsp1(rExprNmsp1),
+ aStrNmsp2(rExprNmsp2),
+ eTempGrammar1(eGrammar1),
+ eTempGrammar2(eGrammar2),
bIsStr1(FALSE),
bIsStr2(FALSE),
pFormula1(NULL),
@@ -207,7 +216,7 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
bRelRef2(FALSE),
bFirstRun(TRUE)
{
- Compile( rExpr1, rExpr2, eGrammar, FALSE );
+ Compile( rExpr1, rExpr2, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2, FALSE );
// Formelzellen werden erst bei IsValid angelegt
}
@@ -219,7 +228,8 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
nOptions(0), // spaeter...
nVal1(0.0),
nVal2(0.0),
- eTempGrammar(FormulaGrammar::GRAM_DEFAULT),
+ eTempGrammar1(FormulaGrammar::GRAM_DEFAULT),
+ eTempGrammar2(FormulaGrammar::GRAM_DEFAULT),
bIsStr1(FALSE),
bIsStr2(FALSE),
pFormula1(NULL),
@@ -294,15 +304,16 @@ ScConditionEntry::~ScConditionEntry()
}
void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2,
- const FormulaGrammar::Grammar eGrammar, BOOL bTextToReal )
+ const String& rExprNmsp1, const String& rExprNmsp2,
+ FormulaGrammar::Grammar eGrammar1, FormulaGrammar::Grammar eGrammar2, BOOL bTextToReal )
{
if ( rExpr1.Len() || rExpr2.Len() )
{
ScCompiler aComp( pDoc, aSrcPos );
- aComp.SetGrammar(eGrammar);
if ( rExpr1.Len() )
{
+ aComp.SetGrammar( eGrammar1 );
if ( pDoc->IsImportingXML() && !bTextToReal )
{
// temporary formula string as string tokens
@@ -313,7 +324,7 @@ void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2,
}
else
{
- pFormula1 = aComp.CompileString( rExpr1 );
+ pFormula1 = aComp.CompileString( rExpr1, rExprNmsp1 );
if ( pFormula1->GetLen() == 1 )
{
// einzelne (konstante Zahl) ?
@@ -339,6 +350,7 @@ void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2,
if ( rExpr2.Len() )
{
+ aComp.SetGrammar( eGrammar2 );
if ( pDoc->IsImportingXML() && !bTextToReal )
{
// temporary formula string as string tokens
@@ -349,7 +361,7 @@ void ScConditionEntry::Compile( const String& rExpr1, const String& rExpr2,
}
else
{
- pFormula2 = aComp.CompileString( rExpr2 );
+ pFormula2 = aComp.CompileString( rExpr2, rExprNmsp2 );
if ( pFormula2->GetLen() == 1 )
{
// einzelne (konstante Zahl) ?
@@ -429,9 +441,9 @@ void ScConditionEntry::CompileXML()
// Convert the text tokens that were created during XML import into real tokens.
- Compile( GetExpression(aSrcPos, 0, 0, eTempGrammar),
- GetExpression(aSrcPos, 1, 0, eTempGrammar),
- eTempGrammar, TRUE );
+ Compile( GetExpression(aSrcPos, 0, 0, eTempGrammar1),
+ GetExpression(aSrcPos, 1, 0, eTempGrammar2),
+ aStrNmsp1, aStrNmsp2, eTempGrammar1, eTempGrammar2, TRUE );
}
void ScConditionEntry::SetSrcString( const String& rNew )
@@ -1129,8 +1141,10 @@ ScCondFormatEntry::ScCondFormatEntry( ScConditionMode eOper,
const String& rExpr1, const String& rExpr2,
ScDocument* pDocument, const ScAddress& rPos,
const String& rStyle,
- const FormulaGrammar::Grammar eGrammar ) :
- ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, eGrammar ),
+ const String& rExprNmsp1, const String& rExprNmsp2,
+ FormulaGrammar::Grammar eGrammar1,
+ FormulaGrammar::Grammar eGrammar2 ) :
+ ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2 ),
aStyleName( rStyle ),
pParent( NULL )
{
@@ -1455,6 +1469,13 @@ void ScConditionalFormat::UpdateReference( UpdateRefMode eUpdateRefMode,
pAreas = NULL;
}
+void ScConditionalFormat::RenameCellStyle(const String& rOld, const String& rNew)
+{
+ for (USHORT i=0; i<nEntryCount; i++)
+ if ( ppEntries[i]->GetStyle() == rOld )
+ ppEntries[i]->UpdateStyleName( rNew );
+}
+
void ScConditionalFormat::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos )
{
for (USHORT i=0; i<nEntryCount; i++)
@@ -1561,6 +1582,13 @@ void ScConditionalFormatList::UpdateReference( UpdateRefMode eUpdateRefMode,
(*this)[i]->UpdateReference( eUpdateRefMode, rRange, nDx, nDy, nDz );
}
+void ScConditionalFormatList::RenameCellStyle( const String& rOld, const String& rNew )
+{
+ ULONG nCount=Count();
+ for (USHORT i=0; i<nCount; i++)
+ (*this)[i]->RenameCellStyle(rOld,rNew);
+}
+
void ScConditionalFormatList::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos )
{
USHORT nCount = Count();
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 1ef50cf30fd7..16613fbcbab4 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -94,6 +94,8 @@
#include "recursionhelper.hxx"
#include "lookupcache.hxx"
#include "externalrefmgr.hxx"
+#include "tabprotection.hxx"
+#include "formulaparserpool.hxx"
// pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
// dtor plus helpers are convenient.
@@ -124,6 +126,7 @@ private:
ScDocument::ScDocument( ScDocumentMode eMode,
SfxObjectShell* pDocShell ) :
xServiceManager( ::comphelper::getProcessServiceFactory() ),
+ mpUndoManager( NULL ),
pEditEngine( NULL ),
pNoteEngine( NULL ),
pNoteItemPool( NULL ),
@@ -151,7 +154,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
pChangeViewSettings( NULL ),
pScriptTypeData( NULL ),
pCacheFieldEditEngine( NULL ),
- pExternalRefMgr( NULL ),
+ pDocProtection( NULL ),
pViewOptions( NULL ),
pDocOptions( NULL ),
pExtDocOptions( NULL ),
@@ -174,7 +177,6 @@ ScDocument::ScDocument( ScDocumentMode eMode,
nHardRecalcState(0),
nVisibleTab( 0 ),
eLinkMode(LM_UNKNOWN),
- bProtected( FALSE ),
bAutoCalc( eMode == SCDOCMODE_DOCUMENT ),
bAutoCalcShellDisabled( FALSE ),
bForcedFormulaPending( FALSE ),
@@ -211,7 +213,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
bInUnoListenerCall( FALSE ),
eGrammar( formula::FormulaGrammar::GRAM_NATIVE ),
bStyleSheetUsageInvalid( TRUE ),
- bUndoEnabled( TRUE ),
+ mbUndoEnabled( true ),
mbAdjustHeightEnabled( true ),
mbExecuteLinkEnabled( true ),
mbChangeReadOnlyEnabled( false ),
@@ -382,15 +384,14 @@ ScDocument::~ScDocument()
pLinkManager->Remove( 0, pLinkManager->GetLinks().Count() );
}
- if (pExternalRefMgr.get())
- // Destroy the external ref mgr instance here because it has a timer
- // which needs to be stopped before the app closes.
- pExternalRefMgr.reset(NULL);
+ mxFormulaParserPool.reset();
+ // Destroy the external ref mgr instance here because it has a timer
+ // which needs to be stopped before the app closes.
+ pExternalRefMgr.reset();
ScAddInAsync::RemoveDocument( this );
ScAddInListener::RemoveDocument( this );
- delete pChartListenerCollection; // vor pBASM wg. evtl. Listener!
- pChartListenerCollection = NULL;
+ DELETEZ( pChartListenerCollection); // vor pBASM wg. evtl. Listener!
DELETEZ( pLookupCacheMapImpl); // before pBASM because of listeners
// BroadcastAreas vor allen Zellen zerstoeren um unnoetige
// Einzel-EndListenings der Formelzellen zu vermeiden
@@ -930,6 +931,7 @@ BOOL ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
DrawCopyPage( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos) );
pTab[nNewPos]->SetPageStyle( pTab[nOldPos]->GetPageStyle() );
+ pTab[nNewPos]->SetPendingRowHeights( pTab[nOldPos]->IsPendingRowHeights() );
// Update cells containing external references.
if (pExternalRefMgr.get())
@@ -1108,6 +1110,8 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
if (bInsertNew)
TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
+
+ pTab[nDestPos]->SetPendingRowHeights( pSrcDoc->pTab[nSrcPos]->IsPendingRowHeights() );
}
if (!bValid)
nRetVal = 0;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 2b3fbb359988..08170fd6cdc9 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -40,6 +40,7 @@
#include <sfx2/bindings.hxx>
#include <sfx2/objsh.hxx>
#include <svtools/zforlist.hxx>
+#include <svtools/PasswordHelper.hxx>
#include <vcl/svapp.hxx>
#include "document.hxx"
#include "attrib.hxx"
@@ -77,6 +78,8 @@
#include "drwlayer.hxx"
#include "unoreflist.hxx"
#include "listenercalls.hxx"
+#include "tabprotection.hxx"
+#include "formulaparserpool.hxx"
#include <memory>
@@ -507,6 +510,13 @@ void ScDocument::MarkUsedExternalReferences()
* collecting them during export. */
}
+ScFormulaParserPool& ScDocument::GetFormulaParserPool() const
+{
+ if( !mxFormulaParserPool.get() )
+ mxFormulaParserPool.reset( new ScFormulaParserPool( *this ) );
+ return *mxFormulaParserPool;
+}
+
ScOutlineTable* ScDocument::GetOutlineTable( SCTAB nTab, BOOL bCreate )
{
ScOutlineTable* pVal = NULL;
@@ -1701,28 +1711,28 @@ void ScDocument::SnapVisArea( Rectangle& rRect ) const
ScDrawLayer::MirrorRectRTL( rRect ); // back to real rectangle
}
-void ScDocument::SetDocProtection( BOOL bProtect, const uno::Sequence<sal_Int8>& rPasswd )
+ScDocProtection* ScDocument::GetDocProtection() const
{
- bProtected = bProtect;
- aProtectPass = rPasswd;
+ return pDocProtection.get();
}
-void ScDocument::SetTabProtection( SCTAB nTab, BOOL bProtect, const uno::Sequence<sal_Int8>& rPasswd )
+void ScDocument::SetDocProtection(const ScDocProtection* pProtect)
{
- if (VALIDTAB(nTab))
- if (pTab[nTab])
- pTab[nTab]->SetProtection( bProtect, rPasswd );
+ if (pProtect)
+ pDocProtection.reset(new ScDocProtection(*pProtect));
+ else
+ pDocProtection.reset(NULL);
}
BOOL ScDocument::IsDocProtected() const
{
- return bProtected;
+ return pDocProtection.get() && pDocProtection->isProtected();
}
BOOL ScDocument::IsDocEditable() const
{
// import into read-only document is possible
- return !bProtected && ( bImportingXML || mbChangeReadOnlyEnabled || !pShell || !pShell->IsReadOnly() );
+ return !IsDocProtected() && ( bImportingXML || mbChangeReadOnlyEnabled || !pShell || !pShell->IsReadOnly() );
}
BOOL ScDocument::IsTabProtected( SCTAB nTab ) const
@@ -1734,18 +1744,28 @@ BOOL ScDocument::IsTabProtected( SCTAB nTab ) const
return FALSE;
}
-const uno::Sequence<sal_Int8>& ScDocument::GetDocPassword() const
+ScTableProtection* ScDocument::GetTabProtection( SCTAB nTab ) const
{
- return aProtectPass;
+ if (VALIDTAB(nTab) && pTab[nTab])
+ return pTab[nTab]->GetProtection();
+
+ return NULL;
}
-const uno::Sequence<sal_Int8>& ScDocument::GetTabPassword( SCTAB nTab ) const
+void ScDocument::SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect)
{
- if (VALIDTAB(nTab) && pTab[nTab])
- return pTab[nTab]->GetPassword();
+ if (!ValidTab(nTab))
+ return;
- DBG_ERROR("Falsche Tabellennummer");
- return aProtectPass;
+ pTab[nTab]->SetProtection(pProtect);
+}
+
+void ScDocument::CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest)
+{
+ if (!ValidTab(nTabSrc) || !ValidTab(nTabDest))
+ return;
+
+ pTab[nTabDest]->SetProtection( pTab[nTabSrc]->GetProtection() );
}
const ScDocOptions& ScDocument::GetDocOptions() const
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 3c72baff5ba4..7313ebbf83f5 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -311,9 +311,16 @@ bool ScDocument::MarkUsedExternalReferences( ScTokenArray & rArr )
switch (t->GetType())
{
case svExternalSingleRef:
- case svExternalDoubleRef:
bAllMarked = pRefMgr->setCacheTableReferenced(
- t->GetIndex(), t->GetString());
+ t->GetIndex(), t->GetString(), 1);
+ break;
+ case svExternalDoubleRef:
+ {
+ const ScComplexRefData& rRef = t->GetDoubleRef();
+ size_t nSheets = rRef.Ref2.nTab - rRef.Ref1.nTab + 1;
+ bAllMarked = pRefMgr->setCacheTableReferenced(
+ t->GetIndex(), t->GetString(), nSheets);
+ }
break;
case svExternalName:
/* TODO: external names aren't supported yet, but would
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 8d528db34118..0be1e6717891 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -130,6 +130,7 @@ void lcl_SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartD
if( xLabel.is())
{
+ // the range string must be in Calc A1 format.
uno::Reference< chart2::data::XDataSequence > xNewSeq(
xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
@@ -145,6 +146,7 @@ void lcl_SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartD
if( xValues.is())
{
+ // the range string must be in Calc A1 format.
uno::Reference< chart2::data::XDataSequence > xNewSeq(
xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
@@ -391,7 +393,7 @@ void ScDocument::GetChartRanges( const String& rChartName, ::std::vector< ScRang
for( sal_Int32 nN=0; nN<aRangeStrings.getLength(); nN++ )
{
ScRangeList aRanges;
- aRanges.Parse( aRangeStrings[nN], pSheetNameDoc );
+ aRanges.Parse( aRangeStrings[nN], pSheetNameDoc, SCA_VALID, pSheetNameDoc->GetAddressConvention() );
rRangesVector.push_back(aRanges);
}
}
@@ -407,8 +409,8 @@ void ScDocument::SetChartRanges( const String& rChartName, const ::std::vector<
for( sal_Int32 nN=0; nN<nCount; nN++ )
{
ScRangeList aScRangeList( rRangesVector[nN] );
- String sRangeStr;
- aScRangeList.Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() );
+ String sRangeStr; // This range must be in Calc A1 format.
+ aScRangeList.Format( sRangeStr, SCR_ABS_3D, this );
aRangeStrings[nN]=sRangeStr;
}
lcl_SetChartRanges( xChartDoc, aRangeStrings );
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 0d12c82dec87..c34e93f10d66 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -44,6 +44,7 @@
#include <svx/linkmgr.hxx>
#include <svx/scripttypeitem.hxx>
#include <svx/unolingu.hxx>
+#include <sfx2/bindings.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/viewfrm.hxx>
@@ -1046,6 +1047,18 @@ void ScDocument::UpdateExternalRefLinks()
TrackFormulas();
pShell->Broadcast( SfxSimpleHint(FID_DATACHANGED) );
ResetChanged( ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB) );
+
+ // #i101960# set document modified, as in TrackTimeHdl for DDE links
+ if (!pShell->IsModified())
+ {
+ pShell->SetModified( TRUE );
+ SfxBindings* pBindings = GetViewBindings();
+ if (pBindings)
+ {
+ pBindings->Invalidate( SID_SAVEDOC );
+ pBindings->Invalidate( SID_DOC_MODIFIED );
+ }
+ }
}
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9cf0151896d3..f80d1c85bb9b 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -93,6 +93,7 @@
#include "bcaslot.hxx"
#include "postit.hxx"
#include "externalrefmgr.hxx"
+#include "tabprotection.hxx"
namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
@@ -358,6 +359,10 @@ BOOL ScDocument::InsertTab( SCTAB nPos, const String& rName,
pTab[nPos]->SetCodeName( rName );
++nMaxTableNumber;
+ // UpdateBroadcastAreas must be called between UpdateInsertTab,
+ // which ends listening, and StartAllListeners, to not modify
+ // areas that are to be inserted by starting listeners.
+ UpdateBroadcastAreas( URM_INSDEL, aRange, 0,0,1);
for (i = 0; i <= MAXTAB; i++)
if (pTab[i])
pTab[i]->UpdateCompile();
@@ -452,6 +457,10 @@ BOOL ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc )
pTab[i - 1] = pTab[i];
pTab[nTabCount - 1] = NULL;
--nMaxTableNumber;
+ // UpdateBroadcastAreas must be called between UpdateDeleteTab,
+ // which ends listening, and StartAllListeners, to not modify
+ // areas that are to be inserted by starting listeners.
+ UpdateBroadcastAreas( URM_INSDEL, aRange, 0,0,-1);
for (i = 0; i <= MAXTAB; i++)
if (pTab[i])
pTab[i]->UpdateCompile();
@@ -531,6 +540,22 @@ BOOL ScDocument::IsVisible( SCTAB nTab ) const
}
+BOOL ScDocument::IsPendingRowHeights( SCTAB nTab ) const
+{
+ if ( ValidTab(nTab) && pTab[nTab] )
+ return pTab[nTab]->IsPendingRowHeights();
+
+ return FALSE;
+}
+
+
+void ScDocument::SetPendingRowHeights( SCTAB nTab, BOOL bSet )
+{
+ if ( ValidTab(nTab) && pTab[nTab] )
+ pTab[nTab]->SetPendingRowHeights( bSet );
+}
+
+
void ScDocument::SetLayoutRTL( SCTAB nTab, BOOL bRTL )
{
if ( ValidTab(nTab) && pTab[nTab] )
@@ -682,6 +707,43 @@ void ScDocument::LimitChartIfAll( ScRangeListRef& rRangeList )
}
+void lcl_GetFirstTabRange( SCTAB& rTabRangeStart, SCTAB& rTabRangeEnd, const ScMarkData* pTabMark )
+{
+ // without ScMarkData, leave start/end unchanged
+ if ( pTabMark )
+ {
+ for (SCTAB nTab=0; nTab<=MAXTAB; ++nTab)
+ if (pTabMark->GetTableSelect(nTab))
+ {
+ // find first range of consecutive selected sheets
+ rTabRangeStart = nTab;
+ while ( nTab+1 <= MAXTAB && pTabMark->GetTableSelect(nTab+1) )
+ ++nTab;
+ rTabRangeEnd = nTab;
+ return;
+ }
+ }
+}
+
+bool lcl_GetNextTabRange( SCTAB& rTabRangeStart, SCTAB& rTabRangeEnd, const ScMarkData* pTabMark )
+{
+ if ( pTabMark )
+ {
+ // find next range of consecutive selected sheets after rTabRangeEnd
+ for (SCTAB nTab=rTabRangeEnd+1; nTab<=MAXTAB; ++nTab)
+ if (pTabMark->GetTableSelect(nTab))
+ {
+ rTabRangeStart = nTab;
+ while ( nTab+1 <= MAXTAB && pTabMark->GetTableSelect(nTab+1) )
+ ++nTab;
+ rTabRangeEnd = nTab;
+ return true;
+ }
+ }
+ return false;
+}
+
+
BOOL ScDocument::CanInsertRow( const ScRange& rRange ) const
{
SCCOL nStartCol = rRange.aStart.Col();
@@ -706,39 +768,60 @@ BOOL ScDocument::CanInsertRow( const ScRange& rRange ) const
BOOL ScDocument::InsertRow( SCCOL nStartCol, SCTAB nStartTab,
SCCOL nEndCol, SCTAB nEndTab,
- SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc )
+ SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc,
+ const ScMarkData* pTabMark )
{
SCTAB i;
PutInOrder( nStartCol, nEndCol );
PutInOrder( nStartTab, nEndTab );
+ if ( pTabMark )
+ {
+ nStartTab = 0;
+ nEndTab = MAXTAB;
+ }
BOOL bTest = TRUE;
BOOL bRet = FALSE;
BOOL bOldAutoCalc = GetAutoCalc();
SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
for ( i = nStartTab; i <= nEndTab && bTest; i++)
- if (pTab[i])
+ if (pTab[i] && (!pTabMark || pTabMark->GetTableSelect(i)))
bTest &= pTab[i]->TestInsertRow( nStartCol, nEndCol, nSize );
if (bTest)
{
// UpdateBroadcastAreas muss vor UpdateReference gerufen werden, damit nicht
// Eintraege verschoben werden, die erst bei UpdateReference neu erzeugt werden
- UpdateBroadcastAreas( URM_INSDEL, ScRange(
- ScAddress( nStartCol, nStartRow, nStartTab ),
- ScAddress( nEndCol, MAXROW, nEndTab )), 0, static_cast<SCsROW>(nSize), 0 );
- UpdateReference( URM_INSDEL, nStartCol, nStartRow, nStartTab,
- nEndCol, MAXROW, nEndTab,
- 0, static_cast<SCsROW>(nSize), 0, pRefUndoDoc, FALSE ); // without drawing objects
+ // handle chunks of consecutive selected sheets together
+ SCTAB nTabRangeStart = nStartTab;
+ SCTAB nTabRangeEnd = nEndTab;
+ lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark );
+ do
+ {
+ UpdateBroadcastAreas( URM_INSDEL, ScRange(
+ ScAddress( nStartCol, nStartRow, nTabRangeStart ),
+ ScAddress( nEndCol, MAXROW, nTabRangeEnd )), 0, static_cast<SCsROW>(nSize), 0 );
+ }
+ while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) );
+
+ lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark );
+ do
+ {
+ UpdateReference( URM_INSDEL, nStartCol, nStartRow, nTabRangeStart,
+ nEndCol, MAXROW, nTabRangeEnd,
+ 0, static_cast<SCsROW>(nSize), 0, pRefUndoDoc, FALSE ); // without drawing objects
+ }
+ while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) );
+
for (i=nStartTab; i<=nEndTab; i++)
- if (pTab[i])
+ if (pTab[i] && (!pTabMark || pTabMark->GetTableSelect(i)))
pTab[i]->InsertRow( nStartCol, nEndCol, nStartRow, nSize );
// #82991# UpdateRef for drawing layer must be after inserting,
// when the new row heights are known.
for (i=nStartTab; i<=nEndTab; i++)
- if (pTab[i])
+ if (pTab[i] && (!pTabMark || pTabMark->GetTableSelect(i)))
pTab[i]->UpdateDrawRef( URM_INSDEL,
nStartCol, nStartRow, nStartTab, nEndCol, MAXROW, nEndTab,
0, static_cast<SCsROW>(nSize), 0 );
@@ -781,42 +864,61 @@ BOOL ScDocument::InsertRow( const ScRange& rRange, ScDocument* pRefUndoDoc )
void ScDocument::DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
SCCOL nEndCol, SCTAB nEndTab,
SCROW nStartRow, SCSIZE nSize,
- ScDocument* pRefUndoDoc, BOOL* pUndoOutline )
+ ScDocument* pRefUndoDoc, BOOL* pUndoOutline,
+ const ScMarkData* pTabMark )
{
SCTAB i;
PutInOrder( nStartCol, nEndCol );
PutInOrder( nStartTab, nEndTab );
+ if ( pTabMark )
+ {
+ nStartTab = 0;
+ nEndTab = MAXTAB;
+ }
BOOL bOldAutoCalc = GetAutoCalc();
SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
- if ( ValidRow(nStartRow+nSize) )
+ // handle chunks of consecutive selected sheets together
+ SCTAB nTabRangeStart = nStartTab;
+ SCTAB nTabRangeEnd = nEndTab;
+ lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark );
+ do
{
- DelBroadcastAreasInRange( ScRange(
- ScAddress( nStartCol, nStartRow, nStartTab ),
- ScAddress( nEndCol, nStartRow+nSize-1, nEndTab ) ) );
- UpdateBroadcastAreas( URM_INSDEL, ScRange(
- ScAddress( nStartCol, nStartRow+nSize, nStartTab ),
- ScAddress( nEndCol, MAXROW, nEndTab )), 0, -(static_cast<SCsROW>(nSize)), 0 );
+ if ( ValidRow(nStartRow+nSize) )
+ {
+ DelBroadcastAreasInRange( ScRange(
+ ScAddress( nStartCol, nStartRow, nTabRangeStart ),
+ ScAddress( nEndCol, nStartRow+nSize-1, nTabRangeEnd ) ) );
+ UpdateBroadcastAreas( URM_INSDEL, ScRange(
+ ScAddress( nStartCol, nStartRow+nSize, nTabRangeStart ),
+ ScAddress( nEndCol, MAXROW, nTabRangeEnd )), 0, -(static_cast<SCsROW>(nSize)), 0 );
+ }
+ else
+ DelBroadcastAreasInRange( ScRange(
+ ScAddress( nStartCol, nStartRow, nTabRangeStart ),
+ ScAddress( nEndCol, MAXROW, nTabRangeEnd ) ) );
}
- else
- DelBroadcastAreasInRange( ScRange(
- ScAddress( nStartCol, nStartRow, nStartTab ),
- ScAddress( nEndCol, MAXROW, nEndTab ) ) );
+ while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) );
if ( ValidRow(nStartRow+nSize) )
{
- UpdateReference( URM_INSDEL, nStartCol, nStartRow+nSize, nStartTab,
- nEndCol, MAXROW, nEndTab,
- 0, -(static_cast<SCsROW>(nSize)), 0, pRefUndoDoc );
+ lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark );
+ do
+ {
+ UpdateReference( URM_INSDEL, nStartCol, nStartRow+nSize, nTabRangeStart,
+ nEndCol, MAXROW, nTabRangeEnd,
+ 0, -(static_cast<SCsROW>(nSize)), 0, pRefUndoDoc );
+ }
+ while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) );
}
if (pUndoOutline)
*pUndoOutline = FALSE;
for ( i = nStartTab; i <= nEndTab; i++)
- if (pTab[i])
+ if (pTab[i] && (!pTabMark || pTabMark->GetTableSelect(i)))
pTab[i]->DeleteRow( nStartCol, nEndCol, nStartRow, nSize, pUndoOutline );
if ( ValidRow(nStartRow+nSize) )
@@ -869,30 +971,51 @@ BOOL ScDocument::CanInsertCol( const ScRange& rRange ) const
BOOL ScDocument::InsertCol( SCROW nStartRow, SCTAB nStartTab,
SCROW nEndRow, SCTAB nEndTab,
- SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc )
+ SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc,
+ const ScMarkData* pTabMark )
{
SCTAB i;
PutInOrder( nStartRow, nEndRow );
PutInOrder( nStartTab, nEndTab );
+ if ( pTabMark )
+ {
+ nStartTab = 0;
+ nEndTab = MAXTAB;
+ }
BOOL bTest = TRUE;
BOOL bRet = FALSE;
BOOL bOldAutoCalc = GetAutoCalc();
SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
for ( i = nStartTab; i <= nEndTab && bTest; i++)
- if (pTab[i])
+ if (pTab[i] && (!pTabMark || pTabMark->GetTableSelect(i)))
bTest &= pTab[i]->TestInsertCol( nStartRow, nEndRow, nSize );
if (bTest)
{
- UpdateBroadcastAreas( URM_INSDEL, ScRange(
- ScAddress( nStartCol, nStartRow, nStartTab ),
- ScAddress( MAXCOL, nEndRow, nEndTab )), static_cast<SCsCOL>(nSize), 0, 0 );
- UpdateReference( URM_INSDEL, nStartCol, nStartRow, nStartTab,
- MAXCOL, nEndRow, nEndTab,
- static_cast<SCsCOL>(nSize), 0, 0, pRefUndoDoc );
+ // handle chunks of consecutive selected sheets together
+ SCTAB nTabRangeStart = nStartTab;
+ SCTAB nTabRangeEnd = nEndTab;
+ lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark );
+ do
+ {
+ UpdateBroadcastAreas( URM_INSDEL, ScRange(
+ ScAddress( nStartCol, nStartRow, nTabRangeStart ),
+ ScAddress( MAXCOL, nEndRow, nTabRangeEnd )), static_cast<SCsCOL>(nSize), 0, 0 );
+ }
+ while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) );
+
+ lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark );
+ do
+ {
+ UpdateReference( URM_INSDEL, nStartCol, nStartRow, nTabRangeStart,
+ MAXCOL, nEndRow, nTabRangeEnd,
+ static_cast<SCsCOL>(nSize), 0, 0, pRefUndoDoc );
+ }
+ while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) );
+
for (i=nStartTab; i<=nEndTab; i++)
- if (pTab[i])
+ if (pTab[i] && (!pTabMark || pTabMark->GetTableSelect(i)))
pTab[i]->InsertCol( nStartCol, nStartRow, nEndRow, nSize );
if ( pChangeTrack && pChangeTrack->IsInDeleteUndo() )
@@ -932,42 +1055,60 @@ BOOL ScDocument::InsertCol( const ScRange& rRange, ScDocument* pRefUndoDoc )
void ScDocument::DeleteCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab,
SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc,
- BOOL* pUndoOutline )
+ BOOL* pUndoOutline, const ScMarkData* pTabMark )
{
SCTAB i;
PutInOrder( nStartRow, nEndRow );
PutInOrder( nStartTab, nEndTab );
+ if ( pTabMark )
+ {
+ nStartTab = 0;
+ nEndTab = MAXTAB;
+ }
BOOL bOldAutoCalc = GetAutoCalc();
SetAutoCalc( FALSE ); // Mehrfachberechnungen vermeiden
- if ( ValidCol(sal::static_int_cast<SCCOL>(nStartCol+nSize)) )
+ // handle chunks of consecutive selected sheets together
+ SCTAB nTabRangeStart = nStartTab;
+ SCTAB nTabRangeEnd = nEndTab;
+ lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark );
+ do
{
- DelBroadcastAreasInRange( ScRange(
- ScAddress( nStartCol, nStartRow, nStartTab ),
- ScAddress( sal::static_int_cast<SCCOL>(nStartCol+nSize-1), nEndRow, nEndTab ) ) );
- UpdateBroadcastAreas( URM_INSDEL, ScRange(
- ScAddress( sal::static_int_cast<SCCOL>(nStartCol+nSize), nStartRow, nStartTab ),
- ScAddress( MAXCOL, nEndRow, nEndTab )), -static_cast<SCsCOL>(nSize), 0, 0 );
+ if ( ValidCol(sal::static_int_cast<SCCOL>(nStartCol+nSize)) )
+ {
+ DelBroadcastAreasInRange( ScRange(
+ ScAddress( nStartCol, nStartRow, nTabRangeStart ),
+ ScAddress( sal::static_int_cast<SCCOL>(nStartCol+nSize-1), nEndRow, nTabRangeEnd ) ) );
+ UpdateBroadcastAreas( URM_INSDEL, ScRange(
+ ScAddress( sal::static_int_cast<SCCOL>(nStartCol+nSize), nStartRow, nTabRangeStart ),
+ ScAddress( MAXCOL, nEndRow, nTabRangeEnd )), -static_cast<SCsCOL>(nSize), 0, 0 );
+ }
+ else
+ DelBroadcastAreasInRange( ScRange(
+ ScAddress( nStartCol, nStartRow, nTabRangeStart ),
+ ScAddress( MAXCOL, nEndRow, nTabRangeEnd ) ) );
}
- else
- DelBroadcastAreasInRange( ScRange(
- ScAddress( nStartCol, nStartRow, nStartTab ),
- ScAddress( MAXCOL, nEndRow, nEndTab ) ) );
+ while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) );
if ( ValidCol(sal::static_int_cast<SCCOL>(nStartCol+nSize)) )
{
- UpdateReference( URM_INSDEL, sal::static_int_cast<SCCOL>(nStartCol+nSize), nStartRow, nStartTab,
- MAXCOL, nEndRow, nEndTab,
- -static_cast<SCsCOL>(nSize), 0, 0, pRefUndoDoc );
+ lcl_GetFirstTabRange( nTabRangeStart, nTabRangeEnd, pTabMark );
+ do
+ {
+ UpdateReference( URM_INSDEL, sal::static_int_cast<SCCOL>(nStartCol+nSize), nStartRow, nTabRangeStart,
+ MAXCOL, nEndRow, nTabRangeEnd,
+ -static_cast<SCsCOL>(nSize), 0, 0, pRefUndoDoc );
+ }
+ while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) );
}
if (pUndoOutline)
*pUndoOutline = FALSE;
for ( i = nStartTab; i <= nEndTab; i++)
- if (pTab[i])
+ if (pTab[i] && (!pTabMark || pTabMark->GetTableSelect(i)))
pTab[i]->DeleteCol( nStartCol, nStartRow, nEndRow, nSize, pUndoOutline );
if ( ValidCol(sal::static_int_cast<SCCOL>(nStartCol+nSize)) )
@@ -1806,9 +1947,17 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
nXw = sal::static_int_cast<SCCOL>( nXw + nDestAddX );
nYw = sal::static_int_cast<SCROW>( nYw + nDestAddY ); // ClipArea, plus ExtendMerge value
- // Inhalte entweder komplett oder gar nicht loeschen:
+ /* Decide which contents to delete before copying. Delete all
+ contents if nInsFlag contains any real content flag.
+ #i102056# Notes are pasted from clipboard in a second pass,
+ together with the special flag IDF_ADDNOTES that states to not
+ overwrite/delete existing cells but to insert the notes into
+ these cells. In this case, just delete old notes from the
+ destination area. */
USHORT nDelFlag = IDF_NONE;
- if ( nInsFlag & IDF_CONTENTS )
+ if ( (nInsFlag & (IDF_CONTENTS | IDF_ADDNOTES)) == (IDF_NOTE | IDF_ADDNOTES) )
+ nDelFlag |= IDF_NOTE;
+ else if ( nInsFlag & IDF_CONTENTS )
nDelFlag |= IDF_CONTENTS;
// With bSkipAttrForEmpty, don't remove attributes, copy
// on top of existing attributes instead.
@@ -2368,7 +2517,7 @@ void ScDocument::GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
ScBaseCell* ScDocument::GetCell( const ScAddress& rPos ) const
{
SCTAB nTab = rPos.Tab();
- if ( pTab[nTab] )
+ if (ValidTab(nTab) && pTab[nTab])
return pTab[nTab]->GetCell( rPos );
DBG_ERROR("GetCell ohne Tabelle");
@@ -2468,6 +2617,18 @@ void ScDocument::DeleteNote( const ScAddress& rPos )
}
+void ScDocument::InitializeNoteCaptions( SCTAB nTab, bool bForced )
+{
+ if( ValidTab( nTab ) && pTab[ nTab ] )
+ pTab[ nTab ]->InitializeNoteCaptions( bForced );
+}
+
+void ScDocument::InitializeAllNoteCaptions( bool bForced )
+{
+ for( SCTAB nTab = 0; nTab < GetTableCount(); ++nTab )
+ InitializeNoteCaptions( nTab, bForced );
+}
+
void ScDocument::SetDirty()
{
BOOL bOldAutoCalc = GetAutoCalc();
@@ -2833,14 +2994,20 @@ BOOL ScDocument::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, U
void ScDocument::UpdateAllRowHeights( OutputDevice* pDev, double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY )
+ const Fraction& rZoomX, const Fraction& rZoomY, const ScMarkData* pTabMark )
{
- // one progress across all sheets
- ScProgress aProgress( GetDocumentShell(), ScGlobal::GetRscString(STR_PROGRESS_HEIGHTING), GetWeightedCount() );
+ // one progress across all (selected) sheets
+
+ ULONG nCellCount = 0;
+ for ( SCTAB nTab=0; nTab<=MAXTAB; nTab++ )
+ if ( pTab[nTab] && ( !pTabMark || pTabMark->GetTableSelect(nTab) ) )
+ nCellCount += pTab[nTab]->GetWeightedCount();
+
+ ScProgress aProgress( GetDocumentShell(), ScGlobal::GetRscString(STR_PROGRESS_HEIGHTING), nCellCount );
ULONG nProgressStart = 0;
for ( SCTAB nTab=0; nTab<=MAXTAB; nTab++ )
- if ( pTab[nTab] )
+ if ( pTab[nTab] && ( !pTabMark || pTabMark->GetTableSelect(nTab) ) )
{
pTab[nTab]->SetOptimalHeight( 0, MAXROW, 0,
pDev, nPPTX, nPPTY, rZoomX, rZoomY, FALSE, &aProgress, nProgressStart );
@@ -4005,24 +4172,6 @@ BOOL ScDocument::RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
}
-//UNUSED2008-05 void ScDocument::SetAutoFilterFlags()
-//UNUSED2008-05 {
-//UNUSED2008-05 USHORT nCount = pDBCollection->GetCount();
-//UNUSED2008-05 for (USHORT i=0; i<nCount; i++)
-//UNUSED2008-05 {
-//UNUSED2008-05 ScDBData* pData = (*pDBCollection)[i];
-//UNUSED2008-05 SCTAB nDBTab;
-//UNUSED2008-05 SCCOL nDBStartCol;
-//UNUSED2008-05 SCROW nDBStartRow;
-//UNUSED2008-05 SCCOL nDBEndCol;
-//UNUSED2008-05 SCROW nDBEndRow;
-//UNUSED2008-05 pData->GetArea( nDBTab, nDBStartCol,nDBStartRow, nDBEndCol,nDBEndRow );
-//UNUSED2008-05 pData->SetAutoFilter( HasAttrib( nDBStartCol,nDBStartRow,nDBTab,
-//UNUSED2008-05 nDBEndCol,nDBStartRow,nDBTab, HASATTR_AUTOFILTER ) );
-//UNUSED2008-05 }
-//UNUSED2008-05 }
-
-
BOOL ScDocument::IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
{
const ScMergeFlagAttr* pAttr = (const ScMergeFlagAttr*)
@@ -4055,16 +4204,21 @@ void ScDocument::ApplySelectionFrame( const ScMarkData& rMark,
const SvxBoxItem* pLineOuter,
const SvxBoxInfoItem* pLineInner )
{
- if (rMark.IsMarked())
+ ScRangeList aRangeList;
+ rMark.FillRangeListWithMarks( &aRangeList, FALSE );
+ ULONG nRangeCount = aRangeList.Count();
+ for (SCTAB i=0; i<=MAXTAB; i++)
{
- ScRange aRange;
- rMark.GetMarkArea(aRange);
- for (SCTAB i=0; i<=MAXTAB; i++)
- if (pTab[i])
- if (rMark.GetTableSelect(i))
- pTab[i]->ApplyBlockFrame( pLineOuter, pLineInner,
- aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row() );
+ if (pTab[i] && rMark.GetTableSelect(i))
+ {
+ for (ULONG j=0; j<nRangeCount; j++)
+ {
+ ScRange aRange = *aRangeList.GetObject(j);
+ pTab[i]->ApplyBlockFrame( pLineOuter, pLineInner,
+ aRange.aStart.Col(), aRange.aStart.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row() );
+ }
+ }
}
}
@@ -4500,5 +4654,18 @@ BOOL ScDocument::NeedPageResetAfterTab( SCTAB nTab ) const
return FALSE; // sonst nicht
}
+SfxUndoManager* ScDocument::GetUndoManager()
+{
+ if (!mpUndoManager)
+ mpUndoManager = new SfxUndoManager;
+ return mpUndoManager;
+}
+
+
+void ScDocument::EnableUndo( bool bVal )
+{
+ GetUndoManager()->EnableUndo(bVal);
+ mbUndoEnabled = bVal;
+}
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx
index 71c7bf273a98..7e1bc0389eaf 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -31,33 +31,25 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-// INCLUDE ---------------------------------------------------------------
-
#include "dpdimsave.hxx"
#include "dpgroup.hxx"
#include "dpobject.hxx"
#include "document.hxx"
+#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
+
#include <svtools/zforlist.hxx>
#include <tools/debug.hxx>
#include <rtl/math.hxx>
#include <algorithm>
-// -----------------------------------------------------------------------
+// ============================================================================
ScDPSaveGroupItem::ScDPSaveGroupItem( const String& rName ) :
aGroupName( rName )
{
}
-ScDPSaveGroupItem::ScDPSaveGroupItem( const ScDPSaveGroupItem& r ) :
- aGroupName( r.aGroupName ),
- aElements( r.aElements )
-{
-}
-
ScDPSaveGroupItem::~ScDPSaveGroupItem()
{
}
@@ -138,7 +130,7 @@ void ScDPSaveGroupItem::AddToData( ScDPGroupDimension& rDataDim, SvNumberFormatt
rDataDim.AddItem( aGroup );
}
-// -----------------------------------------------------------------------
+// ============================================================================
ScDPSaveGroupDimension::ScDPSaveGroupDimension( const String& rSource, const String& rName ) :
aSourceDim( rSource ),
@@ -147,12 +139,11 @@ ScDPSaveGroupDimension::ScDPSaveGroupDimension( const String& rSource, const Str
{
}
-ScDPSaveGroupDimension::ScDPSaveGroupDimension( const ScDPSaveGroupDimension& r ) :
- aSourceDim( r.aSourceDim ),
- aGroupDimName( r.aGroupDimName ),
- aGroups( r.aGroups ),
- aDateInfo( r.aDateInfo ),
- nDatePart( r.nDatePart )
+ScDPSaveGroupDimension::ScDPSaveGroupDimension( const String& rSource, const String& rName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart ) :
+ aSourceDim( rSource ),
+ aGroupDimName( rName ),
+ aDateInfo( rDateInfo ),
+ nDatePart( nPart )
{
}
@@ -307,7 +298,7 @@ void ScDPSaveGroupDimension::AddToData( ScDPGroupTableData& rData ) const
}
}
-// -----------------------------------------------------------------------
+// ============================================================================
ScDPSaveNumGroupDimension::ScDPSaveNumGroupDimension( const String& rName, const ScDPNumGroupInfo& rInfo ) :
aDimensionName( rName ),
@@ -316,11 +307,10 @@ ScDPSaveNumGroupDimension::ScDPSaveNumGroupDimension( const String& rName, const
{
}
-ScDPSaveNumGroupDimension::ScDPSaveNumGroupDimension( const ScDPSaveNumGroupDimension& r ) :
- aDimensionName( r.aDimensionName ),
- aGroupInfo( r.aGroupInfo ),
- aDateInfo( r.aDateInfo ),
- nDatePart( r.nDatePart )
+ScDPSaveNumGroupDimension::ScDPSaveNumGroupDimension( const String& rName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart ) :
+ aDimensionName( rName ),
+ aDateInfo( rDateInfo ),
+ nDatePart( nPart )
{
}
@@ -352,15 +342,29 @@ void ScDPSaveNumGroupDimension::SetDateInfo( const ScDPNumGroupInfo& rInfo, sal_
nDatePart = nPart;
}
-// -----------------------------------------------------------------------
+// ============================================================================
-ScDPDimensionSaveData::ScDPDimensionSaveData()
+namespace {
+
+struct ScDPSaveGroupDimNameFunc
{
-}
+ String maDimName;
+ inline explicit ScDPSaveGroupDimNameFunc( const String& rDimName ) : maDimName( rDimName ) {}
+ inline bool operator()( const ScDPSaveGroupDimension& rGroupDim ) const { return rGroupDim.GetGroupDimName() == maDimName; }
+};
+
+struct ScDPSaveGroupSourceNameFunc
+{
+ String maSrcDimName;
+ inline explicit ScDPSaveGroupSourceNameFunc( const String& rSrcDimName ) : maSrcDimName( rSrcDimName ) {}
+ inline bool operator()( const ScDPSaveGroupDimension& rGroupDim ) const { return rGroupDim.GetSourceDimName() == maSrcDimName; }
+};
+
+} // namespace
-ScDPDimensionSaveData::ScDPDimensionSaveData( const ScDPDimensionSaveData& r ) :
- aGroupDimensions( r.aGroupDimensions ),
- aNumGroupDimensions( r.aNumGroupDimensions )
+// ----------------------------------------------------------------------------
+
+ScDPDimensionSaveData::ScDPDimensionSaveData()
{
}
@@ -373,40 +377,52 @@ bool ScDPDimensionSaveData::operator==( const ScDPDimensionSaveData& ) const
return false;
}
-void ScDPDimensionSaveData::AddGroupDimension( const ScDPSaveGroupDimension& rGroup )
+void ScDPDimensionSaveData::AddGroupDimension( const ScDPSaveGroupDimension& rGroupDim )
{
- aGroupDimensions.push_back( rGroup );
+ DBG_ASSERT( ::std::find_if( maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDim.GetGroupDimName() ) ) == maGroupDims.end(),
+ "ScDPDimensionSaveData::AddGroupDimension - group dimension exists already" );
+ // ReplaceGroupDimension() adds new or replaces existing
+ ReplaceGroupDimension( rGroupDim );
}
-void ScDPDimensionSaveData::AddNumGroupDimension( const ScDPSaveNumGroupDimension& rGroup )
+void ScDPDimensionSaveData::ReplaceGroupDimension( const ScDPSaveGroupDimension& rGroupDim )
{
- aNumGroupDimensions.push_back( rGroup );
+ ScDPSaveGroupDimVec::iterator aIt = ::std::find_if(
+ maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDim.GetGroupDimName() ) );
+ if( aIt == maGroupDims.end() )
+ maGroupDims.push_back( rGroupDim );
+ else
+ *aIt = rGroupDim;
}
-void ScDPDimensionSaveData::RemoveGroupDimension( const String& rDimensionName )
+void ScDPDimensionSaveData::RemoveGroupDimension( const String& rGroupDimName )
{
- for ( ScDPSaveGroupDimensionVec::iterator aIter(aGroupDimensions.begin());
- aIter != aGroupDimensions.end(); aIter++ )
- {
- if ( aIter->GetGroupDimName() == rDimensionName ) //! ignore case
- {
- aGroupDimensions.erase( aIter ); // found -> remove
- return; // don't have to look further
- }
- }
+ ScDPSaveGroupDimVec::iterator aIt = ::std::find_if(
+ maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDimName ) );
+ if( aIt != maGroupDims.end() )
+ maGroupDims.erase( aIt );
}
-void ScDPDimensionSaveData::RemoveNumGroupDimension( const String& rDimensionName )
+void ScDPDimensionSaveData::AddNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim )
{
- for ( ScDPSaveNumGroupDimensionVec::iterator aIter(aNumGroupDimensions.begin());
- aIter != aNumGroupDimensions.end(); aIter++ )
- {
- if ( aIter->GetDimensionName() == rDimensionName ) //! ignore case
- {
- aNumGroupDimensions.erase( aIter ); // found -> remove
- return; // don't have to look further
- }
- }
+ DBG_ASSERT( maNumGroupDims.count( rGroupDim.GetDimensionName() ) == 0,
+ "ScDPDimensionSaveData::AddNumGroupDimension - numeric group dimension exists already" );
+ // ReplaceNumGroupDimension() adds new or replaces existing
+ ReplaceNumGroupDimension( rGroupDim );
+}
+
+void ScDPDimensionSaveData::ReplaceNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim )
+{
+ ScDPSaveNumGroupDimMap::iterator aIt = maNumGroupDims.find( rGroupDim.GetDimensionName() );
+ if( aIt == maNumGroupDims.end() )
+ maNumGroupDims.insert( ScDPSaveNumGroupDimMap::value_type( rGroupDim.GetDimensionName(), rGroupDim ) );
+ else
+ aIt->second = rGroupDim;
+}
+
+void ScDPDimensionSaveData::RemoveNumGroupDimension( const String& rGroupDimName )
+{
+ maNumGroupDims.erase( rGroupDimName );
}
void ScDPDimensionSaveData::WriteToData( ScDPGroupTableData& rData ) const
@@ -414,92 +430,89 @@ void ScDPDimensionSaveData::WriteToData( ScDPGroupTableData& rData ) const
// rData is assumed to be empty
// AddToData also handles date grouping
- for ( ScDPSaveGroupDimensionVec::const_iterator aIter(aGroupDimensions.begin());
- aIter != aGroupDimensions.end(); aIter++ )
- aIter->AddToData( rData );
+ for( ScDPSaveGroupDimVec::const_iterator aIt = maGroupDims.begin(), aEnd = maGroupDims.end(); aIt != aEnd; ++aIt )
+ aIt->AddToData( rData );
- for ( ScDPSaveNumGroupDimensionVec::const_iterator aNumIter(aNumGroupDimensions.begin());
- aNumIter != aNumGroupDimensions.end(); aNumIter++ )
- aNumIter->AddToData( rData );
+ for( ScDPSaveNumGroupDimMap::const_iterator aIt = maNumGroupDims.begin(), aEnd = maNumGroupDims.end(); aIt != aEnd; ++aIt )
+ aIt->second.AddToData( rData );
}
-ScDPSaveGroupDimension* ScDPDimensionSaveData::GetGroupDimAccForBase( const String& rBaseName )
+const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetGroupDimForBase( const String& rBaseDimName ) const
{
- String aOrigBase( rBaseName ); // the original base dim in the case of nested group dims
-
- for ( ScDPSaveGroupDimensionVec::iterator aIter(aGroupDimensions.begin());
- aIter != aGroupDimensions.end(); aIter++ )
- {
- if ( aIter->GetSourceDimName() == aOrigBase ) //! ignore case
- {
- return &*aIter; // return the first one directly - it's the immediate derivative
- }
- else if ( aIter->GetGroupDimName() == aOrigBase )
- {
- // found the definition of rBaseName in the array - look for the next occurrence
- // of this definitions's base
+ return const_cast< ScDPDimensionSaveData* >( this )->GetGroupDimAccForBase( rBaseDimName );
+}
- aOrigBase = aIter->GetSourceDimName(); // and continue the loop
- }
- }
+const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNamedGroupDim( const String& rGroupDimName ) const
+{
+ return const_cast< ScDPDimensionSaveData* >( this )->GetNamedGroupDimAcc( rGroupDimName );
+}
- return NULL; // none
+const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetFirstNamedGroupDim( const String& rBaseDimName ) const
+{
+ return const_cast< ScDPDimensionSaveData* >( this )->GetFirstNamedGroupDimAcc( rBaseDimName );
}
-const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetGroupDimForBase( const String& rBaseName ) const
+const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNextNamedGroupDim( const String& rGroupDimName ) const
{
- return const_cast< ScDPDimensionSaveData* >( this )->GetGroupDimAccForBase( rBaseName );
+ return const_cast< ScDPDimensionSaveData* >( this )->GetNextNamedGroupDimAcc( rGroupDimName );
}
-const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNamedGroupDim( const String& rGroupDim ) const
+const ScDPSaveNumGroupDimension* ScDPDimensionSaveData::GetNumGroupDim( const String& rGroupDimName ) const
{
- return const_cast< ScDPDimensionSaveData* >( this )->GetNamedGroupDimAcc( rGroupDim );
+ return const_cast< ScDPDimensionSaveData* >( this )->GetNumGroupDimAcc( rGroupDimName );
}
-const ScDPSaveNumGroupDimension* ScDPDimensionSaveData::GetNumGroupDim( const String& rName ) const
+ScDPSaveGroupDimension* ScDPDimensionSaveData::GetGroupDimAccForBase( const String& rBaseDimName )
{
- return const_cast< ScDPDimensionSaveData* >( this )->GetNumGroupDimAcc( rName );
+ ScDPSaveGroupDimension* pGroupDim = GetFirstNamedGroupDimAcc( rBaseDimName );
+ return pGroupDim ? pGroupDim : GetNextNamedGroupDimAcc( rBaseDimName );
}
-ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNamedGroupDimAcc( const String& rGroupDim )
+ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNamedGroupDimAcc( const String& rGroupDimName )
{
- for ( ScDPSaveGroupDimensionVec::iterator aIter(aGroupDimensions.begin());
- aIter != aGroupDimensions.end(); aIter++ )
- if ( aIter->GetGroupDimName() == rGroupDim ) //! ignore case
- return &*aIter; // there should be only one - use it directly
+ ScDPSaveGroupDimVec::iterator aIt = ::std::find_if(
+ maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDimName ) );
+ return (aIt == maGroupDims.end()) ? 0 : &*aIt;
+}
- return NULL; // none
+ScDPSaveGroupDimension* ScDPDimensionSaveData::GetFirstNamedGroupDimAcc( const String& rBaseDimName )
+{
+ ScDPSaveGroupDimVec::iterator aIt = ::std::find_if(
+ maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupSourceNameFunc( rBaseDimName ) );
+ return (aIt == maGroupDims.end()) ? 0 : &*aIt;
}
-ScDPSaveNumGroupDimension* ScDPDimensionSaveData::GetNumGroupDimAcc( const String& rName )
+ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNextNamedGroupDimAcc( const String& rGroupDimName )
{
- for ( ScDPSaveNumGroupDimensionVec::iterator aIter(aNumGroupDimensions.begin());
- aIter != aNumGroupDimensions.end(); aIter++ )
- if ( aIter->GetDimensionName() == rName ) //! ignore case
- return &*aIter; // there should be only one - use it directly
+ // find the group dimension with the passed name
+ ScDPSaveGroupDimVec::iterator aIt = ::std::find_if(
+ maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDimName ) );
+ // find next group dimension based on the same source dimension name
+ if( aIt != maGroupDims.end() )
+ aIt = ::std::find_if( aIt + 1, maGroupDims.end(), ScDPSaveGroupSourceNameFunc( aIt->GetSourceDimName() ) );
+ return (aIt == maGroupDims.end()) ? 0 : &*aIt;
+}
- return NULL; // none
+ScDPSaveNumGroupDimension* ScDPDimensionSaveData::GetNumGroupDimAcc( const String& rGroupDimName )
+{
+ ScDPSaveNumGroupDimMap::iterator aIt = maNumGroupDims.find( rGroupDimName );
+ return (aIt == maNumGroupDims.end()) ? 0 : &aIt->second;
}
bool ScDPDimensionSaveData::HasGroupDimensions() const
{
- return !aGroupDimensions.empty() || !aNumGroupDimensions.empty();
+ return !maGroupDims.empty() || !maNumGroupDims.empty();
}
sal_Int32 ScDPDimensionSaveData::CollectDateParts( const String& rBaseDimName ) const
{
sal_Int32 nParts = 0;
- const ScDPSaveNumGroupDimension* pNumDim = GetNumGroupDim( rBaseDimName );
- if ( pNumDim )
+ // start with part of numeric group
+ if( const ScDPSaveNumGroupDimension* pNumDim = GetNumGroupDim( rBaseDimName ) )
nParts |= pNumDim->GetDatePart();
-
- for ( ScDPSaveGroupDimensionVec::const_iterator aIter(aGroupDimensions.begin());
- aIter != aGroupDimensions.end(); aIter++ )
- if ( aIter->GetSourceDimName() == rBaseDimName ) //! ignore case
- {
- nParts |= aIter->GetDatePart();
- // continue loop, collect parts from all matching group dimensions
- }
+ // collect parts from all matching group dimensions
+ for( const ScDPSaveGroupDimension* pGroupDim = GetFirstNamedGroupDim( rBaseDimName ); pGroupDim; pGroupDim = GetNextNamedGroupDim( pGroupDim->GetGroupDimName() ) )
+ nParts |= pGroupDim->GetDatePart();
return nParts;
}
@@ -523,9 +536,8 @@ String ScDPDimensionSaveData::CreateGroupDimName( const String& rSourceName,
bool bExists = false;
// look for existing group dimensions
- for ( ScDPSaveGroupDimensionVec::const_iterator aIter(aGroupDimensions.begin());
- aIter != aGroupDimensions.end() && !bExists; aIter++ )
- if ( aIter->GetGroupDimName() == aDimName ) //! ignore case
+ for( ScDPSaveGroupDimVec::const_iterator aIt = maGroupDims.begin(), aEnd = maGroupDims.end(); (aIt != aEnd) && !bExists; ++aIt )
+ if( aIt->GetGroupDimName() == aDimName ) //! ignore case
bExists = true;
// look for base dimensions that happen to have that name
@@ -552,3 +564,24 @@ String ScDPDimensionSaveData::CreateGroupDimName( const String& rSourceName,
return EMPTY_STRING;
}
+String ScDPDimensionSaveData::CreateDateGroupDimName( sal_Int32 nDatePart, const ScDPObject& rObject, bool bAllowSource, const ::std::vector< String >* pDeletedNames )
+{
+ using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
+ String aPartName;
+ switch( nDatePart )
+ {
+ //! use translated strings from globstr.src
+ case SECONDS: aPartName = String::CreateFromAscii( "Seconds" ); break;
+ case MINUTES: aPartName = String::CreateFromAscii( "Minutes" ); break;
+ case HOURS: aPartName = String::CreateFromAscii( "Hours" ); break;
+ case DAYS: aPartName = String::CreateFromAscii( "Days" ); break;
+ case MONTHS: aPartName = String::CreateFromAscii( "Months" ); break;
+ case QUARTERS: aPartName = String::CreateFromAscii( "Quarters" ); break;
+ case YEARS: aPartName = String::CreateFromAscii( "Years" ); break;
+ }
+ DBG_ASSERT( aPartName.Len() > 0, "ScDPDimensionSaveData::CreateDateGroupDimName - invalid date part" );
+ return CreateGroupDimName( aPartName, rObject, bAllowSource, pDeletedNames );
+}
+
+// ============================================================================
+
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 22ae204474ec..813a3381c901 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -166,7 +166,6 @@ ScDPObject::ScDPObject( ScDocument* pD ) :
bSettingsChanged( FALSE ),
bAlive( FALSE ),
bAllowMove( FALSE ),
- bInfoValid( FALSE ),
nHeaderRows( 0 )
{
}
@@ -185,7 +184,6 @@ ScDPObject::ScDPObject(const ScDPObject& r) :
bSettingsChanged( FALSE ),
bAlive( FALSE ),
bAllowMove( FALSE ),
- bInfoValid( r.bInfoValid ),
nHeaderRows( r.nHeaderRows )
{
if (r.pSaveData)
@@ -310,7 +308,6 @@ void ScDPObject::WriteSourceDataTo( ScDPObject& rDest ) const
void ScDPObject::WriteTempDataTo( ScDPObject& rDest ) const
{
rDest.nHeaderRows = nHeaderRows;
- rDest.bInfoValid = bInfoValid;
}
BOOL ScDPObject::IsSheetData() const
@@ -344,7 +341,6 @@ void ScDPObject::CreateOutput()
long nOldRows = nHeaderRows;
nHeaderRows = pOutput->GetHeaderRows();
- bInfoValid = TRUE;
if ( bAllowMove && nHeaderRows != nOldRows )
{
@@ -449,13 +445,11 @@ void ScDPObject::CreateObjects()
void ScDPObject::InvalidateData()
{
bSettingsChanged = TRUE;
- bInfoValid = FALSE;
}
void ScDPObject::InvalidateSource()
{
xSource = NULL;
- bInfoValid = FALSE;
}
ScRange ScDPObject::GetNewOutputRange( BOOL& rOverflow )
@@ -472,7 +466,7 @@ ScRange ScDPObject::GetNewOutputRange( BOOL& rOverflow )
}
}
-void ScDPObject::Output()
+void ScDPObject::Output( const ScAddress& rPos )
{
// clear old output area
pDoc->DeleteAreaTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(),
@@ -484,6 +478,8 @@ void ScDPObject::Output()
CreateOutput(); // create xSource and pOutput if not already done
+ pOutput->SetPosition( rPos );
+
pOutput->Output();
// aOutRange is always the range that was last output to the document
@@ -535,8 +531,6 @@ void ScDPObject::RefreshAfterLoad()
}
else
nHeaderRows = 0; // nothing found, no drop-down lists
-
- bInfoValid = TRUE;
}
void ScDPObject::UpdateReference( UpdateRefMode eUpdateRefMode,
@@ -2345,7 +2339,7 @@ ScDPCollection::ScDPCollection(const ScDPCollection& r) :
ScCollection(r),
pDoc(r.pDoc),
maSharedString(r.maSharedString),
- maCacheCellPool(r.maCacheCellPool)
+ maCacheCellPool() // #i101725# don't copy hash_set with pointers from the other collection
{
}
@@ -2507,8 +2501,9 @@ void ScDPCollection::clearCacheCellPool()
vector<ScDPCacheCell*> ps;
ps.reserve(maCacheCellPool.size());
copy(maCacheCellPool.begin(), maCacheCellPool.end(), back_inserter(ps));
- for_each(ps.begin(), ps.end(), DeleteCacheCells());
maCacheCellPool.clear();
+ // for correctness' sake, delete the elements after clearing the hash_set
+ for_each(ps.begin(), ps.end(), DeleteCacheCells());
}
//------------------------------------------------------------------------
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 007ecb24af33..f4180312ce0d 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -832,8 +832,8 @@ ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName)
ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension()
{
- long nCount = aDimList.Count();
- for (long i=0; i<nCount; i++)
+ ULONG nCount = aDimList.Count();
+ for (ULONG i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
if ( pDim->IsDataLayout() )
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index c6a48a8f1925..5fa5c393df37 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -288,6 +288,10 @@ void ScDPSource::SetOrientation(long nColumn, USHORT nNew)
case sheet::DataPilotFieldOrientation_PAGE:
nPageDims[nPageDimCount++] = nColumn;
break;
+ case sheet::DataPilotFieldOrientation_HIDDEN:
+ /* Do not assert HIDDEN as it occurs e.g. while using the
+ csss.XDataPilotTables.createDataPilotDescriptor() function. */
+ break;
default:
DBG_ERROR( "ScDPSource::SetOrientation: unexpected orientation" );
break;
@@ -1129,7 +1133,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPSource::getPropertySetInfo(
{
ScUnoGuard aGuard;
- static SfxItemPropertyMap aDPSourceMap_Impl[] =
+ static SfxItemPropertyMapEntry aDPSourceMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_COLGRAND), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_DATADESC), 0, &getCppuType((rtl::OUString*)0), beans::PropertyAttribute::READONLY, 0 },
@@ -1508,7 +1512,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPDimension::getPropertySetIn
{
ScUnoGuard aGuard;
- static SfxItemPropertyMap aDPDimensionMap_Impl[] =
+ static SfxItemPropertyMapEntry aDPDimensionMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_FILTER), 0, &getCppuType((uno::Sequence<sheet::TableFilterField>*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_FUNCTION), 0, &getCppuType((sheet::GeneralFunction*)0), 0, 0 },
@@ -1974,13 +1978,16 @@ public:
BOOL ScDPGlobalMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) const
{
- ScDPMembers* pMembers = rLevel.GetMembersObject();
- ScDPMember* pMember1 = pMembers->getByIndex(nIndex1);
- ScDPMember* pMember2 = pMembers->getByIndex(nIndex2);
-
- sal_Int32 nCompare = pMember1->Compare( *pMember2 );
-
- return bAscending ? ( nCompare < 0 ) : ( nCompare > 0 );
+ sal_Int32 nCompare = 0;
+ // seems that some ::std::sort() implementations pass the same index twice
+ if( nIndex1 != nIndex2 )
+ {
+ ScDPMembers* pMembers = rLevel.GetMembersObject();
+ ScDPMember* pMember1 = pMembers->getByIndex(nIndex1);
+ ScDPMember* pMember2 = pMembers->getByIndex(nIndex2);
+ nCompare = pMember1->Compare( *pMember2 );
+ }
+ return bAscending ? (nCompare < 0) : (nCompare > 0);
}
// -----------------------------------------------------------------------
@@ -2037,7 +2044,7 @@ void ScDPLevel::EvaluateSortOrder()
ScDPMembers* pLocalMembers = GetMembersObject();
long nCount = pLocalMembers->getCount();
- DBG_ASSERT( aGlobalOrder.empty(), "sort twice?" );
+// DBG_ASSERT( aGlobalOrder.empty(), "sort twice?" );
aGlobalOrder.resize( nCount );
for (long nPos=0; nPos<nCount; nPos++)
aGlobalOrder[nPos] = nPos;
@@ -2190,7 +2197,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPLevel::getPropertySetInfo()
{
ScUnoGuard aGuard;
- static SfxItemPropertyMap aDPLevelMap_Impl[] =
+ static SfxItemPropertyMapEntry aDPLevelMap_Impl[] =
{
//! change type of AutoShow/Layout/Sorting to API struct when available
{MAP_CHAR_LEN(SC_UNO_AUTOSHOW), 0, &getCppuType((sheet::DataPilotFieldAutoShowInfo*)0), 0, 0 },
@@ -2657,7 +2664,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPMember::getPropertySetInfo(
{
ScUnoGuard aGuard;
- static SfxItemPropertyMap aDPMemberMap_Impl[] =
+ static SfxItemPropertyMapEntry aDPMemberMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_ISVISIBL), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_POSITION), 0, &getCppuType((sal_Int32*)0), 0, 0 },
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 5401c0e5327b..a5c571026e96 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -60,6 +60,7 @@
#include <svx/drawitem.hxx>
#include <svx/fhgtitem.hxx>
#include <svx/scriptspaceitem.hxx>
+#include <svx/shapepropertynotifier.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/docfile.hxx>
#include <sot/storage.hxx>
@@ -492,7 +493,7 @@ void ScDrawLayer::MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SC
if ( pObj->ISA( SdrRectObj ) && pData->maStart.IsValid() && pData->maEnd.IsValid() )
pData->maStart.PutInOrder( pData->maEnd );
AddCalcUndo( new ScUndoObjData( pObj, aOldStt, aOldEnd, pData->maStart, pData->maEnd ) );
- RecalcPos( pObj, *pData, aOldStt, aOldEnd, bNegativePage );
+ RecalcPos( pObj, *pData, bNegativePage );
}
}
}
@@ -521,27 +522,33 @@ void ScDrawLayer::SetPageSize( USHORT nPageNo, const Size& rSize )
SdrObject* pObj = pPage->GetObj( i );
ScDrawObjData* pData = GetObjDataTab( pObj, static_cast<SCTAB>(nPageNo) );
if( pData )
- RecalcPos( pObj, *pData, pData->maStart, pData->maEnd, bNegativePage );
+ RecalcPos( pObj, *pData, bNegativePage );
}
}
}
-void ScDrawLayer::RecalcPos( SdrObject* pObj, const ScDrawObjData& rData,
- const ScAddress& rOldStart, const ScAddress& /*rOldEnd*/, bool bNegativePage )
+void ScDrawLayer::RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage )
{
DBG_ASSERT( pDoc, "ScDrawLayer::RecalcPos - missing document" );
if( !pDoc )
return;
+ /* TODO CleanUp: Updating note position works just by chance currently...
+ When inserting rows/columns, this function is called after the
+ insertion, and the note is located at the new position contained in the
+ passed ScDrawObjData already. But when deleting rows/columns, this
+ function is called *before* the deletion, so the note is still at the
+ old cell position, and ScDocument::GetNote() will fail to get the note
+ or will get another note. But after the rows/columns are deleted, a
+ call to ScDrawLayer::SetPageSize() will call this function again, and
+ now the note is at the expected position in the document. */
if( rData.mbNote )
{
- /* #i63671# while inserting/deleting cells/rows/columns: note has
- not been moved yet in document, get it from old position. */
- DBG_ASSERT( rOldStart.IsValid(), "ScDrawLayer::RecalcPos - invalid position for cell note" );
+ DBG_ASSERT( rData.maStart.IsValid(), "ScDrawLayer::RecalcPos - invalid position for cell note" );
/* When inside an undo action, there may be pending note captions
where cell note is already deleted. The caption will be deleted
later with drawing undo. */
- if( ScPostIt* pNote = pDoc->GetNote( rOldStart ) )
+ if( ScPostIt* pNote = pDoc->GetNote( rData.maStart ) )
pNote->UpdateCaptionPos( rData.maStart );
return;
}
@@ -1809,10 +1816,15 @@ void ScDrawLayer::EnsureGraphicNames()
void ScDrawLayer::SetAnchor( SdrObject* pObj, ScAnchorType eType )
{
+ ScAnchorType eOldAnchorType = GetAnchor( pObj );
+
// Ein an der Seite verankertes Objekt zeichnet sich durch eine Anker-Pos
// von (0,1) aus. Das ist ein shabby Trick, der aber funktioniert!
Point aAnchor( 0, eType == SCA_PAGE ? 1 : 0 );
pObj->SetAnchorPos( aAnchor );
+
+ if ( eOldAnchorType != eType )
+ pObj->notifyShapePropertyChange( ::svx::eSpreadsheetAnchor );
}
ScAnchorType ScDrawLayer::GetAnchor( const SdrObject* pObj )
diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk
index 7129198c204f..29618da6630b 100644
--- a/sc/source/core/data/makefile.mk
+++ b/sc/source/core/data/makefile.mk
@@ -108,6 +108,7 @@ SLOFILES = \
$(SLO)$/table4.obj \
$(SLO)$/table5.obj \
$(SLO)$/table6.obj \
+ $(SLO)$/tabprotection.obj \
$(SLO)$/userdat.obj \
$(SLO)$/validat.obj \
$(SLO)$/postit.obj
@@ -127,7 +128,9 @@ EXCEPTIONSFILES= \
$(SLO)$/dptabdat.obj \
$(SLO)$/global2.obj \
$(SLO)$/table1.obj \
+ $(SLO)$/table2.obj \
$(SLO)$/table3.obj \
+ $(SLO)$/tabprotection.obj \
$(SLO)$/postit.obj \
$(SLO)$/documen3.obj \
$(SLO)$/documen5.obj \
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 068ec3ade5e5..c53694b7674c 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -33,6 +33,7 @@
#include "postit.hxx"
+#include <rtl/ustrbuf.hxx>
#include <svtools/useroptions.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdocapt.hxx>
@@ -57,6 +58,9 @@
#include "userdat.hxx"
#include "detfunc.hxx"
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
// ============================================================================
namespace {
@@ -69,8 +73,107 @@ const long SC_NOTECAPTION_OFFSET_Y = -1500; /// Default Y offset of
const long SC_NOTECAPTION_OFFSET_X = 1500; /// Default X offset of note captions to left border of anchor cell.
const long SC_NOTECAPTION_BORDERDIST_TEMP = 100; /// Distance of temporary note captions to visible sheet area.
+// ============================================================================
+
+/** Static helper functions for caption objects. */
+class ScCaptionUtil
+{
+public:
+ /** Moves the caption object to the correct layer according to passed visibility. */
+ static void SetCaptionLayer( SdrCaptionObj& rCaption, bool bShown );
+ /** Sets basic caption settings required for note caption objects. */
+ static void SetBasicCaptionSettings( SdrCaptionObj& rCaption, bool bShown );
+ /** Stores the cell position of the note in the user data area of the caption. */
+ static void SetCaptionUserData( SdrCaptionObj& rCaption, const ScAddress& rPos );
+ /** Sets all default formatting attributes to the caption object. */
+ static void SetDefaultItems( SdrCaptionObj& rCaption, ScDocument& rDoc );
+ /** Updates caption item set according to the passed item set while removing shadow items. */
+ static void SetCaptionItems( SdrCaptionObj& rCaption, const SfxItemSet& rItemSet );
+};
+
// ----------------------------------------------------------------------------
+void ScCaptionUtil::SetCaptionLayer( SdrCaptionObj& rCaption, bool bShown )
+{
+ SdrLayerID nLayer = bShown ? SC_LAYER_INTERN : SC_LAYER_HIDDEN;
+ if( nLayer != rCaption.GetLayer() )
+ rCaption.SetLayer( nLayer );
+}
+
+void ScCaptionUtil::SetBasicCaptionSettings( SdrCaptionObj& rCaption, bool bShown )
+{
+ ScDrawLayer::SetAnchor( &rCaption, SCA_PAGE );
+ SetCaptionLayer( rCaption, bShown );
+ rCaption.SetFixedTail();
+ rCaption.SetSpecialTextBoxShadow();
+}
+
+void ScCaptionUtil::SetCaptionUserData( SdrCaptionObj& rCaption, const ScAddress& rPos )
+{
+ // pass true to ScDrawLayer::GetObjData() to create the object data entry
+ ScDrawObjData* pObjData = ScDrawLayer::GetObjData( &rCaption, true );
+ OSL_ENSURE( pObjData, "ScCaptionUtil::SetCaptionUserData - missing drawing object user data" );
+ pObjData->maStart = rPos;
+ pObjData->mbNote = true;
+}
+
+void ScCaptionUtil::SetDefaultItems( SdrCaptionObj& rCaption, ScDocument& rDoc )
+{
+ SfxItemSet aItemSet = rCaption.GetMergedItemSet();
+
+ // caption tail arrow
+ ::basegfx::B2DPolygon aTriangle;
+ aTriangle.append( ::basegfx::B2DPoint( 10.0, 0.0 ) );
+ aTriangle.append( ::basegfx::B2DPoint( 0.0, 30.0 ) );
+ aTriangle.append( ::basegfx::B2DPoint( 20.0, 30.0 ) );
+ aTriangle.setClosed( true );
+ /* #99319# Line ends are now created with an empty name. The
+ checkForUniqueItem() method then finds a unique name for the item's
+ value. */
+ aItemSet.Put( XLineStartItem( String::EmptyString(), ::basegfx::B2DPolyPolygon( aTriangle ) ) );
+ aItemSet.Put( XLineStartWidthItem( 200 ) );
+ aItemSet.Put( XLineStartCenterItem( FALSE ) );
+ aItemSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aItemSet.Put( XFillColorItem( String::EmptyString(), ScDetectiveFunc::GetCommentColor() ) );
+ aItemSet.Put( SdrCaptionEscDirItem( SDRCAPT_ESCBESTFIT ) );
+
+ // shadow
+ /* SdrShadowItem has FALSE, instead the shadow is set for the
+ rectangle only with SetSpecialTextBoxShadow() when the object is
+ created (item must be set to adjust objects from older files). */
+ aItemSet.Put( SdrShadowItem( FALSE ) );
+ aItemSet.Put( SdrShadowXDistItem( 100 ) );
+ aItemSet.Put( SdrShadowYDistItem( 100 ) );
+
+ // text attributes
+ aItemSet.Put( SdrTextLeftDistItem( 100 ) );
+ aItemSet.Put( SdrTextRightDistItem( 100 ) );
+ aItemSet.Put( SdrTextUpperDistItem( 100 ) );
+ aItemSet.Put( SdrTextLowerDistItem( 100 ) );
+ aItemSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
+ aItemSet.Put( SdrTextAutoGrowHeightItem( TRUE ) );
+ // #78943# use the default cell style to be able to modify the caption font
+ const ScPatternAttr& rDefPattern = static_cast< const ScPatternAttr& >( rDoc.GetPool()->GetDefaultItem( ATTR_PATTERN ) );
+ rDefPattern.FillEditItemSet( &aItemSet );
+
+ rCaption.SetMergedItemSet( aItemSet );
+}
+
+void ScCaptionUtil::SetCaptionItems( SdrCaptionObj& rCaption, const SfxItemSet& rItemSet )
+{
+ // copy all items
+ rCaption.SetMergedItemSet( rItemSet );
+ // reset shadow items
+ rCaption.SetMergedItem( SdrShadowItem( FALSE ) );
+ rCaption.SetMergedItem( SdrShadowXDistItem( 100 ) );
+ rCaption.SetMergedItem( SdrShadowYDistItem( 100 ) );
+ rCaption.SetSpecialTextBoxShadow();
+}
+
+// ============================================================================
+
+/** Helper for creation and manipulation of caption drawing objects independent
+ from cell annotations. */
class ScCaptionCreator
{
public:
@@ -79,27 +182,32 @@ public:
/** Manipulate an existing caption. */
explicit ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj& rCaption );
+ /** Returns the drawing layer page of the sheet contained in maPos. */
+ SdrPage* GetDrawPage();
/** Returns the caption drawing obejct. */
inline SdrCaptionObj* GetCaption() { return mpCaption; }
/** Moves the caption inside the passed rectangle. Uses page area if 0 is passed. */
void FitCaptionToRect( const Rectangle* pVisRect = 0 );
- /** Places the passed caption inside the passed rectangle, tries to keep the cell rectangle uncovered. Uses page area if 0 is passed. */
+ /** Places the caption inside the passed rectangle, tries to keep the cell rectangle uncovered. Uses page area if 0 is passed. */
void AutoPlaceCaption( const Rectangle* pVisRect = 0 );
/** Updates caption tail and textbox according to current cell position. Uses page area if 0 is passed. */
void UpdateCaptionPos( const Rectangle* pVisRect = 0 );
- /** Sets all default formatting attributes to the caption object. */
- void SetDefaultItems();
- /** Updates caption itemset according to the passed item set while removing shadow items. */
- void SetCaptionItems( const SfxItemSet& rItemSet );
+
+protected:
+ /** Helper constructor for derived classes. */
+ explicit ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos );
+
+ /** Calculates the caption tail position according to current cell position. */
+ Point CalcTailPos( bool bTailFront );
+ /** Implements creation of the caption object. The caption will not be inserted into the document. */
+ void CreateCaption( bool bShown, bool bTailFront );
private:
/** Initializes all members. */
void Initialize();
/** Returns the passed rectangle if existing, page rectangle otherwise. */
inline const Rectangle& GetVisRect( const Rectangle* pVisRect ) const { return pVisRect ? *pVisRect : maPageRect; }
- /** Calculates the caption tail position according to current cell position. */
- Point CalcTailPos( bool bTailFront );
private:
ScDocument& mrDoc;
@@ -118,17 +226,7 @@ ScCaptionCreator::ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, boo
mpCaption( 0 )
{
Initialize();
-
- // create the caption drawing object
- Rectangle aTextRect( Point( 0 , 0 ), Size( SC_NOTECAPTION_WIDTH, SC_NOTECAPTION_HEIGHT ) );
- Point aTailPos = CalcTailPos( bTailFront );
- mpCaption = new SdrCaptionObj( aTextRect, aTailPos );
-
- // basic settings
- ScDrawLayer::SetAnchor( mpCaption, SCA_PAGE );
- mpCaption->SetLayer( bShown ? SC_LAYER_INTERN : SC_LAYER_HIDDEN );
- mpCaption->SetFixedTail();
- mpCaption->SetSpecialTextBoxShadow();
+ CreateCaption( bShown, bTailFront );
}
ScCaptionCreator::ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj& rCaption ) :
@@ -139,6 +237,20 @@ ScCaptionCreator::ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, Sdr
Initialize();
}
+ScCaptionCreator::ScCaptionCreator( ScDocument& rDoc, const ScAddress& rPos ) :
+ mrDoc( rDoc ),
+ maPos( rPos ),
+ mpCaption( 0 )
+{
+ Initialize();
+}
+
+SdrPage* ScCaptionCreator::GetDrawPage()
+{
+ ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer();
+ return pDrawLayer ? pDrawLayer->GetPage( static_cast< sal_uInt16 >( maPos.Tab() ) ) : 0;
+}
+
void ScCaptionCreator::FitCaptionToRect( const Rectangle* pVisRect )
{
const Rectangle& rVisRect = GetVisRect( pVisRect );
@@ -269,98 +381,131 @@ void ScCaptionCreator::UpdateCaptionPos( const Rectangle* pVisRect )
}
}
-void ScCaptionCreator::SetDefaultItems()
+Point ScCaptionCreator::CalcTailPos( bool bTailFront )
{
- SfxItemSet aItemSet = mpCaption->GetMergedItemSet();
-
- // caption tail arrow
- ::basegfx::B2DPolygon aTriangle;
- aTriangle.append( ::basegfx::B2DPoint( 10.0, 0.0 ) );
- aTriangle.append( ::basegfx::B2DPoint( 0.0, 30.0 ) );
- aTriangle.append( ::basegfx::B2DPoint( 20.0, 30.0 ) );
- aTriangle.setClosed( true );
- /* #99319# Line ends are now created with an empty name. The
- checkForUniqueItem() method then finds a unique name for the item's
- value. */
- aItemSet.Put( XLineStartItem( String::EmptyString(), ::basegfx::B2DPolyPolygon( aTriangle ) ) );
- aItemSet.Put( XLineStartWidthItem( 200 ) );
- aItemSet.Put( XLineStartCenterItem( FALSE ) );
- aItemSet.Put( XFillStyleItem( XFILL_SOLID ) );
- aItemSet.Put( XFillColorItem( String::EmptyString(), ScDetectiveFunc::GetCommentColor() ) );
- aItemSet.Put( SdrCaptionEscDirItem( SDRCAPT_ESCBESTFIT ) );
-
- // shadow
- /* SdrShadowItem has FALSE, instead the shadow is set for the
- rectangle only with SetSpecialTextBoxShadow when the object is
- created (item must be set to adjust objects from older files). */
- aItemSet.Put( SdrShadowItem( FALSE ) );
- aItemSet.Put( SdrShadowXDistItem( 100 ) );
- aItemSet.Put( SdrShadowYDistItem( 100 ) );
-
- // text attributes
- aItemSet.Put( SdrTextLeftDistItem( 100 ) );
- aItemSet.Put( SdrTextRightDistItem( 100 ) );
- aItemSet.Put( SdrTextUpperDistItem( 100 ) );
- aItemSet.Put( SdrTextLowerDistItem( 100 ) );
- aItemSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
- aItemSet.Put( SdrTextAutoGrowHeightItem( TRUE ) );
- // #78943# use the default cell style to be able to modify the caption font
- const ScPatternAttr& rDefPattern = static_cast< const ScPatternAttr& >( mrDoc.GetPool()->GetDefaultItem( ATTR_PATTERN ) );
- rDefPattern.FillEditItemSet( &aItemSet );
-
- mpCaption->SetMergedItemSet( aItemSet );
+ // tail position
+ bool bTailLeft = bTailFront != mbNegPage;
+ Point aTailPos = bTailLeft ? maCellRect.TopLeft() : maCellRect.TopRight();
+ // move caption point 1/10 mm inside cell
+ if( bTailLeft ) aTailPos.X() += 10; else aTailPos.X() -= 10;
+ aTailPos.Y() += 10;
+ return aTailPos;
}
-void ScCaptionCreator::SetCaptionItems( const SfxItemSet& rItemSet )
+void ScCaptionCreator::CreateCaption( bool bShown, bool bTailFront )
{
- // copy all items
- mpCaption->SetMergedItemSet( rItemSet );
- // reset shadow items
- mpCaption->SetMergedItem( SdrShadowItem( FALSE ) );
- mpCaption->SetMergedItem( SdrShadowXDistItem( 100 ) );
- mpCaption->SetMergedItem( SdrShadowYDistItem( 100 ) );
- mpCaption->SetSpecialTextBoxShadow();
+ // create the caption drawing object
+ Rectangle aTextRect( Point( 0 , 0 ), Size( SC_NOTECAPTION_WIDTH, SC_NOTECAPTION_HEIGHT ) );
+ Point aTailPos = CalcTailPos( bTailFront );
+ mpCaption = new SdrCaptionObj( aTextRect, aTailPos );
+ // basic caption settings
+ ScCaptionUtil::SetBasicCaptionSettings( *mpCaption, bShown );
}
void ScCaptionCreator::Initialize()
{
maCellRect = ScDrawLayer::GetCellRect( mrDoc, maPos, true );
mbNegPage = mrDoc.IsNegativePage( maPos.Tab() );
+ if( SdrPage* pDrawPage = GetDrawPage() )
+ {
+ maPageRect = Rectangle( Point( 0, 0 ), pDrawPage->GetSize() );
+ /* #i98141# SdrPage::GetSize() returns negative width in RTL mode.
+ The call to Rectangle::Adjust() orders left/right coordinate
+ accordingly. */
+ maPageRect.Justify();
+ }
+}
+
+// ============================================================================
- if( ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer() )
+/** Helper for creation of permanent caption drawing objects for cell notes. */
+class ScNoteCaptionCreator : public ScCaptionCreator
+{
+public:
+ /** Create a new caption object and inserts it into the document. */
+ explicit ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, ScNoteData& rNoteData );
+ /** Manipulate an existing caption. */
+ explicit ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj& rCaption, bool bShown );
+};
+
+// ----------------------------------------------------------------------------
+
+ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, ScNoteData& rNoteData ) :
+ ScCaptionCreator( rDoc, rPos ) // use helper c'tor that does not create the caption yet
+{
+ SdrPage* pDrawPage = GetDrawPage();
+ OSL_ENSURE( pDrawPage, "ScNoteCaptionCreator::ScNoteCaptionCreator - no drawing page" );
+ if( pDrawPage )
{
- if( SdrPage* pPage = pDrawLayer->GetPage( static_cast< sal_uInt16 >( maPos.Tab() ) ) )
+ // create the caption drawing object
+ CreateCaption( rNoteData.mbShown, false );
+ rNoteData.mpCaption = GetCaption();
+ OSL_ENSURE( rNoteData.mpCaption, "ScNoteCaptionCreator::ScNoteCaptionCreator - missing caption object" );
+ if( rNoteData.mpCaption )
{
- maPageRect = Rectangle( Point( 0, 0 ), pPage->GetSize() );
- /* #i98141# SdrPage::GetSize() returns negative width in RTL mode.
- The call to Rectangle::Adjust() orders left/right coordinate
- accordingly. */
- maPageRect.Justify();
+ // store note position in user data of caption object
+ ScCaptionUtil::SetCaptionUserData( *rNoteData.mpCaption, rPos );
+ // insert object into draw page
+ pDrawPage->InsertObject( rNoteData.mpCaption );
}
}
}
-Point ScCaptionCreator::CalcTailPos( bool bTailFront )
+ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj& rCaption, bool bShown ) :
+ ScCaptionCreator( rDoc, rPos, rCaption )
{
- // tail position
- bool bTailLeft = bTailFront != mbNegPage;
- Point aTailPos = bTailLeft ? maCellRect.TopLeft() : maCellRect.TopRight();
- // move caption point 1/10 mm inside cell
- if( bTailLeft ) aTailPos.X() += 10; else aTailPos.X() -= 10;
- aTailPos.Y() += 10;
- return aTailPos;
+ SdrPage* pDrawPage = GetDrawPage();
+ OSL_ENSURE( pDrawPage, "ScNoteCaptionCreator::ScNoteCaptionCreator - no drawing page" );
+ OSL_ENSURE( rCaption.GetPage() == pDrawPage, "ScNoteCaptionCreator::ScNoteCaptionCreator - wrong drawing page in caption" );
+ if( pDrawPage && (rCaption.GetPage() == pDrawPage) )
+ {
+ // store note position in user data of caption object
+ ScCaptionUtil::SetCaptionUserData( rCaption, rPos );
+ // basic caption settings
+ ScCaptionUtil::SetBasicCaptionSettings( rCaption, bShown );
+ // set correct tail position
+ rCaption.SetTailPos( CalcTailPos( false ) );
+ }
}
} // namespace
// ============================================================================
+struct ScCaptionInitData
+{
+ typedef ::std::auto_ptr< SfxItemSet > SfxItemSetPtr;
+ typedef ::std::auto_ptr< OutlinerParaObject > OutlinerParaObjPtr;
+
+ SfxItemSetPtr mxItemSet; /// Caption object formatting.
+ OutlinerParaObjPtr mxOutlinerObj; /// Text object with all text portion formatting.
+ ::rtl::OUString maSimpleText; /// Simple text without formatting.
+ Point maCaptionOffset; /// Caption position relative to cell corner.
+ Size maCaptionSize; /// Size of the caption object.
+ bool mbDefaultPosSize; /// True = use default position and size for caption.
+
+ explicit ScCaptionInitData();
+};
+
+// ----------------------------------------------------------------------------
+
+ScCaptionInitData::ScCaptionInitData() :
+ mbDefaultPosSize( true )
+{
+}
+
+// ============================================================================
+
ScNoteData::ScNoteData( bool bShown ) :
mpCaption( 0 ),
mbShown( bShown )
{
}
+ScNoteData::~ScNoteData()
+{
+}
+
// ============================================================================
ScPostIt::ScPostIt( ScDocument& rDoc, const ScAddress& rPos, bool bShown ) :
@@ -379,10 +524,12 @@ ScPostIt::ScPostIt( ScDocument& rDoc, const ScAddress& rPos, const ScPostIt& rNo
CreateCaption( rPos, rNote.maNoteData.mpCaption );
}
-ScPostIt::ScPostIt( ScDocument& rDoc, const ScNoteData& rNoteData ) :
+ScPostIt::ScPostIt( ScDocument& rDoc, const ScAddress& rPos, const ScNoteData& rNoteData, bool bAlwaysCreateCaption ) :
mrDoc( rDoc ),
maNoteData( rNoteData )
{
+ if( bAlwaysCreateCaption || maNoteData.mbShown )
+ CreateCaptionFromInitData( rPos );
}
ScPostIt::~ScPostIt()
@@ -390,164 +537,229 @@ ScPostIt::~ScPostIt()
RemoveCaption();
}
+ScPostIt* ScPostIt::Clone( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, bool bCloneCaption ) const
+{
+ CreateCaptionFromInitData( rOwnPos );
+ return bCloneCaption ? new ScPostIt( rDestDoc, rDestPos, *this ) : new ScPostIt( rDestDoc, rDestPos, maNoteData, false );
+}
+
void ScPostIt::AutoStamp()
{
maNoteData.maDate = ScGlobal::pLocaleData->getDate( Date() );
maNoteData.maAuthor = SvtUserOptions().GetID();
}
-const EditTextObject* ScPostIt::GetEditTextObject() const
+const OutlinerParaObject* ScPostIt::GetOutlinerObject() const
{
if( maNoteData.mpCaption )
- if( const OutlinerParaObject* pOPO = maNoteData.mpCaption->GetOutlinerParaObject() )
- return &pOPO->GetTextObject();
+ return maNoteData.mpCaption->GetOutlinerParaObject();
+ if( maNoteData.mxInitData.get() )
+ return maNoteData.mxInitData->mxOutlinerObj.get();
return 0;
}
-String ScPostIt::GetText() const
+const EditTextObject* ScPostIt::GetEditTextObject() const
+{
+ const OutlinerParaObject* pOPO = GetOutlinerObject();
+ return pOPO ? &pOPO->GetTextObject() : 0;
+}
+
+OUString ScPostIt::GetText() const
{
- String aText;
if( const EditTextObject* pEditObj = GetEditTextObject() )
{
+ OUStringBuffer aBuffer;
for( USHORT nPara = 0, nParaCount = pEditObj->GetParagraphCount(); nPara < nParaCount; ++nPara )
{
if( nPara > 0 )
- aText.Append( '\n' );
- aText.Append( pEditObj->GetText( nPara ) );
+ aBuffer.append( sal_Unicode( '\n' ) );
+ aBuffer.append( pEditObj->GetText( nPara ) );
}
+ return aBuffer.makeStringAndClear();
}
- return aText;
+ if( maNoteData.mxInitData.get() )
+ return maNoteData.mxInitData->maSimpleText;
+ return OUString();
}
bool ScPostIt::HasMultiLineText() const
{
- const EditTextObject* pEditObj = GetEditTextObject();
- return pEditObj && (pEditObj->GetParagraphCount() > 1);
+ if( const EditTextObject* pEditObj = GetEditTextObject() )
+ return pEditObj->GetParagraphCount() > 1;
+ if( maNoteData.mxInitData.get() )
+ return maNoteData.mxInitData->maSimpleText.indexOf( '\n' ) >= 0;
+ return false;
}
-void ScPostIt::SetText( const String& rText )
+void ScPostIt::SetText( const ScAddress& rPos, const OUString& rText )
{
+ CreateCaptionFromInitData( rPos );
if( maNoteData.mpCaption )
maNoteData.mpCaption->SetText( rText );
}
-void ScPostIt::ShowCaption( bool bShow )
+SdrCaptionObj* ScPostIt::GetOrCreateCaption( const ScAddress& rPos ) const
{
- maNoteData.mbShown = bShow;
- UpdateCaptionLayer( maNoteData.mbShown );
+ CreateCaptionFromInitData( rPos );
+ return maNoteData.mpCaption;
}
-void ScPostIt::ShowCaptionTemp( bool bShow )
+void ScPostIt::ForgetCaption()
{
- UpdateCaptionLayer( maNoteData.mbShown || bShow );
+ /* This function is used in undo actions to give up the responsibility for
+ the caption object which is handled by separate drawing undo actions. */
+ maNoteData.mpCaption = 0;
+ maNoteData.mxInitData.reset();
}
-void ScPostIt::UpdateCaptionPos( const ScAddress& rPos )
+void ScPostIt::ShowCaption( const ScAddress& rPos, bool bShow )
{
+ CreateCaptionFromInitData( rPos );
+ // no separate drawing undo needed, handled completely inside ScUndoShowHideNote
+ maNoteData.mbShown = bShow;
if( maNoteData.mpCaption )
- {
- ScCaptionCreator aCreator( mrDoc, rPos, *maNoteData.mpCaption );
- aCreator.UpdateCaptionPos();
- }
+ ScCaptionUtil::SetCaptionLayer( *maNoteData.mpCaption, bShow );
}
-void ScPostIt::SetCaptionDefaultItems()
+void ScPostIt::ShowCaptionTemp( const ScAddress& rPos, bool bShow )
{
+ CreateCaptionFromInitData( rPos );
if( maNoteData.mpCaption )
- {
- ScCaptionCreator aCreator( mrDoc, ScAddress(), *maNoteData.mpCaption );
- aCreator.SetDefaultItems();
- }
+ ScCaptionUtil::SetCaptionLayer( *maNoteData.mpCaption, maNoteData.mbShown || bShow );
}
-void ScPostIt::SetCaptionItems( const SfxItemSet& rItemSet )
+void ScPostIt::UpdateCaptionPos( const ScAddress& rPos )
{
+ CreateCaptionFromInitData( rPos );
if( maNoteData.mpCaption )
{
- ScCaptionCreator aCreator( mrDoc, ScAddress(), *maNoteData.mpCaption );
- aCreator.SetCaptionItems( rItemSet );
+ ScCaptionCreator aCreator( mrDoc, rPos, *maNoteData.mpCaption );
+ aCreator.UpdateCaptionPos();
}
}
// private --------------------------------------------------------------------
+void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const
+{
+ OSL_ENSURE( maNoteData.mpCaption || maNoteData.mxInitData.get(), "ScPostIt::CreateCaptionFromInitData - need caption object or initial caption data" );
+ if( maNoteData.mxInitData.get() )
+ {
+ /* This function is called from ScPostIt::Clone() when copying cells
+ to the clipboard/undo document, and when copying cells from the
+ clipboard/undo document. The former should always be called first,
+ so if called in an clipboard/undo document, the caption should have
+ been created already. */
+ OSL_ENSURE( !mrDoc.IsUndo() && !mrDoc.IsClipboard(), "ScPostIt::CreateCaptionFromInitData - note caption should not be created in undo/clip documents" );
+
+ if( !maNoteData.mpCaption )
+ {
+ // ScNoteCaptionCreator c'tor creates the caption and inserts it into the document and maNoteData
+ ScNoteCaptionCreator aCreator( mrDoc, rPos, maNoteData );
+ if( maNoteData.mpCaption )
+ {
+ ScCaptionInitData& rInitData = *maNoteData.mxInitData;
+
+ // transfer ownership of outliner object to caption, or set simple text
+ OSL_ENSURE( rInitData.mxOutlinerObj.get() || (rInitData.maSimpleText.getLength() > 0),
+ "ScPostIt::CreateCaptionFromInitData - need either outliner para object or simple text" );
+ if( rInitData.mxOutlinerObj.get() )
+ maNoteData.mpCaption->SetOutlinerParaObject( rInitData.mxOutlinerObj.release() );
+ else
+ maNoteData.mpCaption->SetText( rInitData.maSimpleText );
+
+ // copy all items or set default items; reset shadow items
+ ScCaptionUtil::SetDefaultItems( *maNoteData.mpCaption, mrDoc );
+ if( rInitData.mxItemSet.get() )
+ ScCaptionUtil::SetCaptionItems( *maNoteData.mpCaption, *rInitData.mxItemSet );
+
+ // set position and size of the caption object
+ if( rInitData.mbDefaultPosSize )
+ {
+ // set other items and fit caption size to text
+ maNoteData.mpCaption->SetMergedItem( SdrTextMinFrameWidthItem( SC_NOTECAPTION_WIDTH ) );
+ maNoteData.mpCaption->SetMergedItem( SdrTextMaxFrameWidthItem( SC_NOTECAPTION_MAXWIDTH_TEMP ) );
+ maNoteData.mpCaption->AdjustTextFrameWidthAndHeight();
+ aCreator.AutoPlaceCaption();
+ }
+ else
+ {
+ Rectangle aCellRect = ScDrawLayer::GetCellRect( mrDoc, rPos, true );
+ bool bNegPage = mrDoc.IsNegativePage( rPos.Tab() );
+ long nPosX = bNegPage ? (aCellRect.Left() - rInitData.maCaptionOffset.X()) : (aCellRect.Right() + rInitData.maCaptionOffset.X());
+ long nPosY = aCellRect.Top() + rInitData.maCaptionOffset.Y();
+ Rectangle aCaptRect( Point( nPosX, nPosY ), rInitData.maCaptionSize );
+ maNoteData.mpCaption->SetLogicRect( aCaptRect );
+ aCreator.FitCaptionToRect();
+ }
+ }
+ }
+ // forget the initial caption data struct
+ maNoteData.mxInitData.reset();
+ }
+}
+
void ScPostIt::CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCaption )
{
- DBG_ASSERT( !maNoteData.mpCaption, "ScPostIt::CreateCaption - unexpected caption object found" );
+ OSL_ENSURE( !maNoteData.mpCaption, "ScPostIt::CreateCaption - unexpected caption object found" );
maNoteData.mpCaption = 0;
// drawing layer may be missing, if a note is copied into a clipboard document
- DBG_ASSERT( !mrDoc.IsUndo(), "ScPostIt::CreateCaption - note caption should not be created in undo documents" );
+ OSL_ENSURE( !mrDoc.IsUndo(), "ScPostIt::CreateCaption - note caption should not be created in undo documents" );
if( mrDoc.IsClipboard() )
mrDoc.InitDrawLayer();
- if( ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer() )
+ // ScNoteCaptionCreator c'tor creates the caption and inserts it into the document and maNoteData
+ ScNoteCaptionCreator aCreator( mrDoc, rPos, maNoteData );
+ if( maNoteData.mpCaption )
{
- SdrPage* pDrawPage = pDrawLayer->GetPage( static_cast< sal_uInt16 >( rPos.Tab() ) );
- DBG_ASSERT( pDrawPage, "ScPostIt::CreateCaption - no drawing page" );
- if( pDrawPage )
+ // clone settings of passed caption
+ if( pCaption )
{
- // create the caption drawing object
- ScCaptionCreator aCreator( mrDoc, rPos, maNoteData.mbShown, false );
- maNoteData.mpCaption = aCreator.GetCaption();
-
- // additional user data (pass true to create the object data entry)
- ScDrawObjData* pData = ScDrawLayer::GetObjData( maNoteData.mpCaption, true );
- pData->maStart = rPos;
- pData->mbNote = true;
-
- // insert object into draw page
- pDrawPage->InsertObject( maNoteData.mpCaption );
-
- // clone settings of passed caption
- if( pCaption )
- {
- // copy edit text object (object must be inserted into page already)
- if( OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
- maNoteData.mpCaption->SetOutlinerParaObject( new OutlinerParaObject( *pOPO ) );
- // copy formatting items (after text has been copied to apply font formatting)
- maNoteData.mpCaption->SetMergedItemSetAndBroadcast( pCaption->GetMergedItemSet() );
- // move textbox position relative to new cell, copy textbox size
- Rectangle aCaptRect = pCaption->GetLogicRect();
- Point aDist = maNoteData.mpCaption->GetTailPos() - pCaption->GetTailPos();
- aCaptRect.Move( aDist.X(), aDist.Y() );
- maNoteData.mpCaption->SetLogicRect( aCaptRect );
- aCreator.FitCaptionToRect();
- }
- else
- {
- // set default formatting and default position
- aCreator.SetDefaultItems();
- aCreator.AutoPlaceCaption();
- }
+ // copy edit text object (object must be inserted into page already)
+ if( OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
+ maNoteData.mpCaption->SetOutlinerParaObject( new OutlinerParaObject( *pOPO ) );
+ // copy formatting items (after text has been copied to apply font formatting)
+ maNoteData.mpCaption->SetMergedItemSetAndBroadcast( pCaption->GetMergedItemSet() );
+ // move textbox position relative to new cell, copy textbox size
+ Rectangle aCaptRect = pCaption->GetLogicRect();
+ Point aDist = maNoteData.mpCaption->GetTailPos() - pCaption->GetTailPos();
+ aCaptRect.Move( aDist.X(), aDist.Y() );
+ maNoteData.mpCaption->SetLogicRect( aCaptRect );
+ aCreator.FitCaptionToRect();
+ }
+ else
+ {
+ // set default formatting and default position
+ ScCaptionUtil::SetDefaultItems( *maNoteData.mpCaption, mrDoc );
+ aCreator.AutoPlaceCaption();
+ }
- // create undo action
+ // create undo action
+ if( ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer() )
if( pDrawLayer->IsRecording() )
pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoNewObject( *maNoteData.mpCaption ) );
- }
}
}
void ScPostIt::RemoveCaption()
{
+
/* Remove caption object only, if this note is its owner (e.g. notes in
undo documents refer to captions in original document, do not remove
them from drawing layer here). */
- if( maNoteData.mpCaption && (mrDoc.GetDrawLayer() == maNoteData.mpCaption->GetModel()) )
+ ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer();
+ if( maNoteData.mpCaption && (pDrawLayer == maNoteData.mpCaption->GetModel()) )
{
+ OSL_ENSURE( pDrawLayer, "ScPostIt::RemoveCaption - object without drawing layer" );
SdrPage* pDrawPage = maNoteData.mpCaption->GetPage();
- DBG_ASSERT( pDrawPage, "ScPostIt::RemoveCaption - object without drawing page" );
+ OSL_ENSURE( pDrawPage, "ScPostIt::RemoveCaption - object without drawing page" );
if( pDrawPage )
{
- pDrawPage->RecalcObjOrdNums();
-
- ScDrawLayer* pDrawLayer = static_cast< ScDrawLayer* >( maNoteData.mpCaption->GetModel() );
- DBG_ASSERT( pDrawLayer, "ScPostIt::RemoveCaption - object without drawing layer" );
-
+ pDrawPage->RecalcObjOrdNums();
// create drawing undo action (before removing the object to have valid draw page in undo action)
if( pDrawLayer && pDrawLayer->IsRecording() )
pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoDeleteObject( *maNoteData.mpCaption ) );
-
// remove the object from the drawing page, delete if undo is disabled
pDrawPage->RemoveObject( maNoteData.mpCaption->GetOrdNum() );
}
@@ -555,21 +767,8 @@ void ScPostIt::RemoveCaption()
maNoteData.mpCaption = 0;
}
-void ScPostIt::UpdateCaptionLayer( bool bShow )
-{
- // no separate drawing undo needed, handled completely inside ScUndoShowHideNote
- SdrLayerID nLayer = bShow ? SC_LAYER_INTERN : SC_LAYER_HIDDEN;
- if( maNoteData.mpCaption && (nLayer != maNoteData.mpCaption->GetLayer()) )
- maNoteData.mpCaption->SetLayer( nLayer );
-}
-
// ============================================================================
-ScPostIt* ScNoteUtil::CloneNote( ScDocument& rDoc, const ScAddress& rPos, const ScPostIt& rNote, bool bCloneCaption )
-{
- return bCloneCaption ? new ScPostIt( rDoc, rPos, rNote ) : new ScPostIt( rDoc, rNote.GetNoteData() );
-}
-
void ScNoteUtil::UpdateCaptionPositions( ScDocument& rDoc, const ScRange& rRange )
{
// do not use ScCellIterator, it skips filtered and subtotal cells
@@ -580,25 +779,26 @@ void ScNoteUtil::UpdateCaptionPositions( ScDocument& rDoc, const ScRange& rRange
pNote->UpdateCaptionPos( aPos );
}
-SdrCaptionObj* ScNoteUtil::CreateTempCaption( ScDocument& rDoc, const ScAddress& rPos,
- SdrPage& rPage, const String& rUserText, const Rectangle& rVisRect, bool bTailFront )
+SdrCaptionObj* ScNoteUtil::CreateTempCaption(
+ ScDocument& rDoc, const ScAddress& rPos, SdrPage& rDrawPage,
+ const OUString& rUserText, const Rectangle& rVisRect, bool bTailFront )
{
- String aFinalText = rUserText;
+ OUStringBuffer aBuffer( rUserText );
// add plain text of invisible (!) cell note (no formatting etc.)
SdrCaptionObj* pNoteCaption = 0;
- if( ScPostIt* pNote = rDoc.GetNote( rPos ) )
+ if( const ScPostIt* pNote = rDoc.GetNote( rPos ) )
{
if( !pNote->IsCaptionShown() )
{
- if( aFinalText.Len() > 0 )
- aFinalText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n--------\n" ) );
- aFinalText.Append( pNote->GetText() );
- pNoteCaption = pNote->GetCaption();
+ if( aBuffer.getLength() > 0 )
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\n--------\n" ) );
+ aBuffer.append( pNote->GetText() );
+ pNoteCaption = pNote->GetOrCreateCaption( rPos );
}
}
// create a caption if any text exists
- if( aFinalText.Len() == 0 )
+ if( aBuffer.getLength() == 0 )
return 0;
// prepare visible rectangle (add default distance to all borders)
@@ -612,12 +812,12 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption( ScDocument& rDoc, const ScAddress&
ScCaptionCreator aCreator( rDoc, rPos, true, bTailFront );
SdrCaptionObj* pCaption = aCreator.GetCaption();
// insert caption into page (needed to set caption text)
- rPage.InsertObject( pCaption );
+ rDrawPage.InsertObject( pCaption );
// set the text to the object
- pCaption->SetText( aFinalText );
+ pCaption->SetText( aBuffer.makeStringAndClear() );
// set formatting (must be done after setting text) and resize the box to fit the text
- if( pNoteCaption && (rUserText.Len() == 0) )
+ if( pNoteCaption && (rUserText.getLength() == 0) )
{
pCaption->SetMergedItemSetAndBroadcast( pNoteCaption->GetMergedItemSet() );
Rectangle aCaptRect( pCaption->GetLogicRect().TopLeft(), pNoteCaption->GetLogicRect().GetSize() );
@@ -625,7 +825,7 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption( ScDocument& rDoc, const ScAddress&
}
else
{
- aCreator.SetDefaultItems();
+ ScCaptionUtil::SetDefaultItems( *pCaption, rDoc );
// adjust caption size to text size
long nMaxWidth = ::std::min< long >( aVisRect.GetWidth() * 2 / 3, SC_NOTECAPTION_MAXWIDTH_TEMP );
pCaption->SetMergedItem( SdrTextAutoGrowWidthItem( TRUE ) );
@@ -640,19 +840,74 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption( ScDocument& rDoc, const ScAddress&
return pCaption;
}
-ScPostIt* ScNoteUtil::CreateNoteFromString( ScDocument& rDoc, const ScAddress& rPos, const String& rNoteText, bool bShown )
+ScPostIt* ScNoteUtil::CreateNoteFromCaption(
+ ScDocument& rDoc, const ScAddress& rPos, SdrCaptionObj& rCaption, bool bShown )
{
- if( rNoteText.Len() == 0 )
- return 0;
- ScPostIt* pNote = new ScPostIt( rDoc, rPos, bShown );
+ ScNoteData aNoteData( bShown );
+ aNoteData.mpCaption = &rCaption;
+ ScPostIt* pNote = new ScPostIt( rDoc, rPos, aNoteData, false );
+ pNote->AutoStamp();
rDoc.TakeNote( rPos, pNote );
- if( SdrCaptionObj* pCaption = pNote->GetCaption() )
+ // if pNote still points to the note after TakeNote(), insertion was successful
+ if( pNote )
{
- pCaption->SetText( rNoteText );
- pNote->SetCaptionDefaultItems(); // reformat text with default font
- pCaption->SetMergedItem( SdrTextMinFrameWidthItem( SC_NOTECAPTION_WIDTH ) );
- pCaption->SetMergedItem( SdrTextMaxFrameWidthItem( SC_NOTECAPTION_MAXWIDTH_TEMP ) );
- pCaption->AdjustTextFrameWidthAndHeight();
+ // ScNoteCaptionCreator c'tor updates the caption object to be part of a note
+ ScNoteCaptionCreator aCreator( rDoc, rPos, rCaption, bShown );
+ }
+ return pNote;
+}
+
+ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
+ ScDocument& rDoc, const ScAddress& rPos, SfxItemSet* pItemSet,
+ OutlinerParaObject* pOutlinerObj, const Rectangle& rCaptionRect,
+ bool bShown, bool bAlwaysCreateCaption )
+{
+ OSL_ENSURE( pItemSet && pOutlinerObj, "ScNoteUtil::CreateNoteFromObjectData - item set and outliner object expected" );
+ ScNoteData aNoteData( bShown );
+ aNoteData.mxInitData.reset( new ScCaptionInitData );
+ ScCaptionInitData& rInitData = *aNoteData.mxInitData;
+ rInitData.mxItemSet.reset( pItemSet );
+ rInitData.mxOutlinerObj.reset( pOutlinerObj );
+
+ // convert absolute caption position to relative position
+ rInitData.mbDefaultPosSize = rCaptionRect.IsEmpty();
+ if( !rInitData.mbDefaultPosSize )
+ {
+ Rectangle aCellRect = ScDrawLayer::GetCellRect( rDoc, rPos, true );
+ bool bNegPage = rDoc.IsNegativePage( rPos.Tab() );
+ rInitData.maCaptionOffset.X() = bNegPage ? (aCellRect.Left() - rCaptionRect.Right()) : (rCaptionRect.Left() - aCellRect.Right());
+ rInitData.maCaptionOffset.Y() = rCaptionRect.Top() - aCellRect.Top();
+ rInitData.maCaptionSize = rCaptionRect.GetSize();
+ }
+
+ /* Create the note and insert it into the document. If the note is
+ visible, the caption object will be created automatically. */
+ ScPostIt* pNote = new ScPostIt( rDoc, rPos, aNoteData, bAlwaysCreateCaption );
+ pNote->AutoStamp();
+ rDoc.TakeNote( rPos, pNote );
+ // if pNote still points to the note after TakeNote(), insertion was successful
+ return pNote;
+}
+
+ScPostIt* ScNoteUtil::CreateNoteFromString(
+ ScDocument& rDoc, const ScAddress& rPos, const OUString& rNoteText,
+ bool bShown, bool bAlwaysCreateCaption )
+{
+ ScPostIt* pNote = 0;
+ if( rNoteText.getLength() > 0 )
+ {
+ ScNoteData aNoteData( bShown );
+ aNoteData.mxInitData.reset( new ScCaptionInitData );
+ ScCaptionInitData& rInitData = *aNoteData.mxInitData;
+ rInitData.maSimpleText = rNoteText;
+ rInitData.mbDefaultPosSize = true;
+
+ /* Create the note and insert it into the document. If the note is
+ visible, the caption object will be created automatically. */
+ pNote = new ScPostIt( rDoc, rPos, aNoteData, bAlwaysCreateCaption );
+ pNote->AutoStamp();
+ rDoc.TakeNote( rPos, pNote );
+ // if pNote still points to the note after TakeNote(), insertion was successful
}
return pNote;
}
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 37dce231cbaf..bad2c664cc4d 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -176,14 +176,8 @@ SfxItemSet& __EXPORT ScStyleSheet::GetItemSet()
if ( pDoc && pDoc->IsLoadingDone() )
{
// Setzen von sinnvollen Default-Werten:
- // SfxPrinter* pPrinter = pDoc->GetPrinter();
SvxPageItem aPageItem( ATTR_PAGE );
- // #50536# PaperBin auf Default lassen,
- // nicht auf aktuelle Drucker-Einstellung umsetzen
- // SvxSizeItem aPaperSizeItem(ATTR_PAGE_SIZE,SvxPaperInfo::GetPaperSize(pPrinter) );
-
- SvxPaper aDefaultPaper = SvxPaperInfo::GetDefaultSvxPaper( Application::GetSettings().GetLanguage() );
- SvxSizeItem aPaperSizeItem( ATTR_PAGE_SIZE, SvxPaperInfo::GetPaperSize(aDefaultPaper) );
+ SvxSizeItem aPaperSizeItem( ATTR_PAGE_SIZE, SvxPaperInfo::GetDefaultPaperSize() );
SvxSetItem aHFSetItem(
(const SvxSetItem&)
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 6546741860f7..671ef91e1dbf 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -114,6 +114,7 @@
#include "progress.hxx"
#include "hints.hxx" // fuer Paint-Broadcast
#include "prnsave.hxx"
+#include "tabprotection.hxx"
// STATIC DATA -----------------------------------------------------------
@@ -133,7 +134,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
bPageSizeValid( FALSE ),
nRepeatStartX( SCCOL_REPEAT_NONE ),
nRepeatStartY( SCROW_REPEAT_NONE ),
- bProtected( FALSE ),
+ pTabProtection( NULL ),
pColWidth( NULL ),
pRowHeight( NULL ),
pColFlags( NULL ),
@@ -141,6 +142,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
pOutlineTable( NULL ),
bTableAreaValid( FALSE ),
bVisible( TRUE ),
+ bPendingRowHeights( FALSE ),
nTab( nNewTab ),
nRecalcLvl( 0 ),
pDocument( pDoc ),
@@ -250,6 +252,11 @@ void ScTable::SetVisible( BOOL bVis )
bVisible = bVis;
}
+void ScTable::SetPendingRowHeights( BOOL bSet )
+{
+ bPendingRowHeights = bSet;
+}
+
void ScTable::SetLayoutRTL( BOOL bSet )
{
bLayoutRTL = bSet;
@@ -864,6 +871,10 @@ BOOL ScTable::ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
if (!ValidCol(nCol) || !ValidRow(nRow))
return FALSE;
+ if (pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_OVERLAPPED))
+ // Skip an overlapped cell.
+ return false;
+
if (bMarked && !rMark.IsCellMarked(nCol,nRow))
return FALSE;
@@ -906,7 +917,8 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
{
BOOL bUp = ( nMovY < 0 );
nRow = rMark.GetNextMarked( nCol, nRow, bUp );
- while ( VALIDROW(nRow) && pRowFlags && (pRowFlags->GetValue(nRow) & CR_HIDDEN) )
+ while ( VALIDROW(nRow) && ((pRowFlags && (pRowFlags->GetValue(nRow) & CR_HIDDEN)) ||
+ pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_OVERLAPPED)) )
{
// #53697# ausgeblendete ueberspringen (s.o.)
nRow += nMovY;
@@ -935,7 +947,8 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
else if (nRow > MAXROW)
nRow = 0;
nRow = rMark.GetNextMarked( nCol, nRow, bUp );
- while ( VALIDROW(nRow) && pRowFlags && (pRowFlags->GetValue(nRow) & CR_HIDDEN) )
+ while ( VALIDROW(nRow) && ((pRowFlags && (pRowFlags->GetValue(nRow) & CR_HIDDEN)) ||
+ pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_OVERLAPPED)) )
{
// #53697# ausgeblendete ueberspringen (s.o.)
nRow += nMovY;
@@ -1096,6 +1109,7 @@ void ScTable::UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nR
{
if ( nTab >= nTab1 && nTab <= nTab2 && nDz == 0 ) // only within the table
{
+ InitializeNoteCaptions();
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if ( eUpdateRefMode != URM_COPY && pDrawLayer )
{
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 6c1ecf660275..59858796078c 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -117,6 +117,7 @@ BOOL ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize )
void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize )
{
nRecalcLvl++;
+ InitializeNoteCaptions();
if (nStartCol==0 && nEndCol==MAXCOL)
{
if (pRowHeight && pRowFlags)
@@ -143,6 +144,7 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
BOOL* pUndoOutline )
{
nRecalcLvl++;
+ InitializeNoteCaptions();
if (nStartCol==0 && nEndCol==MAXCOL)
{
if (pRowHeight && pRowFlags)
@@ -186,6 +188,7 @@ BOOL ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize )
void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize )
{
nRecalcLvl++;
+ InitializeNoteCaptions();
if (nStartRow==0 && nEndRow==MAXROW)
{
if (pColWidth && pColFlags)
@@ -236,6 +239,7 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
BOOL* pUndoOutline )
{
nRecalcLvl++;
+ InitializeNoteCaptions();
if (nStartRow==0 && nEndRow==MAXROW)
{
if (pColWidth && pColFlags)
@@ -292,7 +296,7 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USH
// Zellschutz auf geschuetzter Tabelle nicht setzen
//
- if ( bProtected && (nDelFlag & IDF_ATTRIB) )
+ if ( IsProtected() && (nDelFlag & IDF_ATTRIB) )
{
ScPatternAttr aPattern(pDocument->GetPool());
aPattern.GetItemSet().Put( ScProtectionAttr( FALSE ) );
@@ -318,7 +322,7 @@ void ScTable::DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark )
// Zellschutz auf geschuetzter Tabelle nicht setzen
//
- if ( bProtected && (nDelFlag & IDF_ATTRIB) )
+ if ( IsProtected() && (nDelFlag & IDF_ATTRIB) )
{
ScDocumentPool* pPool = pDocument->GetPool();
SfxItemSet aSet( *pPool, ATTR_PATTERN_START, ATTR_PATTERN_END );
@@ -361,7 +365,7 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
// ggf. Formeln durch Werte ersetzen
- if (bProtected)
+ if ( IsProtected() )
for (i = nCol1; i <= nCol2; i++)
pTable->aCol[i].RemoveProtected(nRow1, nRow2);
}
@@ -406,7 +410,7 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
// Zellschutz auf geschuetzter Tabelle nicht setzen
//
- if ( bProtected && (nInsFlag & IDF_ATTRIB) )
+ if ( IsProtected() && (nInsFlag & IDF_ATTRIB) )
{
ScPatternAttr aPattern(pDocument->GetPool());
aPattern.GetItemSet().Put( ScProtectionAttr( FALSE ) );
@@ -484,9 +488,10 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
else // kopieren
{
+ ScAddress aOwnPos( nCol, nRow, nTab );
if (pCell->GetCellType() == CELLTYPE_FORMULA)
{
- pNew = pCell->CloneWithNote( *pDestDoc, aDestPos, SC_CLONECELL_STARTLISTENING );
+ pNew = pCell->CloneWithNote( aOwnPos, *pDestDoc, aDestPos, SC_CLONECELL_STARTLISTENING );
// Referenzen drehen
// bei Cut werden Referenzen spaeter per UpdateTranspose angepasst
@@ -495,7 +500,9 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
((ScFormulaCell*)pNew)->TransposeReference();
}
else
- pNew = pCell->CloneWithNote( *pDestDoc, aDestPos );
+ {
+ pNew = pCell->CloneWithNote( aOwnPos, *pDestDoc, aDestPos );
+ }
}
pTransClip->PutCell( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pNew );
}
@@ -623,38 +630,44 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
{
// Charts muessen beim Ein-/Ausblenden angepasst werden
ScChartListenerCollection* pCharts = pDestTab->pDocument->GetChartListenerCollection();
- if ( pCharts && !pCharts->GetCount() )
- pCharts = NULL;
- if (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth)
- for (SCCOL i=nCol1; i<=nCol2; i++)
- {
- BOOL bChange = pCharts &&
- ( pDestTab->pColFlags[i] & CR_HIDDEN ) != ( pColFlags[i] & CR_HIDDEN );
- pDestTab->pColWidth[i] = pColWidth[i];
- pDestTab->pColFlags[i] = pColFlags[i];
- //! Aenderungen zusammenfassen?
- if (bChange)
- pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, MAXROW, nTab ));
- }
+ BOOL bWidth = (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth);
+ BOOL bHeight = (nCol1==0 && nCol2==MAXCOL && pRowHeight && pDestTab->pRowHeight);
- if (nCol1==0 && nCol2==MAXCOL && pRowHeight && pDestTab->pRowHeight)
+ if (bWidth||bHeight)
{
- pDestTab->pRowHeight->CopyFrom( *pRowHeight, nRow1, nRow2);
- for (SCROW i=nRow1; i<=nRow2; i++)
+ pDestTab->IncRecalcLevel();
+
+ if (bWidth)
+ for (SCCOL i=nCol1; i<=nCol2; i++)
+ {
+ BOOL bChange = pCharts &&
+ ( pDestTab->pColFlags[i] & CR_HIDDEN ) != ( pColFlags[i] & CR_HIDDEN );
+ pDestTab->pColWidth[i] = pColWidth[i];
+ pDestTab->pColFlags[i] = pColFlags[i];
+ //! Aenderungen zusammenfassen?
+ if (bChange)
+ pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, MAXROW, nTab ));
+ }
+
+ if (bHeight)
{
- // TODO: might need some performance improvement, block
- // operations instead of single GetValue()/SetValue() calls.
- BYTE nThisRowFlags = pRowFlags->GetValue(i);
- BOOL bChange = pCharts &&
- ( pDestTab->pRowFlags->GetValue(i) & CR_HIDDEN ) != ( nThisRowFlags & CR_HIDDEN );
- pDestTab->pRowFlags->SetValue( i, nThisRowFlags );
- //! Aenderungen zusammenfassen?
- if (bChange)
- pCharts->SetRangeDirty(ScRange( 0, i, nTab, MAXCOL, i, nTab ));
+ pDestTab->pRowHeight->CopyFrom( *pRowHeight, nRow1, nRow2);
+ for (SCROW i=nRow1; i<=nRow2; i++)
+ {
+ // TODO: might need some performance improvement, block
+ // operations instead of single GetValue()/SetValue() calls.
+ BYTE nThisRowFlags = pRowFlags->GetValue(i);
+ BOOL bChange = pCharts &&
+ ( pDestTab->pRowFlags->GetValue(i) & CR_HIDDEN ) != ( nThisRowFlags & CR_HIDDEN );
+ pDestTab->pRowFlags->SetValue( i, nThisRowFlags );
+ //! Aenderungen zusammenfassen?
+ if (bChange)
+ pCharts->SetRangeDirty(ScRange( 0, i, nTab, MAXCOL, i, nTab ));
+ }
}
+ pDestTab->DecRecalcLevel();
}
-
pDestTab->SetOutlineTable( pOutlineTable ); // auch nur wenn bColRowFlags
}
}
@@ -894,7 +907,15 @@ ScPostIt* ScTable::GetNote( SCCOL nCol, SCROW nRow )
void ScTable::TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote )
{
if( ValidColRow( nCol, nRow ) )
+ {
aCol[ nCol ].TakeNote( nRow, rpNote );
+ if( rpNote && rpNote->GetNoteData().mxInitData.get() )
+ {
+ if( !mxUninitNotes.get() )
+ mxUninitNotes.reset( new ScAddress2DVec );
+ mxUninitNotes->push_back( ScAddress2D( nCol, nRow ) );
+ }
+ }
else
DELETEZ( rpNote );
}
@@ -913,6 +934,17 @@ void ScTable::DeleteNote( SCCOL nCol, SCROW nRow )
}
+void ScTable::InitializeNoteCaptions( bool bForced )
+{
+ if( mxUninitNotes.get() && (bForced || pDocument->IsUndoEnabled()) )
+ {
+ for( ScAddress2DVec::iterator aIt = mxUninitNotes->begin(), aEnd = mxUninitNotes->end(); aIt != aEnd; ++aIt )
+ if( ScPostIt* pNote = GetNote( aIt->first, aIt->second ) )
+ pNote->GetOrCreateCaption( ScAddress( aIt->first, aIt->second, nTab ) );
+ mxUninitNotes.reset();
+ }
+}
+
CellType ScTable::GetCellType( SCCOL nCol, SCROW nRow ) const
{
if (ValidColRow( nCol, nRow ))
@@ -1451,7 +1483,7 @@ BOOL ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
BOOL bIsEditable = TRUE;
if ( nLockCount )
bIsEditable = FALSE;
- else if ( bProtected && !pDocument->IsScenario(nTab) )
+ else if ( IsProtected() && !pDocument->IsScenario(nTab) )
{
if((bIsEditable = !HasAttrib( nCol1, nRow1, nCol2, nRow2, HASATTR_PROTECTED )) != FALSE)
{
@@ -1518,7 +1550,7 @@ BOOL ScTable::IsSelectionEditable( const ScMarkData& rMark,
BOOL bIsEditable = TRUE;
if ( nLockCount )
bIsEditable = FALSE;
- else if ( bProtected && !pDocument->IsScenario(nTab))
+ else if ( IsProtected() && !pDocument->IsScenario(nTab) )
{
if((bIsEditable = !HasAttribSelection( rMark, HASATTR_PROTECTED )) != FALSE)
{
@@ -1912,6 +1944,7 @@ void ScTable::SetColWidth( SCCOL nCol, USHORT nNewWidth )
if ( nNewWidth != pColWidth[nCol] )
{
nRecalcLvl++;
+ InitializeNoteCaptions();
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
pDrawLayer->WidthChanged( nTab, nCol, ((long) nNewWidth) - (long) pColWidth[nCol] );
@@ -1941,6 +1974,7 @@ void ScTable::SetRowHeight( SCROW nRow, USHORT nNewHeight )
if ( nNewHeight != nOldHeight )
{
nRecalcLvl++;
+ InitializeNoteCaptions();
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
pDrawLayer->HeightChanged( nTab, nRow, ((long) nNewHeight) - (long) nOldHeight );
@@ -1963,6 +1997,7 @@ BOOL ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeig
if (VALIDROW(nStartRow) && VALIDROW(nEndRow) && pRowHeight)
{
nRecalcLvl++;
+ InitializeNoteCaptions();
if (!nNewHeight)
{
DBG_ERROR("Zeilenhoehe 0 in SetRowHeight");
@@ -1971,7 +2006,7 @@ BOOL ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeig
long nNewPix = (long) ( nNewHeight * nPPTY );
- BOOL bSingle = FALSE;
+ BOOL bSingle = FALSE; // TRUE = process every row for its own
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
if (pDrawLayer->HasObjectsInRows( nTab, nStartRow, nEndRow ))
@@ -1997,7 +2032,23 @@ BOOL ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeig
if (*aIter != nNewHeight)
bChanged = (nNewPix != (long) (*aIter * nPPTY));
} while (!bChanged && aIter.NextRange());
- pRowHeight->SetValue( nStartRow, nEndRow, nNewHeight);
+
+ /* #i94028# #i94991# If drawing objects are involved, each row
+ has to be changed for its own, because each call to
+ ScDrawLayer::HeightChanged expects correct row heights
+ above passed row in the document. Cannot use array iterator
+ because array changes in every cycle. */
+ if( pDrawLayer )
+ {
+ for( SCROW nRow = nStartRow; nRow <= nEndRow ; ++nRow )
+ {
+ pDrawLayer->HeightChanged( nTab, nRow,
+ ((long) nNewHeight) - ((long) pRowHeight->GetValue( nRow )));
+ pRowHeight->SetValue( nRow, nNewHeight );
+ }
+ }
+ else
+ pRowHeight->SetValue( nStartRow, nEndRow, nNewHeight);
}
else
{
@@ -2213,6 +2264,7 @@ void ScTable::ShowCol(SCCOL nCol, BOOL bShow)
if (bWasVis != bShow)
{
nRecalcLvl++;
+ InitializeNoteCaptions();
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
{
@@ -2230,7 +2282,7 @@ void ScTable::ShowCol(SCCOL nCol, BOOL bShow)
SetDrawPageSize();
ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
- if ( pCharts && pCharts->GetCount() )
+ if ( pCharts )
pCharts->SetRangeDirty(ScRange( nCol, 0, nTab, nCol, MAXROW, nTab ));
}
}
@@ -2250,6 +2302,7 @@ void ScTable::ShowRow(SCROW nRow, BOOL bShow)
if (bWasVis != bShow)
{
nRecalcLvl++;
+ InitializeNoteCaptions();
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
{
@@ -2267,7 +2320,7 @@ void ScTable::ShowRow(SCROW nRow, BOOL bShow)
SetDrawPageSize();
ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
- if ( pCharts && pCharts->GetCount() )
+ if ( pCharts )
pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, MAXCOL, nRow, nTab ));
}
}
@@ -2285,6 +2338,7 @@ void ScTable::DBShowRow(SCROW nRow, BOOL bShow)
BYTE nFlags = pRowFlags->GetValue(nRow);
BOOL bWasVis = ( nFlags & CR_HIDDEN ) == 0;
nRecalcLvl++;
+ InitializeNoteCaptions();
if (bWasVis != bShow)
{
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
@@ -2308,7 +2362,7 @@ void ScTable::DBShowRow(SCROW nRow, BOOL bShow)
if (bWasVis != bShow)
{
ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
- if ( pCharts && pCharts->GetCount() )
+ if ( pCharts )
pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, MAXCOL, nRow, nTab ));
if (pOutlineTable)
@@ -2326,6 +2380,7 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow)
{
SCROW nStartRow = nRow1;
nRecalcLvl++;
+ InitializeNoteCaptions();
while (nStartRow <= nRow2)
{
BYTE nOldFlag = pRowFlags->GetValue(nStartRow) & CR_HIDDEN;
@@ -2356,7 +2411,7 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow)
if ( bChanged )
{
ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
- if ( pCharts && pCharts->GetCount() )
+ if ( pCharts )
pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab ));
}
@@ -2378,6 +2433,7 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow)
{
SCROW nStartRow = nRow1;
nRecalcLvl++;
+ InitializeNoteCaptions();
while (nStartRow <= nRow2)
{
BYTE nOldFlag = pRowFlags->GetValue(nStartRow) & CR_HIDDEN;
@@ -2408,7 +2464,7 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow)
if ( bChanged )
{
ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
- if ( pCharts && pCharts->GetCount() )
+ if ( pCharts )
pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab ));
}
@@ -2645,7 +2701,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
pCell = aCol[nCol].GetCell( nRow );
if (pCell)
if ( pCell->GetCellType() == CELLTYPE_FORMULA )
- if (((ScFormulaCell*)pCell)->HasOneReference( aRef ))
+ if (((ScFormulaCell*)pCell)->HasRefListExpressibleAsOneReference( aRef ))
if ( aRef.aStart.Col() == nCol && aRef.aEnd.Col() == nCol &&
aRef.aStart.Tab() == nTab && aRef.aEnd.Tab() == nTab &&
DiffSign( aRef.aStart.Row(), nRow ) ==
@@ -2676,7 +2732,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
while ( aIter.Next( nRow, pCell ) && !bFound )
{
if ( pCell->GetCellType() == CELLTYPE_FORMULA )
- if (((ScFormulaCell*)pCell)->HasOneReference( aRef ))
+ if (((ScFormulaCell*)pCell)->HasRefListExpressibleAsOneReference( aRef ))
if ( aRef.aStart.Row() == nRow && aRef.aEnd.Row() == nRow &&
aRef.aStart.Tab() == nTab && aRef.aEnd.Tab() == nTab &&
DiffSign( aRef.aStart.Col(), nCol ) ==
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 74f2a97e9c2e..ae299fdf5fca 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1022,12 +1022,19 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
}
}
else if ( (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) ||
+ (rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN ||
+ rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH ||
+ rEntry.eOp == SC_DOES_NOT_BEGIN_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) ||
(rEntry.bQueryByString && (pCell ? pCell->HasStringData() :
HasStringData(
static_cast<SCCOL>(rEntry.nField),
nRow))))
{ // by String
String aCellStr;
+ if( rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN
+ || rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH
+ || rEntry.eOp == SC_DOES_NOT_BEGIN_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH )
+ bMatchWholeCell = FALSE;
if ( pCell )
{
if (pCell->GetCellType() != CELLTYPE_NOTE)
@@ -1040,7 +1047,10 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
GetInputString( static_cast<SCCOL>(rEntry.nField), nRow, aCellStr );
BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
- || (rEntry.eOp == SC_NOT_EQUAL)));
+ || (rEntry.eOp == SC_NOT_EQUAL) || (rEntry.eOp == SC_CONTAINS)
+ || (rEntry.eOp == SC_DOES_NOT_CONTAIN) || (rEntry.eOp == SC_BEGINS_WITH)
+ || (rEntry.eOp == SC_ENDS_WITH) || (rEntry.eOp == SC_DOES_NOT_BEGIN_WITH)
+ || (rEntry.eOp == SC_DOES_NOT_END_WITH)));
BOOL bTestRegExp = (pbTestEqualCondition && rParam.bRegExp
&& ((rEntry.eOp == SC_LESS_EQUAL)
|| (rEntry.eOp == SC_GREATER_EQUAL)));
@@ -1048,20 +1058,61 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
{
xub_StrLen nStart = 0;
xub_StrLen nEnd = aCellStr.Len();
- BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens )
- ->SearchFrwrd( aCellStr, &nStart, &nEnd );
+
// from 614 on, nEnd is behind the found text
+ BOOL bMatch = FALSE;
+ if ( rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH )
+ {
+ nEnd = 0;
+ nStart = aCellStr.Len();
+ bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens )
+ ->SearchBkwrd( aCellStr, &nStart, &nEnd );
+ }
+ else
+ {
+ bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens )
+ ->SearchFrwrd( aCellStr, &nStart, &nEnd );
+ }
if ( bMatch && bMatchWholeCell
&& (nStart != 0 || nEnd != aCellStr.Len()) )
bMatch = FALSE; // RegExp must match entire cell string
if ( bRealRegExp )
- bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
+ switch (rEntry.eOp)
+ {
+ case SC_EQUAL:
+ case SC_CONTAINS:
+ bOk = bMatch;
+ break;
+ case SC_NOT_EQUAL:
+ case SC_DOES_NOT_CONTAIN:
+ bOk = !bMatch;
+ break;
+ case SC_BEGINS_WITH:
+ bOk = ( bMatch && (nStart == 0) );
+ break;
+ case SC_DOES_NOT_BEGIN_WITH:
+ bOk = !( bMatch && (nStart == 0) );
+ break;
+ case SC_ENDS_WITH:
+ bOk = ( bMatch && (nEnd == aCellStr.Len()) );
+ break;
+ case SC_DOES_NOT_END_WITH:
+ bOk = !( bMatch && (nEnd == aCellStr.Len()) );
+ break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
else
bTestEqual = bMatch;
}
if ( !bRealRegExp )
{
- if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL )
+ if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL
+ || rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN
+ || rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH
+ || rEntry.eOp == SC_DOES_NOT_BEGIN_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH )
{
if ( !rEntry.bQueryByString && rEntry.pStr->Len() == 0 )
{
@@ -1069,22 +1120,54 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
// the query value is assigned directly, and the string is empty. In that case,
// don't find any string (isEqual would find empty string results in formula cells).
bOk = FALSE;
+ if ( rEntry.eOp == SC_NOT_EQUAL )
+ bOk = !bOk;
}
else if ( bMatchWholeCell )
+ {
bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr );
+ if ( rEntry.eOp == SC_NOT_EQUAL )
+ bOk = !bOk;
+ }
else
{
- ::com::sun::star::uno::Sequence< sal_Int32 > xOff;
String aCell( pTransliteration->transliterate(
aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(),
- &xOff ) );
+ NULL ) );
String aQuer( pTransliteration->transliterate(
*rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(),
- &xOff ) );
- bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND);
+ NULL ) );
+ xub_StrLen nIndex = (rEntry.eOp == SC_ENDS_WITH
+ || rEntry.eOp == SC_DOES_NOT_END_WITH)? (aCell.Len()-aQuer.Len()):0;
+ xub_StrLen nStrPos = aCell.Search( aQuer, nIndex );
+ switch (rEntry.eOp)
+ {
+ case SC_EQUAL:
+ case SC_CONTAINS:
+ bOk = ( nStrPos != STRING_NOTFOUND );
+ break;
+ case SC_NOT_EQUAL:
+ case SC_DOES_NOT_CONTAIN:
+ bOk = ( nStrPos == STRING_NOTFOUND );
+ break;
+ case SC_BEGINS_WITH:
+ bOk = ( nStrPos == 0 );
+ break;
+ case SC_DOES_NOT_BEGIN_WITH:
+ bOk = ( nStrPos != 0 );
+ break;
+ case SC_ENDS_WITH:
+ bOk = ( nStrPos + aQuer.Len() == aCell.Len() );
+ break;
+ case SC_DOES_NOT_END_WITH:
+ bOk = ( nStrPos + aQuer.Len() != aCell.Len() );
+ break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
}
- if ( rEntry.eOp == SC_NOT_EQUAL )
- bOk = !bOk;
}
else
{ // use collator here because data was probably sorted
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index a29a34ebd7e3..fd725e96d124 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -106,7 +106,14 @@ short lcl_DecompValueString( String& aValue, sal_Int32& nVal, USHORT* pMinDigits
nNum = nNeg = 1;
while ( p[nNum] && CharClass::isAsciiNumeric( p[nNum] ) )
nNum++;
- if ( nNum > nNeg )
+
+ sal_Unicode cNext = p[nNum]; // 0 if at the end
+ sal_Unicode cLast = p[aValue.Len()-1];
+
+ // #i5550# If there are numbers at the beginning and the end,
+ // prefer the one at the beginning only if it's followed by a space.
+ // Otherwise, use the number at the end, to enable things like IP addresses.
+ if ( nNum > nNeg && ( cNext == 0 || cNext == ' ' || !CharClass::isAsciiNumeric(cLast) ) )
{ // number at the beginning
nVal = aValue.Copy( 0, nNum ).ToInt32();
// #60893# any number with a leading zero sets the minimum number of digits
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index a6ef174e326c..021385678160 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -51,8 +51,11 @@
#include "stlpool.hxx"
#include "stlsheet.hxx"
#include "brdcst.hxx"
+#include "tabprotection.hxx"
#include "globstr.hrc"
+using ::com::sun::star::uno::Sequence;
+
// STATIC DATA -----------------------------------------------------------
#define GET_SCALEVALUE(set,id) ((const SfxUInt16Item&)(set.Get( id ))).GetValue()
@@ -273,6 +276,24 @@ void ScTable::SetPageSize( const Size& rSize )
bPageSizeValid = FALSE;
}
+BOOL ScTable::IsProtected() const
+{
+ return pTabProtection.get() && pTabProtection->isProtected();
+}
+
+void ScTable::SetProtection(const ScTableProtection* pProtect)
+{
+ if (pProtect)
+ pTabProtection.reset(new ScTableProtection(*pProtect));
+ else
+ pTabProtection.reset(NULL);
+}
+
+ScTableProtection* ScTable::GetProtection()
+{
+ return pTabProtection.get();
+}
+
Size ScTable::GetPageSize() const
{
if ( bPageSizeValid )
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 443d0f23e3d0..9ca7b29b745e 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -219,7 +219,7 @@ BOOL ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
// NB: rich text format is lost.
// This is also true of Cells.
if( ScPostIt* pNote = pCell->GetNote() )
- pNote->SetText( aString );
+ pNote->SetText( ScAddress( nCol, nRow, nTab ), aString );
}
else if ( cMatrixFlag != MM_NONE )
{ // #60558# Matrix nicht zerreissen
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
new file mode 100644
index 000000000000..1620c5194e92
--- /dev/null
+++ b/sc/source/core/data/tabprotection.cxx
@@ -0,0 +1,465 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tabprotection.cxx,v $
+ * $Revision: 1.1.4.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+
+#include "tabprotection.hxx"
+#include "tools/debug.hxx"
+#include "svtools/PasswordHelper.hxx"
+#include "document.hxx"
+
+#define DEBUG_TAB_PROTECTION 0
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// ============================================================================
+
+bool ScPassHashHelper::needsPassHashRegen(const ScDocument& rDoc, ScPasswordHash eHash)
+{
+ if (rDoc.IsDocProtected())
+ {
+ const ScDocProtection* p = rDoc.GetDocProtection();
+ if (!p->isPasswordEmpty() && !p->hasPasswordHash(eHash))
+ return true;
+ }
+
+ SCTAB nTabCount = rDoc.GetTableCount();
+ for (SCTAB i = 0; i < nTabCount; ++i)
+ {
+ const ScTableProtection* p = rDoc.GetTabProtection(i);
+ if (!p || !p->isProtected())
+ // Sheet not protected. Skip it.
+ continue;
+
+ if (!p->isPasswordEmpty() && !p->hasPasswordHash(eHash))
+ return true;
+ }
+
+ return false;
+}
+
+// ============================================================================
+
+ScPassHashProtectable::~ScPassHashProtectable()
+{
+}
+
+// ============================================================================
+
+static sal_uInt16 lcl_getXLHashFromChar(const sal_Char* szPassword)
+{
+ sal_uInt16 cchPassword = static_cast< sal_uInt16 >( strlen(szPassword) );
+ sal_uInt16 wPasswordHash = 0;
+ if (!cchPassword)
+ return wPasswordHash;
+
+ const char* pch = &szPassword[cchPassword];
+ while (pch-- != szPassword)
+ {
+ wPasswordHash = ((wPasswordHash >> 14) & 0x01) |
+ ((wPasswordHash << 1) & 0x7fff);
+ wPasswordHash ^= *pch;
+ }
+
+ wPasswordHash = ((wPasswordHash >> 14) & 0x01) |
+ ((wPasswordHash << 1) & 0x7fff);
+
+ wPasswordHash ^= (0x8000 | ('N' << 8) | 'K');
+ wPasswordHash ^= cchPassword;
+
+ return wPasswordHash;
+}
+
+static Sequence<sal_Int8> lcl_getXLHash(const String& aPassText)
+{
+ const sal_Char* szBuf = OUStringToOString(OUString(aPassText), RTL_TEXTENCODING_UTF8).getStr();
+ sal_uInt16 nHash = lcl_getXLHashFromChar(szBuf);
+ Sequence<sal_Int8> aHash(2);
+ aHash[0] = (nHash >> 8) & 0xFF;
+ aHash[1] = nHash & 0xFF;
+ return aHash;
+}
+
+class ScTableProtectionImpl
+{
+public:
+ static ::com::sun::star::uno::Sequence<sal_Int8> hashPassword(const String& aPassText, ScPasswordHash eHash = PASSHASH_OOO);
+
+ explicit ScTableProtectionImpl(SCSIZE nOptSize);
+ explicit ScTableProtectionImpl(const ScTableProtectionImpl& r);
+
+ bool isProtected() const;
+ bool isProtectedWithPass() const;
+ void setProtected(bool bProtected);
+
+ bool isPasswordEmpty() const;
+ bool hasPasswordHash(ScPasswordHash eHash) const;
+ void setPassword(const String& aPassText);
+ ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const;
+ void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash = PASSHASH_OOO);
+ bool verifyPassword(const String& aPassText) const;
+
+ bool isOptionEnabled(SCSIZE nOptId) const;
+ void setOption(SCSIZE nOptId, bool bEnabled);
+
+private:
+ String maPassText;
+ ::com::sun::star::uno::Sequence<sal_Int8> maPassHash;
+ ::std::vector<bool> maOptions;
+ bool mbEmptyPass;
+ bool mbProtected;
+ ScPasswordHash meHash;
+};
+
+Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const String& aPassText, ScPasswordHash eHash)
+{
+ Sequence<sal_Int8> aHash;
+ switch (eHash)
+ {
+ case PASSHASH_XL:
+ aHash = lcl_getXLHash(aPassText);
+ break;
+ case PASSHASH_OOO:
+ default:
+ SvPasswordHelper::GetHashPassword(aHash, aPassText);
+ break;
+ }
+ return aHash;
+}
+
+ScTableProtectionImpl::ScTableProtectionImpl(SCSIZE nOptSize) :
+ maOptions(nOptSize),
+ mbEmptyPass(true),
+ mbProtected(false),
+ meHash(PASSHASH_OOO)
+{
+}
+
+ScTableProtectionImpl::ScTableProtectionImpl(const ScTableProtectionImpl& r) :
+ maPassText(r.maPassText),
+ maPassHash(r.maPassHash),
+ maOptions(r.maOptions),
+ mbEmptyPass(r.mbEmptyPass),
+ mbProtected(r.mbProtected),
+ meHash(r.meHash)
+{
+}
+
+bool ScTableProtectionImpl::isProtected() const
+{
+ return mbProtected;
+}
+
+bool ScTableProtectionImpl::isProtectedWithPass() const
+{
+ if (!mbProtected)
+ return false;
+
+ return maPassText.Len() || maPassHash.getLength();
+}
+
+void ScTableProtectionImpl::setProtected(bool bProtected)
+{
+ mbProtected = bProtected;
+ // We need to keep the old password even when the protection is off. So,
+ // don't erase the password data here.
+}
+
+void ScTableProtectionImpl::setPassword(const String& aPassText)
+{
+ // We can't hash it here because we don't know whether this document will
+ // get saved to Excel or ODF, depending on which we will need to use a
+ // different hashing algorithm. One alternative is to hash it using all
+ // hash algorithms that we support, and store them all.
+
+ maPassText = aPassText;
+ mbEmptyPass = aPassText.Len() == 0;
+ if (mbEmptyPass)
+ {
+ maPassHash = Sequence<sal_Int8>();
+ }
+}
+
+bool ScTableProtectionImpl::isPasswordEmpty() const
+{
+ return mbEmptyPass;
+}
+
+bool ScTableProtectionImpl::hasPasswordHash(ScPasswordHash eHash) const
+{
+ if (mbEmptyPass)
+ return true;
+
+ if (maPassText.Len())
+ return true;
+
+ if (meHash == eHash)
+ return true;
+
+ return false;
+}
+
+Sequence<sal_Int8> ScTableProtectionImpl::getPasswordHash(ScPasswordHash eHash) const
+{
+ if (mbEmptyPass)
+ // Flaged as empty.
+ return Sequence<sal_Int8>();
+
+ if (maPassText.Len())
+ // Cleartext password exists. Hash it.
+ return hashPassword(maPassText, eHash);
+
+ if (meHash == eHash)
+ // Stored hash exists.
+ return maPassHash;
+
+ // Failed to find a matching hash.
+ return Sequence<sal_Int8>();
+}
+
+void ScTableProtectionImpl::setPasswordHash(const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash)
+{
+ sal_Int32 nLen = aPassword.getLength();
+ mbEmptyPass = nLen <= 0 ? true : false;
+ meHash = eHash;
+ maPassHash = aPassword;
+
+#if DEBUG_TAB_PROTECTION
+ for (sal_Int32 i = 0; i < nLen; ++i)
+ printf("%2.2X ", static_cast<sal_uInt8>(aPassword[i]));
+ printf("\n");
+#endif
+}
+
+bool ScTableProtectionImpl::verifyPassword(const String& aPassText) const
+{
+#if DEBUG_TAB_PROTECTION
+ fprintf(stdout, "ScTableProtectionImpl::verifyPassword: input = '%s'\n",
+ OUStringToOString(rtl::OUString(aPassText), RTL_TEXTENCODING_UTF8).getStr());
+#endif
+
+ if (mbEmptyPass)
+ return aPassText.Len() == 0;
+
+ if (maPassText.Len())
+ // Clear text password exists, and this one takes precedence.
+ return aPassText.Equals(maPassText);
+
+ Sequence<sal_Int8> aHash = hashPassword(aPassText, meHash);
+
+#if DEBUG_TAB_PROTECTION
+ fprintf(stdout, "ScTableProtectionImpl::verifyPassword: hash = ");
+ for (sal_Int32 i = 0; i < aHash.getLength(); ++i)
+ printf("%2.2X ", static_cast<sal_uInt8>(aHash[i]));
+ printf("\n");
+#endif
+
+ return aHash == maPassHash;
+}
+
+bool ScTableProtectionImpl::isOptionEnabled(SCSIZE nOptId) const
+{
+ if ( maOptions.size() <= static_cast<size_t>(nOptId) )
+ {
+ DBG_ERROR("ScTableProtectionImpl::isOptionEnabled: wrong size");
+ return false;
+ }
+
+ return maOptions[nOptId];
+}
+
+void ScTableProtectionImpl::setOption(SCSIZE nOptId, bool bEnabled)
+{
+ if ( maOptions.size() <= static_cast<size_t>(nOptId) )
+ {
+ DBG_ERROR("ScTableProtectionImpl::setOption: wrong size");
+ return;
+ }
+
+ maOptions[nOptId] = bEnabled;
+}
+
+// ============================================================================
+
+ScDocProtection::ScDocProtection() :
+ mpImpl(new ScTableProtectionImpl(static_cast<SCSIZE>(ScDocProtection::NONE)))
+{
+}
+
+ScDocProtection::ScDocProtection(const ScDocProtection& r) :
+ ScPassHashProtectable(),
+ mpImpl(new ScTableProtectionImpl(*r.mpImpl))
+{
+}
+
+ScDocProtection::~ScDocProtection()
+{
+}
+
+bool ScDocProtection::isProtected() const
+{
+ return mpImpl->isProtected();
+}
+
+bool ScDocProtection::isProtectedWithPass() const
+{
+ return mpImpl->isProtectedWithPass();
+}
+
+void ScDocProtection::setProtected(bool bProtected)
+{
+ mpImpl->setProtected(bProtected);
+
+ // Currently Calc doesn't support document protection options. So, let's
+ // assume that when the document is protected, its structure is protected.
+ // We need to do this for Excel export.
+ mpImpl->setOption(ScDocProtection::STRUCTURE, bProtected);
+}
+
+bool ScDocProtection::isPasswordEmpty() const
+{
+ return mpImpl->isPasswordEmpty();
+}
+
+bool ScDocProtection::hasPasswordHash(ScPasswordHash eHash) const
+{
+ return mpImpl->hasPasswordHash(eHash);
+}
+
+void ScDocProtection::setPassword(const String& aPassText)
+{
+ mpImpl->setPassword(aPassText);
+}
+
+uno::Sequence<sal_Int8> ScDocProtection::getPasswordHash(ScPasswordHash eHash) const
+{
+ return mpImpl->getPasswordHash(eHash);
+}
+
+void ScDocProtection::setPasswordHash(const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash)
+{
+ mpImpl->setPasswordHash(aPassword, eHash);
+}
+
+bool ScDocProtection::verifyPassword(const String& aPassText) const
+{
+ return mpImpl->verifyPassword(aPassText);
+}
+
+bool ScDocProtection::isOptionEnabled(Option eOption) const
+{
+ return mpImpl->isOptionEnabled(eOption);
+}
+
+void ScDocProtection::setOption(Option eOption, bool bEnabled)
+{
+ mpImpl->setOption(eOption, bEnabled);
+}
+
+// ============================================================================
+
+ScTableProtection::ScTableProtection() :
+ mpImpl(new ScTableProtectionImpl(static_cast<SCSIZE>(ScTableProtection::NONE)))
+{
+ // Set default values for the options.
+ mpImpl->setOption(SELECT_LOCKED_CELLS, true);
+ mpImpl->setOption(SELECT_UNLOCKED_CELLS, true);
+}
+
+ScTableProtection::ScTableProtection(const ScTableProtection& r) :
+ ScPassHashProtectable(),
+ mpImpl(new ScTableProtectionImpl(*r.mpImpl))
+{
+}
+
+ScTableProtection::~ScTableProtection()
+{
+}
+
+bool ScTableProtection::isProtected() const
+{
+ return mpImpl->isProtected();
+}
+
+bool ScTableProtection::isProtectedWithPass() const
+{
+ return mpImpl->isProtectedWithPass();
+}
+
+void ScTableProtection::setProtected(bool bProtected)
+{
+ mpImpl->setProtected(bProtected);
+}
+
+bool ScTableProtection::isPasswordEmpty() const
+{
+ return mpImpl->isPasswordEmpty();
+}
+
+bool ScTableProtection::hasPasswordHash(ScPasswordHash eHash) const
+{
+ return mpImpl->hasPasswordHash(eHash);
+}
+
+void ScTableProtection::setPassword(const String& aPassText)
+{
+ mpImpl->setPassword(aPassText);
+}
+
+Sequence<sal_Int8> ScTableProtection::getPasswordHash(ScPasswordHash eHash) const
+{
+ return mpImpl->getPasswordHash(eHash);
+}
+
+void ScTableProtection::setPasswordHash(const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash)
+{
+ mpImpl->setPasswordHash(aPassword, eHash);
+}
+
+bool ScTableProtection::verifyPassword(const String& aPassText) const
+{
+ return mpImpl->verifyPassword(aPassText);
+}
+
+bool ScTableProtection::isOptionEnabled(Option eOption) const
+{
+ return mpImpl->isOptionEnabled(eOption);
+}
+
+void ScTableProtection::setOption(Option eOption, bool bEnabled)
+{
+ mpImpl->setOption(eOption, bEnabled);
+}
+
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 09c1db07c464..9bb8bff1081f 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -76,8 +76,9 @@ SV_IMPL_OP_PTRARR_SORT( ScValidationEntries_Impl, ScValidationDataPtr );
ScValidationData::ScValidationData( ScValidationMode eMode, ScConditionMode eOper,
const String& rExpr1, const String& rExpr2,
ScDocument* pDocument, const ScAddress& rPos,
- const formula::FormulaGrammar::Grammar eGrammar ) :
- ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, eGrammar ),
+ const String& rExprNmsp1, const String& rExprNmsp2,
+ FormulaGrammar::Grammar eGrammar1, FormulaGrammar::Grammar eGrammar2 ) :
+ ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2 ),
nKey( 0 ),
eDataMode( eMode ),
eErrorStyle( SC_VALERR_STOP ),
@@ -695,6 +696,40 @@ bool ScValidationData::GetSelectionFromFormula( TypedScStrCollection* pStrings,
SCSIZE nCol, nRow, nCols, nRows, n = 0;
pValues->GetDimensions( nCols, nRows );
+ BOOL bRef = FALSE;
+ ScRange aRange;
+
+ ScTokenArray* pArr = (ScTokenArray*) &rTokArr;
+ pArr->Reset();
+ ScToken* t = NULL;
+ if (pArr->GetLen() == 1 && (t = static_cast<ScToken*>(pArr->GetNextReferenceOrName())) != NULL)
+ {
+ if (t->GetOpCode() == ocDBArea)
+ {
+ if( ScDBData* pDBData = pDocument->GetDBCollection()->FindIndex( t->GetIndex() ) )
+ {
+ pDBData->GetArea(aRange);
+ bRef = TRUE;
+ }
+ }
+ else if (t->GetOpCode() == ocName)
+ {
+ ScRangeData* pName = pDocument->GetRangeName()->FindIndex( t->GetIndex() );
+ if (pName && pName->IsReference(aRange))
+ {
+ bRef = TRUE;
+ }
+ }
+ else if (t->GetType() != svIndex)
+ {
+ t->CalcAbsIfRel(rPos);
+ if (pArr->IsValidReference(aRange))
+ {
+ bRef = TRUE;
+ }
+ }
+ }
+
/* XL artificially limits things to a single col or row in the UI but does
* not list the constraint in MOOXml. If a defined name or INDIRECT
* resulting in 1D is entered in the UI and the definition later modified
@@ -735,7 +770,15 @@ bool ScValidationData::GetSelectionFromFormula( TypedScStrCollection* pStrings,
{
// FIXME FIXME FIXME
// Feature regression. Date formats are lost passing through the matrix
- pFormatter->GetInputLineString( pMatVal->fVal, 0, aValStr );
+ //pFormatter->GetInputLineString( pMatVal->fVal, 0, aValStr );
+ //For external reference and a formula that results in an area or array, date formats are still lost.
+ if ( bRef )
+ {
+ pDocument->GetInputString((SCCOL)(nCol+aRange.aStart.Col()),
+ (SCROW)(nRow+aRange.aStart.Row()), aRange.aStart.Tab() , aValStr);
+ }
+ else
+ pFormatter->GetInputLineString( pMatVal->fVal, 0, aValStr );
}
if( pCell && rMatch < 0 )
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
index 387535a770db..ef2f77b55684 100644
--- a/sc/source/core/inc/bcaslot.hxx
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -40,7 +40,10 @@
#include "global.hxx"
#include "brdcst.hxx"
-/// Used in a Unique Sorted Associative Container
+/**
+ Used in a Unique Associative Container.
+ */
+
class ScBroadcastArea
{
private:
@@ -62,32 +65,41 @@ public:
inline const ScAddress& GetStart() const { return aRange.aStart; }
inline const ScAddress& GetEnd() const { return aRange.aEnd; }
inline void IncRef() { ++nRefCount; }
- inline ULONG DecRef() { return --nRefCount; }
+ inline ULONG DecRef() { return nRefCount ? --nRefCount : 0; }
+ inline ULONG GetRef() { return nRefCount; }
inline ScBroadcastArea* GetUpdateChainNext() const { return pUpdateChainNext; }
inline void SetUpdateChainNext( ScBroadcastArea* p ) { pUpdateChainNext = p; }
inline BOOL IsInUpdateChain() const { return bInUpdateChain; }
inline void SetInUpdateChain( BOOL b ) { bInUpdateChain = b; }
- /** Strict weak sorting order, upper left corner and then lower right */
- inline bool operator<( const ScBroadcastArea& rArea ) const;
+ /** Equalness of this or range. */
+ inline bool operator==( const ScBroadcastArea & rArea ) const;
};
-inline bool ScBroadcastArea::operator<( const ScBroadcastArea& rArea ) const
+inline bool ScBroadcastArea::operator==( const ScBroadcastArea & rArea ) const
{
- return aRange < rArea.aRange;
+ return aRange == rArea.aRange;
}
//=============================================================================
-struct ScBroadcastAreaSort
+struct ScBroadcastAreaHash
+{
+ size_t operator()( const ScBroadcastArea* p ) const
+ {
+ return p->GetRange().hashArea();
+ }
+};
+
+struct ScBroadcastAreaEqual
{
bool operator()( const ScBroadcastArea* p1, const ScBroadcastArea* p2) const
{
- return *p1 < *p2;
+ return *p1 == *p2;
}
};
-typedef ::std::set< ScBroadcastArea*, ScBroadcastAreaSort > ScBroadcastAreas;
+typedef ::std::hash_set< ScBroadcastArea*, ScBroadcastAreaHash, ScBroadcastAreaEqual > ScBroadcastAreas;
//=============================================================================
@@ -125,20 +137,55 @@ private:
ScBroadcastAreas::iterator FindBroadcastArea( const ScRange& rRange ) const;
+ /**
+ More hypothetical (memory would probably be doomed anyway) check
+ whether there would be an overflow when adding an area, setting the
+ proper state if so.
+
+ @return TRUE if a HardRecalcState is effective and area is not to be
+ added.
+ */
+ bool CheckHardRecalcStateCondition() const;
+
public:
ScBroadcastAreaSlot( ScDocument* pDoc,
ScBroadcastAreaSlotMachine* pBASM );
~ScBroadcastAreaSlot();
const ScBroadcastAreas& GetBroadcastAreas() const
{ return aBroadcastAreaTbl; }
- void StartListeningArea( const ScRange& rRange,
+
+ /**
+ Only here new ScBroadcastArea objects are created, prevention of dupes.
+
+ @param rpArea
+ If NULL, a new ScBroadcastArea is created and assigned ton the
+ reference if a matching area wasn't found. If a matching area was
+ found, that is assigned. In any case, the SvtListener is added to
+ the broadcaster.
+
+ If not NULL then no listeners are startet, only the area is
+ inserted and the reference count incremented. Effectively the same
+ as InsertListeningArea(), so use that instead.
+
+ @return
+ TRUE if rpArea passed was NULL and ScBroadcastArea is newly
+ created.
+ */
+ bool StartListeningArea( const ScRange& rRange,
SvtListener* pListener,
ScBroadcastArea*& rpArea );
+
+ /**
+ Insert a ScBroadcastArea obtained via StartListeningArea() to
+ subsequent slots.
+ */
+ void InsertListeningArea( ScBroadcastArea* pArea );
+
void EndListeningArea( const ScRange& rRange,
SvtListener* pListener,
ScBroadcastArea*& rpArea );
BOOL AreaBroadcast( const ScHint& rHint ) const;
- // return: mindestens ein Broadcast gewesen
+ /// @return TRUE if at least one broadcast occurred.
BOOL AreaBroadcastInRange( const ScRange& rRange,
const ScHint& rHint ) const;
void DelBroadcastAreasInRange( const ScRange& rRange );
@@ -149,26 +196,61 @@ public:
};
-/*
- BroadcastAreaSlots und deren Verwaltung, einmal je Dokument
-
- +---+---+
- | 0 | 2 | Anordnung Cols/Rows
- +---+---+
- | 1 | 3 |
- +---+---+
+/**
+ BroadcastAreaSlots and their management, once per document.
*/
class ScBroadcastAreaSlotMachine
{
private:
- ScBroadcastAreasBulk aBulkBroadcastAreas;
- ScBroadcastAreaSlot** ppSlots;
- SvtBroadcaster* pBCAlways; // for the RC_ALWAYS special range
- ScDocument* pDoc;
- ScBroadcastArea* pUpdateChain;
- ScBroadcastArea* pEOUpdateChain;
- ULONG nInBulkBroadcast;
+
+ /**
+ Slot offset arrangement of columns and rows, once per sheet.
+
+ +---+---+
+ | 0 | 3 |
+ +---+---+
+ | 1 | 4 |
+ +---+---+
+ | 2 | 5 |
+ +---+---+
+ */
+
+ /* TODO: When going for 1M rows this will definitely need some change, or
+ * with lots of referred sheets even the reservation of NULL pointers would
+ * be a memory hog. */
+
+ class TableSlots
+ {
+ public:
+ TableSlots();
+ ~TableSlots();
+ inline ScBroadcastAreaSlot** getSlots() { return ppSlots; }
+
+ /**
+ Obtain slot pointer, no check on validity! It is assumed that
+ all calls are made with the result of ComputeSlotOfsset()
+ */
+ inline ScBroadcastAreaSlot* getAreaSlot( SCSIZE nOff ) { return *(ppSlots + nOff); }
+
+ private:
+ ScBroadcastAreaSlot** ppSlots;
+
+ // prevent usage
+ TableSlots( const TableSlots& );
+ TableSlots& operator=( const TableSlots& );
+ };
+
+ typedef ::std::map< SCTAB, TableSlots* > TableSlotsMap;
+
+private:
+ ScBroadcastAreasBulk aBulkBroadcastAreas;
+ TableSlotsMap aTableSlotsMap;
+ SvtBroadcaster *pBCAlways; // for the RC_ALWAYS special range
+ ScDocument *pDoc;
+ ScBroadcastArea *pUpdateChain;
+ ScBroadcastArea *pEOUpdateChain;
+ ULONG nInBulkBroadcast;
inline SCSIZE ComputeSlotOffset( const ScAddress& rAddress ) const;
void ComputeAreaPoints( const ScRange& rRange,
@@ -183,7 +265,7 @@ public:
void EndListeningArea( const ScRange& rRange,
SvtListener* pListener );
BOOL AreaBroadcast( const ScHint& rHint ) const;
- // return: mindestens ein Broadcast gewesen
+ // return: at least one broadcast occurred
BOOL AreaBroadcastInRange( const ScRange& rRange, const ScHint& rHint ) const;
void DelBroadcastAreasInRange( const ScRange& rRange );
void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode,
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 3d783e74c03d..9fcf743c1e85 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -70,6 +70,21 @@ struct ScCompare
}
};
+struct ScCompareOptions
+{
+ ScQueryEntry aQueryEntry;
+ bool bRegEx;
+ bool bMatchWholeCell;
+ bool bIgnoreCase;
+
+ ScCompareOptions( ScDocument* pDoc, const ScQueryEntry& rEntry, bool bReg );
+private:
+ // Not implemented, prevent usage.
+ ScCompareOptions();
+ ScCompareOptions( const ScCompareOptions & );
+ ScCompareOptions& operator=( const ScCompareOptions & );
+};
+
class ScToken;
#define MAXSTACK (4096 / sizeof(formula::FormulaToken*))
@@ -356,9 +371,16 @@ void ScChoseJump();
// Returns true if last jump was executed and result matrix pushed.
bool JumpMatrix( short nStackLevel );
-double CompareFunc( const ScCompare& rComp );
+/** @param pOptions
+ NULL means case sensitivity document option is to be used!
+ */
+double CompareFunc( const ScCompare& rComp, ScCompareOptions* pOptions = NULL );
double Compare();
-ScMatrixRef CompareMat();
+/** @param pOptions
+ NULL means case sensitivity document option is to be used!
+ */
+ScMatrixRef CompareMat( ScCompareOptions* pOptions = NULL );
+ScMatrixRef QueryMat( ScMatrix* pMat, ScCompareOptions& rOptions );
void ScEqual();
void ScNotEqual();
void ScLess();
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 1eb81b689ae7..b38d5b52e4f5 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -729,7 +729,7 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks )
{
const sal_Unicode* tmp1, *tmp2;
- String aExternDocName, aStartTabName, aEndTabName;
+ String aExternDocName, aStartTabName, aEndTabName; // for external link table
USHORT nFlags = SCA_VALID | SCA_VALID_TAB, nFlags2 = SCA_VALID_TAB;
#if 0
@@ -1126,39 +1126,48 @@ lcl_ScAddress_Parse ( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr,
bool ConvertSingleRef( ScDocument* pDoc, const String& rRefString,
SCTAB nDefTab, ScRefAddress& rRefAddress,
- const ScAddress::Details& rDetails )
+ const ScAddress::Details& rDetails,
+ ScAddress::ExternalInfo* pExtInfo /* = NULL */ )
{
- ScAddress aAddr( 0, 0, nDefTab );
- USHORT nRes = lcl_ScAddress_Parse( rRefString.GetBuffer(), pDoc, aAddr, rDetails, NULL );
- if( nRes & SCA_VALID )
+ bool bRet = false;
+ if (pExtInfo || (ScGlobal::FindUnquoted( rRefString, SC_COMPILER_FILE_TAB_SEP) == STRING_NOTFOUND))
{
- rRefAddress.Set( aAddr,
- ((nRes & SCA_COL_ABSOLUTE) == 0),
- ((nRes & SCA_ROW_ABSOLUTE) == 0),
- ((nRes & SCA_TAB_ABSOLUTE) == 0));
- return TRUE;
+ ScAddress aAddr( 0, 0, nDefTab );
+ USHORT nRes = aAddr.Parse( rRefString, pDoc, rDetails, pExtInfo);
+ if ( nRes & SCA_VALID )
+ {
+ rRefAddress.Set( aAddr,
+ ((nRes & SCA_COL_ABSOLUTE) == 0),
+ ((nRes & SCA_ROW_ABSOLUTE) == 0),
+ ((nRes & SCA_TAB_ABSOLUTE) == 0));
+ bRet = true;
+ }
}
- else
- return FALSE;
+ return bRet;
}
bool ConvertDoubleRef( ScDocument* pDoc, const String& rRefString, SCTAB nDefTab,
ScRefAddress& rStartRefAddress, ScRefAddress& rEndRefAddress,
- const ScAddress::Details& rDetails )
+ const ScAddress::Details& rDetails,
+ ScAddress::ExternalInfo* pExtInfo /* = NULL */ )
{
- BOOL bRet = FALSE;
- // FIXME : This will break for Lotus
- xub_StrLen nPos = rRefString.Search(':');
- if (nPos != STRING_NOTFOUND)
+ bool bRet = false;
+ if (pExtInfo || (ScGlobal::FindUnquoted( rRefString, SC_COMPILER_FILE_TAB_SEP) == STRING_NOTFOUND))
{
- String aTmp( rRefString );
- sal_Unicode* p = aTmp.GetBufferAccess();
- p[ nPos ] = 0;
- if( ConvertSingleRef( pDoc, p, nDefTab, rStartRefAddress, rDetails ) )
+ ScRange aRange( ScAddress( 0, 0, nDefTab));
+ USHORT nRes = aRange.Parse( rRefString, pDoc, rDetails, pExtInfo);
+ if ( nRes & SCA_VALID )
{
- nDefTab = rStartRefAddress.Tab();
- bRet = ConvertSingleRef( pDoc, p + nPos + 1, nDefTab, rEndRefAddress, rDetails );
+ rStartRefAddress.Set( aRange.aStart,
+ ((nRes & SCA_COL_ABSOLUTE) == 0),
+ ((nRes & SCA_ROW_ABSOLUTE) == 0),
+ ((nRes & SCA_TAB_ABSOLUTE) == 0));
+ rEndRefAddress.Set( aRange.aEnd,
+ ((nRes & SCA_COL2_ABSOLUTE) == 0),
+ ((nRes & SCA_ROW2_ABSOLUTE) == 0),
+ ((nRes & SCA_TAB2_ABSOLUTE) == 0));
+ bRet = true;
}
}
return bRet;
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 8cec6f99959a..d66cdae50f4c 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -42,6 +42,7 @@
using namespace com::sun::star;
using ::std::vector;
+using ::std::list;
using ::std::hash_set;
using ::std::auto_ptr;
using ::std::unary_function;
@@ -454,9 +455,24 @@ BOOL ScChartListener::operator==( const ScChartListener& r )
return *mpTokens == *r.mpTokens;
}
+// ============================================================================
+
+ScChartHiddenRangeListener::ScChartHiddenRangeListener()
+{
+}
+
+ScChartHiddenRangeListener::~ScChartHiddenRangeListener()
+{
+ // empty d'tor
+}
// === ScChartListenerCollection ======================================
+ScChartListenerCollection::RangeListenerItem::RangeListenerItem(const ScRange& rRange, ScChartHiddenRangeListener* p) :
+ maRange(rRange), mpListener(p)
+{
+}
+
ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) :
ScStrCollection( 4, 4, FALSE ),
pDoc( pDocP )
@@ -643,6 +659,14 @@ void ScChartListenerCollection::SetRangeDirty( const ScRange& rRange )
}
if ( bDirty )
StartTimer();
+
+ // New hidden range listener implementation
+ for (list<RangeListenerItem>::iterator itr = maHiddenListeners.begin(), itrEnd = maHiddenListeners.end();
+ itr != itrEnd; ++itr)
+ {
+ if (itr->maRange.Intersects(rRange))
+ itr->mpListener->notify();
+ }
}
@@ -682,6 +706,34 @@ BOOL ScChartListenerCollection::operator==( const ScChartListenerCollection& r )
return TRUE;
}
+void ScChartListenerCollection::StartListeningHiddenRange( const ScRange& rRange, ScChartHiddenRangeListener* pListener )
+{
+ RangeListenerItem aItem(rRange, pListener);
+ maHiddenListeners.push_back(aItem);
+}
+
+namespace {
+
+struct MatchListener : public ::std::unary_function<
+ ScChartListenerCollection::RangeListenerItem, bool>
+{
+ MatchListener(const ScChartHiddenRangeListener* pMatch) :
+ mpMatch(pMatch)
+ {
+ }
+
+ bool operator() (const ScChartListenerCollection::RangeListenerItem& rItem) const
+ {
+ return mpMatch == rItem.mpListener;
+ }
+private:
+ const ScChartHiddenRangeListener* mpMatch;
+};
+}
+void ScChartListenerCollection::EndListeningHiddenRange( ScChartHiddenRangeListener* pListener )
+{
+ maHiddenListeners.remove_if(MatchListener(pListener));
+}
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index dbc5298fc0dc..fff3122052bd 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -307,27 +307,18 @@ void ScChartPositioner::CheckColRowHeaders()
if ( aRangeListRef->Count() == 1 )
{
aRangeListRef->First()->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- // Beschriftungen auch nach hidden Cols/Rows finden
- while ( nCol1 <= nCol2 && (pDocument->GetColFlags(
- nCol1, nTab1) & CR_HIDDEN) != 0 )
- nCol1++;
- while ( nRow1 <= nRow2 && (pDocument->GetRowFlags(
- nRow1, nTab1) & CR_HIDDEN) != 0 )
- nRow1++;
if ( nCol1 > nCol2 || nRow1 > nRow2 )
bColStrings = bRowStrings = FALSE;
else
{
for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++)
{
- if ( iCol==nCol1 || (pDocument->GetColFlags( iCol, nTab1) & CR_HIDDEN) == 0 )
- if (pDocument->HasValueData( iCol, nRow1, nTab1 ))
+ if (pDocument->HasValueData( iCol, nRow1, nTab1 ))
bColStrings = FALSE;
}
for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++)
{
- if ( iRow==nRow1 || (pDocument->GetRowFlags( iRow, nTab1) & CR_HIDDEN) == 0 )
- if (pDocument->HasValueData( nCol1, iRow, nTab1 ))
+ if (pDocument->HasValueData( nCol1, iRow, nTab1 ))
bRowStrings = FALSE;
}
}
@@ -341,43 +332,22 @@ void ScChartPositioner::CheckColRowHeaders()
{
pR->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
BOOL bTopRow = (nRow1 == nStartRow);
- BOOL bHidOk;
if ( bRowStrings && (bVert || nCol1 == nStartCol) )
{ // NONE oder ROWS: RowStrings in jeder Selektion moeglich
// COLS oder BOTH: nur aus der ersten Spalte
- while ( nCol1 <= nCol2 && (pDocument->GetColFlags(
- nCol1, nTab1) & CR_HIDDEN) != 0 )
- nCol1++;
- while ( nRow1 <= nRow2 && (pDocument->GetRowFlags(
- nRow1, nTab1) & CR_HIDDEN) != 0 )
- nRow1++;
if ( nCol1 <= nCol2 )
for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++)
{
- if ( iRow==nRow1 || (pDocument->GetRowFlags( iRow, nTab1) & CR_HIDDEN) == 0 )
- if (pDocument->HasValueData( nCol1, iRow, nTab1 ))
+ if (pDocument->HasValueData( nCol1, iRow, nTab1 ))
bRowStrings = FALSE;
}
- bHidOk = TRUE;
}
- else
- bHidOk = FALSE;
if ( bColStrings && bTopRow )
{ // ColStrings nur aus der ersten Zeile
- if ( !bHidOk )
- {
- while ( nCol1 <= nCol2 && (pDocument->GetColFlags(
- nCol1, nTab1) & CR_HIDDEN) != 0 )
- nCol1++;
- while ( nRow1 <= nRow2 && (pDocument->GetRowFlags(
- nRow1, nTab1) & CR_HIDDEN) != 0 )
- nRow1++;
- }
if ( nRow1 <= nRow2 )
for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++)
{
- if ( iCol==nCol1 || (pDocument->GetColFlags( iCol, nTab1) & CR_HIDDEN) == 0 )
- if (pDocument->HasValueData( iCol, nRow1, nTab1 ))
+ if (pDocument->HasValueData( iCol, nRow1, nTab1 ))
bColStrings = FALSE;
}
}
@@ -439,40 +409,34 @@ void ScChartPositioner::CreatePositionMap()
static_cast<ULONG>(nCol1));
for ( nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol )
{
- if ( (pDocument->GetColFlags( nCol, nTab) & CR_HIDDEN) == 0 )
- {
- if ( bNoGlue || eGlue == SC_CHARTGLUE_ROWS )
- { // meistens gleiche Cols
- if ( (pCol = (Table*) pCols->Get( nInsCol ))==NULL )
- {
- pCols->Insert( nInsCol, pNewRowTable );
- pCol = pNewRowTable;
- pNewRowTable = new Table;
- }
+ if ( bNoGlue || eGlue == SC_CHARTGLUE_ROWS )
+ { // meistens gleiche Cols
+ if ( (pCol = (Table*) pCols->Get( nInsCol ))==NULL )
+ {
+ pCols->Insert( nInsCol, pNewRowTable );
+ pCol = pNewRowTable;
+ pNewRowTable = new Table;
}
- else
- { // meistens neue Cols
- if ( pCols->Insert( nInsCol, pNewRowTable ) )
- {
- pCol = pNewRowTable;
- pNewRowTable = new Table;
- }
- else
- pCol = (Table*) pCols->Get( nInsCol );
+ }
+ else
+ { // meistens neue Cols
+ if ( pCols->Insert( nInsCol, pNewRowTable ) )
+ {
+ pCol = pNewRowTable;
+ pNewRowTable = new Table;
}
- // bei anderer Tabelle wurde bereits neuer ColKey erzeugt,
- // die Zeilen muessen fuer's Dummy fuellen gleich sein!
- ULONG nInsRow = (bNoGlue ? nNoGlueRow : nRow1);
- for ( nRow = nRow1; nRow <= nRow2; nRow++, nInsRow++ )
+ else
+ pCol = (Table*) pCols->Get( nInsCol );
+ }
+ // bei anderer Tabelle wurde bereits neuer ColKey erzeugt,
+ // die Zeilen muessen fuer's Dummy fuellen gleich sein!
+ ULONG nInsRow = (bNoGlue ? nNoGlueRow : nRow1);
+ for ( nRow = nRow1; nRow <= nRow2; nRow++, nInsRow++ )
+ {
+ if ( pCol->Insert( nInsRow, pNewAddress ) )
{
- if ( (pDocument->GetRowFlags( nRow, nTab) & CR_HIDDEN) == 0 )
- {
- if ( pCol->Insert( nInsRow, pNewAddress ) )
- {
- pNewAddress->Set( nCol, nRow, nTab );
- pNewAddress = new ScAddress;
- }
- }
+ pNewAddress->Set( nCol, nRow, nTab );
+ pNewAddress = new ScAddress;
}
}
}
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 78b63c8c4622..5f1213e79b35 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2938,262 +2938,6 @@ void lcl_EnsureSorting( ScStrCollection& rCollection )
}
}
-
-BOOL ScChangeTrack::Load( SvStream& rStrm, USHORT nVer )
-{
- BOOL bOk = TRUE;
- SetLoadSave( TRUE );
-
- ScReadHeader aGlobalHdr( rStrm );
-
- BYTE n8;
- UINT16 n16;
- UINT32 n32;
-
- rStrm >> n16; nLoadedFileFormatVersion = n16;
- if ( (nLoadedFileFormatVersion & 0xFF00) > (SC_CHGTRACK_FILEFORMAT & 0xFF00) )
- { // inkompatible neuere Version
- Clear();
- rStrm.SetError( SCWARN_IMPORT_INFOLOST );
- return FALSE;
- }
-
- aUserCollection.Load( rStrm );
-
- ULONG nCount, nLastAction, nGeneratedCount;
- rStrm >> n32; nCount = n32;
- rStrm >> n32; nActionMax = n32;
- rStrm >> n32; nLastAction = n32;
-
- rStrm >> n32; nGeneratedCount = n32;
-
- // GeneratedDelContents laden
- {
- ScMultipleReadHeader aHdr( rStrm );
- for ( ULONG j = 0; j < nGeneratedCount && bOk; j++ )
- {
- ScChangeActionContent* pAct;
-
- aHdr.StartEntry();
-
- ScChangeActionType eType;
- rStrm >> n8; eType = (ScChangeActionType) n8;
-
- switch ( eType )
- {
- case SC_CAT_CONTENT :
- pAct = new ScChangeActionContent( rStrm, aHdr, pDoc, nVer, this );
- break;
- default:
- DBG_ERROR( "ScChangeTrack::Load: unknown GeneratedType" );
- pAct = NULL;
- bOk = FALSE;
- }
-
- aHdr.EndEntry();
-
- if ( pAct )
- {
- pAct->SetType( eType );
- if ( pFirstGeneratedDelContent )
- pFirstGeneratedDelContent->pPrev = pAct;
- pAct->pNext = pFirstGeneratedDelContent;
- pFirstGeneratedDelContent = pAct;
- aGeneratedTable.Insert( pAct->GetActionNumber(), pAct );
- }
- }
- rStrm >> n32; nGeneratedMin = n32;
- }
-
- if ( bOk )
- bOk = ( nGeneratedCount == aGeneratedTable.Count() );
- DBG_ASSERT( bOk, "ScChangeTrack::Load: Generated failed" );
-
-
- // erste Runde: Actions laden
- {
- ScMultipleReadHeader aHdr( rStrm );
- for ( ULONG j = 0; j < nCount && bOk; j++ )
- {
- ScChangeAction* pAct;
-
- aHdr.StartEntry();
-
- USHORT nUserIndex;
- rStrm >> n16; nUserIndex = n16;
-
- ScChangeActionType eType;
- rStrm >> n8; eType = (ScChangeActionType) n8;
-
- switch ( eType )
- {
- case SC_CAT_INSERT_COLS :
- case SC_CAT_INSERT_ROWS :
- case SC_CAT_INSERT_TABS :
- pAct = new ScChangeActionIns( rStrm, aHdr, this );
- break;
- case SC_CAT_DELETE_COLS :
- case SC_CAT_DELETE_ROWS :
- case SC_CAT_DELETE_TABS :
- pAct = new ScChangeActionDel( rStrm, aHdr, pDoc, nVer, this );
- break;
- case SC_CAT_MOVE :
- pAct = new ScChangeActionMove( rStrm, aHdr, this );
- break;
- case SC_CAT_CONTENT :
- pAct = new ScChangeActionContent( rStrm, aHdr, pDoc, nVer, this );
- break;
- case SC_CAT_REJECT :
- pAct = new ScChangeActionReject( rStrm, aHdr, this );
- break;
- default:
- DBG_ERROR( "ScChangeTrack::Load: unknown ScChangeActionType" );
- pAct = NULL;
- bOk = FALSE;
- }
-
- aHdr.EndEntry();
-
- if ( pAct )
- {
- pAct->SetType( eType );
- if ( nUserIndex != 0xffff )
- {
- StrData* pUser = (StrData*) aUserCollection.At( nUserIndex );
- if ( pUser )
- pAct->SetUser( pUser->GetString() );
- }
- AppendLoaded( pAct );
- }
- }
- }
-
- if ( pLast )
- nMarkLastSaved = pLast->GetActionNumber();
-
- if ( bOk )
- bOk = ( nMarkLastSaved == nLastAction && nCount == aTable.Count() );
- DBG_ASSERT( bOk, "ScChangeTrack::Load: failed" );
-
- // zweite Runde: Links laden und alles verpointern
- {
- ScMultipleReadHeader aHdr( rStrm );
- for ( ScChangeAction* p = GetFirst(); p && bOk; p = p->GetNext() )
- {
- aHdr.StartEntry();
- bOk = p->LoadLinks( rStrm, this );
- aHdr.EndEntry();
- }
- }
-
- SetLoadSave( FALSE );
-
- // versions between 583 and 633 had the sorting wrong -> correct (after loading the actions)
- lcl_EnsureSorting( aUserCollection );
-
- // den aktuellen User erst einfuegen, wenn die Actions bereits ihre User haben
- SetUser( aUser );
-
- if ( !bOk )
- {
- Clear(); // eindeutiger Zustand
- rStrm.SetError( SCWARN_IMPORT_INFOLOST );
- }
-
- return bOk;
-}
-
-
-BOOL ScChangeTrack::Store( SvStream& rStrm )
-{
- BOOL bOk = TRUE;
- SetLoadSave( TRUE );
-
- ScWriteHeader aGlobalHdr( rStrm );
-
- rStrm << (UINT16) SC_CHGTRACK_FILEFORMAT;
-
- aUserCollection.Store( rStrm );
-
- ULONG nCount = aTable.Count();
- ULONG nLastAction = ( pLast ? pLast->GetActionNumber() : 0 );
- ULONG nGeneratedCount = aGeneratedTable.Count();
- rStrm << (UINT32) nCount << (UINT32) nActionMax << (UINT32) nLastAction;
- rStrm << (UINT32) nGeneratedCount;
-
- // GeneratedDelContents speichern
- ULONG nSave = 0;
- {
- ScMultipleWriteHeader aHdr( rStrm );
- ULONG nNewGeneratedMin = SC_CHGTRACK_GENERATED_START;
- for ( ScChangeAction* p = pFirstGeneratedDelContent; p && bOk;
- p = p->GetNext() )
- {
- ++nSave;
- aHdr.StartEntry();
- rStrm << (BYTE) p->GetType();
- bOk = p->Store( rStrm, aHdr );
- aHdr.EndEntry();
- ULONG nAct = p->GetActionNumber();
- if ( nNewGeneratedMin > nAct )
- nNewGeneratedMin = nAct;
- }
- nGeneratedMin = nNewGeneratedMin; // evtl. unbenutzten Bereich freigeben
- rStrm << (UINT32) nGeneratedMin;
- }
-
- if ( bOk )
- bOk = ( nGeneratedCount == nSave );
- DBG_ASSERT( bOk, "ScChangeTrack::Store: failed" );
-
- // erste Runde: Actions speichern
- nSave = 0;
- {
- ScMultipleWriteHeader aHdr( rStrm );
- StrData* pUserSearch = new StrData( aUser );
- USHORT nUserIndex;
- for ( ScChangeAction* p = GetFirst(); p && bOk; p = p->GetNext() )
- {
- ++nSave;
- aHdr.StartEntry();
-
- pUserSearch->SetString( p->GetUser() );
- if ( aUserCollection.Search( pUserSearch, nUserIndex ) )
- rStrm << (UINT16) nUserIndex;
- else
- rStrm << (UINT16) 0xffff;
- rStrm << (BYTE) p->GetType();
-
- bOk = p->Store( rStrm, aHdr );
-
- aHdr.EndEntry();
- }
- delete pUserSearch;
- }
-
- if ( pLast )
- nMarkLastSaved = pLast->GetActionNumber();
-
- if ( bOk )
- bOk = ( nCount == nSave );
- DBG_ASSERT( bOk, "ScChangeTrack::Store: failed" );
-
- // zweite Runde: Links speichern
- {
- ScMultipleWriteHeader aHdr( rStrm );
- for ( ScChangeAction* p = GetFirst(); p && bOk; p = p->GetNext() )
- {
- aHdr.StartEntry();
- bOk = p->StoreLinks( rStrm );
- aHdr.EndEntry();
- }
- }
-
- SetLoadSave( FALSE );
- return bOk;
-}
-
-
void ScChangeTrack::MasterLinks( ScChangeAction* pAppend )
{
ScChangeActionType eType = pAppend->GetType();
@@ -5107,8 +4851,13 @@ BOOL ScChangeTrack::RejectAll()
}
-BOOL ScChangeTrack::Reject( ScChangeAction* pAct )
+BOOL ScChangeTrack::Reject( ScChangeAction* pAct, bool bShared )
{
+ // #i100895# When collaboration changes are reversed, it must be possible
+ // to reject a deleted row above another deleted row.
+ if ( bShared && pAct->IsDeletedIn() )
+ pAct->RemoveAllDeletedIn();
+
if ( !pAct->IsRejectable() )
return FALSE;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 90029b6ac0c1..2b66663f3ee9 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -68,11 +68,14 @@
#include "cell.hxx"
#include "dociter.hxx"
#include "docoptio.hxx"
-#include "formula/errorcodes.hxx"
+#include <formula/errorcodes.hxx>
#include "parclass.hxx"
#include "autonamecache.hxx"
#include "externalrefmgr.hxx"
#include "rangeutl.hxx"
+#include "convuno.hxx"
+#include "tokenuno.hxx"
+#include "formulaparserpool.hxx"
using namespace formula;
using namespace ::com::sun::star;
@@ -408,28 +411,36 @@ void ScCompiler::InitCharClassEnglish()
void ScCompiler::SetGrammar( const FormulaGrammar::Grammar eGrammar )
{
- DBG_ASSERT( eGrammar != FormulaGrammar::GRAM_UNSPECIFIED, "ScCompiler::SetGrammar: don't passFormulaGrammar::GRAM_UNSPECIFIED");
+ DBG_ASSERT( eGrammar != FormulaGrammar::GRAM_UNSPECIFIED, "ScCompiler::SetGrammar: don't pass FormulaGrammar::GRAM_UNSPECIFIED");
if (eGrammar == GetGrammar())
return; // nothing to be done
- FormulaGrammar::Grammar eMyGrammar = eGrammar;
- const sal_Int32 nFormulaLanguage = FormulaGrammar::extractFormulaLanguage( eMyGrammar);
- OpCodeMapPtr xMap( GetOpCodeMap( nFormulaLanguage));
- DBG_ASSERT( xMap, "ScCompiler::SetGrammar: unknown formula language");
- if (!xMap)
+ if( eGrammar == FormulaGrammar::GRAM_EXTERNAL )
{
- xMap = GetOpCodeMap( ::com::sun::star::sheet::FormulaLanguage::NATIVE);
- eMyGrammar = xMap->getGrammar();
+ meGrammar = eGrammar;
+ mxSymbols = GetOpCodeMap( ::com::sun::star::sheet::FormulaLanguage::NATIVE);
}
+ else
+ {
+ FormulaGrammar::Grammar eMyGrammar = eGrammar;
+ const sal_Int32 nFormulaLanguage = FormulaGrammar::extractFormulaLanguage( eMyGrammar);
+ OpCodeMapPtr xMap = GetOpCodeMap( nFormulaLanguage);
+ DBG_ASSERT( xMap, "ScCompiler::SetGrammar: unknown formula language");
+ if (!xMap)
+ {
+ xMap = GetOpCodeMap( ::com::sun::star::sheet::FormulaLanguage::NATIVE);
+ eMyGrammar = xMap->getGrammar();
+ }
- // Save old grammar for call to SetGrammarAndRefConvention().
- FormulaGrammar::Grammar eOldGrammar = GetGrammar();
- // This also sets the grammar associated with the map!
- SetFormulaLanguage( xMap);
+ // Save old grammar for call to SetGrammarAndRefConvention().
+ FormulaGrammar::Grammar eOldGrammar = GetGrammar();
+ // This also sets the grammar associated with the map!
+ SetFormulaLanguage( xMap);
- // Override if necessary.
- if (eMyGrammar != GetGrammar())
- SetGrammarAndRefConvention( eMyGrammar, eOldGrammar);
+ // Override if necessary.
+ if (eMyGrammar != GetGrammar())
+ SetGrammarAndRefConvention( eMyGrammar, eOldGrammar);
+ }
}
@@ -1811,9 +1822,11 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArra
aPos( rPos ),
pCharClass( ScGlobal::pCharClass ),
mnPredetectedReference(0),
+ mnRangeOpPosInSymbol(-1),
pConv( pConvOOO_A1 ),
mbCloseBrackets( true ),
- mbExtendedErrorDetection( false )
+ mbExtendedErrorDetection( false ),
+ mbRewind( false )
{
nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
}
@@ -1824,9 +1837,11 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
aPos( rPos ),
pCharClass( ScGlobal::pCharClass ),
mnPredetectedReference(0),
+ mnRangeOpPosInSymbol(-1),
pConv( pConvOOO_A1 ),
mbCloseBrackets( true ),
- mbExtendedErrorDetection( false )
+ mbExtendedErrorDetection( false ),
+ mbRewind( false )
{
nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
}
@@ -1962,7 +1977,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray)
sal_Unicode c = *pSrc;
sal_Unicode cLast = 0;
bool bQuote = false;
- bool bRangeOp = false;
+ mnRangeOpPosInSymbol = -1;
ScanState eState = ssGetChar;
xub_StrLen nSpaces = 0;
sal_Unicode cSep = mxSymbols->getSymbol( ocSep).GetChar(0);
@@ -2110,11 +2125,11 @@ Label_MaskStateMachine:
else
*pSym++ = c;
}
- else if (c == ':' && !bRangeOp)
+ else if (c == ':' && mnRangeOpPosInSymbol < 0)
{
// One range operator may form Sheet1.A:A, which we need to
// pass as one entity to IsReference().
- bRangeOp = true;
+ mnRangeOpPosInSymbol = pSym - &cSymbol[0];
if( pSym == &cSymbol[ MAXSTRLEN-1 ] )
{
SetError(errStringOverflow);
@@ -2409,7 +2424,7 @@ Label_MaskStateMachine:
{
nSrcPos = sal::static_int_cast<xub_StrLen>( nSrcPos + nSpaces );
String aSymbol;
- bRangeOp = false;
+ mnRangeOpPosInSymbol = -1;
USHORT nErr = 0;
do
{
@@ -2438,9 +2453,9 @@ Label_MaskStateMachine:
bi18n = (c == cSheetSep || c == SC_COMPILER_FILE_TAB_SEP);
}
// One range operator restarts parsing for second reference.
- if (c == ':' && !bRangeOp)
+ if (c == ':' && mnRangeOpPosInSymbol < 0)
{
- bRangeOp = true;
+ mnRangeOpPosInSymbol = aSymbol.Len();
bi18n = true;
}
if ( bi18n )
@@ -2460,6 +2475,14 @@ Label_MaskStateMachine:
nSrcPos = sal::static_int_cast<xub_StrLen>( pSrc - pStart );
*pSym = 0;
}
+ if (mnRangeOpPosInSymbol >= 0 && mnRangeOpPosInSymbol == (pSym-1) - &cSymbol[0])
+ {
+ // This is a trailing range operator, which is nonsense. Will be caught
+ // in next round.
+ mnRangeOpPosInSymbol = -1;
+ *--pSym = 0;
+ --nSrcPos;
+ }
if ( bAutoCorrect )
aCorrectedSymbol = cSymbol;
if (bAutoIntersection && nSpaces > 1)
@@ -2835,8 +2858,21 @@ BOOL ScCompiler::IsReference( const String& rName )
// Though the range operator is handled explicitly, when encountering
// something like Sheet1.A:A we will have to treat it as one entity if it
// doesn't pass as single cell reference.
- if (ScGlobal::FindUnquoted( rName, ':') != STRING_NOTFOUND)
- return IsDoubleReference( rName);
+ if (mnRangeOpPosInSymbol > 0) // ":foo" would be nonsense
+ {
+ if (IsDoubleReference( rName))
+ return true;
+ // Now try with a symbol up to the range operator, rewind source
+ // position.
+ sal_Int32 nLen = mnRangeOpPosInSymbol;
+ while (cSymbol[++nLen])
+ ;
+ cSymbol[mnRangeOpPosInSymbol] = 0;
+ nSrcPos -= static_cast<xub_StrLen>(nLen - mnRangeOpPosInSymbol);
+ mnRangeOpPosInSymbol = -1;
+ mbRewind = true;
+ return true; // end all checks
+ }
return false;
}
@@ -3443,6 +3479,23 @@ void ScCompiler::AutoCorrectParsedSymbol()
}
}
+inline bool lcl_UpperAsciiOrI18n( String& rUpper, const String& rOrg, FormulaGrammar::Grammar eGrammar )
+{
+ if (FormulaGrammar::isODFF( eGrammar ))
+ {
+ // ODFF has a defined set of English function names, avoid i18n
+ // overhead.
+ rUpper = rOrg;
+ rUpper.ToUpperAscii();
+ return true;
+ }
+ else
+ {
+ rUpper = ScGlobal::pCharClass->upper( rOrg );
+ return false;
+ }
+}
+
BOOL ScCompiler::NextNewToken( bool bInArray )
{
bool bAllowBooleans = bInArray;
@@ -3453,115 +3506,180 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
rtl::OUStringToOString( cSymbol, RTL_TEXTENCODING_UTF8 ).getStr(), nSpaces );
#endif
- ScRawToken aToken;
- if( cSymbol[0] )
+ if (!cSymbol[0])
+ return false;
+
+ if( nSpaces )
{
- if( nSpaces )
+ ScRawToken aToken;
+ aToken.SetOpCode( ocSpaces );
+ aToken.sbyte.cByte = (BYTE) ( nSpaces > 255 ? 255 : nSpaces );
+ if( !static_cast<ScTokenArray*>(pArr)->AddRawToken( aToken ) )
{
- aToken.SetOpCode( ocSpaces );
- aToken.sbyte.cByte = (BYTE) ( nSpaces > 255 ? 255 : nSpaces );
- if( !static_cast<ScTokenArray*>(pArr)->AddRawToken( aToken ) )
- {
- SetError(errCodeOverflow); return FALSE;
- }
+ SetError(errCodeOverflow);
+ return false;
}
- // Short cut for references when reading ODF to speedup things.
- if (mnPredetectedReference)
+ }
+
+ // Short cut for references when reading ODF to speedup things.
+ if (mnPredetectedReference)
+ {
+ String aStr( cSymbol);
+ if (!IsPredetectedReference( aStr) && !IsExternalNamedRange( aStr))
{
- String aStr( cSymbol);
- if (!IsPredetectedReference( aStr) && !IsExternalNamedRange( aStr))
- {
- /* TODO: it would be nice to generate a #REF! error here, which
- * would need an ocBad token with additional error value.
- * FormulaErrorToken wouldn't do because we want to preserve the
- * original string containing partial valid address
- * information. */
- aToken.SetString( aStr.GetBuffer() );
- aToken.NewOpCode( ocBad );
- pRawToken = aToken.Clone();
- }
- return TRUE;
- }
- if ( (cSymbol[0] == '#' || cSymbol[0] == '$') && cSymbol[1] == 0 &&
- !bAutoCorrect )
- { // #101100# special case to speed up broken [$]#REF documents
- /* FIXME: ISERROR(#REF!) would be valid and TRUE and the formula to
- * be processed as usual. That would need some special treatment,
- * also in NextSymbol() because of possible combinations of
- * #REF!.#REF!#REF! parts. In case of reading ODF that is all
- * handled by IsPredetectedReference(), this case here remains for
- * manual/API input. */
- String aBad( aFormula.Copy( nSrcPos-1 ) );
- eLastOp = pArr->AddBad( aBad )->GetOpCode();
- return FALSE;
+ /* TODO: it would be nice to generate a #REF! error here, which
+ * would need an ocBad token with additional error value.
+ * FormulaErrorToken wouldn't do because we want to preserve the
+ * original string containing partial valid address
+ * information. */
+ ScRawToken aToken;
+ aToken.SetString( aStr.GetBuffer() );
+ aToken.NewOpCode( ocBad );
+ pRawToken = aToken.Clone();
}
- if( !IsString() )
- {
- BOOL bMayBeFuncName;
- if ( cSymbol[0] < 128 )
- bMayBeFuncName = CharClass::isAsciiAlpha( cSymbol[0] );
- else
- {
- String aTmpStr( cSymbol[0] );
- bMayBeFuncName = ScGlobal::pCharClass->isLetter( aTmpStr, 0 );
- }
- if ( bMayBeFuncName )
- { // a function name must be followed by a parenthesis
- const sal_Unicode* p = aFormula.GetBuffer() + nSrcPos;
- while( *p == ' ' )
- p++;
- bMayBeFuncName = ( *p == '(' );
- }
- else
- bMayBeFuncName = TRUE; // operators and other opcodes
+ return true;
+ }
+
+ if ( (cSymbol[0] == '#' || cSymbol[0] == '$') && cSymbol[1] == 0 &&
+ !bAutoCorrect )
+ { // #101100# special case to speed up broken [$]#REF documents
+ /* FIXME: ISERROR(#REF!) would be valid and TRUE and the formula to
+ * be processed as usual. That would need some special treatment,
+ * also in NextSymbol() because of possible combinations of
+ * #REF!.#REF!#REF! parts. In case of reading ODF that is all
+ * handled by IsPredetectedReference(), this case here remains for
+ * manual/API input. */
+ String aBad( aFormula.Copy( nSrcPos-1 ) );
+ eLastOp = pArr->AddBad( aBad )->GetOpCode();
+ return false;
+ }
+
+ if( IsString() )
+ return true;
+
+ bool bMayBeFuncName;
+ bool bAsciiNonAlnum; // operators, separators, ...
+ if ( cSymbol[0] < 128 )
+ {
+ bMayBeFuncName = CharClass::isAsciiAlpha( cSymbol[0] );
+ bAsciiNonAlnum = !bMayBeFuncName && !CharClass::isAsciiDigit( cSymbol[0] );
+ }
+ else
+ {
+ String aTmpStr( cSymbol[0] );
+ bMayBeFuncName = ScGlobal::pCharClass->isLetter( aTmpStr, 0 );
+ bAsciiNonAlnum = false;
+ }
+ if ( bMayBeFuncName )
+ {
+ // a function name must be followed by a parenthesis
+ const sal_Unicode* p = aFormula.GetBuffer() + nSrcPos;
+ while( *p == ' ' )
+ p++;
+ bMayBeFuncName = ( *p == '(' );
+ }
- String aOrg( cSymbol ); // preserve file names in IsReference()
- String aUpper( ScGlobal::pCharClass->upper( aOrg ) );
#if 0
- fprintf( stderr, "Token '%s'\n",
- rtl::OUStringToOString( aUpper, RTL_TEXTENCODING_UTF8 ).getStr() );
+ fprintf( stderr, "Token '%s'\n",
+ rtl::OUStringToOString( aUpper, RTL_TEXTENCODING_UTF8 ).getStr() );
#endif
- // Column 'DM' ("Deutsche Mark", German currency) couldn't be
- // referred to => IsReference() before IsValue().
- // #42016# Italian ARCTAN.2 resulted in #REF! => IsOpcode() before
- // IsReference().
- // IsBoolean before isValue to catch inline bools without the kludge
- // for inline arrays.
- if ( !(bMayBeFuncName && IsOpCode( aUpper, bInArray ))
- && !IsReference( aOrg )
- && !(bAllowBooleans && IsBoolean( aUpper ))
- && !IsValue( aUpper )
- && !IsNamedRange( aUpper )
- && !IsExternalNamedRange(aOrg)
- && !IsDBRange( aUpper )
- && !IsColRowName( aUpper )
- && !(bMayBeFuncName && IsMacro( aUpper ))
- && !(bMayBeFuncName && IsOpCode2( aUpper )) )
- {
- if ( mbExtendedErrorDetection )
- {
- // set an error and end compilation
- SetError( errNoName );
- return FALSE;
- }
- else
- {
- // Provide single token information and continue. Do not set an
- // error, that would prematurely end compilation. Simple
- // unknown names are handled by the interpreter.
- ScGlobal::pCharClass->toLower( aUpper );
- aToken.SetString( aUpper.GetBuffer() );
- aToken.NewOpCode( ocBad );
- pRawToken = aToken.Clone();
- if ( bAutoCorrect )
- AutoCorrectParsedSymbol();
- }
- }
+
+ // #42016# Italian ARCTAN.2 resulted in #REF! => IsOpcode() before
+ // IsReference().
+
+ String aUpper;
+
+ do
+ {
+ mbRewind = false;
+ const String aOrg( cSymbol );
+
+ if (bAsciiNonAlnum && IsOpCode( aOrg, bInArray ))
+ return true;
+
+ aUpper.Erase();
+ bool bAsciiUpper = false;
+ if (bMayBeFuncName)
+ {
+ bAsciiUpper = lcl_UpperAsciiOrI18n( aUpper, aOrg, meGrammar);
+ if (IsOpCode( aUpper, bInArray ))
+ return true;
}
- return TRUE;
+
+ // Column 'DM' ("Deutsche Mark", German currency) couldn't be
+ // referred => IsReference() before IsValue().
+ // Preserve case of file names in external references.
+ if (IsReference( aOrg ))
+ {
+ if (mbRewind) // Range operator, but no direct reference.
+ continue; // do; up to range operator.
+ return true;
+ }
+
+ if (!aUpper.Len())
+ bAsciiUpper = lcl_UpperAsciiOrI18n( aUpper, aOrg, meGrammar);
+
+ // IsBoolean() before IsValue() to catch inline bools without the kludge
+ // for inline arrays.
+ if (bAllowBooleans && IsBoolean( aUpper ))
+ return true;
+
+ if (IsValue( aUpper ))
+ return true;
+
+ // User defined names and such do need i18n upper also in ODF.
+ if (bAsciiUpper)
+ aUpper = ScGlobal::pCharClass->upper( aOrg );
+
+ if (IsNamedRange( aUpper ))
+ return true;
+ // Preserve case of file names in external references.
+ if (IsExternalNamedRange( aOrg ))
+ return true;
+ if (IsDBRange( aUpper ))
+ return true;
+ if (IsColRowName( aUpper ))
+ return true;
+ if (bMayBeFuncName && IsMacro( aUpper ))
+ return true;
+ if (bMayBeFuncName && IsOpCode2( aUpper ))
+ return true;
+
+ } while (mbRewind);
+
+ if ( mbExtendedErrorDetection )
+ {
+ // set an error and end compilation
+ SetError( errNoName );
+ return false;
+ }
+
+ // Provide single token information and continue. Do not set an error, that
+ // would prematurely end compilation. Simple unknown names are handled by
+ // the interpreter.
+ ScGlobal::pCharClass->toLower( aUpper );
+ ScRawToken aToken;
+ aToken.SetString( aUpper.GetBuffer() );
+ aToken.NewOpCode( ocBad );
+ pRawToken = aToken.Clone();
+ if ( bAutoCorrect )
+ AutoCorrectParsedSymbol();
+ return true;
+}
+
+void ScCompiler::CreateStringFromXMLTokenArray( String& rFormula, String& rFormulaNmsp )
+{
+ bool bExternal = GetGrammar() == FormulaGrammar::GRAM_EXTERNAL;
+ USHORT nExpectedCount = bExternal ? 2 : 1;
+ DBG_ASSERT( pArr->GetLen() == nExpectedCount, "ScCompiler::CreateStringFromXMLTokenArray - wrong number of tokens" );
+ if( pArr->GetLen() == nExpectedCount )
+ {
+ FormulaToken** ppTokens = pArr->GetArray();
+ // string tokens expected, GetString() will assert if token type is wrong
+ rFormula = ppTokens[ 0 ]->GetString();
+ if( bExternal )
+ rFormulaNmsp = ppTokens[ 1 ]->GetString();
}
- else
- return FALSE;
}
ScTokenArray* ScCompiler::CompileString( const String& rFormula )
@@ -3571,6 +3689,10 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula )
rtl::OUStringToOString( rFormula, RTL_TEXTENCODING_UTF8 ).getStr() );
#endif
+ OSL_ENSURE( meGrammar != FormulaGrammar::GRAM_EXTERNAL, "ScCompiler::CompileString - unexpected grammar GRAM_EXTERNAL" );
+ if( meGrammar == FormulaGrammar::GRAM_EXTERNAL )
+ SetGrammar( FormulaGrammar::GRAM_PODF );
+
ScTokenArray aArr;
pArr = &aArr;
aFormula = rFormula;
@@ -3773,6 +3895,34 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula )
}
+ScTokenArray* ScCompiler::CompileString( const String& rFormula, const String& rFormulaNmsp )
+{
+ DBG_ASSERT( (GetGrammar() == FormulaGrammar::GRAM_EXTERNAL) || (rFormulaNmsp.Len() == 0),
+ "ScCompiler::CompileString - unexpected formula namespace for internal grammar" );
+ if( GetGrammar() == FormulaGrammar::GRAM_EXTERNAL ) try
+ {
+ ScFormulaParserPool& rParserPool = pDoc->GetFormulaParserPool();
+ uno::Reference< sheet::XFormulaParser > xParser( rParserPool.getFormulaParser( rFormulaNmsp ), uno::UNO_SET_THROW );
+ table::CellAddress aReferencePos;
+ ScUnoConversion::FillApiAddress( aReferencePos, aPos );
+ uno::Sequence< sheet::FormulaToken > aTokenSeq = xParser->parseFormula( rFormula, aReferencePos );
+ ScTokenArray aTokenArray;
+ if( ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokenSeq ) )
+ {
+ // remember pArr, in case a subsequent CompileTokenArray() is executed.
+ ScTokenArray* pNew = new ScTokenArray( aTokenArray );
+ pArr = pNew;
+ return pNew;
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ // no success - fallback to some internal grammar and hope the best
+ return CompileString( rFormula );
+}
+
+
BOOL ScCompiler::HandleRange()
{
ScRangeData* pRangeData = pDoc->GetRangeName()->FindIndex( pToken->GetIndex() );
@@ -5004,6 +5154,11 @@ BOOL ScCompiler::EnQuote( String& rStr )
return TRUE;
}
+sal_Unicode ScCompiler::GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const
+{
+ return pConv->getSpecialSymbol(eType);
+}
+
void ScCompiler::fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const
{
// All known AddIn functions.
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 20c534a0a556..2d337eab2eb3 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -1420,6 +1420,7 @@ void ScDetectiveFunc::UpdateAllComments( ScDocument& rDoc )
for( SCTAB nObjTab = 0, nTabCount = rDoc.GetTableCount(); nObjTab < nTabCount; ++nObjTab )
{
+ rDoc.InitializeNoteCaptions( nObjTab );
SdrPage* pPage = pModel->GetPage( static_cast< sal_uInt16 >( nObjTab ) );
DBG_ASSERT( pPage, "Page ?" );
if( pPage )
@@ -1430,6 +1431,7 @@ void ScDetectiveFunc::UpdateAllComments( ScDocument& rDoc )
if ( ScDrawObjData* pData = ScDrawLayer::GetNoteCaptionData( pObject, nObjTab ) )
{
ScPostIt* pNote = rDoc.GetNote( pData->maStart );
+ // caption should exist, we iterate over drawing objects...
DBG_ASSERT( pNote && (pNote->GetCaption() == pObject), "ScDetectiveFunc::UpdateAllComments - invalid cell note" );
if( pNote )
{
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 0e9477f9015a..5519c679f84e 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -64,12 +64,13 @@
#include "patattr.hxx"
#include "scmod.hxx"
#include "inputopt.hxx"
+#include "compiler.hxx"
// STATIC DATA -----------------------------------------------------------
// Delimiters zusaetzlich zu EditEngine-Default:
-const sal_Char __FAR_DATA ScEditUtil::pCalcDelimiters[] = "=();+-*/^&<>";
+const sal_Char __FAR_DATA ScEditUtil::pCalcDelimiters[] = "=()+-*/^&<>";
//------------------------------------------------------------------------
@@ -79,22 +80,33 @@ String ScEditUtil::ModifyDelimiters( const String& rOld )
String aRet = rOld;
aRet.EraseAllChars( '_' ); // underscore is used in function argument names
aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( pCalcDelimiters ) );
+ aRet.Append(ScCompiler::GetNativeSymbol(ocSep)); // argument separator is localized.
return aRet;
}
-String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine )
+static String lcl_GetDelimitedString( const EditEngine& rEngine, const sal_Char c )
{
String aRet;
USHORT nParCount = rEngine.GetParagraphCount();
for (USHORT nPar=0; nPar<nParCount; nPar++)
{
if (nPar > 0)
- aRet += ' ';
+ aRet += c;
aRet += rEngine.GetText( nPar );
}
return aRet;
}
+String ScEditUtil::GetSpaceDelimitedString( const EditEngine& rEngine )
+{
+ return lcl_GetDelimitedString(rEngine, ' ');
+}
+
+String ScEditUtil::GetMultilineString( const EditEngine& rEngine )
+{
+ return lcl_GetDelimitedString(rEngine, '\n');
+}
+
//------------------------------------------------------------------------
Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, BOOL bForceToTop )
diff --git a/sc/source/core/tool/formulaparserpool.cxx b/sc/source/core/tool/formulaparserpool.cxx
new file mode 100644
index 000000000000..94259a56d6e2
--- /dev/null
+++ b/sc/source/core/tool/formulaparserpool.cxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formulaparserpool.cxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "formulaparserpool.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sheet/XFilterFormulaParser.hpp>
+#include <rtl/instance.hxx>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/objsh.hxx>
+#include "document.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringHash;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::uno;
+
+// ============================================================================
+
+namespace {
+
+class ScParserFactoryMap
+{
+public:
+ explicit ScParserFactoryMap();
+
+ Reference< XFormulaParser > createFormulaParser(
+ const Reference< XComponent >& rxComponent,
+ const OUString& rNamespace );
+
+private:
+ typedef ::std::hash_map<
+ OUString,
+ Reference< XSingleComponentFactory >,
+ OUStringHash,
+ ::std::equal_to< OUString > > FactoryMap;
+
+ Reference< XComponentContext > mxContext; /// Default context of global process factory.
+ FactoryMap maFactories; /// All parser factories, mapped by formula namespace.
+};
+
+ScParserFactoryMap::ScParserFactoryMap()
+{
+ try
+ {
+ // get process factory and default component context
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW );
+ Reference< XPropertySet > xPropSet( xFactory, UNO_QUERY_THROW );
+ mxContext.set( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), UNO_QUERY_THROW );
+
+ // enumerate all implementations of the FormulaParser service
+ Reference< XContentEnumerationAccess > xFactoryEA( xFactory, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnum( xFactoryEA->createContentEnumeration( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FilterFormulaParser" ) ) ), UNO_SET_THROW );
+ while( xEnum->hasMoreElements() ) try // single try/catch for every element
+ {
+ // create an instance of the formula parser implementation
+ Reference< XSingleComponentFactory > xCompFactory( xEnum->nextElement(), UNO_QUERY_THROW );
+ Reference< XFilterFormulaParser > xParser( xCompFactory->createInstanceWithContext( mxContext ), UNO_QUERY_THROW );
+
+ // store factory in the map
+ OUString aNamespace = xParser->getSupportedNamespace();
+ if( aNamespace.getLength() > 0 )
+ maFactories[ aNamespace ] = xCompFactory;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+Reference< XFormulaParser > ScParserFactoryMap::createFormulaParser(
+ const Reference< XComponent >& rxComponent, const OUString& rNamespace )
+{
+ Reference< XFormulaParser > xParser;
+ FactoryMap::const_iterator aIt = maFactories.find( rNamespace );
+ if( aIt != maFactories.end() ) try
+ {
+ Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= rxComponent;
+ xParser.set( aIt->second->createInstanceWithArgumentsAndContext( aArgs, mxContext ), UNO_QUERY_THROW );
+ }
+ catch( Exception& )
+ {
+ }
+ return xParser;
+}
+
+struct ScParserFactorySingleton : public ::rtl::Static< ScParserFactoryMap, ScParserFactorySingleton > {};
+
+} // namespace
+
+// ============================================================================
+
+ScFormulaParserPool::ScFormulaParserPool( const ScDocument& rDoc ) :
+ mrDoc( rDoc )
+{
+}
+
+ScFormulaParserPool::~ScFormulaParserPool()
+{
+}
+
+bool ScFormulaParserPool::hasFormulaParser( const OUString& rNamespace )
+{
+ return getFormulaParser( rNamespace ).is();
+}
+
+Reference< XFormulaParser > ScFormulaParserPool::getFormulaParser( const OUString& rNamespace )
+{
+ // try to find an existing parser entry
+ ParserMap::iterator aIt = maParsers.find( rNamespace );
+ if( aIt != maParsers.end() )
+ return aIt->second;
+
+ // always create a new entry in the map (even if the following initialization fails)
+ Reference< XFormulaParser >& rxParser = maParsers[ rNamespace ];
+
+ // try to create a new parser object
+ if( SfxObjectShell* pDocShell = mrDoc.GetDocumentShell() ) try
+ {
+ Reference< XComponent > xComponent( pDocShell->GetModel(), UNO_QUERY_THROW );
+ ScParserFactoryMap& rFactoryMap = ScParserFactorySingleton::get();
+ rxParser = rFactoryMap.createFormulaParser( xComponent, rNamespace );
+ }
+ catch( Exception& )
+ {
+ }
+ return rxParser;
+}
+
+// ============================================================================
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index ec4c4c293839..195366271f0d 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -71,6 +71,7 @@
#include "lookupcache.hxx"
#include "rangenam.hxx"
#include "compiler.hxx"
+#include "externalrefmgr.hxx"
#define SC_DOUBLE_MAXVALUE 1.7e307
@@ -626,7 +627,20 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
}
-double ScInterpreter::CompareFunc( const ScCompare& rComp )
+ScCompareOptions::ScCompareOptions( ScDocument* pDoc, const ScQueryEntry& rEntry, bool bReg ) :
+ aQueryEntry(rEntry),
+ bRegEx(bReg),
+ bMatchWholeCell(pDoc->GetDocOptions().IsMatchWholeCell()),
+ bIgnoreCase(true)
+{
+ bRegEx = (bRegEx && (aQueryEntry.eOp == SC_EQUAL || aQueryEntry.eOp == SC_NOT_EQUAL));
+ // Interpreter functions usually are case insensitive, except the simple
+ // comparison operators, for which these options aren't used. Override in
+ // struct if needed.
+}
+
+
+double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOptions )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CompareFunc" );
// Keep DoubleError if encountered
@@ -698,7 +712,53 @@ double ScInterpreter::CompareFunc( const ScCompare& rComp )
fRes = 1; // number is less than string
else
{
- if (pDok->GetDocOptions().IsIgnoreCase())
+ // Both strings.
+ if (pOptions)
+ {
+ // All similar to Sctable::ValidQuery(), *rComp.pVal[1] actually
+ // is/must be identical to *rEntry.pStr, which is essential for
+ // regex to work through GetSearchTextPtr().
+ ScQueryEntry& rEntry = pOptions->aQueryEntry;
+ DBG_ASSERT( *rComp.pVal[1] == *rEntry.pStr, "ScInterpreter::CompareFunc: broken options");
+ if (pOptions->bRegEx)
+ {
+ xub_StrLen nStart = 0;
+ xub_StrLen nStop = rComp.pVal[0]->Len();
+ bool bMatch = rEntry.GetSearchTextPtr(
+ !pOptions->bIgnoreCase)->SearchFrwrd( *rComp.pVal[0],
+ &nStart, &nStop);
+ if (bMatch && pOptions->bMatchWholeCell && (nStart != 0 || nStop != rComp.pVal[0]->Len()))
+ bMatch = false; // RegEx must match entire string.
+ fRes = (bMatch ? 0 : 1);
+ }
+ else if (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL)
+ {
+ ::utl::TransliterationWrapper* pTransliteration =
+ (pOptions->bIgnoreCase ? ScGlobal::pTransliteration :
+ ScGlobal::pCaseTransliteration);
+ bool bMatch;
+ if (pOptions->bMatchWholeCell)
+ bMatch = pTransliteration->isEqual( *rComp.pVal[0], *rComp.pVal[1]);
+ else
+ {
+ String aCell( pTransliteration->transliterate(
+ *rComp.pVal[0], ScGlobal::eLnge, 0,
+ rComp.pVal[0]->Len(), NULL));
+ String aQuer( pTransliteration->transliterate(
+ *rComp.pVal[1], ScGlobal::eLnge, 0,
+ rComp.pVal[1]->Len(), NULL));
+ bMatch = (aCell.Search( aQuer ) != STRING_NOTFOUND);
+ }
+ fRes = (bMatch ? 0 : 1);
+ }
+ else if (pOptions->bIgnoreCase)
+ fRes = (double) ScGlobal::pCollator->compareString(
+ *rComp.pVal[ 0 ], *rComp.pVal[ 1 ] );
+ else
+ fRes = (double) ScGlobal::pCaseCollator->compareString(
+ *rComp.pVal[ 0 ], *rComp.pVal[ 1 ] );
+ }
+ else if (pDok->GetDocOptions().IsIgnoreCase())
fRes = (double) ScGlobal::pCollator->compareString(
*rComp.pVal[ 0 ], *rComp.pVal[ 1 ] );
else
@@ -763,7 +823,7 @@ double ScInterpreter::Compare()
}
-ScMatrixRef ScInterpreter::CompareMat()
+ScMatrixRef ScInterpreter::CompareMat( ScCompareOptions* pOptions )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CompareMat" );
String aVal1, aVal2;
@@ -855,7 +915,7 @@ ScMatrixRef ScInterpreter::CompareMat()
aComp.bEmpty[i] = FALSE;
}
}
- pResMat->PutDouble( CompareFunc( aComp ), j,k );
+ pResMat->PutDouble( CompareFunc( aComp, pOptions ), j,k );
}
else
pResMat->PutString( ScGlobal::GetRscString(STR_NO_VALUE), j,k );
@@ -885,7 +945,7 @@ ScMatrixRef ScInterpreter::CompareMat()
*aComp.pVal[i] = pMat[i]->GetString(j);
aComp.bEmpty[i] = pMat[i]->IsEmpty(j);
}
- pResMat->PutDouble( CompareFunc( aComp ), j );
+ pResMat->PutDouble( CompareFunc( aComp, pOptions ), j );
}
}
}
@@ -894,6 +954,52 @@ ScMatrixRef ScInterpreter::CompareMat()
}
+ScMatrixRef ScInterpreter::QueryMat( ScMatrix* pMat, ScCompareOptions& rOptions )
+{
+ short nSaveCurFmtType = nCurFmtType;
+ short nSaveFuncFmtType = nFuncFmtType;
+ PushMatrix( pMat);
+ if (rOptions.aQueryEntry.bQueryByString)
+ PushString( *rOptions.aQueryEntry.pStr);
+ else
+ PushDouble( rOptions.aQueryEntry.nVal);
+ ScMatrixRef pResultMatrix = CompareMat( &rOptions);
+ nCurFmtType = nSaveCurFmtType;
+ nFuncFmtType = nSaveFuncFmtType;
+ if (nGlobalError || !pResultMatrix)
+ {
+ SetError( errIllegalParameter);
+ return pResultMatrix;
+ }
+
+ switch (rOptions.aQueryEntry.eOp)
+ {
+ case SC_EQUAL:
+ pResultMatrix->CompareEqual();
+ break;
+ case SC_LESS:
+ pResultMatrix->CompareLess();
+ break;
+ case SC_GREATER:
+ pResultMatrix->CompareGreater();
+ break;
+ case SC_LESS_EQUAL:
+ pResultMatrix->CompareLessEqual();
+ break;
+ case SC_GREATER_EQUAL:
+ pResultMatrix->CompareGreaterEqual();
+ break;
+ case SC_NOT_EQUAL:
+ pResultMatrix->CompareNotEqual();
+ break;
+ default:
+ SetError( errIllegalArgument);
+ DBG_ERROR1( "ScInterpreter::QueryMat: unhandled comparison operator: %d", (int)rOptions.aQueryEntry.eOp);
+ }
+ return pResultMatrix;
+}
+
+
void ScInterpreter::ScEqual()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEqual" );
@@ -4310,6 +4416,7 @@ void ScInterpreter::ScCountIf()
SCCOL nCol2;
SCROW nRow2;
SCTAB nTab2;
+ ScMatrixRef pQueryMatrix;
switch ( GetStackType() )
{
case svDoubleRef :
@@ -4326,6 +4433,24 @@ void ScInterpreter::ScCountIf()
nRow2 = nRow1;
nTab2 = nTab1;
break;
+ case svMatrix:
+ {
+ pQueryMatrix = PopMatrix();
+ if (!pQueryMatrix)
+ {
+ PushIllegalParameter();
+ return;
+ }
+ nCol1 = 0;
+ nRow1 = 0;
+ nTab1 = 0;
+ SCSIZE nC, nR;
+ pQueryMatrix->GetDimensions( nC, nR);
+ nCol2 = static_cast<SCCOL>(nC - 1);
+ nRow2 = static_cast<SCROW>(nR - 1);
+ nTab2 = 0;
+ }
+ break;
default:
PushIllegalParameter();
return ;
@@ -4367,15 +4492,37 @@ void ScInterpreter::ScCountIf()
rParam.nCol1 = nCol1;
rParam.nCol2 = nCol2;
rEntry.nField = nCol1;
- ScQueryCellIterator aCellIter(pDok, nTab1, rParam, FALSE);
- // Entry.nField im Iterator bei Spaltenwechsel weiterschalten
- aCellIter.SetAdvanceQueryParamEntryField( TRUE );
- if ( aCellIter.GetFirst() )
+ if (pQueryMatrix)
{
- do
+ // Never case-sensitive.
+ ScCompareOptions aOptions( pDok, rEntry, rParam.bRegExp);
+ ScMatrixRef pResultMatrix = QueryMat( pQueryMatrix, aOptions);
+ if (nGlobalError || !pResultMatrix)
{
- fSum++;
- } while ( aCellIter.GetNext() );
+ PushIllegalParameter();
+ return;
+ }
+
+ SCSIZE nSize = pResultMatrix->GetElementCount();
+ for (SCSIZE nIndex = 0; nIndex < nSize; ++nIndex)
+ {
+ if (pResultMatrix->IsValue( nIndex) &&
+ pResultMatrix->GetDouble( nIndex))
+ ++fSum;
+ }
+ }
+ else
+ {
+ ScQueryCellIterator aCellIter(pDok, nTab1, rParam, FALSE);
+ // Entry.nField im Iterator bei Spaltenwechsel weiterschalten
+ aCellIter.SetAdvanceQueryParamEntryField( TRUE );
+ if ( aCellIter.GetFirst() )
+ {
+ do
+ {
+ fSum++;
+ } while ( aCellIter.GetNext() );
+ }
}
}
else
@@ -4399,6 +4546,7 @@ void ScInterpreter::ScSumIf()
SCROW nRow3 = 0;
SCTAB nTab3 = 0;
+ ScMatrixRef pSumExtraMatrix;
bool bSumExtraRange = (nParamCount == 3);
if (bSumExtraRange)
{
@@ -4423,6 +4571,10 @@ void ScInterpreter::ScSumIf()
case svSingleRef :
PopSingleRef( nCol3, nRow3, nTab3 );
break;
+ case svMatrix:
+ pSumExtraMatrix = PopMatrix();
+ //! nCol3, nRow3, nTab3 remain 0
+ break;
default:
PushIllegalParameter();
return ;
@@ -4498,6 +4650,7 @@ void ScInterpreter::ScSumIf()
SCCOL nCol2;
SCROW nRow2;
SCTAB nTab2;
+ ScMatrixRef pQueryMatrix;
switch ( GetStackType() )
{
case svRefList :
@@ -4522,13 +4675,31 @@ void ScInterpreter::ScSumIf()
nRow2 = nRow1;
nTab2 = nTab1;
break;
+ case svMatrix:
+ {
+ pQueryMatrix = PopMatrix();
+ if (!pQueryMatrix)
+ {
+ PushIllegalParameter();
+ return;
+ }
+ nCol1 = 0;
+ nRow1 = 0;
+ nTab1 = 0;
+ SCSIZE nC, nR;
+ pQueryMatrix->GetDimensions( nC, nR);
+ nCol2 = static_cast<SCCOL>(nC - 1);
+ nRow2 = static_cast<SCROW>(nR - 1);
+ nTab2 = 0;
+ }
+ break;
default:
PushIllegalParameter();
return ;
}
if ( nTab1 != nTab2 )
{
- PushIllegalParameter();
+ PushIllegalArgument();
return;
}
@@ -4544,15 +4715,29 @@ void ScInterpreter::ScSumIf()
// instead of the result range.
SCCOL nColDelta = nCol2 - nCol1;
SCROW nRowDelta = nRow2 - nRow1;
- if (nCol3 + nColDelta > MAXCOL)
+ SCCOL nMaxCol;
+ SCROW nMaxRow;
+ if (pSumExtraMatrix)
{
- SCCOL nNewDelta = MAXCOL - nCol3;
+ SCSIZE nC, nR;
+ pSumExtraMatrix->GetDimensions( nC, nR);
+ nMaxCol = static_cast<SCCOL>(nC - 1);
+ nMaxRow = static_cast<SCROW>(nR - 1);
+ }
+ else
+ {
+ nMaxCol = MAXCOL;
+ nMaxRow = MAXROW;
+ }
+ if (nCol3 + nColDelta > nMaxCol)
+ {
+ SCCOL nNewDelta = nMaxCol - nCol3;
nCol2 = nCol1 + nNewDelta;
}
- if (nRow3 + nRowDelta > MAXROW)
+ if (nRow3 + nRowDelta > nMaxRow)
{
- SCROW nNewDelta = MAXROW - nRow3;
+ SCROW nNewDelta = nMaxRow - nRow3;
nRow2 = nRow1 + nNewDelta;
}
}
@@ -4592,30 +4777,119 @@ void ScInterpreter::ScSumIf()
rParam.nCol1 = nCol1;
rParam.nCol2 = nCol2;
rEntry.nField = nCol1;
- SCCOL nColDiff = nCol3 - nCol1;
- SCROW nRowDiff = nRow3 - nRow1;
- ScQueryCellIterator aCellIter(pDok, nTab1, rParam, FALSE);
- // Increment Entry.nField in iterator when switching to next column.
- aCellIter.SetAdvanceQueryParamEntryField( TRUE );
- if ( aCellIter.GetFirst() )
+ SCsCOL nColDiff = nCol3 - nCol1;
+ SCsROW nRowDiff = nRow3 - nRow1;
+ if (pQueryMatrix)
{
- do
+ // Never case-sensitive.
+ ScCompareOptions aOptions( pDok, rEntry, rParam.bRegExp);
+ ScMatrixRef pResultMatrix = QueryMat( pQueryMatrix, aOptions);
+ if (nGlobalError || !pResultMatrix)
{
- aAdr.SetCol( aCellIter.GetCol() + nColDiff);
- aAdr.SetRow( aCellIter.GetRow() + nRowDiff);
- ScBaseCell* pCell = GetCell( aAdr );
- if ( HasCellValueData(pCell) )
+ PushIllegalParameter();
+ return;
+ }
+
+ if (pSumExtraMatrix)
+ {
+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
{
- fVal = GetCellValue( aAdr, pCell );
- if ( bNull && fVal != 0.0 )
+ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
{
- bNull = FALSE;
- fMem = fVal;
+ if (pResultMatrix->IsValue( nCol, nRow) &&
+ pResultMatrix->GetDouble( nCol, nRow))
+ {
+ SCSIZE nC = nCol + nColDiff;
+ SCSIZE nR = nRow + nRowDiff;
+ if (pSumExtraMatrix->IsValue( nC, nR))
+ {
+ fVal = pSumExtraMatrix->GetDouble( nC, nR);
+ if ( bNull && fVal != 0.0 )
+ {
+ bNull = FALSE;
+ fMem = fVal;
+ }
+ else
+ fSum += fVal;
+ }
+ }
}
- else
- fSum += fVal;
}
- } while ( aCellIter.GetNext() );
+ }
+ else
+ {
+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+ {
+ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+ {
+ if (pResultMatrix->GetDouble( nCol, nRow))
+ {
+ aAdr.SetCol( nCol + nColDiff);
+ aAdr.SetRow( nRow + nRowDiff);
+ ScBaseCell* pCell = GetCell( aAdr );
+ if ( HasCellValueData(pCell) )
+ {
+ fVal = GetCellValue( aAdr, pCell );
+ if ( bNull && fVal != 0.0 )
+ {
+ bNull = FALSE;
+ fMem = fVal;
+ }
+ else
+ fSum += fVal;
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ ScQueryCellIterator aCellIter(pDok, nTab1, rParam, FALSE);
+ // Increment Entry.nField in iterator when switching to next column.
+ aCellIter.SetAdvanceQueryParamEntryField( TRUE );
+ if ( aCellIter.GetFirst() )
+ {
+ if (pSumExtraMatrix)
+ {
+ do
+ {
+ SCSIZE nC = aCellIter.GetCol() + nColDiff;
+ SCSIZE nR = aCellIter.GetRow() + nRowDiff;
+ if (pSumExtraMatrix->IsValue( nC, nR))
+ {
+ fVal = pSumExtraMatrix->GetDouble( nC, nR);
+ if ( bNull && fVal != 0.0 )
+ {
+ bNull = FALSE;
+ fMem = fVal;
+ }
+ else
+ fSum += fVal;
+ }
+ } while ( aCellIter.GetNext() );
+ }
+ else
+ {
+ do
+ {
+ aAdr.SetCol( aCellIter.GetCol() + nColDiff);
+ aAdr.SetRow( aCellIter.GetRow() + nRowDiff);
+ ScBaseCell* pCell = GetCell( aAdr );
+ if ( HasCellValueData(pCell) )
+ {
+ fVal = GetCellValue( aAdr, pCell );
+ if ( bNull && fVal != 0.0 )
+ {
+ bNull = FALSE;
+ fMem = fVal;
+ }
+ else
+ fSum += fVal;
+ }
+ } while ( aCellIter.GetNext() );
+ }
+ }
}
}
else
@@ -5762,6 +6036,52 @@ void ScInterpreter::ScDBVarP()
}
+ScTokenArray* lcl_CreateExternalRefTokenArray( const ScAddress& rPos, ScDocument* pDoc,
+ const ScAddress::ExternalInfo& rExtInfo, const ScRefAddress& rRefAd1,
+ const ScRefAddress* pRefAd2 )
+{
+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
+ size_t nSheets = 1;
+ const String* pRealTab = pRefMgr->getRealTableName( rExtInfo.mnFileId, rExtInfo.maTabName);
+ ScTokenArray* pTokenArray = new ScTokenArray;
+ if (pRefAd2)
+ {
+ ScComplexRefData aRef;
+ aRef.InitRangeRel( ScRange( rRefAd1.GetAddress(), pRefAd2->GetAddress()), rPos);
+ aRef.Ref1.SetColRel( rRefAd1.IsRelCol());
+ aRef.Ref1.SetRowRel( rRefAd1.IsRelRow());
+ aRef.Ref1.SetTabRel( rRefAd1.IsRelTab());
+ aRef.Ref1.SetFlag3D( true);
+ aRef.Ref2.SetColRel( pRefAd2->IsRelCol());
+ aRef.Ref2.SetRowRel( pRefAd2->IsRelRow());
+ aRef.Ref2.SetTabRel( pRefAd2->IsRelTab());
+ nSheets = aRef.Ref2.nTab - aRef.Ref1.nTab + 1;
+ aRef.Ref2.SetFlag3D( nSheets > 1 );
+ pTokenArray->AddExternalDoubleReference( rExtInfo.mnFileId,
+ (pRealTab ? *pRealTab : rExtInfo.maTabName), aRef);
+ }
+ else
+ {
+ ScSingleRefData aRef;
+ aRef.InitAddressRel( rRefAd1.GetAddress(), rPos);
+ aRef.SetColRel( rRefAd1.IsRelCol());
+ aRef.SetRowRel( rRefAd1.IsRelRow());
+ aRef.SetTabRel( rRefAd1.IsRelTab());
+ aRef.SetFlag3D( true);
+ pTokenArray->AddExternalSingleReference( rExtInfo.mnFileId,
+ (pRealTab ? *pRealTab : rExtInfo.maTabName), aRef);
+ }
+ // The indirect usage of the external table can't be detected during the
+ // store-to-file cycle, mark it as permanently referenced so it gets stored
+ // even if not directly referenced anywhere.
+ pRefMgr->setCacheTableReferencedPermanently( rExtInfo.mnFileId,
+ rExtInfo.maTabName, nSheets);
+ ScCompiler aComp( pDoc, rPos, *pTokenArray);
+ aComp.CompileTokenArray();
+ return pTokenArray;
+}
+
+
void ScInterpreter::ScIndirect()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIndirect" );
@@ -5780,15 +6100,46 @@ void ScInterpreter::ScIndirect()
SCTAB nTab = aPos.Tab();
String sRefStr( GetString() );
ScRefAddress aRefAd, aRefAd2;
- if ( ConvertDoubleRef( pDok, sRefStr, nTab, aRefAd, aRefAd2, aDetails) ||
+ ScAddress::ExternalInfo aExtInfo;
+ if ( ConvertDoubleRef( pDok, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) ||
(bTryXlA1 && ConvertDoubleRef( pDok, sRefStr, nTab, aRefAd,
- aRefAd2, aDetailsXlA1)))
- PushDoubleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab(),
- aRefAd2.Col(), aRefAd2.Row(), aRefAd2.Tab() );
- else if ( ConvertSingleRef ( pDok, sRefStr, nTab, aRefAd, aDetails) ||
+ aRefAd2, aDetailsXlA1, &aExtInfo)))
+ {
+ if (aExtInfo.mbExternal)
+ {
+ /* TODO: future versions should implement a proper subroutine
+ * token. This procedure here is a minimally invasive fix for
+ * #i101645# in OOo3.1.1 */
+ // Push a subroutine on the instruction code stack that
+ // resolves the external reference as the next instruction.
+ aCode.Push( lcl_CreateExternalRefTokenArray( aPos, pDok,
+ aExtInfo, aRefAd, &aRefAd2));
+ // Signal subroutine call to interpreter.
+ PushTempToken( new FormulaUnknownToken( ocCall));
+ }
+ else
+ PushDoubleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab(),
+ aRefAd2.Col(), aRefAd2.Row(), aRefAd2.Tab() );
+ }
+ else if ( ConvertSingleRef ( pDok, sRefStr, nTab, aRefAd, aDetails, &aExtInfo) ||
(bTryXlA1 && ConvertSingleRef ( pDok, sRefStr, nTab, aRefAd,
- aDetailsXlA1)))
- PushSingleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab() );
+ aDetailsXlA1, &aExtInfo)))
+ {
+ if (aExtInfo.mbExternal)
+ {
+ /* TODO: future versions should implement a proper subroutine
+ * token. This procedure here is a minimally invasive fix for
+ * #i101645# in OOo3.1.1 */
+ // Push a subroutine on the instruction code stack that
+ // resolves the external reference as the next instruction.
+ aCode.Push( lcl_CreateExternalRefTokenArray( aPos, pDok,
+ aExtInfo, aRefAd, NULL));
+ // Signal subroutine call to interpreter.
+ PushTempToken( new FormulaUnknownToken( ocCall));
+ }
+ else
+ PushSingleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab() );
+ }
else
{
do
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2722925fc56d..a73fe62998a6 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3812,6 +3812,15 @@ StackVar ScInterpreter::Interpret()
default : PushError( errUnknownOpCode); break;
}
+ // If the function signalled that it pushed a subroutine on the
+ // instruction code stack instead of a result, continue with
+ // execution of the subroutine.
+ if (sp > nStackBase && pStack[sp-1]->GetOpCode() == ocCall)
+ {
+ Pop();
+ continue; // while( ( pCur = aCode.Next() ) != NULL ...
+ }
+
// Remember result matrix in case it could be reused.
if (pTokenMatrixMap && sp && GetStackType() == svMatrix)
pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pCur,
diff --git a/sc/source/core/tool/makefile.mk b/sc/source/core/tool/makefile.mk
index 8a4b1b44fd12..ac0aa23fc044 100644
--- a/sc/source/core/tool/makefile.mk
+++ b/sc/source/core/tool/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -78,6 +78,7 @@ SLOFILES = \
$(SLO)$/docoptio.obj \
$(SLO)$/editutil.obj \
$(SLO)$/filtopt.obj \
+ $(SLO)$/formulaparserpool.obj \
$(SLO)$/hints.obj \
$(SLO)$/indexmap.obj \
$(SLO)$/inputopt.obj \
@@ -122,6 +123,7 @@ EXCEPTIONSFILES= \
$(SLO)$/chartlock.obj \
$(SLO)$/chgtrack.obj \
$(SLO)$/compiler.obj \
+ $(SLO)$/formulaparserpool.obj \
$(SLO)$/interpr1.obj \
$(SLO)$/interpr2.obj \
$(SLO)$/interpr3.obj \
diff --git a/sc/source/core/tool/progress.cxx b/sc/source/core/tool/progress.cxx
index fc7a7088d2a9..450736997c2d 100644
--- a/sc/source/core/tool/progress.cxx
+++ b/sc/source/core/tool/progress.cxx
@@ -162,7 +162,7 @@ void ScProgress::CreateInterpretProgress( ScDocument* pDoc, BOOL bWait )
if ( !pGlobalProgress )
pInterpretProgress = new ScProgress( pDoc->GetDocumentShell(),
ScGlobal::GetRscString( STR_PROGRESS_CALCULATING ),
- pDoc->GetFormulaCodeInTree(), FALSE, bWait );
+ pDoc->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE, FALSE, bWait );
pInterpretDoc = pDoc;
}
}
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 42cf295390d6..e129abdcf97f 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -49,13 +49,14 @@ using ::std::auto_ptr;
using ::rtl::OUString;
void ScRefTokenHelper::compileRangeRepresentation(
- vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc)
+ vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc, FormulaGrammar::Grammar eGrammar)
{
const sal_Unicode cSep = ';';
const sal_Unicode cQuote = '\'';
+ bool bFailure = false;
sal_Int32 nOffset = 0;
- while (nOffset >= 0)
+ while (nOffset >= 0 && !bFailure)
{
OUString aToken;
ScRangeStringConverter::GetTokenByOffset(aToken, rRangeStr, nOffset, cSep, cQuote);
@@ -63,17 +64,52 @@ void ScRefTokenHelper::compileRangeRepresentation(
break;
ScCompiler aCompiler(pDoc, ScAddress(0,0,0));
- aCompiler.SetGrammar(FormulaGrammar::GRAM_ENGLISH);
+ aCompiler.SetGrammar(eGrammar);
auto_ptr<ScTokenArray> pArray(aCompiler.CompileString(aToken));
- // There should only be one reference per range token.
- pArray->Reset();
- FormulaToken* p = pArray->GetNextReference();
- if (!p)
- continue;
+ // There MUST be exactly one reference per range token and nothing
+ // else, and it MUST be a valid reference, not some #REF!
+ USHORT nLen = pArray->GetLen();
+ if (!nLen)
+ continue; // Should a missing range really be allowed?
+ if (nLen != 1)
+ bFailure = true;
+ else
+ {
+ pArray->Reset();
+ const FormulaToken* p = pArray->GetNextReference();
+ if (!p)
+ bFailure = true;
+ else
+ {
+ const ScToken* pT = static_cast<const ScToken*>(p);
+ switch (pT->GetType())
+ {
+ case svSingleRef:
+ if (!pT->GetSingleRef().Valid())
+ bFailure = true;
+ break;
+ case svDoubleRef:
+ if (!pT->GetDoubleRef().Valid())
+ bFailure = true;
+ break;
+ case svExternalSingleRef:
+ if (!pT->GetSingleRef().ValidExternal())
+ bFailure = true;
+ break;
+ case svExternalDoubleRef:
+ if (!pT->GetDoubleRef().ValidExternal())
+ bFailure = true;
+ break;
+ default:
+ ;
+ }
+ if (!bFailure)
+ rRefTokens.push_back(
+ ScSharedTokenRef(static_cast<ScToken*>(p->Clone())));
+ }
+ }
- rRefTokens.push_back(
- ScSharedTokenRef(static_cast<ScToken*>(p->Clone())));
#if 0
switch (p->GetType())
{
@@ -93,7 +129,10 @@ void ScRefTokenHelper::compileRangeRepresentation(
;
}
#endif
+
}
+ if (bFailure)
+ rRefTokens.clear();
}
bool ScRefTokenHelper::getRangeFromToken(ScRange& rRange, const ScSharedTokenRef& pToken, bool bExternal)
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index e8a1dd90a403..0f03d31d3fc8 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1821,8 +1821,11 @@ void ScTokenArray::ReadjustRelative3DReferences( const ScAddress& rOldPos,
case svSingleRef :
{
ScSingleRefData& rRef1 = static_cast<ScToken*>(pCode[j])->GetSingleRef();
+ if ( rRef1.IsFlag3D() )
+ {
rRef1.CalcAbsIfRel( rOldPos );
rRef1.CalcRelFromAbs( rNewPos );
+ }
}
break;
default:
diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx
index 31fce4357007..cf0ccf5447a3 100644
--- a/sc/source/filter/dif/difimp.cxx
+++ b/sc/source/filter/dif/difimp.cxx
@@ -338,7 +338,7 @@ TOPIC DifParser::GetNextTopic( void )
while( eS != S_END )
{
- if( !rIn.ReadUniOrByteStringLine( aLine ) )
+ if( !ReadNextLine( aLine ) )
{
eS = S_END;
eRet = T_END;
@@ -406,10 +406,10 @@ TOPIC DifParser::GetNextTopic( void )
break;
case S_UNKNOWN:
// 2 Zeilen ueberlesen
- rIn.ReadUniOrByteStringLine( aLine );
+ ReadNextLine( aLine );
case S_ERROR_L2: // Fehler in Line 2 aufgetreten
// eine Zeile ueberlesen
- rIn.ReadUniOrByteStringLine( aLine );
+ ReadNextLine( aLine );
eS = S_END;
break;
default:
@@ -421,7 +421,7 @@ TOPIC DifParser::GetNextTopic( void )
}
-void lcl_DeEscapeQuotesDif( String& rString )
+static void lcl_DeEscapeQuotesDif( String& rString )
{
// Special handling for DIF import: Escaped (duplicated) quotes are resolved.
// Single quote characters are left in place because older versions didn't
@@ -437,25 +437,107 @@ void lcl_DeEscapeQuotesDif( String& rString )
}
}
+// Determine if passed in string is numeric data and set fVal/nNumFormat if so
+DATASET DifParser::GetNumberDataset( const sal_Unicode* pPossibleNumericData )
+{
+ DATASET eRet = D_SYNT_ERROR;
+ if( bPlain )
+ {
+ if( ScanFloatVal( pPossibleNumericData ) )
+ eRet = D_NUMERIC;
+ else
+ eRet = D_SYNT_ERROR;
+ }
+ else
+ { // ...und zur Strafe mit'm Numberformatter...
+ DBG_ASSERT( pNumFormatter, "-DifParser::GetNextDataset(): No Formatter, more fun!" );
+ String aTestVal( pPossibleNumericData );
+ sal_uInt32 nFormat = 0;
+ double fTmpVal;
+ if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) )
+ {
+ fVal = fTmpVal;
+ nNumFormat = nFormat;
+ eRet = D_NUMERIC;
+ }
+ else
+ eRet = D_SYNT_ERROR;
+ }
+ return eRet;
+}
+
+bool DifParser::ReadNextLine( String& rStr )
+{
+ if( aLookAheadLine.Len() == 0 )
+ {
+ return rIn.ReadUniOrByteStringLine( rStr );
+ }
+ else
+ {
+ rStr = aLookAheadLine;
+ aLookAheadLine.Erase();
+ return true;
+ }
+}
+
+// Look ahead in the stream to determine if the next line is the first line of
+// a valid data record structure
+bool DifParser::LookAhead()
+{
+ const sal_Unicode* pAktBuffer;
+ bool bValidStructure = false;
+
+ DBG_ASSERT( aLookAheadLine.Len() == 0, "*DifParser::LookAhead(): LookAhead called twice in a row" );
+ rIn.ReadUniOrByteStringLine( aLookAheadLine );
+
+ pAktBuffer = aLookAheadLine.GetBuffer();
+
+ switch( *pAktBuffer )
+ {
+ case '-': // Special Datatype
+ pAktBuffer++;
+
+ if( Is1_0( pAktBuffer ) )
+ {
+ bValidStructure = true;
+ }
+ break;
+ case '0': // Numeric Data
+ pAktBuffer++;
+ if( *pAktBuffer == ',' )
+ {
+ pAktBuffer++;
+ bValidStructure = ( GetNumberDataset(pAktBuffer) != D_SYNT_ERROR );
+ }
+ break;
+ case '1': // String Data
+ if( Is1_0( aLookAheadLine.GetBuffer() ) )
+ {
+ bValidStructure = true;
+ }
+ break;
+ }
+ return bValidStructure;
+}
DATASET DifParser::GetNextDataset( void )
{
DATASET eRet = D_UNKNOWN;
String aLine;
- const sal_Unicode* pAkt;
+ const sal_Unicode* pAktBuffer;
- rIn.ReadUniOrByteStringLine( aLine );
+ ReadNextLine( aLine );
- pAkt = aLine.GetBuffer();
+ pAktBuffer = aLine.GetBuffer();
- switch( *pAkt )
+ switch( *pAktBuffer )
{
case '-': // Special Datatype
- pAkt++;
+ pAktBuffer++;
- if( Is1_0( pAkt ) )
+ if( Is1_0( pAktBuffer ) )
{
- rIn.ReadUniOrByteStringLine( aLine );
+ ReadNextLine( aLine );
if( IsBOT( aLine.GetBuffer() ) )
eRet = D_BOT;
else if( IsEOD( aLine.GetBuffer() ) )
@@ -463,37 +545,16 @@ DATASET DifParser::GetNextDataset( void )
}
break;
case '0': // Numeric Data
- pAkt++; // Wert in fVal, 2. Zeile in aData
- if( *pAkt == ',' )
+ pAktBuffer++; // Wert in fVal, 2. Zeile in aData
+ if( *pAktBuffer == ',' )
{
- pAkt++;
- if( bPlain )
- {
- if( ScanFloatVal( pAkt ) )
- eRet = D_NUMERIC;
- else
- eRet = D_SYNT_ERROR;
- }
- else
- { // ...und zur Strafe mit'm Numberformatter...
- DBG_ASSERT( pNumFormatter, "-DifParser::GetNextDataset(): No Formatter, more fun!" );
- String aTestVal( pAkt );
- sal_uInt32 nFormat = 0;
- double fTmpVal;
- if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) )
- {
- fVal = fTmpVal;
- nNumFormat = nFormat;
- eRet = D_NUMERIC;
- }
- else
- eRet = D_SYNT_ERROR;
- }
- rIn.ReadUniOrByteStringLine( aData );
+ pAktBuffer++;
+ eRet = GetNumberDataset(pAktBuffer);
+ ReadNextLine( aData );
if ( eRet == D_SYNT_ERROR )
{ // for broken records write "#ERR: data" to cell
String aTmp( RTL_CONSTASCII_USTRINGPARAM( "#ERR: " ));
- aTmp += pAkt;
+ aTmp += pAktBuffer;
aTmp.AppendAscii( " (" );
aTmp += aData;
aTmp += sal_Unicode(')');
@@ -505,18 +566,62 @@ DATASET DifParser::GetNextDataset( void )
case '1': // String Data
if( Is1_0( aLine.GetBuffer() ) )
{
- rIn.ReadUniOrByteStringLine( aLine );
- DBG_ASSERT( aLine.Len() >= 2,
- "*DifParser::GetNextTopic(): Text ist zu kurz (mind. \"\")!" );
- aData = aLine.Copy( 1, aLine.Len() - 2 );
- lcl_DeEscapeQuotesDif( aData );
- eRet = D_STRING;
+ ReadNextLine( aLine );
+ xub_StrLen nLineLength = aLine.Len();
+ const sal_Unicode* pLine = aLine.GetBuffer();
+
+ if( nLineLength >= 1 && *pLine == '"' )
+ {
+ // Quotes are not always escaped (duplicated), see lcl_DeEscapeQuotesDif
+ // A look ahead into the next line is needed in order to deal with
+ // multiline strings containing quotes
+ if( LookAhead() )
+ {
+ // Single line string
+ if( nLineLength >= 2 && pLine[nLineLength - 1] == '"' )
+ {
+ aData = aLine.Copy( 1, nLineLength - 2 );
+ lcl_DeEscapeQuotesDif( aData );
+ eRet = D_STRING;
+ }
+ }
+ else
+ {
+ // Multiline string
+ aData = aLine.Copy( 1 );
+ bool bContinue = true;
+ while ( bContinue )
+ {
+ aData.Append( '\n' );
+ bContinue = !rIn.IsEof() && ReadNextLine( aLine );
+ if( bContinue )
+ {
+ nLineLength = aLine.Len();
+ if( nLineLength >= 1 )
+ {
+ pLine = aLine.GetBuffer();
+ bContinue = !LookAhead();
+ if( bContinue )
+ {
+ aData.Append( aLine );
+ }
+ else if( pLine[nLineLength - 1] == '"' )
+ {
+ aData.Append( pLine, nLineLength - 1 );
+ lcl_DeEscapeQuotesDif( aData );
+ eRet = D_STRING;
+ }
+ }
+ }
+ };
+ }
+ }
}
break;
}
if( eRet == D_UNKNOWN )
- rIn.ReadUniOrByteStringLine( aLine );
+ ReadNextLine( aLine );
if( rIn.IsEof() )
eRet = D_EOD;
diff --git a/sc/source/filter/excel/biffrecdumper.ini b/sc/source/filter/excel/biffrecdumper.ini
deleted file mode 100644
index ba30b217e671..000000000000
--- a/sc/source/filter/excel/biffrecdumper.ini
+++ /dev/null
@@ -1,340 +0,0 @@
-//SKIPDUMP // on = deactivates the dumper
-CONTLOAD // on = dump and load file; off = dump only
-SKIPOFFSET // on = skip record stream position
-READCONTRECS // on = merge CONTINUE records; off = dump CONTINUEs separately
-NOWARNINGS // on = no stream assertions
-CLEARFILE // on = overwrite text file; off = append to text file
-BLANKLINE // on = blank line between records
-//EXPORTBOOKSTREAM // on = export the Book or Workbook stream to [filename]_book.xls
-PARSEP=,
-//COMMENT=//
-OUTPUT=*
-//TITLE=--------- Biff8 Woorkbook - Stream - Dump --------------------------------
-//TITLE=--------------------------------------------------------------------------
-MAXBODYLINES=8000
-INCLUDE=* // alternativ +
-//EXCLUDE=*
-BODY=* // alternativ B
-//NAMEONLY=0x0000...0x1000
-//EXCLUDE=0x00E1,0x00C1 // alternativ -
-//HEX=* // alternativ H
-// 0xYYYY=BEZEICHNUNG,IN/EXCLUDE,MODE(=BODY(B),HEX(H) oder NAMEONLY(N))
-0x0000=DIMENSIONS ,
-0x0001=BLANK ,
-0x0002=INTEGER ,
-0x0003=NUMBER ,
-0x0004=LABEL ,
-0x0005=BOOLERR ,
-0x0006=FORMULA ,
-0x0007=STRING ,
-0x0008=ROW ,
-0x0009=BOF ,
-0x000A=EOF ,
-0x000B=INDEX ,
-0x000C=CALCCOUNT ,
-0x000D=CALCMODE ,
-0x000E=PRECISION ,
-0x000F=REFMODE ,
-0x0010=DELTA ,
-0x0011=ITERATION ,
-0x0012=PROTECT ,
-0x0013=PASSWORD ,
-0x0014=HEADER ,
-0x0015=FOOTER ,
-0x0016=EXTERNCOUNT ,
-0x0017=EXTERNSHEET ,
-0x0018=NAME ,
-0x0019=WINDOWPROTECT ,
-0x001A=VERTICALPAGEBREAKS ,
-0x001B=HORIZONTALPAGEBREAKS ,
-0x001C=NOTE ,
-0x001D=SELECTION ,
-0x001E=FORMAT ,
-0x001F=FORMATCOUNT ,
-0x0020=COLUMNDEFAULT ,
-0x0021=ARRAY ,
-0x0022=1904 ,
-0x0023=EXTERNNAME ,
-0x0024=COLWIDTH ,
-0x0025=DEFAULTROWHEIGHT ,
-0x0026=LEFTMARGIN ,
-0x0027=RIGHTMARGIN ,
-0x0028=TOPMARGIN ,
-0x0029=BOTTOMMARGIN ,
-0x002A=PRINTHEADERS ,
-0x002B=PRINTGRIDLINES ,
-0x002F=FILEPASS ,
-0x0031=FONT ,
-0x0033=PRINTSIZE ,
-0x0035=INFOOPTS ,
-0x0036=TABLE ,
-0x0038=WNDESK ,
-0x003A=BEGINPREF ,
-0x003B=ENDPREF ,
-0x003C=CONTINUE ,
-0x003D=WINDOW1 ,
-0x003E=WINDOW2 ,
-0x0040=BACKUP ,
-0x0041=PANE ,
-0x0042=CODEPAGE ,
-0x0043=XF ,
-0x0044=IXFE ,
-0x0045=EFONT ,
-0x0046=SHOWSCROLL ,
-0x0047=SHOWFORMULA ,
-0x0048=STATUSBAR ,
-0x0049=SHORTMENUS ,
-0x004A=DDEENABLED ,
-0x004B=AUTODEC ,
-0x004C=MENUKEY ,
-0x004D=PLS|ZOOM ,
-0x004E=MENUUND ,
-0x004F=MOVESEL ,
-0x0050=DCON ,
-0x0051=DCONREF ,
-0x0052=DCONNAME ,
-0x0055=DEFCOLWIDTH ,
-0x0056=BUILTINFMTCNT ,
-0x0058=TOOLBAR ,
-0x0059=XCT ,
-0x005A=CRN ,
-0x005B=FILESHARING ,
-0x005C=WRITEACCESS ,
-0x005D=OBJ ,
-0x005E=UNCALCED ,
-0x005F=SAFERECALC ,
-0x0060=TEMPLATE ,
-0x0063=OBJPROTECT ,
-0x007D=COLINFO ,
-0x007E=RK ,
-0x007F=IMDATA ,
-0x0080=GUTS ,
-0x0081=WSBOOL ,
-0x0082=GRIDSET ,
-0x0083=HCENTER ,
-0x0084=VCENTER ,
-0x0085=BOUNDSHEET ,
-0x0086=WRITEPROT ,
-0x0087=ADDIN ,
-0x0088=EDG ,
-0x0089=PUB ,
-0x008A=NOTEOFF ,
-0x008B=LH ,
-0x008C=COUNTRY ,
-0x008D=HIDEOBJ ,
-0x008E=SHEETSOFFSET ,
-0x008F=SHEETHEADER ,
-0x0090=SORT ,
-0x0091=SUB ,
-0x0092=PALETTE ,
-0x0093=STYLE ,
-0x0094=LHRECORD ,
-0x0095=LHNGRAPH ,
-0x0096=SOUND ,
-0x0098=LPR ,
-0x0099=STANDARDWIDTH ,
-0x009A=FNGROUPNAME ,
-0x009B=FILTERMODE ,
-0x009C=FNGROUPCOUNT ,
-0x009D=AUTOFILTERINFO ,
-0x009E=AUTOFILTER ,
-0x00A0=SCL ,
-0x00A1=SETUP ,
-0x00A3=PROJEXTSHEET ,
-0x00A8=DRAGDROP ,
-0x00A9=COORDLIST ,
-0x00AB=GCW ,
-0x00AE=SCENMAN ,
-0x00AF=SCENARIO ,
-0x00B0=SXVIEW ,
-0x00B1=SXVD ,
-0x00B2=SXVI ,
-0x00B4=SXIVD ,
-0x00B5=SXLI ,
-0x00B6=SXPI ,
-0x00B8=DOCROUTE ,
-0x00B9=RECIPNAME ,
-0x00BC=SHRFMLA ,
-0x00BD=MULRK ,
-0x00BE=MULBLANK ,
-0x00C1=MMS ,
-0x00C2=ADDMENU ,
-0x00C3=DELMENU ,
-0x00C5=SXDI ,
-0x00C6=SXDB ,
-0x00C7=SXFIELD ,
-0x00C8=SXINDEXLIST ,
-0x00C9=SXDOUBLE ,
-0x00CA=SXBOOLEAN ,
-0x00CB=SXERROR ,
-0x00CC=SXINTEGER ,
-0x00CD=SXSTRING ,
-0x00CE=SXDATETIME ,
-0x00CF=SXEMPTY ,
-0x00D0=SXTBL ,
-0x00D1=SXTBRGITEM ,
-0x00D2=SXTBPG ,
-0x00D3=OBPROJ ,
-0x00D5=SXIDSTM ,
-0x00D6=RSTRING ,
-0x00D7=DBCELL ,
-0x00D8=SXNUMGROUP ,
-0x00D9=SXGROUPINFO ,
-0x00DA=BOOKBOOL ,
-0x00DB=REVERT ,
-0x00DC=SXEXT|PARAMQRY ,
-0x00DD=SCENPROTECT ,
-0x00DE=OLESIZE ,
-0x00DF=UDDESC ,
-0x00E0=XF ,
-0x00E1=INTERFACEHDR ,
-0x00E2=INTERFACEEND ,
-0x00E3=SXVS ,
-0x00E5=CELLMERGING ,
-0x00E9=BITMAP ,
-0x00EB=MSODRAWINGGROUP ,
-0x00EC=MSODRAWING ,
-0x00ED=MSODRAWINGSELECTION ,
-0x00EF=PHONETIC ,
-0x00F0=SXRULE ,
-0x00F1=SXEX ,
-0x00F2=SXFILT ,
-0x00F6=SXNAME ,
-0x00F7=SXSELECT ,
-0x00F8=SXPAIR ,
-0x00F9=SXFMLA ,
-0x00FB=SXFORMAT ,
-0x00FC=SST ,
-0x00FD=LABELSST ,
-0x00FF=EXTSST ,
-0x0100=SXVDEX ,
-0x0103=SXFORMULA ,
-0x0122=SXDBEX ,
-0x0137=CHTRINSERT ,
-0x0138=CHTRINFO ,
-0x013B=CHTRCELLCONTENT ,
-0x013D=TABID ,
-0x0140=CHTRMOVERANGE ,
-0x014D=CHTRINSERTTAB ,
-0x015F=LABELRANGES ,
-0x0160=USESELFS ,
-0x0162=XL5MODIFY ,
-0x0196=CHTRHEADER ,
-0x01A9=USERBVIEW ,
-0x01AA=USERSVIEWBEGIN ,
-0x01AB=USERSVIEWEND ,
-0x01AD=QSI ,
-0x01AE=SUPBOOK ,
-0x01AF=PROT4REV ,
-0x0161=DSF ,
-0x01B0=CONDFMT ,
-0x01B1=CF ,
-0x01B2=DVAL ,
-0x01B5=DCONBIN ,
-0x01B6=TXO ,
-0x01B7=REFRESHALL ,
-0x01B8=HLINK ,
-0x01BA=CODENAME ,
-0x01BB=SXFDBTYPE ,
-0x01BC=PROT4REVPASS ,
-0x01BE=DV ,
-0x0200=DIMENSIONS ,
-0x0201=BLANK ,
-0x0203=NUMBER ,
-0x0204=LABEL ,
-0x0205=BOOLERR ,
-0x0206=FORMULA ,
-0x0207=STRING ,
-0x0208=ROW ,
-0x0209=BOF ,
-0x020B=INDEX ,
-0x0218=NAME ,
-0x0221=ARRAY ,
-0x0223=EXTERNNAME ,
-0x0225=DEFAULTROWHEIGHT ,
-0x0231=FONT ,
-0x0236=TABLE ,
-0x023E=WINDOW2 ,
-0x0243=XF ,
-0x027E=RK ,
-0x0293=STYLE ,
-0x0406=FORMULA ,
-0x0409=BOF ,
-0x041E=FORMAT ,
-0x0443=XF ,
-0x04BC=SHRFMLA ,
-0x0800=SCREENTIP ,
-0x0803=WEBQRYSETTINGS ,
-0x0804=WEBQRYTABLES ,
-0x0809=BOF ,
-0x0862=SHEETLAYOUT ,
-0x0867=SHEETPROTECTION ,
-0x1001=CHUNITS ,
-0x1002=CHCHART ,
-0x1003=CHSERIES ,
-0x1004=CHSOURCELINK ,
-0x1006=CHDATAFORMAT ,
-0x1007=CHLINEFORMAT ,
-0x1009=CHMARKERFORMAT ,
-0x100A=CHAREAFORMAT ,
-0x100B=CHPIEFORMAT ,
-0x100C=CHATTACHEDLABEL ,
-0x100D=CHSTRING ,
-0x1014=CHCHARTGROUP ,
-0x1015=CHLEGEND ,
-0x1016=CHSERIESLIST ,
-0x1017=CHBAR ,
-0x1018=CHLINE ,
-0x1019=CHPIE ,
-0x101A=CHAREA ,
-0x101B=CHSCATTER ,
-0x101C=CHCHARTLINE ,
-0x101D=CHAXIS ,
-0x101E=CHTICK ,
-0x101F=CHVALUERANGE ,
-0x1020=CHLABELRANGE ,
-0x1021=CHAXISLINE ,
-0x1022=CHFORMATLINK ,
-0x1024=CHDEFAULTTEXT ,
-0x1025=CHTEXT ,
-0x1026=CHFONT ,
-0x1027=CHOBJECTLINK ,
-0x102D=CHARROW ,
-0x102F=CHARROWHEAD ,
-0x1032=CHFRAME ,
-0x1033=CHBEGIN ,
-0x1034=CHEND ,
-0x1035=CHPLOTAREA ,
-0x1036=CHCHARTSIZE ,
-0x1037=CHRELPOSITION ,
-0x1038=CHARROWRELPOS ,
-0x103A=CHCHART3D ,
-0x103B=CHMULTILINK ,
-0x103C=CHPICFORMAT ,
-0x103D=CHDROPBAR ,
-0x103E=CHRADARLINE ,
-0x103F=CHSURFACE ,
-0x1040=CHRADARAREA ,
-0x1041=CHAXESSET ,
-0x1043=CHLEGENDENTRY ,
-0x1044=CHPROPERTIES ,
-0x1045=CHSERGROUP ,
-0x1046=CHUSEDAXESSETS ,
-0x1048=CHPIVOTREF ,
-0x104A=CHSERPARENT ,
-0x104B=CHSERTRENDLINE ,
-0x104E=CHFORMAT ,
-0x104F=CHPOS ,
-0x1050=CHFORMATRUNS ,
-0x1051=CHSOURCELINK ,
-0x105B=CHSERERRORBAR ,
-0x105D=CHSERIESFORMAT ,
-0x105F=CH3DDATAFORMAT ,
-0x1060=CHFONTBASE ,
-0x1061=CHPIEEXT ,
-0x1062=CHEXTRANGE ,
-0x1063=CHDATATABLE ,
-0x1064=CHPLOTGROWTH ,
-0x1065=CHSERINDEX ,
-0x1066=CHESCHERFORMAT ,
-0x1067=CHPIEEXTSETT ,
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index 312604d7ab92..b1ec8752de7b 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -95,6 +95,12 @@ void XclImpColRowSettings::SetWidthRange( SCCOL nScCol1, SCCOL nScCol2, sal_uInt
{
DBG_ASSERT( (nScCol1 <= nScCol2) && ValidCol( nScCol2 ), "XclImpColRowSettings::SetColWidthRange - invalid column range" );
nScCol2 = ::std::min( nScCol2, MAXCOL );
+ if (nScCol2 == 256)
+ // In BIFF8, the column range is 0-255, and the use of 256 probably
+ // means the range should extend to the max column if the loading app
+ // support columns beyond 255.
+ nScCol2 = MAXCOL;
+
nScCol1 = ::std::min( nScCol1, nScCol2 );
::std::fill( maWidths.begin() + nScCol1, maWidths.begin() + nScCol2 + 1, nWidth );
for( ScfUInt8Vec::iterator aIt = maColFlags.begin() + nScCol1, aEnd = maColFlags.begin() + nScCol2 + 1; aIt != aEnd; ++aIt )
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 811097183b1e..d1b08b9cfc68 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -68,11 +68,11 @@
#include "convuno.hxx"
#include "patattr.hxx"
#include "docoptio.hxx"
+#include "tabprotection.hxx"
#include "excdoc.hxx"
#include "namebuff.hxx"
-#include "xcl97dum.hxx"
#include "xcl97rec.hxx"
#include "xcl97esc.hxx"
#include "xetable.hxx"
@@ -118,7 +118,7 @@ static void lcl_AddCalcPr( XclExpRecordList<>& aRecList, ExcTable& self )
aRecList.AppendNewRecord( new XclRefmode( rDoc ) );
aRecList.AppendNewRecord( new XclIteration( rDoc ) );
aRecList.AppendNewRecord( new XclDelta( rDoc ) );
- aRecList.AppendNewRecord( new ExcDummy8_02 );
+ aRecList.AppendNewRecord( new XclExpBoolRecord(0x005F, true) ); // SAVERECALC
aRecList.AppendNewRecord( new XclExpXmlEndSingleElementRecord() ); // XML_calcPr
}
@@ -209,7 +209,16 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
Add( new ExcDummy_00 );
else
{
- Add( new ExcDummy8_00a );
+ if ( IsDocumentEncrypted() )
+ Add( new XclExpFilePass(GetRoot()) );
+
+ Add( new XclExpInterfaceHdr );
+ Add( new XclExpMMS );
+ Add( new XclExpInterfaceEnd );
+ Add( new XclExpWriteAccess );
+ Add( new XclExpCodePage );
+ Add( new XclExpDSF );
+ Add( new XclExpExcel9File );
rR.pTabId = new XclExpChTrTabId( Max( nExcTabCount, nCodenames ) );
Add( rR.pTabId );
if( HasVbaStorage() )
@@ -219,7 +228,8 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
if( rCodeName.Len() )
Add( new XclCodename( rCodeName ) );
}
- Add( new ExcDummy8_00b );
+
+ Add( new XclExpFnGroupCount );
}
// erst Namen- und Tabellen-Eintraege aufbauen
@@ -239,12 +249,22 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
aRecList.AppendRecord( CreateRecord( EXC_ID_NAME ) );
}
- aRecList.AppendNewRecord( new XclExpWindowProtection( GetExtDocOptions().GetDocSettings().mbWinProtected ) );
- aRecList.AppendNewRecord( new XclExpDocProtection( rDoc.IsDocProtected() ) );
- aRecList.AppendNewRecord( new XclExpBoolRecord( EXC_ID_PASSWORD, false ) );
+ // document protection options
+ const ScDocProtection* pProtect = GetDoc().GetDocProtection();
+ if (pProtect && pProtect->isProtected())
+ {
+ Add( new XclExpWindowProtection(pProtect->isOptionEnabled(ScDocProtection::WINDOWS)) );
+ Add( new XclExpProtection(pProtect->isOptionEnabled(ScDocProtection::STRUCTURE)) );
+#if ENABLE_SHEET_PROTECTION
+ Add( new XclExpPassHash(pProtect->getPasswordHash(PASSHASH_XL)) );
+#endif
+ }
if( GetBiff() == EXC_BIFF8 )
- Add( new ExcDummy8_040 );
+ {
+ Add( new XclExpProt4Rev );
+ Add( new XclExpProt4RevPass );
+ }
// document protection options
if( GetOutput() == EXC_OUTPUT_BINARY )
@@ -255,6 +275,12 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
Add( new XclExpXmlStartSingleElementRecord( XML_workbookPr ) );
+ if ( GetBiff() == EXC_BIFF8 )
+ {
+ Add( new XclExpBoolRecord(0x0040, false) ); // BACKUP
+ Add( new XclExpBoolRecord(0x008D, false) ); // HIDEOBJ
+ }
+
if( GetBiff() <= EXC_BIFF5 )
{
Add( new ExcDummy_040 );
@@ -263,9 +289,11 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
}
else
{
+ // BIFF8
Add( new Exc1904( rDoc ) );
Add( new XclExpBoolRecord( 0x000E, !rDoc.GetDocOptions().IsCalcAsShown() ) );
- Add( new ExcDummy8_041 );
+ Add( new XclExpBoolRecord(0x01B7, false) ); // REFRESHALL
+ Add( new XclExpBoolRecord(0x00DA, false) ); // BOOKBOOL
// OOXTODO: The following /workbook/workbookPr attributes are mapped
// to various BIFF records that are not currently supported:
//
@@ -361,10 +389,14 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
if( GetOutput() != EXC_OUTPUT_BINARY )
lcl_AddCalcPr( aRecList, *this );
+ Add( new XclExpRecalcId );
+
// MSODRAWINGGROUP per-document data
Add( new XclMsodrawinggroup( rR, ESCHER_DggContainer ) );
// Shared string table: SST, EXTSST
aRecList.AppendRecord( CreateRecord( EXC_ID_SST ) );
+
+ Add( new XclExpBookExt );
}
Add( new ExcEof );
@@ -425,8 +457,16 @@ void ExcTable::FillAsTable( size_t nCodeNameIdx )
// page settings (SETUP and various other records)
aRecList.AppendRecord( xPageSett );
- if( rDoc.IsTabProtected( mnScTab ) )
- Add( new XclProtection() );
+ const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnScTab);
+ if (pTabProtect && pTabProtect->isProtected())
+ {
+ Add( new XclExpProtection(true) );
+ Add( new XclExpBoolRecord(0x00DD, pTabProtect->isOptionEnabled(ScTableProtection::SCENARIOS)) );
+ Add( new XclExpBoolRecord(0x0063, pTabProtect->isOptionEnabled(ScTableProtection::OBJECTS)) );
+#if ENABLE_SHEET_PROTECTION
+ Add( new XclExpPassHash(pTabProtect->getPasswordHash(PASSHASH_XL)) );
+#endif
+ }
// local link table: EXTERNCOUNT, EXTERNSHEET
if( eBiff <= EXC_BIFF5 )
@@ -467,6 +507,9 @@ void ExcTable::FillAsTable( size_t nCodeNameIdx )
if( eBiff == EXC_BIFF8 )
{
+ // sheet protection options
+ Add( new XclExpSheetProtectOptions( GetRoot(), mnScTab ) );
+
// web queries
Add( new XclExpWebQueryBuffer( GetRoot() ) );
@@ -771,7 +814,7 @@ void ExcDocument::WriteXml( SvStream& rStrm )
rWorkbook->endElement( XML_workbook );
rWorkbook.reset();
- aStrm.commit();
+ aStrm.commitStorage();
}
#if 0
if( pExpChangeTrack )
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index 1a90817f99ae..3965d0acaf4e 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -39,6 +39,7 @@
#include <tools/globname.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/processfactory.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include "scitems.hxx"
@@ -77,17 +78,24 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument
using namespace ::com::sun::star;
using namespace ::comphelper;
- // false = use old sc filter for import (OOX only as file dumper), true = use new OOX filter for import
- bool bUseOoxFilter = false;
+ /* Environment variable "OOO_OOXBIFFFILTER":
+ - "1" = use new OOX filter for import;
+ - undef/other = use old sc filter for import (OOX only as file dumper). */
+ const sal_Char* pcFileName = ::getenv( "OOO_OOXBIFFFILTER" );
+ bool bUseOoxFilter = pcFileName && (*pcFileName == '1') && (*(pcFileName + 1) == 0);
if( SfxObjectShell* pDocShell = pDocument->GetDocumentShell() ) try
{
uno::Reference< lang::XComponent > xComponent( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Sequence< beans::NamedValue > aArgSeq( 1 );
+ aArgSeq[ 0 ].Name = CREATE_OUSTRING( "UseBiffFilter" );
+ aArgSeq[ 0 ].Value <<= bUseOoxFilter;
+
uno::Sequence< uno::Any > aArgs( 2 );
aArgs[ 0 ] <<= getProcessServiceFactory();
- aArgs[ 1 ] <<= !bUseOoxFilter;
+ aArgs[ 1 ] <<= aArgSeq;
uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs(
- CREATE_STRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW );
+ CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW );
xImporter->setTargetDocument( xComponent );
MediaDescriptor aDescriptor;
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 9e06dede525f..35662f44d2bb 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -160,12 +160,6 @@ void ImportExcel8::Iteration( void )
}
-void ImportExcel8:: WinProtection( void )
-{
- if( aIn.ReaduInt16() != 0 )
- GetExtDocOptions().GetDocSettings().mbWinProtected = true;
-}
-
void ImportExcel8::Boundsheet( void )
{
UINT8 nLen;
@@ -255,6 +249,11 @@ void ImportExcel8::Codename( BOOL bWorkbookGlobals )
}
}
+void ImportExcel8::SheetProtection( void )
+{
+ GetSheetProtectBuffer().ReadOptions( aIn, GetCurrScTab() );
+}
+
bool lcl_hasVBAEnabled()
{
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY);
@@ -301,6 +300,8 @@ void ImportExcel8::PostDocLoad( void )
pExcRoot->pAutoFilterBuffer->Apply();
GetWebQueryBuffer().Apply(); //! test if extant
+ GetSheetProtectBuffer().Apply();
+ GetDocProtectBuffer().Apply();
ImportExcel::PostDocLoad();
@@ -432,6 +433,38 @@ void XclImpAutoFilterData::InsertQueryParam()
}
}
+static void ExcelQueryToOooQuery( ScQueryEntry& rEntry )
+{
+ if( ( rEntry.eOp != SC_EQUAL && rEntry.eOp != SC_NOT_EQUAL ) || rEntry.pStr == NULL )
+ return;
+ else
+ {
+ xub_StrLen nLen = rEntry.pStr->Len();
+ sal_Unicode nStart = rEntry.pStr->GetChar( 0 );
+ sal_Unicode nEnd = rEntry.pStr->GetChar( nLen-1 );
+ if( nLen >2 && nStart == '*' && nEnd == '*' )
+ {
+ rEntry.pStr->Erase( nLen-1, 1 );
+ rEntry.pStr->Erase( 0, 1 );
+ rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_CONTAINS : SC_DOES_NOT_CONTAIN;
+ }
+ else if( nLen > 1 && nStart == '*' && nEnd != '*' )
+ {
+ rEntry.pStr->Erase( 0, 1 );
+ rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_ENDS_WITH : SC_DOES_NOT_END_WITH;
+ }
+ else if( nLen > 1 && nStart != '*' && nEnd == '*' )
+ {
+ rEntry.pStr->Erase( nLen-1, 1 );
+ rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_BEGINS_WITH : SC_DOES_NOT_BEGIN_WITH;
+ }
+ else if( nLen == 2 && nStart == '*' && nEnd == '*' )
+ {
+ rEntry.pStr->Erase( 0, 1 );
+ }
+ }
+}
+
void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
{
UINT16 nCol, nFlags;
@@ -469,14 +502,14 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
BOOL bIgnore;
UINT8 nStrLen[ 2 ] = { 0, 0 };
- String* pEntryStr[ 2 ] = { NULL, NULL };
+ ScQueryEntry *pQueryEntries[ 2 ] = { NULL, NULL };
for( nE = 0; nE < 2; nE++ )
{
if( nFirstEmpty < nCount )
{
ScQueryEntry& aEntry = aParam.GetEntry( nFirstEmpty );
- pEntryStr[ nE ] = aEntry.pStr;
+ pQueryEntries[ nE ] = &aEntry;
bIgnore = FALSE;
rStrm >> nType >> nOper;
@@ -564,8 +597,12 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
}
for( nE = 0; nE < 2; nE++ )
- if( nStrLen[ nE ] && pEntryStr[ nE ] )
- pEntryStr[ nE ]->Assign( rStrm.ReadUniString( nStrLen[ nE ] ) );
+ if( nStrLen[ nE ] && pQueryEntries[ nE ] )
+ {
+ pQueryEntries[ nE ]->pStr->Assign ( rStrm.ReadUniString( nStrLen[ nE ] ) );
+ ExcelQueryToOooQuery( *pQueryEntries[ nE ] );
+ }
+
}
}
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index e97a0d9fdd6f..0f51bb8f2f1b 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -100,6 +100,7 @@
#include <oox/core/tokens.hxx>
+using ::com::sun::star::uno::Sequence;
using ::rtl::OString;
@@ -432,7 +433,9 @@ ExcBundlesheetBase::ExcBundlesheetBase() :
void ExcBundlesheetBase::UpdateStreamPos( XclExpStream& rStrm )
{
rStrm.SetSvStreamPos( nOwnPos );
+ rStrm.DisableEncryption();
rStrm << static_cast<sal_uInt32>(nStrPos);
+ rStrm.EnableEncryption();
}
@@ -532,7 +535,7 @@ void XclExpWsbool::SaveXml( XclExpXmlStream& rStrm )
// XclExpWindowProtection ===============================================================
XclExpWindowProtection::XclExpWindowProtection(bool bValue) :
- XclExpBoolRecord(EXC_ID_WINDOWPROTECT,bValue)
+ XclExpBoolRecord(EXC_ID_WINDOWPROTECT, bValue)
{
}
@@ -545,13 +548,35 @@ void XclExpWindowProtection::SaveXml( XclExpXmlStream& rStrm )
// XclExpDocProtection ===============================================================
-XclExpDocProtection::XclExpDocProtection(bool bValue) :
- XclExpBoolRecord(EXC_ID_PROTECT,bValue)
+XclExpProtection::XclExpProtection(bool bValue) :
+ XclExpBoolRecord(EXC_ID_PROTECT, bValue)
{
}
// ============================================================================
+XclExpPassHash::XclExpPassHash(const Sequence<sal_Int8>& aHash) :
+ XclExpRecord(EXC_ID_PASSWORD, 2),
+ mnHash(0x0000)
+{
+ if (aHash.getLength() >= 2)
+ {
+ mnHash = ((aHash[0] << 8) & 0xFFFF);
+ mnHash |= (aHash[1] & 0xFF);
+ }
+}
+
+XclExpPassHash::~XclExpPassHash()
+{
+}
+
+void XclExpPassHash::WriteBody(XclExpStream& rStrm)
+{
+ rStrm << mnHash;
+}
+
+// ============================================================================
+
XclExpFiltermode::XclExpFiltermode() :
XclExpEmptyRecord( EXC_ID_FILTERMODE )
{
@@ -699,7 +724,31 @@ BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry )
String sText;
if( rEntry.pStr )
+ {
sText.Assign( *rEntry.pStr );
+ switch( rEntry.eOp )
+ {
+ case SC_CONTAINS:
+ case SC_DOES_NOT_CONTAIN:
+ {
+ sText.InsertAscii( "*" , 0 );
+ sText.AppendAscii( "*" );
+ }
+ break;
+ case SC_BEGINS_WITH:
+ case SC_DOES_NOT_BEGIN_WITH:
+ sText.AppendAscii( "*" );
+ break;
+ case SC_ENDS_WITH:
+ case SC_DOES_NOT_END_WITH:
+ sText.InsertAscii( "*" , 0 );
+ break;
+ default:
+ {
+ //nothing
+ }
+ }
+ }
BOOL bLen = sText.Len() > 0;
@@ -759,6 +808,14 @@ BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry )
case SC_LESS_EQUAL: nOper = EXC_AFOPER_LESSEQUAL; break;
case SC_GREATER_EQUAL: nOper = EXC_AFOPER_GREATEREQUAL; break;
case SC_NOT_EQUAL: nOper = EXC_AFOPER_NOTEQUAL; break;
+ case SC_CONTAINS:
+ case SC_BEGINS_WITH:
+ case SC_ENDS_WITH:
+ nOper = EXC_AFOPER_EQUAL; break;
+ case SC_DOES_NOT_CONTAIN:
+ case SC_DOES_NOT_BEGIN_WITH:
+ case SC_DOES_NOT_END_WITH:
+ nOper = EXC_AFOPER_NOTEQUAL; break;
default:;
}
bConflict = !AddCondition( rEntry.eConnect, nType, nOper, fVal, pText );
diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx
index 165a6db5fdc2..677d872fe8e9 100644
--- a/sc/source/filter/excel/expop2.cxx
+++ b/sc/source/filter/excel/expop2.cxx
@@ -102,7 +102,7 @@ FltError ExportBiff5::Write()
SvxImportMSVBasic aBasicImport( *pDocShell, *xRootStrg, bWriteBasicCode, bWriteBasicStrg );
ULONG nErr = aBasicImport.SaveOrDelMSVBAStorage( TRUE, EXC_STORAGE_VBA_PROJECT );
if( nErr != ERRCODE_NONE )
- pDocShell->SetError( nErr );
+ pDocShell->SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
pExcDoc->ReadDoc(); // ScDoc -> ExcDoc
@@ -198,7 +198,7 @@ FltError ExportXml2007::Write()
SvxImportMSVBasic aBasicImport( *pDocShell, *xRootStrg, bWriteBasicCode, bWriteBasicStrg );
ULONG nErr = aBasicImport.SaveOrDelMSVBAStorage( TRUE, EXC_STORAGE_VBA_PROJECT );
if( nErr != ERRCODE_NONE )
- pDocShell->SetError( nErr );
+ pDocShell->SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
pExcDoc->ReadDoc(); // ScDoc -> ExcDoc
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index a2c5e786abbe..cfbef0a15a6e 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -84,6 +84,7 @@
#include "xiview.hxx"
#include "xilink.hxx"
#include "xiescher.hxx"
+#include "xicontent.hxx"
#include "excimp8.hxx"
#include "excform.hxx"
@@ -418,14 +419,12 @@ void ImportExcel::Eof( void )
}
-BOOL ImportExcel::Password( void )
+void ImportExcel::SheetPassword( void )
{
- // POST: return = TRUE, wenn Password <> 0
- UINT16 nPasswd;
-
- aIn >> nPasswd;
+ if (GetRoot().GetBiff() != EXC_BIFF8)
+ return;
- return nPasswd != 0x0000;
+ GetRoot().GetSheetProtectBuffer().ReadPasswordHash( aIn, GetCurrScTab() );
}
@@ -439,6 +438,15 @@ void ImportExcel::Externsheet( void )
}
+void ImportExcel:: WinProtection( void )
+{
+ if (GetRoot().GetBiff() != EXC_BIFF8)
+ return;
+
+ GetRoot().GetDocProtectBuffer().ReadWinProtect( aIn );
+}
+
+
void ImportExcel::Columndefault( void )
{// Default Cell Attributes
UINT16 nColMic, nColMac;
@@ -570,27 +578,33 @@ void ImportExcel::Defrowheight2( void )
}
-void ImportExcel::Protect( void )
+void ImportExcel::SheetProtect( void )
{
- if( aIn.ReaduInt16() )
- {
- uno::Sequence<sal_Int8> aEmptyPass;
- GetDoc().SetTabProtection( GetCurrScTab(), TRUE, aEmptyPass );
- }
+ if (GetRoot().GetBiff() != EXC_BIFF8)
+ return;
+
+ GetRoot().GetSheetProtectBuffer().ReadProtect( aIn, GetCurrScTab() );
}
void ImportExcel::DocProtect( void )
{
- if( aIn.ReaduInt16() )
- {
- uno::Sequence<sal_Int8> aEmptyPass;
- GetDoc().SetDocProtection( TRUE, aEmptyPass );
- }
+ if (GetRoot().GetBiff() != EXC_BIFF8)
+ return;
+
+ GetRoot().GetDocProtectBuffer().ReadDocProtect( aIn );
}
+void ImportExcel::DocPasssword( void )
+{
+ if (GetRoot().GetBiff() != EXC_BIFF8)
+ return;
+
+ GetRoot().GetDocProtectBuffer().ReadPasswordHash( aIn );
+}
void ImportExcel::Codepage( void )
{
+ maStrm.EnableDecryption();
SetCodePage( maStrm.ReaduInt16() );
}
diff --git a/sc/source/filter/excel/makefile.mk b/sc/source/filter/excel/makefile.mk
index 785ad197a168..4fffb1ef3ed1 100644
--- a/sc/source/filter/excel/makefile.mk
+++ b/sc/source/filter/excel/makefile.mk
@@ -51,7 +51,6 @@ VISIBILITY_HIDDEN=TRUE
# --- Files --------------------------------------------------------
SLOFILES = \
- $(SLO)$/biffdump.obj \
$(SLO)$/colrowst.obj \
$(SLO)$/excdoc.obj \
$(SLO)$/excel.obj \
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index f56a00763d4e..e7473ba23d02 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -54,20 +54,11 @@
#include "XclImpChangeTrack.hxx"
#include "root.hxx"
-#include "biffdump.hxx"
#include "imp_op.hxx"
#include "excimp8.hxx"
FltError ImportExcel::Read( void )
{
-#if EXC_INCL_DUMPER
- {
- Biff8RecDumper aDumper( GetRoot(), FALSE );
- if( aDumper.Dump( aIn ) )
- return ERRCODE_ABORT;
- }
-#endif
-
XclImpPageSettings& rPageSett = GetPageSettings();
XclImpTabViewSettings& rTabViewSett = GetTabViewSettings();
XclImpPalette& rPal = GetPalette();
@@ -363,7 +354,7 @@ FltError ImportExcel::Read( void )
Eof();
eAkt = Z_Ende;
break;
- case 0x12: Protect(); break; // SHEET PROTECTION
+ case 0x12: SheetProtect(); break; // SHEET PROTECTION
case 0x14:
case 0x15: rPageSett.ReadHeaderFooter( maStrm ); break;
case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
@@ -478,7 +469,7 @@ FltError ImportExcel::Read( void )
Eof();
eAkt = Z_Biff4E;
break;
- case 0x12: Protect(); break; // SHEET PROTECTION
+ case 0x12: SheetProtect(); break; // SHEET PROTECTION
case 0x14:
case 0x15: rPageSett.ReadHeaderFooter( maStrm ); break;
case 0x1A:
@@ -605,7 +596,7 @@ FltError ImportExcel::Read( void )
eAkt = Z_Biff5T;
aIn.SeekGlobalPosition(); // und zurueck an alte Position
break;
- case 0x12: Protect(); break; // SHEET PROTECTION
+ case 0x12: SheetProtect(); break; // SHEET PROTECTION
case 0x1A:
case 0x1B: rPageSett.ReadPageBreaks( maStrm ); break;
case 0x1D: rTabViewSett.ReadSelection( maStrm ); break;
@@ -904,6 +895,7 @@ FltError ImportExcel8::Read( void )
}
break;
case 0x12: DocProtect(); break; // PROTECT [ 5678]
+ case 0x13: DocPasssword(); break;
case 0x19: WinProtection(); break;
case 0x2F: // FILEPASS [ 2345 ]
eLastErr = XclImpDecryptHelper::ReadFilepass( maStrm );
@@ -1048,7 +1040,8 @@ FltError ImportExcel8::Read( void )
eAkt = EXC_STATE_SHEET;
aIn.SeekGlobalPosition(); // und zurueck an alte Position
break;
- case 0x12: Protect(); break;
+ case 0x12: SheetProtect(); break;
+ case 0x13: SheetPassword(); break;
case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
case 0x55: DefColWidth(); break;
case 0x7D: Colinfo(); break; // COLINFO [ 345 ]
@@ -1064,6 +1057,7 @@ FltError ImportExcel8::Read( void )
case 0x0221: Array34(); break; // ARRAY [ 34 ]
case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345 ]
case 0x04BC: Shrfmla(); break; // SHRFMLA [ 5 ]
+ case 0x0867: SheetProtection(); break; // SHEETPROTECTION
}
}
break;
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 211aed3fd079..d1fed27bbec1 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -36,6 +36,11 @@
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
@@ -51,8 +56,6 @@
#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
#include <com/sun/star/chart2/TickmarkStyle.hpp>
-#include <com/sun/star/chart/DataLabelPlacement.hpp>
-#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <vcl/outdev.hxx>
#include <svx/escherex.hxx>
@@ -60,13 +63,13 @@
#include "document.hxx"
#include "rangelst.hxx"
#include "rangeutl.hxx"
+#include "compiler.hxx"
+#include "tokenarray.hxx"
+#include "token.hxx"
#include "xeformula.hxx"
#include "xehelper.hxx"
#include "xepage.hxx"
#include "xestyle.hxx"
-#include "compiler.hxx"
-#include "tokenarray.hxx"
-#include "token.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Any;
@@ -102,6 +105,9 @@ using ::com::sun::star::chart2::data::XDataSource;
using ::com::sun::star::chart2::data::XLabeledDataSequence;
using ::com::sun::star::chart2::data::XDataSequence;
+using ::formula::FormulaGrammar;
+using ::formula::FormulaToken;
+
// Helpers ====================================================================
namespace {
@@ -128,17 +134,25 @@ void lclSaveRecord( XclExpStream& rStrm, XclExpRecordRef xRec, sal_uInt16 nRecId
}
}
+void lclWriteChFrBlockRecord( XclExpStream& rStrm, const XclChFrBlock& rFrBlock, bool bBegin )
+{
+ sal_uInt16 nRecId = bBegin ? EXC_ID_CHFRBLOCKBEGIN : EXC_ID_CHFRBLOCKEND;
+ rStrm.StartRecord( nRecId, 12 );
+ rStrm << nRecId << EXC_FUTUREREC_EMPTYFLAGS << rFrBlock.mnType << rFrBlock.mnContext << rFrBlock.mnValue1 << rFrBlock.mnValue2;
+ rStrm.EndRecord();
+}
+
template< typename Type >
inline bool lclIsAutoAnyOrGetValue( Type& rValue, const Any& rAny )
{
return !rAny.hasValue() || !(rAny >>= rValue);
}
-bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, Reference< XScaling > xScaling )
+bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, bool bLogScale )
{
bool bIsAuto = lclIsAutoAnyOrGetValue( rfValue, rAny );
- if( !bIsAuto && xScaling.is() )
- rfValue = xScaling->doScaling( rfValue );
+ if( !bIsAuto && bLogScale )
+ rfValue = log( rfValue ) / log( 10.0 );
return bIsAuto;
}
@@ -155,15 +169,74 @@ public:
/** Returns a reference to the parent chart data object. */
inline XclExpChChart& GetChartData() const { return *mpChartData; }
+ /** Registers a new future record level. */
+ void RegisterFutureRecBlock( const XclChFrBlock& rFrBlock );
+ /** Initializes the current future record level (writes all unwritten CHFRBLOCKBEGIN records). */
+ void InitializeFutureRecBlock( XclExpStream& rStrm );
+ /** Finalizes the current future record level (writes CHFRBLOCKEND record if needed). */
+ void FinalizeFutureRecBlock( XclExpStream& rStrm );
+
private:
+ typedef ::std::vector< XclChFrBlock > XclChFrBlockVector;
+
XclExpChChart* mpChartData; /// Pointer to the chart data object.
+ XclChFrBlockVector maWrittenFrBlocks; /// Stack of future record levels already written out.
+ XclChFrBlockVector maUnwrittenFrBlocks; /// Stack of future record levels not yet written out.
};
+// ----------------------------------------------------------------------------
+
XclExpChRootData::XclExpChRootData( XclExpChChart* pChartData ) :
mpChartData( pChartData )
{
}
+void XclExpChRootData::RegisterFutureRecBlock( const XclChFrBlock& rFrBlock )
+{
+ maUnwrittenFrBlocks.push_back( rFrBlock );
+}
+
+void XclExpChRootData::InitializeFutureRecBlock( XclExpStream& rStrm )
+{
+ // first call from a future record writes all missing CHFRBLOCKBEGIN records
+ if( !maUnwrittenFrBlocks.empty() )
+ {
+ // write the leading CHFRINFO record
+ if( maWrittenFrBlocks.empty() )
+ {
+ rStrm.StartRecord( EXC_ID_CHFRINFO, 20 );
+ rStrm << EXC_ID_CHFRINFO << EXC_FUTUREREC_EMPTYFLAGS << EXC_CHFRINFO_EXCELXP2003 << EXC_CHFRINFO_EXCELXP2003 << sal_uInt16( 3 );
+ rStrm << sal_uInt16( 0x0850 ) << sal_uInt16( 0x085A ) << sal_uInt16( 0x0861 ) << sal_uInt16( 0x0861 ) << sal_uInt16( 0x086A ) << sal_uInt16( 0x086B );
+ rStrm.EndRecord();
+ }
+ // write all unwritten CHFRBLOCKBEGIN records
+ for( XclChFrBlockVector::const_iterator aIt = maUnwrittenFrBlocks.begin(), aEnd = maUnwrittenFrBlocks.end(); aIt != aEnd; ++aIt )
+ {
+ DBG_ASSERT( aIt->mnType != EXC_CHFRBLOCK_TYPE_UNKNOWN, "XclExpChRootData::InitializeFutureRecBlock - unknown future record block type" );
+ lclWriteChFrBlockRecord( rStrm, *aIt, true );
+ }
+ // move all record infos to vector of written blocks
+ maWrittenFrBlocks.insert( maWrittenFrBlocks.end(), maUnwrittenFrBlocks.begin(), maUnwrittenFrBlocks.end() );
+ maUnwrittenFrBlocks.clear();
+ }
+}
+
+void XclExpChRootData::FinalizeFutureRecBlock( XclExpStream& rStrm )
+{
+ DBG_ASSERT( !maUnwrittenFrBlocks.empty() || !maWrittenFrBlocks.empty(), "XclExpChRootData::FinalizeFutureRecBlock - no future record level found" );
+ if( !maUnwrittenFrBlocks.empty() )
+ {
+ // no future record has been written, just forget the topmost level
+ maUnwrittenFrBlocks.pop_back();
+ }
+ else if( !maWrittenFrBlocks.empty() )
+ {
+ // write the CHFRBLOCKEND record for the topmost block and delete it
+ lclWriteChFrBlockRecord( rStrm, maWrittenFrBlocks.back(), false );
+ maWrittenFrBlocks.pop_back();
+ }
+}
+
// ----------------------------------------------------------------------------
XclExpChRoot::XclExpChRoot( const XclExpRoot& rRoot, XclExpChChart* pChartData ) :
@@ -254,10 +327,28 @@ sal_uInt16 XclExpChRoot::ConvertPieRotation( const ScfPropertySet& rPropSet )
return static_cast< sal_uInt16 >( (450 - (nApiRot % 360)) % 360 );
}
+void XclExpChRoot::RegisterFutureRecBlock( const XclChFrBlock& rFrBlock )
+{
+ mxChData->RegisterFutureRecBlock( rFrBlock );
+}
+
+void XclExpChRoot::InitializeFutureRecBlock( XclExpStream& rStrm )
+{
+ mxChData->InitializeFutureRecBlock( rStrm );
+}
+
+void XclExpChRoot::FinalizeFutureRecBlock( XclExpStream& rStrm )
+{
+ mxChData->FinalizeFutureRecBlock( rStrm );
+}
+
// ----------------------------------------------------------------------------
-XclExpChGroupBase::XclExpChGroupBase( sal_uInt16 nRecId, sal_Size nRecSize ) :
- XclExpRecord( nRecId, nRecSize )
+XclExpChGroupBase::XclExpChGroupBase( const XclExpChRoot& rRoot,
+ sal_uInt16 nFrType, sal_uInt16 nRecId, sal_Size nRecSize ) :
+ XclExpRecord( nRecId, nRecSize ),
+ XclExpChRoot( rRoot ),
+ maFrBlock( nFrType )
{
}
@@ -272,10 +363,14 @@ void XclExpChGroupBase::Save( XclExpStream& rStrm )
// group records
if( HasSubRecords() )
{
+ // register the future record context corresponding to this record group
+ RegisterFutureRecBlock( maFrBlock );
// CHBEGIN record
XclExpEmptyRecord( EXC_ID_CHBEGIN ).Save( rStrm );
// embedded records
WriteSubRecords( rStrm );
+ // finalize the future records, must be done before the closing CHEND
+ FinalizeFutureRecBlock( rStrm );
// CHEND record
XclExpEmptyRecord( EXC_ID_CHEND ).Save( rStrm );
}
@@ -286,6 +381,28 @@ bool XclExpChGroupBase::HasSubRecords() const
return true;
}
+void XclExpChGroupBase::SetFutureRecordContext( sal_uInt16 nFrContext, sal_uInt16 nFrValue1, sal_uInt16 nFrValue2 )
+{
+ maFrBlock.mnContext = nFrContext;
+ maFrBlock.mnValue1 = nFrValue1;
+ maFrBlock.mnValue2 = nFrValue2;
+}
+
+// ----------------------------------------------------------------------------
+
+XclExpChFutureRecordBase::XclExpChFutureRecordBase( const XclExpChRoot& rRoot,
+ XclFutureRecType eRecType, sal_uInt16 nRecId, sal_Size nRecSize ) :
+ XclExpFutureRecord( eRecType, nRecId, nRecSize ),
+ XclExpChRoot( rRoot )
+{
+}
+
+void XclExpChFutureRecordBase::Save( XclExpStream& rStrm )
+{
+ InitializeFutureRecBlock( rStrm );
+ XclExpFutureRecord::Save( rStrm );
+}
+
// Frame formatting ===========================================================
XclExpChLineFormat::XclExpChLineFormat( const XclExpChRoot& rRoot ) :
@@ -450,22 +567,20 @@ void XclExpChAreaFormat::WriteBody( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
XclExpChEscherFormat::XclExpChEscherFormat( const XclExpChRoot& rRoot ) :
- XclExpChGroupBase( EXC_ID_CHESCHERFORMAT ),
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_UNKNOWN, EXC_ID_CHESCHERFORMAT ),
mnColor1Id( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWBACK ) ),
mnColor2Id( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWBACK ) )
{
- DBG_ASSERT_BIFF( rRoot.GetBiff() == EXC_BIFF8 );
- (void)rRoot;
+ DBG_ASSERT_BIFF( GetBiff() == EXC_BIFF8 );
}
-void XclExpChEscherFormat::Convert( const XclExpChRoot& rRoot,
- const ScfPropertySet& rPropSet, XclChObjectType eObjType )
+void XclExpChEscherFormat::Convert( const ScfPropertySet& rPropSet, XclChObjectType eObjType )
{
- const XclChFormatInfo& rFmtInfo = rRoot.GetFormatInfo( eObjType );
- rRoot.ConvertEscherFormat( maData, maPicFmt, rPropSet, rFmtInfo.mePropMode );
+ const XclChFormatInfo& rFmtInfo = GetFormatInfo( eObjType );
+ ConvertEscherFormat( maData, maPicFmt, rPropSet, rFmtInfo.mePropMode );
// register colors in palette
- mnColor1Id = RegisterColor( rRoot, ESCHER_Prop_fillColor );
- mnColor2Id = RegisterColor( rRoot, ESCHER_Prop_fillBackColor );
+ mnColor1Id = RegisterColor( ESCHER_Prop_fillColor );
+ mnColor2Id = RegisterColor( ESCHER_Prop_fillBackColor );
}
bool XclExpChEscherFormat::IsValid() const
@@ -478,7 +593,7 @@ void XclExpChEscherFormat::Save( XclExpStream& rStrm )
if( maData.mxEscherSet.is() )
{
// replace RGB colors with palette indexes in the Escher container
- const XclExpPalette& rPal = rStrm.GetRoot().GetPalette();
+ const XclExpPalette& rPal = GetPalette();
maData.mxEscherSet->AddOpt( ESCHER_Prop_fillColor, 0x08000000 | rPal.GetColorIndex( mnColor1Id ) );
maData.mxEscherSet->AddOpt( ESCHER_Prop_fillBackColor, 0x08000000 | rPal.GetColorIndex( mnColor2Id ) );
@@ -500,7 +615,7 @@ void XclExpChEscherFormat::WriteSubRecords( XclExpStream& rStrm )
rStrm.EndRecord();
}
-sal_uInt32 XclExpChEscherFormat::RegisterColor( const XclExpChRoot& rRoot, sal_uInt16 nPropId )
+sal_uInt32 XclExpChEscherFormat::RegisterColor( sal_uInt16 nPropId )
{
sal_uInt32 nBGRValue;
if( maData.mxEscherSet.is() && maData.mxEscherSet->GetOpt( nPropId, nBGRValue ) )
@@ -510,7 +625,7 @@ sal_uInt32 XclExpChEscherFormat::RegisterColor( const XclExpChRoot& rRoot, sal_u
COLORDATA_BLUE( nBGRValue ),
COLORDATA_GREEN( nBGRValue ),
COLORDATA_RED( nBGRValue ) ) );
- return rRoot.GetPalette().InsertColor( aColor, EXC_COLOR_CHARTAREA );
+ return GetPalette().InsertColor( aColor, EXC_COLOR_CHARTAREA );
}
return XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWBACK );
}
@@ -549,7 +664,7 @@ void XclExpChFrameBase::ConvertFrameBase( const XclExpChRoot& rRoot,
if( (rRoot.GetBiff() == EXC_BIFF8) && bComplexFill )
{
mxEscherFmt.reset( new XclExpChEscherFormat( rRoot ) );
- mxEscherFmt->Convert( rRoot, rPropSet, eObjType );
+ mxEscherFmt->Convert( rPropSet, eObjType );
if( mxEscherFmt->IsValid() )
mxAreaFmt->SetAuto( false );
else
@@ -590,8 +705,7 @@ void XclExpChFrameBase::WriteFrameRecords( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
XclExpChFrame::XclExpChFrame( const XclExpChRoot& rRoot, XclChObjectType eObjType ) :
- XclExpChGroupBase( EXC_ID_CHFRAME, 4 ),
- XclExpChRoot( rRoot ),
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_FRAME, EXC_ID_CHFRAME, 4 ),
meObjType( eObjType )
{
}
@@ -648,43 +762,41 @@ XclExpChFrameRef lclCreateFrame( const XclExpChRoot& rRoot,
return xFrame;
}
-void lclAddDoubleRefData(ScTokenArray& rArray, const ::formula::FormulaToken& rToken,
- SCsTAB nTab1, SCsTAB nTab2, SCsCOL nCol1, SCsCOL nCol2, SCsROW nRow1, SCsROW nRow2)
-{
- using namespace ::formula;
-
- StackVar eType = rToken.GetType();
- bool bExternal = (eType == svExternalDoubleRef);
- DBG_ASSERT(eType == svDoubleRef || eType == svExternalDoubleRef, "not a double ref token!");
-
- ScComplexRefData aData;
+} // namespace
- aData.InitFlags();
- aData.Ref1.SetFlag3D(true);
- aData.Ref1.SetTabRel(false);
- aData.Ref1.SetColRel(false);
- aData.Ref1.SetRowRel(false);
- aData.Ref2.SetFlag3D(false);
- aData.Ref2.SetTabRel(false);
- aData.Ref2.SetColRel(false);
- aData.Ref2.SetRowRel(false);
+// Source links ===============================================================
- aData.Ref1.nTab = nTab1;
- aData.Ref1.nCol = nCol1;
- aData.Ref1.nRow = nRow1;
- aData.Ref2.nTab = nTab2;
- aData.Ref2.nCol = nCol2;
- aData.Ref2.nRow = nRow2;
+namespace {
- if (bExternal)
- rArray.AddExternalDoubleReference(rToken.GetIndex(), rToken.GetString(), aData);
+void lclAddDoubleRefData(
+ ScTokenArray& orArray, const FormulaToken& rToken,
+ SCsTAB nScTab1, SCsCOL nScCol1, SCsROW nScRow1,
+ SCsTAB nScTab2, SCsCOL nScCol2, SCsROW nScRow2 )
+{
+ ScComplexRefData aComplexRef;
+ aComplexRef.InitFlags();
+ aComplexRef.Ref1.SetFlag3D( true );
+ aComplexRef.Ref1.nTab = nScTab1;
+ aComplexRef.Ref1.nCol = nScCol1;
+ aComplexRef.Ref1.nRow = nScRow1;
+ aComplexRef.Ref2.nTab = nScTab2;
+ aComplexRef.Ref2.nCol = nScCol2;
+ aComplexRef.Ref2.nRow = nScRow2;
+
+ if( orArray.GetLen() > 0 )
+ orArray.AddOpCode( ocUnion );
+
+ DBG_ASSERT( (rToken.GetType() == ::formula::svDoubleRef) || (rToken.GetType() == ::formula::svExternalDoubleRef),
+ "lclAddDoubleRefData - double reference token expected");
+ if( rToken.GetType() == ::formula::svExternalDoubleRef )
+ orArray.AddExternalDoubleReference( rToken.GetIndex(), rToken.GetString(), aComplexRef );
else
- rArray.AddDoubleReference(aData);
+ orArray.AddDoubleReference( aComplexRef );
}
} // namespace
-// Source links ===============================================================
+// ----------------------------------------------------------------------------
XclExpChSourceLink::XclExpChSourceLink( const XclExpChRoot& rRoot, sal_uInt8 nDestType ) :
XclExpRecord( EXC_ID_CHSOURCELINK ),
@@ -696,80 +808,68 @@ XclExpChSourceLink::XclExpChSourceLink( const XclExpChRoot& rRoot, sal_uInt8 nDe
sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > xDataSeq, bool bSplitToColumns, sal_uInt16 nDefCount )
{
- using namespace ::formula;
-
mxLinkFmla.reset();
maData.mnLinkType = EXC_CHSRCLINK_DEFAULT;
- sal_uInt16 nValueCount = nDefCount;
- if (!xDataSeq.is())
- return nValueCount;
+ if( !xDataSeq.is() )
+ return nDefCount;
- // Compile the range representation string into token array.
+ // Compile the range representation string into token array. Note that the
+ // source range text depends on the current grammar.
OUString aRangeRepr = xDataSeq->getSourceRangeRepresentation();
- ScRangeList aScRanges;
- ScCompiler aComp(GetDocPtr(), ScAddress());
- aComp.SetGrammar(FormulaGrammar::GRAM_ENGLISH);
- ScTokenArray* pArray = aComp.CompileString(aRangeRepr);
- if (!pArray)
- return nValueCount;
+ ScCompiler aComp( GetDocPtr(), ScAddress() );
+ aComp.SetGrammar( GetDocPtr()->GetGrammar() );
+ ScTokenArray* pArray = aComp.CompileString( aRangeRepr );
+ if( !pArray )
+ return nDefCount;
ScTokenArray aArray;
+ sal_uInt32 nValueCount = 0;
pArray->Reset();
- bool bFirst = true;
- for (const FormulaToken* p = pArray->First(); p; p = pArray->Next())
+ for( const FormulaToken* pToken = pArray->First(); pToken; pToken = pArray->Next() )
{
- StackVar eType = p->GetType();
- if (eType == svSingleRef || eType == svExternalSingleRef)
+ switch( pToken->GetType() )
{
- // For a single ref token, just add it to the new token array as is.
- if (bFirst)
- bFirst = false;
- else
- aArray.AddOpCode(ocUnion);
-
- aArray.AddToken(*p);
- }
-
- if (eType != svDoubleRef && eType != svExternalDoubleRef)
- continue;
+ case ::formula::svSingleRef:
+ case ::formula::svExternalSingleRef:
+ // for a single ref token, just add it to the new token array as is
+ if( aArray.GetLen() > 0 )
+ aArray.AddOpCode( ocUnion );
+ aArray.AddToken( *pToken );
+ ++nValueCount;
+ break;
- // split 3-dimensional ranges into single sheets.
- const ScComplexRefData& r = static_cast<const ScToken*>(p)->GetDoubleRef();
- const ScSingleRefData& s = r.Ref1;
- const ScSingleRefData& e = r.Ref2;
- for (SCsTAB nTab = s.nTab; nTab <= e.nTab; ++nTab)
- {
- if (bSplitToColumns && (s.nRow != e.nRow))
+ case ::formula::svDoubleRef:
+ case ::formula::svExternalDoubleRef:
{
- // split 2-dimensional ranges into single columns.
- for (SCsCOL nCol = s.nCol; nCol <= e.nCol; ++nCol)
+ // split 3-dimensional ranges into single sheets
+ const ScComplexRefData& rComplexRef = static_cast< const ScToken* >( pToken )->GetDoubleRef();
+ const ScSingleRefData& rRef1 = rComplexRef.Ref1;
+ const ScSingleRefData& rRef2 = rComplexRef.Ref2;
+ for( SCsTAB nScTab = rRef1.nTab; nScTab <= rRef2.nTab; ++nScTab )
{
- if (bFirst)
- bFirst = false;
+ // split 2-dimensional ranges into single columns
+ if( bSplitToColumns && (rRef1.nCol < rRef2.nCol) && (rRef1.nRow < rRef2.nRow) )
+ for( SCsCOL nScCol = rRef1.nCol; nScCol <= rRef2.nCol; ++nScCol )
+ lclAddDoubleRefData( aArray, *pToken, nScTab, nScCol, rRef1.nRow, nScTab, nScCol, rRef2.nRow );
else
- aArray.AddOpCode(ocUnion);
-
- lclAddDoubleRefData(aArray, *p, nTab, nTab, nCol, nCol, s.nRow, e.nRow);
+ lclAddDoubleRefData( aArray, *pToken, nScTab, rRef1.nCol, rRef1.nRow, nScTab, rRef2.nCol, rRef2.nRow );
}
+ sal_uInt32 nTabs = static_cast< sal_uInt32 >( rRef2.nTab - rRef1.nTab + 1 );
+ sal_uInt32 nCols = static_cast< sal_uInt32 >( rRef2.nCol - rRef1.nCol + 1 );
+ sal_uInt32 nRows = static_cast< sal_uInt32 >( rRef2.nRow - rRef1.nRow + 1 );
+ nValueCount += nCols * nRows * nTabs;
}
- else
- {
- if (bFirst)
- bFirst = false;
- else
- aArray.AddOpCode(ocUnion);
+ break;
- lclAddDoubleRefData(aArray, *p, nTab, nTab, s.nCol, e.nCol, s.nRow, e.nRow);
- }
+ default:;
}
}
- const ScAddress aBaseCell(0,0,0);
- mxLinkFmla = GetFormulaCompiler().CreateFormula(EXC_FMLATYPE_CHART, aArray, &aBaseCell);
+ const ScAddress aBaseCell;
+ mxLinkFmla = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_CHART, aArray, &aBaseCell );
maData.mnLinkType = EXC_CHSRCLINK_WORKSHEET;
- nValueCount = ulimit_cast< sal_uInt16 >( aScRanges.GetCellCount(), EXC_CHDATAFORMAT_MAXPOINTCOUNT );
- return nValueCount;
+ return ulimit_cast< sal_uInt16 >( nValueCount, EXC_CHDATAFORMAT_MAXPOINTCOUNT );
}
sal_uInt16 XclExpChSourceLink::ConvertStringSequence( const Sequence< Reference< XFormattedString > >& rStringSeq )
@@ -917,6 +1017,35 @@ void XclExpChObjectLink::WriteBody( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
+XclExpChFrLabelProps::XclExpChFrLabelProps( const XclExpChRoot& rRoot ) :
+ XclExpChFutureRecordBase( rRoot, EXC_FUTUREREC_UNUSEDREF, EXC_ID_CHFRLABELPROPS, 4 )
+{
+}
+
+void XclExpChFrLabelProps::Convert( const ScfPropertySet& rPropSet, bool bShowSeries,
+ bool bShowCateg, bool bShowValue, bool bShowPercent, bool bShowBubble )
+{
+ // label value flags
+ ::set_flag( maData.mnFlags, EXC_CHFRLABELPROPS_SHOWSERIES, bShowSeries );
+ ::set_flag( maData.mnFlags, EXC_CHFRLABELPROPS_SHOWCATEG, bShowCateg );
+ ::set_flag( maData.mnFlags, EXC_CHFRLABELPROPS_SHOWVALUE, bShowValue );
+ ::set_flag( maData.mnFlags, EXC_CHFRLABELPROPS_SHOWPERCENT, bShowPercent );
+ ::set_flag( maData.mnFlags, EXC_CHFRLABELPROPS_SHOWBUBBLE, bShowBubble );
+
+ // label value separator
+ rPropSet.GetStringProperty( maData.maSeparator, EXC_CHPROP_LABELSEPARATOR );
+ if( maData.maSeparator.Len() == 0 )
+ maData.maSeparator = String( sal_Unicode( ' ' ) );
+}
+
+void XclExpChFrLabelProps::WriteBody( XclExpStream& rStrm )
+{
+ XclExpString aXclSep( maData.maSeparator, EXC_STR_FORCEUNICODE | EXC_STR_SMARTFLAGS );
+ rStrm << maData.mnFlags << aXclSep;
+}
+
+// ----------------------------------------------------------------------------
+
XclExpChFontBase::~XclExpChFontBase()
{
}
@@ -936,17 +1065,16 @@ void XclExpChFontBase::ConvertFontBase( const XclExpChRoot& rRoot, const ScfProp
}
void XclExpChFontBase::ConvertRotationBase(
- const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet )
+ const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, bool bSupportsStacked )
{
- sal_uInt16 nRotation = rRoot.GetChartPropSetHelper().ReadRotationProperties( rPropSet );
+ sal_uInt16 nRotation = rRoot.GetChartPropSetHelper().ReadRotationProperties( rPropSet, bSupportsStacked );
SetRotation( nRotation );
}
// ----------------------------------------------------------------------------
XclExpChText::XclExpChText( const XclExpChRoot& rRoot ) :
- XclExpChGroupBase( EXC_ID_CHTEXT, (rRoot.GetBiff() == EXC_BIFF8) ? 32 : 26 ),
- XclExpChRoot( rRoot ),
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_TEXT, EXC_ID_CHTEXT, (rRoot.GetBiff() == EXC_BIFF8) ? 32 : 26 ),
mnTextColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_CHWINDOWTEXT ) )
{
}
@@ -967,6 +1095,14 @@ void XclExpChText::SetRotation( sal_uInt16 nRotation )
void XclExpChText::ConvertTitle( Reference< XTitle > xTitle, sal_uInt16 nTarget )
{
+ switch( nTarget )
+ {
+ case EXC_CHOBJLINK_TITLE: SetFutureRecordContext( EXC_CHFRBLOCK_TEXT_TITLE ); break;
+ case EXC_CHOBJLINK_YAXIS: SetFutureRecordContext( EXC_CHFRBLOCK_TEXT_AXISTITLE, 1 ); break;
+ case EXC_CHOBJLINK_XAXIS: SetFutureRecordContext( EXC_CHFRBLOCK_TEXT_AXISTITLE, 0 ); break;
+ case EXC_CHOBJLINK_ZAXIS: SetFutureRecordContext( EXC_CHFRBLOCK_TEXT_AXISTITLE, 2 ); break;
+ }
+
mxSrcLink.reset();
mxObjLink.reset( new XclExpChObjectLink( nTarget, XclChDataPointPos( 0, 0 ) ) );
@@ -982,7 +1118,7 @@ void XclExpChText::ConvertTitle( Reference< XTitle > xTitle, sal_uInt16 nTarget
ConvertFontBase( GetChRoot(), nFontIdx );
// rotation
- ConvertRotationBase( GetChRoot(), aTitleProp );
+ ConvertRotationBase( GetChRoot(), aTitleProp, true );
}
else
{
@@ -1000,69 +1136,93 @@ void XclExpChText::ConvertLegend( const ScfPropertySet& rPropSet )
bool XclExpChText::ConvertDataLabel( const ScfPropertySet& rPropSet,
const XclChTypeInfo& rTypeInfo, const XclChDataPointPos& rPointPos )
{
+ SetFutureRecordContext( EXC_CHFRBLOCK_TEXT_DATALABEL, rPointPos.mnPointIdx, rPointPos.mnSeriesIdx );
+
namespace cssc = ::com::sun::star::chart2;
cssc::DataPointLabel aPointLabel;
- if( rPropSet.GetProperty( aPointLabel, EXC_CHPROP_LABEL ) )
- {
- //! TODO: make value and percent independent
- bool bIsPie = rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE;
- bool bShowValue = aPointLabel.ShowNumber;
- bool bShowPercent = bIsPie && !bShowValue && aPointLabel.ShowNumberInPercent;
- bool bShowCateg = !bShowValue && aPointLabel.ShowCategoryName;
- bool bShowAny = bShowValue || bShowPercent || bShowCateg;
- bool bShowSymbol = bShowAny && aPointLabel.ShowLegendSymbol;
-
- ::set_flag( maData.mnFlags, EXC_CHTEXT_AUTOTEXT );
- ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWVALUE, bShowValue );
- ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWPERCENT, bShowPercent );
- ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWCATEG, bShowCateg );
- ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWCATEGPERC, bShowPercent && bShowCateg );
- ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWSYMBOL, bShowSymbol );
- ::set_flag( maData.mnFlags, EXC_CHTEXT_DELETED, !bShowAny );
-
- if( bShowAny )
+ if( !rPropSet.GetProperty( aPointLabel, EXC_CHPROP_LABEL ) )
+ return false;
+
+ // percentage only allowed in pie and donut charts
+ bool bIsPie = rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE;
+ // bubble sizes only allowed in bubble charts
+ bool bIsBubble = rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES;
+ DBG_ASSERT( (GetBiff() == EXC_BIFF8) || !bIsBubble, "XclExpChText::ConvertDataLabel - bubble charts only in BIFF8" );
+
+ // raw show flags
+ bool bShowValue = !bIsBubble && aPointLabel.ShowNumber; // Chart2 uses 'ShowNumber' for bubble size
+ bool bShowPercent = bIsPie && aPointLabel.ShowNumberInPercent; // percentage only in pie/donut charts
+ bool bShowCateg = aPointLabel.ShowCategoryName;
+ bool bShowBubble = bIsBubble && aPointLabel.ShowNumber; // Chart2 uses 'ShowNumber' for bubble size
+ bool bShowAny = bShowValue || bShowPercent || bShowCateg || bShowBubble;
+
+ // create the CHFRLABELPROPS record for extended settings in BIFF8
+ if( bShowAny && (GetBiff() == EXC_BIFF8) )
+ {
+ mxLabelProps.reset( new XclExpChFrLabelProps( GetChRoot() ) );
+ mxLabelProps->Convert( rPropSet, false, bShowCateg, bShowValue, bShowPercent, bShowBubble );
+ }
+
+ // restrict to combinations allowed in CHTEXT
+ if( bShowPercent ) bShowValue = false; // percent wins over value
+ if( bShowValue ) bShowCateg = false; // value wins over category
+ if( bShowValue || bShowCateg ) bShowBubble = false; // value or category wins over bubble size
+
+ // set all flags
+ ::set_flag( maData.mnFlags, EXC_CHTEXT_AUTOTEXT );
+ ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWVALUE, bShowValue );
+ ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWPERCENT, bShowPercent );
+ ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWCATEG, bShowCateg );
+ ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWCATEGPERC, bShowPercent && bShowCateg );
+ ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWBUBBLE, bShowBubble );
+ ::set_flag( maData.mnFlags, EXC_CHTEXT_SHOWSYMBOL, bShowAny && aPointLabel.ShowLegendSymbol );
+ ::set_flag( maData.mnFlags, EXC_CHTEXT_DELETED, !bShowAny );
+
+ if( bShowAny )
+ {
+ // font settings
+ ConvertFontBase( GetChRoot(), rPropSet );
+ ConvertRotationBase( GetChRoot(), rPropSet, false );
+ // label placement
+ sal_Int32 nPlacement = 0;
+ if( rPropSet.GetProperty( nPlacement, EXC_CHPROP_LABELPLACEMENT ) )
{
- // font settings
- ConvertFontBase( GetChRoot(), rPropSet );
- // label placement
- sal_Int32 nPlacement = 0;
- if( rPropSet.GetProperty( nPlacement, EXC_CHPROP_LABELPLACEMENT ) )
+ using namespace ::com::sun::star::chart::DataLabelPlacement;
+ if( nPlacement == rTypeInfo.mnDefaultLabelPos )
{
- using namespace ::com::sun::star::chart::DataLabelPlacement;
- if( nPlacement == rTypeInfo.mnDefaultLabelPos )
- {
- maData.mnPlacement = EXC_CHTEXT_POS_DEFAULT;
- }
- else switch( nPlacement )
- {
- case AVOID_OVERLAP: maData.mnPlacement = EXC_CHTEXT_POS_AUTO; break;
- case CENTER: maData.mnPlacement = EXC_CHTEXT_POS_CENTER; break;
- case TOP: maData.mnPlacement = EXC_CHTEXT_POS_ABOVE; break;
- case TOP_LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break;
- case LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break;
- case BOTTOM_LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break;
- case BOTTOM: maData.mnPlacement = EXC_CHTEXT_POS_BELOW; break;
- case BOTTOM_RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break;
- case RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break;
- case TOP_RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break;
- case INSIDE: maData.mnPlacement = EXC_CHTEXT_POS_INSIDE; break;
- case OUTSIDE: maData.mnPlacement = EXC_CHTEXT_POS_OUTSIDE; break;
- case NEAR_ORIGIN: maData.mnPlacement = EXC_CHTEXT_POS_AXIS; break;
- default: DBG_ERRORFILE( "XclExpChText::ConvertDataLabel - unknown label placement type" );
- }
+ maData.mnPlacement = EXC_CHTEXT_POS_DEFAULT;
+ }
+ else switch( nPlacement )
+ {
+ case AVOID_OVERLAP: maData.mnPlacement = EXC_CHTEXT_POS_AUTO; break;
+ case CENTER: maData.mnPlacement = EXC_CHTEXT_POS_CENTER; break;
+ case TOP: maData.mnPlacement = EXC_CHTEXT_POS_ABOVE; break;
+ case TOP_LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break;
+ case LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break;
+ case BOTTOM_LEFT: maData.mnPlacement = EXC_CHTEXT_POS_LEFT; break;
+ case BOTTOM: maData.mnPlacement = EXC_CHTEXT_POS_BELOW; break;
+ case BOTTOM_RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break;
+ case RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break;
+ case TOP_RIGHT: maData.mnPlacement = EXC_CHTEXT_POS_RIGHT; break;
+ case INSIDE: maData.mnPlacement = EXC_CHTEXT_POS_INSIDE; break;
+ case OUTSIDE: maData.mnPlacement = EXC_CHTEXT_POS_OUTSIDE; break;
+ case NEAR_ORIGIN: maData.mnPlacement = EXC_CHTEXT_POS_AXIS; break;
+ default: DBG_ERRORFILE( "XclExpChText::ConvertDataLabel - unknown label placement type" );
}
- // source link (contains number format)
- mxSrcLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ) );
- if( bShowValue || bShowPercent )
- // percentage format wins over value format
- mxSrcLink->ConvertNumFmt( rPropSet, bShowPercent );
- // object link
- mxObjLink.reset( new XclExpChObjectLink( EXC_CHOBJLINK_DATA, rPointPos ) );
- // return true to indicate existing label
- return true;
}
+ // source link (contains number format)
+ mxSrcLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ) );
+ if( bShowValue || bShowPercent )
+ // percentage format wins over value format
+ mxSrcLink->ConvertNumFmt( rPropSet, bShowPercent );
+ // object link
+ mxObjLink.reset( new XclExpChObjectLink( EXC_CHOBJLINK_DATA, rPointPos ) );
}
- return false;
+
+ /* Return true to indicate valid label settings:
+ - for existing labels at entire series
+ - for any settings at single data point (to be able to delete a point label) */
+ return bShowAny || (rPointPos.mnPointIdx != EXC_CHDATAFORMAT_ALLPOINTS);
}
void XclExpChText::ConvertTrendLineEquation( const ScfPropertySet& rPropSet, const XclChDataPointPos& rPointPos )
@@ -1104,6 +1264,8 @@ void XclExpChText::WriteSubRecords( XclExpStream& rStrm )
lclSaveRecord( rStrm, mxFrame );
// CHOBJECTLINK record
lclSaveRecord( rStrm, mxObjLink );
+ // CHFRLABELPROPS record
+ lclSaveRecord( rStrm, mxLabelProps );
}
void XclExpChText::WriteBody( XclExpStream& rStrm )
@@ -1283,8 +1445,7 @@ XclExpChAttachedLabel::XclExpChAttachedLabel( sal_uInt16 nFlags ) :
XclExpChDataFormat::XclExpChDataFormat( const XclExpChRoot& rRoot,
const XclChDataPointPos& rPointPos, sal_uInt16 nFormatIdx ) :
- XclExpChGroupBase( EXC_ID_CHDATAFORMAT, 8 ),
- XclExpChRoot( rRoot )
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_DATAFORMAT, EXC_ID_CHDATAFORMAT, 8 )
{
maData.maPointPos = rPointPos;
maData.mnFormatIdx = nFormatIdx;
@@ -1532,8 +1693,7 @@ ScfPropertySet lclGetPointPropSet( Reference< XDataSeries > xDataSeries, sal_Int
} // namespace
XclExpChSeries::XclExpChSeries( const XclExpChRoot& rRoot, sal_uInt16 nSeriesIdx ) :
- XclExpChGroupBase( EXC_ID_CHSERIES, (rRoot.GetBiff() == EXC_BIFF8) ? 12 : 8 ),
- XclExpChRoot( rRoot ),
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_SERIES, EXC_ID_CHSERIES, (rRoot.GetBiff() == EXC_BIFF8) ? 12 : 8 ),
mnGroupIdx( EXC_CHSERGROUP_NONE ),
mnSeriesIdx( nSeriesIdx ),
mnParentIdx( EXC_CHSERIES_INVALID )
@@ -1554,7 +1714,7 @@ bool XclExpChSeries::ConvertDataSeries(
Reference< XDataSource > xDataSource( xDataSeries, UNO_QUERY );
if( xDataSource.is() )
{
- Reference< XDataSequence > xYValueSeq, xTitleSeq, xXValueSeq;
+ Reference< XDataSequence > xYValueSeq, xTitleSeq, xXValueSeq, xBubbleSeq;
// find first sequence with role 'values-y'
Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences();
@@ -1570,12 +1730,18 @@ bool XclExpChSeries::ConvertDataSeries(
if( !xYValueSeq.is() && (aRole == EXC_CHPROP_ROLE_YVALUES) )
{
xYValueSeq = xTmpValueSeq;
- xTitleSeq = (*pIt)->getLabel(); // ignore role of label sequence
+ if( !xTitleSeq.is() )
+ xTitleSeq = (*pIt)->getLabel(); // ignore role of label sequence
}
else if( !xXValueSeq.is() && !rTypeInfo.mbCategoryAxis && (aRole == EXC_CHPROP_ROLE_XVALUES) )
{
xXValueSeq = xTmpValueSeq;
}
+ else if( !xBubbleSeq.is() && (rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES) && (aRole == EXC_CHPROP_ROLE_SIZEVALUES) )
+ {
+ xBubbleSeq = xTmpValueSeq;
+ xTitleSeq = (*pIt)->getLabel(); // ignore role of label sequence
+ }
}
}
@@ -1592,6 +1758,10 @@ bool XclExpChSeries::ConvertDataSeries(
// X values of XY charts
maData.mnCategCount = mxCategLink->ConvertDataSequence( xXValueSeq, false, maData.mnValueCount );
+ // size values of bubble charts
+ if( mxBubbleLink.is() )
+ mxBubbleLink->ConvertDataSequence( xBubbleSeq, false, maData.mnValueCount );
+
// series formatting
XclChDataPointPos aPointPos( mnSeriesIdx );
ScfPropertySet aSeriesProp( xDataSeries );
@@ -1619,15 +1789,15 @@ bool XclExpChSeries::ConvertDataSeries(
{
const OUString aFillStyleName = CREATE_OUSTRING( "FillStyle" );
const OUString aColorName = CREATE_OUSTRING( "Color" );
- namespace csscd = ::com::sun::star::drawing;
+ namespace cssd = ::com::sun::star::drawing;
for( sal_Int32 nPointIdx = 0; nPointIdx < nMaxPointCount; ++nPointIdx )
{
aPointPos.mnPointIdx = static_cast< sal_uInt16 >( nPointIdx );
ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, nPointIdx );
// test that the point fill style is solid, but no color is set
- csscd::FillStyle eFillStyle = csscd::FillStyle_NONE;
+ cssd::FillStyle eFillStyle = cssd::FillStyle_NONE;
if( aPointProp.GetProperty( eFillStyle, aFillStyleName ) &&
- (eFillStyle == csscd::FillStyle_SOLID) &&
+ (eFillStyle == cssd::FillStyle_SOLID) &&
!aPointProp.HasProperty( aColorName ) )
{
aPointProp.SetProperty( aColorName, xColorScheme->getColorByIndex( nPointIdx ) );
@@ -1968,8 +2138,7 @@ void XclExpChChart3d::WriteBody( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
XclExpChLegend::XclExpChLegend( const XclExpChRoot& rRoot ) :
- XclExpChGroupBase( EXC_ID_CHLEGEND, 20 ),
- XclExpChRoot( rRoot )
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_LEGEND, EXC_ID_CHLEGEND, 20 )
{
}
@@ -1997,19 +2166,19 @@ void XclExpChLegend::WriteBody( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
-XclExpChDropBar::XclExpChDropBar( XclChObjectType eObjType ) :
- XclExpChGroupBase( EXC_ID_CHDROPBAR, 2 ),
+XclExpChDropBar::XclExpChDropBar( const XclExpChRoot& rRoot, XclChObjectType eObjType ) :
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_DROPBAR, EXC_ID_CHDROPBAR, 2 ),
meObjType( eObjType ),
mnBarDist( 100 )
{
}
-void XclExpChDropBar::Convert( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet )
+void XclExpChDropBar::Convert( const ScfPropertySet& rPropSet )
{
if( rPropSet.Is() )
- ConvertFrameBase( rRoot, rPropSet, meObjType );
+ ConvertFrameBase( GetChRoot(), rPropSet, meObjType );
else
- SetDefaultFrameBase( rRoot, EXC_CHFRAMETYPE_INVISIBLE, true );
+ SetDefaultFrameBase( GetChRoot(), EXC_CHFRAMETYPE_INVISIBLE, true );
}
void XclExpChDropBar::WriteSubRecords( XclExpStream& rStrm )
@@ -2025,8 +2194,7 @@ void XclExpChDropBar::WriteBody( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
XclExpChTypeGroup::XclExpChTypeGroup( const XclExpChRoot& rRoot, sal_uInt16 nGroupIdx ) :
- XclExpChGroupBase( EXC_ID_CHTYPEGROUP, 20 ),
- XclExpChRoot( rRoot ),
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_TYPEGROUP, EXC_ID_CHTYPEGROUP, 20 ),
maType( rRoot ),
maTypeInfo( maType.GetTypeInfo() )
{
@@ -2199,13 +2367,13 @@ void XclExpChTypeGroup::CreateAllStockSeries(
// white dropbar format
aTypeProp.GetProperty( xWhitePropSet, EXC_CHPROP_WHITEDAY );
ScfPropertySet aWhiteProp( xWhitePropSet );
- mxUpBar.reset( new XclExpChDropBar( EXC_CHOBJTYPE_WHITEDROPBAR ) );
- mxUpBar->Convert( GetChRoot(), aWhiteProp );
+ mxUpBar.reset( new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_WHITEDROPBAR ) );
+ mxUpBar->Convert( aWhiteProp );
// black dropbar format
aTypeProp.GetProperty( xBlackPropSet, EXC_CHPROP_BLACKDAY );
ScfPropertySet aBlackProp( xBlackPropSet );
- mxDownBar.reset( new XclExpChDropBar( EXC_CHOBJTYPE_BLACKDROPBAR ) );
- mxDownBar->Convert( GetChRoot(), aBlackProp );
+ mxDownBar.reset( new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_BLACKDROPBAR ) );
+ mxDownBar->Convert( aBlackProp );
}
}
@@ -2245,13 +2413,27 @@ void XclExpChLabelRange::Convert( const ScaleData& rScaleData, bool bMirrorOrien
// origin
double fOrigin = 0.0;
if( !lclIsAutoAnyOrGetValue( fOrigin, rScaleData.Origin ) )
- maData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 32767 );
+ maData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 31999 );
// reverse order
if( (rScaleData.Orientation == ::com::sun::star::chart2::AxisOrientation_REVERSE) != bMirrorOrient )
- {
::set_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE );
- SwapAxisMaxCross();
+}
+
+void XclExpChLabelRange::ConvertAxisPosition( const ScfPropertySet& rPropSet )
+{
+ namespace cssc = ::com::sun::star::chart;
+ cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE;
+ rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION );
+ double fCrossingPos = 1.0;
+ rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE );
+ switch( eAxisPos )
+ {
+ case cssc::ChartAxisPosition_ZERO: maData.mnCross = 1; break;
+ case cssc::ChartAxisPosition_START: maData.mnCross = 1; break;
+ case cssc::ChartAxisPosition_END: ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_MAXCROSS ); break;
+ case cssc::ChartAxisPosition_VALUE: maData.mnCross = limit_cast< sal_uInt16 >( fCrossingPos, 1, 31999 ); break;
+ default: maData.mnCross = 1;
}
}
@@ -2273,18 +2455,15 @@ void XclExpChValueRange::Convert( const ScaleData& rScaleData )
// scaling algorithm
bool bLogScale = ScfApiHelper::GetServiceName( rScaleData.Scaling ) == SERVICE_CHART2_LOGSCALING;
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE, bLogScale );
- Reference< XScaling > xLogScaling;
- if( bLogScale )
- xLogScaling = rScaleData.Scaling;
// min/max
- bool bAutoMin = lclIsAutoAnyOrGetScaledValue( maData.mfMin, rScaleData.Minimum, xLogScaling );
+ bool bAutoMin = lclIsAutoAnyOrGetScaledValue( maData.mfMin, rScaleData.Minimum, bLogScale );
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMIN, bAutoMin );
- bool bAutoMax = lclIsAutoAnyOrGetScaledValue( maData.mfMax, rScaleData.Maximum, xLogScaling );
+ bool bAutoMax = lclIsAutoAnyOrGetScaledValue( maData.mfMax, rScaleData.Maximum, bLogScale );
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMAX, bAutoMax );
// origin
- bool bAutoCross = lclIsAutoAnyOrGetScaledValue( maData.mfCross, rScaleData.Origin, xLogScaling );
+ bool bAutoCross = lclIsAutoAnyOrGetScaledValue( maData.mfCross, rScaleData.Origin, bLogScale );
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS, bAutoCross );
// major increment
@@ -2294,7 +2473,7 @@ void XclExpChValueRange::Convert( const ScaleData& rScaleData )
// minor increment
const Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements;
sal_Int32 nCount = 0;
- bool bAutoMinor = bAutoMajor || (rSubIncrementSeq.getLength() < 1) ||
+ bool bAutoMinor = bLogScale || bAutoMajor || (rSubIncrementSeq.getLength() < 1) ||
lclIsAutoAnyOrGetValue( nCount, rSubIncrementSeq[ 0 ].IntervalCount ) || (nCount < 1);
if( !bAutoMinor )
maData.mfMinorStep = maData.mfMajorStep / nCount;
@@ -2305,6 +2484,32 @@ void XclExpChValueRange::Convert( const ScaleData& rScaleData )
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_REVERSE, rScaleData.Orientation == cssc::AxisOrientation_REVERSE );
}
+void XclExpChValueRange::ConvertAxisPosition( const ScfPropertySet& rPropSet )
+{
+ namespace cssc = ::com::sun::star::chart;
+ cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE;
+ double fCrossingPos = 0.0;
+ if( rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION ) && rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE ) )
+ {
+ switch( eAxisPos )
+ {
+ case cssc::ChartAxisPosition_ZERO:
+ case cssc::ChartAxisPosition_START:
+ ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS );
+ break;
+ case cssc::ChartAxisPosition_END:
+ ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_MAXCROSS );
+ break;
+ case cssc::ChartAxisPosition_VALUE:
+ ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS, false );
+ maData.mfCross = ::get_flagvalue< double >( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE, log( fCrossingPos ) / log( 10.0 ), fCrossingPos );
+ break;
+ default:
+ ::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS );
+ }
+ }
+}
+
void XclExpChValueRange::WriteBody( XclExpStream& rStrm )
{
rStrm << maData.mfMin
@@ -2337,14 +2542,46 @@ XclExpChTick::XclExpChTick( const XclExpChRoot& rRoot ) :
{
}
-void XclExpChTick::Convert( const ScfPropertySet& rPropSet )
+void XclExpChTick::Convert( const ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo, sal_uInt16 nAxisType )
{
// tick mark style
- sal_Int32 nApiTickmarks(0);
+ sal_Int32 nApiTickmarks = 0;
if( rPropSet.GetProperty( nApiTickmarks, EXC_CHPROP_MAJORTICKS ) )
maData.mnMajor = lclGetXclTickPos( nApiTickmarks );
if( rPropSet.GetProperty( nApiTickmarks, EXC_CHPROP_MINORTICKS ) )
maData.mnMinor = lclGetXclTickPos( nApiTickmarks );
+
+ // axis labels
+ if( (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) && (nAxisType == EXC_CHAXIS_X) )
+ {
+ /* Radar charts disable their category labels via chart type, not via
+ axis, and axis labels are always 'near axis'. */
+ maData.mnLabelPos = EXC_CHTICK_NEXT;
+ }
+ else if( !rPropSet.GetBoolProperty( EXC_CHPROP_DISPLAYLABELS ) )
+ {
+ // no labels
+ maData.mnLabelPos = EXC_CHTICK_NOLABEL;
+ }
+ else if( rTypeInfo.mb3dChart && (nAxisType == EXC_CHAXIS_Y) )
+ {
+ // Excel expects 'near axis' at Y axes in 3D charts
+ maData.mnLabelPos = EXC_CHTICK_NEXT;
+ }
+ else
+ {
+ namespace cssc = ::com::sun::star::chart;
+ cssc::ChartAxisLabelPosition eApiLabelPos = cssc::ChartAxisLabelPosition_NEAR_AXIS;
+ rPropSet.GetProperty( eApiLabelPos, EXC_CHPROP_LABELPOSITION );
+ switch( eApiLabelPos )
+ {
+ case cssc::ChartAxisLabelPosition_NEAR_AXIS:
+ case cssc::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE: maData.mnLabelPos = EXC_CHTICK_NEXT; break;
+ case cssc::ChartAxisLabelPosition_OUTSIDE_START: maData.mnLabelPos = EXC_CHTICK_LOW; break;
+ case cssc::ChartAxisLabelPosition_OUTSIDE_END: maData.mnLabelPos = EXC_CHTICK_HIGH; break;
+ default: maData.mnLabelPos = EXC_CHTICK_NEXT;
+ }
+ }
}
void XclExpChTick::SetFontColor( const Color& rColor, sal_uInt32 nColorId )
@@ -2383,10 +2620,9 @@ Reference< XAxis > lclGetApiAxis( Reference< XCoordinateSystem > xCoordSystem,
sal_Int32 nApiAxisDim, sal_Int32 nApiAxesSetIdx )
{
Reference< XAxis > xAxis;
- try
+ if( (nApiAxisDim >= 0) && xCoordSystem.is() ) try
{
- if( xCoordSystem.is() )
- xAxis = xCoordSystem->getAxisByDimension( nApiAxisDim, nApiAxesSetIdx );
+ xAxis = xCoordSystem->getAxisByDimension( nApiAxisDim, nApiAxesSetIdx );
}
catch( Exception& )
{
@@ -2397,8 +2633,7 @@ Reference< XAxis > lclGetApiAxis( Reference< XCoordinateSystem > xCoordSystem,
} // namespace
XclExpChAxis::XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType ) :
- XclExpChGroupBase( EXC_ID_CHAXIS, 18 ),
- XclExpChRoot( rRoot ),
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_AXIS, EXC_ID_CHAXIS, 18 ),
mnNumFmtIdx( EXC_FORMAT_NOTFOUND )
{
maData.mnType = nAxisType;
@@ -2417,7 +2652,7 @@ void XclExpChAxis::SetRotation( sal_uInt16 nRotation )
mxTick->SetRotation( nRotation );
}
-void XclExpChAxis::Convert( Reference< XAxis > xAxis, const XclChExtTypeInfo& rTypeInfo, sal_Int32 nApiAxesSetIdx )
+void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossingAxis, const XclChExtTypeInfo& rTypeInfo )
{
ScfPropertySet aAxisProp( xAxis );
bool bCategoryAxis = ((GetAxisType() == EXC_CHAXIS_X) && rTypeInfo.mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z);
@@ -2431,6 +2666,7 @@ void XclExpChAxis::Convert( Reference< XAxis > xAxis, const XclChExtTypeInfo& rT
// axis scaling and increment ---------------------------------------------
+ ScfPropertySet aCrossingProp( xCrossingAxis );
if( bCategoryAxis )
{
mxLabelRange.reset( new XclExpChLabelRange( GetChRoot() ) );
@@ -2438,38 +2674,29 @@ void XclExpChAxis::Convert( Reference< XAxis > xAxis, const XclChExtTypeInfo& rT
if( xAxis.is() )
// #i71684# radar charts have reversed rotation direction
mxLabelRange->Convert( xAxis->getScaleData(), (GetAxisType() == EXC_CHAXIS_X) && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) );
- // swap max-cross flag for secondary X axis to have the secondary Y axis at right side
- if( (GetAxisType() == EXC_CHAXIS_X) && (nApiAxesSetIdx == EXC_CHAXESSET_SECONDARY) )
- mxLabelRange->SwapAxisMaxCross();
+ // get position of crossing axis on this axis from passed axis object
+ if( aCrossingProp.Is() )
+ mxLabelRange->ConvertAxisPosition( aCrossingProp );
}
else
{
mxValueRange.reset( new XclExpChValueRange( GetChRoot() ) );
if( xAxis.is() )
mxValueRange->Convert( xAxis->getScaleData() );
+ // get position of crossing axis on this axis from passed axis object
+ if( aCrossingProp.Is() )
+ mxValueRange->ConvertAxisPosition( aCrossingProp );
}
// axis caption text ------------------------------------------------------
// axis ticks properties
mxTick.reset( new XclExpChTick( GetChRoot() ) );
- mxTick->Convert( aAxisProp );
-
- // existence and position of axis labels
- sal_uInt8 nLabelPos = EXC_CHTICK_NOLABEL;
- if( rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR )
- /* Radar charts disable their category labels via chart type, not via
- axis, and axis labels are always 'near axis' in Chart2. */
- nLabelPos = EXC_CHTICK_NEXT;
- else if( aAxisProp.GetBoolProperty( EXC_CHPROP_DISPLAYLABELS ) )
- /* #i85862# Axis labels in other chart types always have position 'low'
- in Chart2, but Excel expects 'near axis' at Y axes in 3D charts. */
- nLabelPos = (rTypeInfo.mb3dChart && (GetAxisType() == EXC_CHAXIS_Y)) ? EXC_CHTICK_NEXT : EXC_CHTICK_LOW;
- mxTick->SetLabelPos( nLabelPos );
+ mxTick->Convert( aAxisProp, rTypeInfo, GetAxisType() );
// axis label formatting and rotation
ConvertFontBase( GetChRoot(), aAxisProp );
- ConvertRotationBase( GetChRoot(), aAxisProp );
+ ConvertRotationBase( GetChRoot(), aAxisProp, true );
// axis number format
sal_Int32 nApiNumFmt = 0;
@@ -2538,10 +2765,10 @@ void XclExpChAxis::WriteBody( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
XclExpChAxesSet::XclExpChAxesSet( const XclExpChRoot& rRoot, sal_uInt16 nAxesSetId ) :
- XclExpChGroupBase( EXC_ID_CHAXESSET, 18 ),
- XclExpChRoot( rRoot )
+ XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_AXESSET, EXC_ID_CHAXESSET, 18 )
{
maData.mnAxesSetId = nAxesSetId;
+ SetFutureRecordContext( 0, nAxesSetId );
}
sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16 nFirstGroupIdx )
@@ -2620,10 +2847,10 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16
// create axes according to chart type (no axes for pie and donut charts)
if( rTypeInfo.meTypeCateg != EXC_CHTYPECATEG_PIE )
{
- ConvertAxis( mxXAxis, EXC_CHAXIS_X, mxXAxisTitle, EXC_CHOBJLINK_XAXIS, xCoordSystem, rTypeInfo );
- ConvertAxis( mxYAxis, EXC_CHAXIS_Y, mxYAxisTitle, EXC_CHOBJLINK_YAXIS, xCoordSystem, rTypeInfo );
+ ConvertAxis( mxXAxis, EXC_CHAXIS_X, mxXAxisTitle, EXC_CHOBJLINK_XAXIS, xCoordSystem, rTypeInfo, EXC_CHART_AXIS_Y );
+ ConvertAxis( mxYAxis, EXC_CHAXIS_Y, mxYAxisTitle, EXC_CHOBJLINK_YAXIS, xCoordSystem, rTypeInfo, EXC_CHART_AXIS_X );
if( pGroup->Is3dDeepChart() )
- ConvertAxis( mxZAxis, EXC_CHAXIS_Z, mxZAxisTitle, EXC_CHOBJLINK_ZAXIS, xCoordSystem, rTypeInfo );
+ ConvertAxis( mxZAxis, EXC_CHAXIS_Z, mxZAxisTitle, EXC_CHOBJLINK_ZAXIS, xCoordSystem, rTypeInfo, EXC_CHART_AXIS_NONE );
}
// X axis category ranges
@@ -2707,14 +2934,16 @@ XclExpChTypeGroupRef XclExpChAxesSet::GetLastTypeGroup() const
void XclExpChAxesSet::ConvertAxis(
XclExpChAxisRef& rxChAxis, sal_uInt16 nAxisType,
XclExpChTextRef& rxChAxisTitle, sal_uInt16 nTitleTarget,
- Reference< XCoordinateSystem > xCoordSystem, const XclChExtTypeInfo& rTypeInfo )
+ Reference< XCoordinateSystem > xCoordSystem, const XclChExtTypeInfo& rTypeInfo,
+ sal_Int32 nCrossingAxisDim )
{
// create and convert axis object
rxChAxis.reset( new XclExpChAxis( GetChRoot(), nAxisType ) );
sal_Int32 nApiAxisDim = rxChAxis->GetApiAxisDimension();
sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex();
Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx );
- rxChAxis->Convert( xAxis, rTypeInfo, nApiAxesSetIdx );
+ Reference< XAxis > xCrossingAxis = lclGetApiAxis( xCoordSystem, nCrossingAxisDim, nApiAxesSetIdx );
+ rxChAxis->Convert( xAxis, xCrossingAxis, rTypeInfo );
// create and convert axis title
Reference< XTitled > xTitled( xAxis, UNO_QUERY );
@@ -2730,8 +2959,7 @@ void XclExpChAxesSet::WriteBody( XclExpStream& rStrm )
XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
Reference< XChartDocument > xChartDoc, const Size& rSize ) :
- XclExpChGroupBase( EXC_ID_CHCHART, 16 ),
- XclExpChRoot( rRoot, this )
+ XclExpChGroupBase( XclExpChRoot( rRoot, this ), EXC_CHFRBLOCK_TYPE_CHART, EXC_ID_CHCHART, 16 )
{
Size aPtSize = OutputDevice::LogicToLogic( rSize, MapMode( MAP_100TH_MM ), MapMode( MAP_POINT ) );
// rectangle is stored in 16.16 fixed-point format
@@ -2739,9 +2967,9 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
maRect.mnWidth = static_cast< sal_Int32 >( aPtSize.Width() << 16 );
maRect.mnHeight = static_cast< sal_Int32 >( aPtSize.Height() << 16 );
- // global chart properties
+ // global chart properties (default values)
::set_flag( maProps.mnFlags, EXC_CHPROPS_MANSERIES );
- ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISCELLS, false );
+ ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISIBLEONLY, false );
maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP;
// always create both axes set objects
@@ -2750,6 +2978,13 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
if( xChartDoc.is() )
{
+ Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram();
+
+ // global chart properties (only 'include hidden cells' attribute for now)
+ ScfPropertySet aDiagramProp( xDiagram );
+ bool bIncludeHidden = aDiagramProp.GetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS );
+ ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISIBLEONLY, !bIncludeHidden );
+
// initialize API conversion (remembers xChartDoc internally)
InitConversion( xChartDoc );
@@ -2762,11 +2997,24 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
mxTitle = lclCreateTitle( GetChRoot(), xTitled, EXC_CHOBJLINK_TITLE );
// diagrams (axes sets)
- Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram();
sal_uInt16 nFreeGroupIdx = mxPrimAxesSet->Convert( xDiagram, 0 );
if( !mxPrimAxesSet->Is3dChart() )
mxSecnAxesSet->Convert( xDiagram, nFreeGroupIdx );
+ // treatment of missing values
+ ScfPropertySet aDiaProp( xDiagram );
+ sal_Int32 nMissingValues = 0;
+ if( aDiaProp.GetProperty( nMissingValues, EXC_CHPROP_MISSINGVALUETREATMENT ) )
+ {
+ using namespace ::com::sun::star::chart::MissingValueTreatment;
+ switch( nMissingValues )
+ {
+ case LEAVE_GAP: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; break;
+ case USE_ZERO: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_ZERO; break;
+ case CONTINUE: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_INTERPOLATE; break;
+ }
+ }
+
// finish API conversion
FinishConversion();
}
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index d40c0d91275c..af1a90291b99 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -391,6 +391,9 @@ XclExpTbxControlObj::XclExpTbxControlObj( const XclExpRoot& rRoot, Reference< XS
rEscherEx.OpenContainer( ESCHER_SpContainer );
rEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_HAVESPT );
EscherPropertyContainer aPropOpt;
+ bool bVisible = aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "EnableVisible" ) );
+ aPropOpt.AddOpt( ESCHER_Prop_fPrint, bVisible ? 0x00080000 : 0x00080002 ); // visible flag
+
aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x01000100 ); // bool field
aPropOpt.AddOpt( ESCHER_Prop_lTxid, 0 ); // Text ID
aPropOpt.AddOpt( ESCHER_Prop_WrapText, 0x00000001 );
@@ -847,7 +850,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
{
// TODO: additional text
if( pScNote )
- if( SdrCaptionObj* pCaption = pScNote->GetCaption() )
+ if( SdrCaptionObj* pCaption = pScNote->GetOrCreateCaption( maScPos ) )
if( const OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
mnObjId = rRoot.GetOldRoot().pObjRecs->Add( new XclObjComment( rRoot, pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible ) );
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index e0df86d37d9a..457cdd2a17e4 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -1500,7 +1500,11 @@ void XclExpPivotTable::WriteSxli( XclExpStream& rStrm, sal_uInt16 nLineCount, sa
{
sal_uInt16 nLineSize = 8 + 2 * nIndexCount;
rStrm.StartRecord( EXC_ID_SXLI, nLineSize * nLineCount );
- rStrm.SetSliceSize( nLineSize );
+
+ /* #158444# Excel expects the records to be filled completely, do not
+ set a segment size... */
+// rStrm.SetSliceSize( nLineSize );
+
for( sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine )
{
// #106598# Excel XP needs a partly initialized SXLI record
diff --git a/sc/source/filter/excel/xerecord.cxx b/sc/source/filter/excel/xerecord.cxx
index 1ee92c191db9..b422781db143 100644
--- a/sc/source/filter/excel/xerecord.cxx
+++ b/sc/source/filter/excel/xerecord.cxx
@@ -240,6 +240,24 @@ void XclExpDummyRecord::WriteBody( XclExpStream& rStrm )
rStrm.Write( mpData, GetRecSize() );
}
+// Future records =============================================================
+
+XclExpFutureRecord::XclExpFutureRecord( XclFutureRecType eRecType, sal_uInt16 nRecId, sal_Size nRecSize ) :
+ XclExpRecord( nRecId, nRecSize ),
+ meRecType( eRecType )
+{
+}
+
+void XclExpFutureRecord::Save( XclExpStream& rStrm )
+{
+ rStrm.StartRecord( GetRecId(), GetRecSize() + ((meRecType == EXC_FUTUREREC_UNUSEDREF) ? 12 : 4) );
+ rStrm << GetRecId() << sal_uInt16( 0 );
+ if( meRecType == EXC_FUTUREREC_UNUSEDREF )
+ rStrm.WriteZeroBytes( 8 );
+ WriteBody( rStrm );
+ rStrm.EndRecord();
+}
+
// ============================================================================
XclExpSubStream::XclExpSubStream( sal_uInt16 nSubStrmType ) :
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 100f1bc54af1..7c4974db3029 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -31,7 +31,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
#include <sfx2/docfile.hxx>
+#include <sfx2/sfxsids.hrc>
#include <svtools/saveopt.hxx>
+#include <svtools/itemset.hxx>
+#include <svtools/stritem.hxx>
+#include <svtools/eitem.hxx>
#include "xecontent.hxx"
#include "xltracer.hxx"
#include "xehelper.hxx"
@@ -42,8 +46,10 @@
#include "xepivot.hxx"
#include "xeroot.hxx"
-// for filter manager
-#include "excrecds.hxx"
+#include "excrecds.hxx" // for filter manager
+#include "tabprotection.hxx"
+#include "document.hxx"
+#include "scextopt.hxx"
// Global data ================================================================
@@ -221,6 +227,40 @@ XclExpRecordRef XclExpRoot::CreateRecord( sal_uInt16 nRecId ) const
return xRec;
}
+bool XclExpRoot::IsDocumentEncrypted() const
+{
+ // We need to encrypt the content when the document structure is protected.
+ const ScDocProtection* pDocProt = GetDoc().GetDocProtection();
+ if (pDocProt && pDocProt->isProtected() && pDocProt->isOptionEnabled(ScDocProtection::STRUCTURE))
+ return true;
+
+ if (GetPassword().Len() > 0)
+ // Password is entered directly into the save dialog.
+ return true;
+
+ return false;
+}
+
+const String XclExpRoot::GetPassword() const
+{
+ SfxItemSet* pSet = GetMedium().GetItemSet();
+ if (!pSet)
+ return String();
+
+ const SfxPoolItem* pItem = NULL;
+ if (SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, sal_True, &pItem))
+ {
+ const SfxStringItem* pStrItem = dynamic_cast<const SfxStringItem*>(pItem);
+ if (pStrItem)
+ {
+ // Password from the save dialog.
+ return pStrItem->GetValue();
+ }
+ }
+
+ return String();
+}
+
XclExpRootData::XclExpLinkMgrRef XclExpRoot::GetLocalLinkMgrRef() const
{
return IsInGlobals() ? mrExpData.mxGlobLinkMgr : mrExpData.mxLocLinkMgr;
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 9cb054d2ada2..6b2f53c8056a 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -51,6 +51,8 @@
#include <oox/core/tokens.hxx>
#include <formula/grammar.hxx>
+#define DEBUG_XL_ENCRYPTION 0
+
using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::io::XOutputStream;
using ::com::sun::star::io::XStream;
@@ -63,7 +65,10 @@ using ::com::sun::star::uno::UNO_QUERY;
using ::rtl::OString;
using ::rtl::OUString;
using ::utl::OStreamWrapper;
+using ::std::vector;
+
using namespace formula;
+
// ============================================================================
XclExpStream::XclExpStream( SvStream& rOutStrm, const XclExpRoot& rRoot, sal_uInt16 nMaxRecSize ) :
@@ -92,16 +97,19 @@ XclExpStream::~XclExpStream()
void XclExpStream::StartRecord( sal_uInt16 nRecId, sal_Size nRecSize )
{
DBG_ASSERT( !mbInRec, "XclExpStream::StartRecord - another record still open" );
+ DisableEncryption();
mnMaxContSize = mnCurrMaxSize = mnMaxRecSize;
mnPredictSize = nRecSize;
mbInRec = true;
InitRecord( nRecId );
SetSliceSize( 0 );
+ EnableEncryption();
}
void XclExpStream::EndRecord()
{
DBG_ASSERT( mbInRec, "XclExpStream::EndRecord - no record open" );
+ DisableEncryption();
UpdateRecSize();
mrStrm.Seek( STREAM_SEEK_TO_END );
mbInRec = false;
@@ -113,6 +121,86 @@ void XclExpStream::SetSliceSize( sal_uInt16 nSize )
mnSliceSize = 0;
}
+XclExpStream& XclExpStream::operator<<( sal_Int8 nValue )
+{
+ PrepareWrite( 1 );
+ if (mbUseEncrypter && HasValidEncrypter())
+ mxEncrypter->Encrypt(mrStrm, nValue);
+ else
+ mrStrm << nValue;
+ return *this;
+}
+
+XclExpStream& XclExpStream::operator<<( sal_uInt8 nValue )
+{
+ PrepareWrite( 1 );
+ if (mbUseEncrypter && HasValidEncrypter())
+ mxEncrypter->Encrypt(mrStrm, nValue);
+ else
+ mrStrm << nValue;
+ return *this;
+}
+
+XclExpStream& XclExpStream::operator<<( sal_Int16 nValue )
+{
+ PrepareWrite( 2 );
+ if (mbUseEncrypter && HasValidEncrypter())
+ mxEncrypter->Encrypt(mrStrm, nValue);
+ else
+ mrStrm << nValue;
+ return *this;
+}
+
+XclExpStream& XclExpStream::operator<<( sal_uInt16 nValue )
+{
+ PrepareWrite( 2 );
+ if (mbUseEncrypter && HasValidEncrypter())
+ mxEncrypter->Encrypt(mrStrm, nValue);
+ else
+ mrStrm << nValue;
+ return *this;
+}
+
+XclExpStream& XclExpStream::operator<<( sal_Int32 nValue )
+{
+ PrepareWrite( 4 );
+ if (mbUseEncrypter && HasValidEncrypter())
+ mxEncrypter->Encrypt(mrStrm, nValue);
+ else
+ mrStrm << nValue;
+ return *this;
+}
+
+XclExpStream& XclExpStream::operator<<( sal_uInt32 nValue )
+{
+ PrepareWrite( 4 );
+ if (mbUseEncrypter && HasValidEncrypter())
+ mxEncrypter->Encrypt(mrStrm, nValue);
+ else
+ mrStrm << nValue;
+ return *this;
+}
+
+XclExpStream& XclExpStream::operator<<( float fValue )
+{
+ PrepareWrite( 4 );
+ if (mbUseEncrypter && HasValidEncrypter())
+ mxEncrypter->Encrypt(mrStrm, fValue);
+ else
+ mrStrm << fValue;
+ return *this;
+}
+
+XclExpStream& XclExpStream::operator<<( double fValue )
+{
+ PrepareWrite( 8 );
+ if (mbUseEncrypter && HasValidEncrypter())
+ mxEncrypter->Encrypt(mrStrm, fValue);
+ else
+ mrStrm << fValue;
+ return *this;
+}
+
sal_Size XclExpStream::Write( const void* pData, sal_Size nBytes )
{
sal_Size nRet = 0;
@@ -127,9 +215,21 @@ sal_Size XclExpStream::Write( const void* pData, sal_Size nBytes )
while( bValid && (nBytesLeft > 0) )
{
sal_Size nWriteLen = ::std::min< sal_Size >( PrepareWrite(), nBytesLeft );
- sal_Size nWriteRet = mrStrm.Write( pBuffer, nWriteLen );
+ sal_Size nWriteRet = nWriteLen;
+ if (mbUseEncrypter && HasValidEncrypter())
+ {
+ DBG_ASSERT(nWriteLen > 0, "XclExpStream::Write: write length is 0!");
+ vector<sal_uInt8> aBytes(nWriteLen);
+ memcpy(&aBytes[0], pBuffer, nWriteLen);
+ mxEncrypter->EncryptBytes(mrStrm, aBytes);
+ // TODO: How do I check if all the bytes have been successfully written ?
+ }
+ else
+ {
+ nWriteRet = mrStrm.Write( pBuffer, nWriteLen );
bValid = (nWriteLen == nWriteRet);
DBG_ASSERT( bValid, "XclExpStream::Write - stream write error" );
+ }
pBuffer += nWriteRet;
nRet += nWriteRet;
nBytesLeft -= nWriteRet;
@@ -265,6 +365,26 @@ void XclExpStream::WriteCharBuffer( const ScfUInt8Vec& rBuffer )
Write( &rBuffer[ 0 ], rBuffer.size() );
}
+void XclExpStream::SetEncrypter( XclExpEncrypterRef xEncrypter )
+{
+ mxEncrypter = xEncrypter;
+}
+
+bool XclExpStream::HasValidEncrypter() const
+{
+ return mxEncrypter.is() && mxEncrypter->IsValid();
+}
+
+void XclExpStream::EnableEncryption( bool bEnable )
+{
+ mbUseEncrypter = bEnable && HasValidEncrypter();
+}
+
+void XclExpStream::DisableEncryption()
+{
+ EnableEncryption(false);
+}
+
sal_Size XclExpStream::SetSvStreamPos( sal_Size nPos )
{
DBG_ASSERT( !mbInRec, "XclExpStream::SetSvStreamPos - not allowed inside of a record" );
@@ -356,6 +476,193 @@ void XclExpStream::WriteRawZeroBytes( sal_Size nBytes )
// ============================================================================
+XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16],
+ const sal_uInt8 nSalt[16] ) :
+ mrRoot(rRoot),
+ mnOldPos(STREAM_SEEK_TO_END),
+ mbValid(false)
+{
+ String aPass = rRoot.GetPassword();
+ if (aPass.Len() == 0)
+ // Empty password. Get the default biff8 password.
+ aPass = XclCryptoHelper::GetBiff8WbProtPassword();
+ Init(aPass, nDocId, nSalt);
+}
+
+XclExpBiff8Encrypter::~XclExpBiff8Encrypter()
+{
+}
+
+bool XclExpBiff8Encrypter::IsValid() const
+{
+ return mbValid;
+}
+
+void XclExpBiff8Encrypter::GetSaltDigest( sal_uInt8 nSaltDigest[16] ) const
+{
+ memcpy(nSaltDigest, mnSaltDigest, 16);
+}
+
+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt8 nData )
+{
+ vector<sal_uInt8> aByte(1);
+ aByte[0] = nData;
+ EncryptBytes(rStrm, aByte);
+}
+
+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt16 nData )
+{
+ ::std::vector<sal_uInt8> pnBytes(2);
+ pnBytes[0] = nData & 0xFF;
+ pnBytes[1] = (nData >> 8) & 0xFF;
+ EncryptBytes(rStrm, pnBytes);
+}
+
+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt32 nData )
+{
+ ::std::vector<sal_uInt8> pnBytes(4);
+ pnBytes[0] = nData & 0xFF;
+ pnBytes[1] = (nData >> 8) & 0xFF;
+ pnBytes[2] = (nData >> 16) & 0xFF;
+ pnBytes[3] = (nData >> 24) & 0xFF;
+ EncryptBytes(rStrm, pnBytes);
+}
+
+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, float fValue )
+{
+ ::std::vector<sal_uInt8> pnBytes(4);
+ memcpy(&pnBytes[0], &fValue, 4);
+ EncryptBytes(rStrm, pnBytes);
+}
+
+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, double fValue )
+{
+ ::std::vector<sal_uInt8> pnBytes(8);
+ memcpy(&pnBytes[0], &fValue, 8);
+ EncryptBytes(rStrm, pnBytes);
+}
+
+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int8 nData )
+{
+ Encrypt(rStrm, static_cast<sal_uInt8>(nData));
+}
+
+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int16 nData )
+{
+ Encrypt(rStrm, static_cast<sal_uInt16>(nData));
+}
+
+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int32 nData )
+{
+ Encrypt(rStrm, static_cast<sal_uInt32>(nData));
+}
+
+void XclExpBiff8Encrypter::Init( const String& aPass, const sal_uInt8 nDocId[16],
+ const sal_uInt8 nSalt[16] )
+{
+ memset(mnSaltDigest, 0, sizeof(mnSaltDigest));
+
+ xub_StrLen nLen = aPass.Len();
+ bool bValid = (0 < nLen) && (nLen < 16);
+ if ( bValid )
+ {
+ // transform String to sal_uInt16 array
+ memset(mnPassw, 0, sizeof(mnPassw));
+ for (xub_StrLen nChar = 0; nChar < nLen; ++nChar)
+ mnPassw[nChar] = static_cast<sal_uInt16>(aPass.GetChar(nChar));
+
+ // copy document ID
+ memcpy(mnDocId, nDocId, sizeof(mnDocId));
+
+ // init codec
+ maCodec.InitKey(mnPassw, mnDocId);
+
+ // generate salt hash.
+ ::svx::MSCodec_Std97 aCodec;
+ aCodec.InitKey(mnPassw, mnDocId);
+ aCodec.CreateSaltDigest(nSalt, mnSaltDigest);
+
+ // verify to make sure it's in good shape.
+ bValid = maCodec.VerifyKey(nSalt, mnSaltDigest);
+ }
+
+ mbValid = bValid;
+}
+
+sal_uInt32 XclExpBiff8Encrypter::GetBlockPos( sal_Size nStrmPos ) const
+{
+ return static_cast<sal_uInt32>(nStrmPos / EXC_ENCR_BLOCKSIZE);
+}
+
+sal_uInt16 XclExpBiff8Encrypter::GetOffsetInBlock( sal_Size nStrmPos ) const
+{
+ return static_cast<sal_uInt16>(nStrmPos % EXC_ENCR_BLOCKSIZE);
+}
+
+void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector<sal_uInt8>& aBytes )
+{
+ sal_Size nStrmPos = rStrm.Tell();
+ sal_uInt16 nBlockOffset = GetOffsetInBlock(nStrmPos);
+ sal_uInt32 nBlockPos = GetBlockPos(nStrmPos);
+
+#if DEBUG_XL_ENCRYPTION
+ fprintf(stdout, "XclExpBiff8Encrypter::EncryptBytes: stream pos = %ld offset in block = %d block pos = %ld\n",
+ nStrmPos, nBlockOffset, nBlockPos);
+#endif
+
+ sal_uInt16 nSize = static_cast< sal_uInt16 >( aBytes.size() );
+ if (nSize == 0)
+ return;
+
+#if DEBUG_XL_ENCRYPTION
+ fprintf(stdout, "RAW: ");
+ for (sal_uInt16 i = 0; i < nSize; ++i)
+ fprintf(stdout, "%2.2X ", aBytes[i]);
+ fprintf(stdout, "\n");
+#endif
+
+ if (mnOldPos != nStrmPos)
+ {
+ sal_uInt16 nOldOffset = GetOffsetInBlock(mnOldPos);
+ sal_uInt32 nOldBlockPos = GetBlockPos(mnOldPos);
+
+ if ( (nBlockPos != nOldBlockPos) || (nBlockOffset < nOldOffset) )
+ {
+ maCodec.InitCipher(nBlockPos);
+ nOldOffset = 0;
+ }
+
+ if (nBlockOffset > nOldOffset)
+ maCodec.Skip(nBlockOffset - nOldOffset);
+ }
+
+ sal_uInt16 nBytesLeft = nSize;
+ sal_uInt16 nPos = 0;
+ while (nBytesLeft > 0)
+ {
+ sal_uInt16 nBlockLeft = EXC_ENCR_BLOCKSIZE - nBlockOffset;
+ sal_uInt16 nEncBytes = ::std::min(nBlockLeft, nBytesLeft);
+
+ bool bRet = maCodec.Encode(&aBytes[nPos], nEncBytes, &aBytes[nPos], nEncBytes);
+ DBG_ASSERT(bRet, "XclExpBiff8Encrypter::EncryptBytes: encryption failed!!");
+ bRet = bRet; // to remove a silly compiler warning.
+
+ sal_Size nRet = rStrm.Write(&aBytes[nPos], nEncBytes);
+ DBG_ASSERT(nRet == nEncBytes, "XclExpBiff8Encrypter::EncryptBytes: fail to write to stream!!");
+ nRet = nRet; // to remove a silly compiler warning.
+
+ nStrmPos = rStrm.Tell();
+ nBlockOffset = GetOffsetInBlock(nStrmPos);
+ nBlockPos = GetBlockPos(nStrmPos);
+ if (nBlockOffset == 0)
+ maCodec.InitCipher(nBlockPos);
+
+ nBytesLeft -= nEncBytes;
+ nPos += nEncBytes;
+ }
+ mnOldPos = nStrmPos;
+}
+
rtl::OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sStream, sal_Int32 nId )
{
rtl::OUStringBuffer sBuf;
@@ -666,7 +973,7 @@ sax_fastparser::FSHelperPtr XclExpXmlStream::CreateOutputStream (
if( pRelationshipId )
*pRelationshipId = sRelationshipId;
- sax_fastparser::FSHelperPtr p = openOutputStreamWithSerializer( sFullStream, OUString::createFromAscii( sContentType ) );
+ sax_fastparser::FSHelperPtr p = openFragmentStreamWithSerializer( sFullStream, OUString::createFromAscii( sContentType ) );
maOpenedStreamMap[ sFullStream ] = std::make_pair( sRelationshipId, p );
@@ -683,14 +990,14 @@ sal_Int32 XclExpXmlStream::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const
return -1;
}
-const oox::vml::DrawingPtr XclExpXmlStream::getDrawings()
+oox::vml::Drawing* XclExpXmlStream::getVmlDrawing()
{
- return oox::vml::DrawingPtr();
+ return 0;
}
const oox::drawingml::Theme* XclExpXmlStream::getCurrentTheme() const
{
- return NULL;
+ return 0;
}
const oox::drawingml::table::TableStyleListPtr XclExpXmlStream::getTableStyles()
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index a9da62f838cc..2172a7678763 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2319,9 +2319,9 @@ sal_uInt32 XclExpXFBuffer::InsertWithFont( const ScPatternAttr* pPattern, sal_In
return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak );
}
-sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt )
+sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt, bool bForceLineBreak )
{
- return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, false );
+ return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, bForceLineBreak );
}
sal_uInt32 XclExpXFBuffer::InsertStyle( const SfxStyleSheetBase* pStyleSheet )
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 5aa515b64578..fadc916d7b86 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -839,13 +839,15 @@ XclExpFormulaCell::XclExpFormulaCell(
// #i41420# find script type according to result type (always latin for numeric results)
sal_Int16 nScript = ApiScriptType::LATIN;
+ bool bForceLineBreak = false;
if( nFormatType == NUMBERFORMAT_TEXT )
{
String aResult;
mrScFmlaCell.GetString( aResult );
+ bForceLineBreak = mrScFmlaCell.IsMultilineResult();
nScript = XclExpStringHelper::GetLeadingScriptType( rRoot, aResult );
}
- SetXFId( rRoot.GetXFBuffer().InsertWithNumFmt( pPattern, nScript, nAltScNumFmt ) );
+ SetXFId( rRoot.GetXFBuffer().InsertWithNumFmt( pPattern, nScript, nAltScNumFmt, bForceLineBreak ) );
}
// *** Convert the formula token array *** --------------------------------
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 8c37b04d904f..2d920b0a0bd4 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -39,7 +39,11 @@
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
@@ -58,12 +62,16 @@
#include <com/sun/star/chart2/TickmarkStyle.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <sfx2/objsh.hxx>
#include "document.hxx"
#include "drwlayer.hxx"
#include "rangeutl.hxx"
+#include "tokenarray.hxx"
+#include "token.hxx"
+#include "compiler.hxx"
#include "fprogressbar.hxx"
#include "xltracer.hxx"
#include "xistream.hxx"
@@ -72,9 +80,6 @@
#include "xipage.hxx"
#include "xiview.hxx"
#include "xiescher.hxx"
-#include "tokenarray.hxx"
-#include "token.hxx"
-#include "compiler.hxx"
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -136,10 +141,10 @@ void lclSetValueOrClearAny( Any& rAny, const Type& rValue, bool bClear )
rAny <<= rValue;
}
-void lclSetScaledValueOrClearAny( Any& rAny, double fValue, Reference< XScaling > xScaling, bool bClear )
+void lclSetExpValueOrClearAny( Any& rAny, double fValue, bool bLogScale, bool bClear )
{
- if( !bClear && xScaling.is() )
- fValue = xScaling->doScaling( fValue );
+ if( !bClear && bLogScale )
+ fValue = pow( 10.0, fValue );
lclSetValueOrClearAny( rAny, fValue, bClear );
}
@@ -633,8 +638,11 @@ Reference< XLabeledDataSequence > lclCreateLabeledDataSequence(
// ----------------------------------------------------------------------------
XclImpChSourceLink::XclImpChSourceLink( const XclImpChRoot& rRoot ) :
- XclImpChRoot( rRoot ),
- mpTokenArray(static_cast<ScTokenArray*>(NULL))
+ XclImpChRoot( rRoot )
+{
+}
+
+XclImpChSourceLink::~XclImpChSourceLink()
{
}
@@ -645,18 +653,16 @@ void XclImpChSourceLink::ReadChSourceLink( XclImpStream& rStrm )
>> maData.mnFlags
>> maData.mnNumFmtIdx;
+ mxTokenArray.reset();
if( GetLinkType() == EXC_CHSRCLINK_WORKSHEET )
{
// read token array
XclTokenArray aXclTokArr;
rStrm >> aXclTokArr;
- // convert xcl formula tokens to Calc's.
- const ScTokenArray* pTokenArray =
- GetFormulaCompiler().CreateFormula(EXC_FMLATYPE_CHART, aXclTokArr);
-
- if (pTokenArray)
- mpTokenArray.reset(pTokenArray->Clone());
+ // convert BIFF formula tokens to Calc token array
+ if( const ScTokenArray* pTokens = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_CHART, aXclTokArr ) )
+ mxTokenArray.reset( pTokens->Clone() );
}
// try to read a following CHSTRING record
@@ -683,79 +689,72 @@ void XclImpChSourceLink::SetTextFormats( const XclFormatRunVec& rFormats )
sal_uInt16 XclImpChSourceLink::GetCellCount() const
{
- using namespace ::formula;
-
sal_uInt32 nCellCount = 0;
- mpTokenArray->Reset();
- for (const FormulaToken* p = mpTokenArray->First(); p; p = mpTokenArray->Next())
+ if( mxTokenArray.is() )
{
- switch (p->GetType())
+ mxTokenArray->Reset();
+ for( const FormulaToken* pToken = mxTokenArray->First(); pToken; pToken = mxTokenArray->Next() )
{
- case svSingleRef:
- case svExternalSingleRef:
- // single cell
- ++nCellCount;
- break;
- case svDoubleRef:
- case svExternalDoubleRef:
+ switch( pToken->GetType() )
{
- // cell range
- const ScComplexRefData& rData = static_cast<const ScToken*>(p)->GetDoubleRef();
- const ScSingleRefData& s = rData.Ref1;
- const ScSingleRefData& e = rData.Ref2;
- SCsTAB nTab = e.nTab - s.nTab;
- SCsCOL nCol = e.nCol - s.nCol;
- SCsROW nRow = e.nRow - s.nRow;
- nCellCount += static_cast<sal_uInt32>(nCol+1) *
- static_cast<sal_uInt32>(nRow+1) *
- static_cast<sal_uInt32>(nTab+1);
+ case ::formula::svSingleRef:
+ case ::formula::svExternalSingleRef:
+ // single cell
+ ++nCellCount;
+ break;
+ case ::formula::svDoubleRef:
+ case ::formula::svExternalDoubleRef:
+ {
+ // cell range
+ const ScComplexRefData& rComplexRef = static_cast< const ScToken* >( pToken )->GetDoubleRef();
+ const ScSingleRefData& rRef1 = rComplexRef.Ref1;
+ const ScSingleRefData& rRef2 = rComplexRef.Ref2;
+ sal_uInt32 nTabs = static_cast< sal_uInt32 >( rRef2.nTab - rRef1.nTab + 1 );
+ sal_uInt32 nCols = static_cast< sal_uInt32 >( rRef2.nCol - rRef1.nCol + 1 );
+ sal_uInt32 nRows = static_cast< sal_uInt32 >( rRef2.nRow - rRef1.nRow + 1 );
+ nCellCount += nCols * nRows * nTabs;
+ }
+ break;
+ default: ;
}
- break;
- default: ;
}
}
- return limit_cast<sal_uInt16>(nCellCount);
+ return limit_cast< sal_uInt16 >( nCellCount );
}
void XclImpChSourceLink::ConvertNumFmt( ScfPropertySet& rPropSet, bool bPercent ) const
{
- if( ::get_flag( maData.mnFlags, EXC_CHSRCLINK_NUMFMT ) )
- {
- sal_uInt32 nScNumFmt = GetNumFmtBuffer().GetScFormat( maData.mnNumFmtIdx );
- if( nScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND )
- {
- sal_Int32 nApiNumFmt = static_cast< sal_Int32 >( nScNumFmt );
- if( bPercent )
- rPropSet.SetProperty( EXC_CHPROP_PERCENTAGENUMFMT, nApiNumFmt );
- else
- rPropSet.SetProperty( EXC_CHPROP_NUMBERFORMAT, nApiNumFmt );
- }
- }
+ bool bLinkToSource = ::get_flag( maData.mnFlags, EXC_CHSRCLINK_NUMFMT );
+ sal_uInt32 nScNumFmt = bLinkToSource ? GetNumFmtBuffer().GetScFormat( maData.mnNumFmtIdx ) : NUMBERFORMAT_ENTRY_NOT_FOUND;
+ OUString aPropName = bPercent ? EXC_CHPROP_PERCENTAGENUMFMT : EXC_CHPROP_NUMBERFORMAT;
+ if( nScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND )
+ rPropSet.SetProperty( aPropName, static_cast< sal_Int32 >( nScNumFmt ) );
+ else
+ // restore 'link to source' at data point (series may contain manual number format)
+ rPropSet.SetAnyProperty( aPropName, Any() );
}
Reference< XDataSequence > XclImpChSourceLink::CreateDataSequence( const OUString& rRole ) const
{
Reference< XDataSequence > xDataSeq;
Reference< XDataProvider > xDataProv = GetDataProvider();
- if( xDataProv.is() )
+ if( xDataProv.is() && mxTokenArray.is() )
{
- if (mpTokenArray)
+ ScCompiler aComp( GetDocPtr(), ScAddress(), *mxTokenArray );
+ aComp.SetGrammar( ::formula::FormulaGrammar::GRAM_ENGLISH );
+ OUStringBuffer aRangeRep;
+ aComp.CreateStringFromTokenArray( aRangeRep );
+ try
{
- ScCompiler aComp(GetDocPtr(), ScAddress(), *mpTokenArray);
- aComp.SetGrammar(::formula::FormulaGrammar::GRAM_ENGLISH);
- OUStringBuffer aBuf;
- aComp.CreateStringFromTokenArray(aBuf);
- xDataSeq = xDataProv->createDataSequenceByRangeRepresentation(
- aBuf.makeStringAndClear());
+ xDataSeq = xDataProv->createDataSequenceByRangeRepresentation( aRangeRep.makeStringAndClear() );
+ // set sequence role
+ ScfPropertySet aSeqProp( xDataSeq );
+ aSeqProp.SetProperty( EXC_CHPROP_ROLE, rRole );
}
- else
+ catch( Exception& )
{
- DBG_ERRORFILE( "XclImpChSourceLink::CreateDataSequence - cannot create data sequence" );
+// DBG_ERRORFILE( "XclImpChSourceLink::CreateDataSequence - cannot create data sequence" );
}
-
- // set sequence role
- ScfPropertySet aSeqProp( xDataSeq );
- aSeqProp.SetProperty( EXC_CHPROP_ROLE, rRole );
}
return xDataSeq;
}
@@ -804,9 +803,9 @@ void XclImpChFontBase::ConvertFontBase( const XclImpChRoot& rRoot, ScfPropertySe
rRoot.ConvertFont( rPropSet, GetFontIndex(), &aFontColor );
}
-void XclImpChFontBase::ConvertRotationBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet ) const
+void XclImpChFontBase::ConvertRotationBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, bool bSupportsStacked ) const
{
- rRoot.GetChartPropSetHelper().WriteRotationProperties( rPropSet, GetRotation() );
+ rRoot.GetChartPropSetHelper().WriteRotationProperties( rPropSet, GetRotation(), bSupportsStacked );
}
// ----------------------------------------------------------------------------
@@ -877,6 +876,9 @@ void XclImpChText::ReadSubRecord( XclImpStream& rStrm )
case EXC_ID_CHOBJECTLINK:
rStrm >> maObjLink.mnTarget >> maObjLink.maPointPos.mnSeriesIdx >> maObjLink.maPointPos.mnPointIdx;
break;
+ case EXC_ID_CHFRLABELPROPS:
+ ReadChFrLabelProps( rStrm );
+ break;
case EXC_ID_CHEND:
if( mxSrcLink.is() && !maFormats.empty() )
mxSrcLink->SetTextFormats( maFormats );
@@ -937,6 +939,11 @@ void XclImpChText::ConvertFont( ScfPropertySet& rPropSet ) const
ConvertFontBase( GetChRoot(), rPropSet );
}
+void XclImpChText::ConvertRotation( ScfPropertySet& rPropSet, bool bSupportsStacked ) const
+{
+ ConvertRotationBase( GetChRoot(), rPropSet, bSupportsStacked );
+}
+
void XclImpChText::ConvertFrame( ScfPropertySet& rPropSet ) const
{
if( mxFrame.is() )
@@ -951,27 +958,42 @@ void XclImpChText::ConvertNumFmt( ScfPropertySet& rPropSet, bool bPercent ) cons
void XclImpChText::ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeInfo& rTypeInfo ) const
{
- const sal_uInt16 EXC_CHTEXT_SHOWANYCATEG = EXC_CHTEXT_SHOWCATEGPERC | EXC_CHTEXT_SHOWCATEG;
- const sal_uInt16 EXC_CHTEXT_SHOWANYVALUE = EXC_CHTEXT_SHOWVALUE;
- const sal_uInt16 EXC_CHTEXT_SHOWANYPERCENT = EXC_CHTEXT_SHOWPERCENT | EXC_CHTEXT_SHOWCATEGPERC;
+ // existing CHFRLABELPROPS record wins over flags from CHTEXT
+ sal_uInt16 nShowFlags = mxLabelProps.is() ? mxLabelProps->mnFlags : maData.mnFlags;
+ sal_uInt16 SHOWANYCATEG = mxLabelProps.is() ? EXC_CHFRLABELPROPS_SHOWCATEG : (EXC_CHTEXT_SHOWCATEGPERC | EXC_CHTEXT_SHOWCATEG);
+ sal_uInt16 SHOWANYVALUE = mxLabelProps.is() ? EXC_CHFRLABELPROPS_SHOWVALUE : EXC_CHTEXT_SHOWVALUE;
+ sal_uInt16 SHOWANYPERCENT = mxLabelProps.is() ? EXC_CHFRLABELPROPS_SHOWPERCENT : (EXC_CHTEXT_SHOWPERCENT | EXC_CHTEXT_SHOWCATEGPERC);
+ sal_uInt16 SHOWANYBUBBLE = mxLabelProps.is() ? EXC_CHFRLABELPROPS_SHOWBUBBLE : EXC_CHTEXT_SHOWBUBBLE;
- bool bIsPie = rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE;
+ // get raw flags for label values
bool bShowNone = IsDeleted();
- bool bShowCateg = !bShowNone && ::get_flag( maData.mnFlags, EXC_CHTEXT_SHOWANYCATEG );
- bool bShowPercent = !bShowNone && bIsPie && ::get_flag( maData.mnFlags, EXC_CHTEXT_SHOWANYPERCENT );
- bool bShowValue = !bShowNone && !bShowPercent && ::get_flag( maData.mnFlags, EXC_CHTEXT_SHOWANYVALUE );
- bool bShowAny = bShowValue || bShowPercent || bShowCateg;
- bool bShowSymbol = bShowAny && ::get_flag( maData.mnFlags, EXC_CHTEXT_SHOWSYMBOL );
+ bool bShowCateg = !bShowNone && ::get_flag( nShowFlags, SHOWANYCATEG );
+ bool bShowPercent = !bShowNone && ::get_flag( nShowFlags, SHOWANYPERCENT );
+ bool bShowValue = !bShowNone && ::get_flag( nShowFlags, SHOWANYVALUE );
+ bool bShowBubble = !bShowNone && ::get_flag( nShowFlags, SHOWANYBUBBLE );
+
+ // adjust to Chart2 behaviour
+ if( rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES )
+ bShowValue = bShowBubble; // Chart2 bubble charts show bubble size if 'ShowValue' is set
- // type of attached label
+ // other flags
+ bool bShowAny = bShowValue || bShowPercent || bShowCateg;
+ bool bShowSymbol = bShowAny && ::get_flag( maData.mnFlags, EXC_CHTEXT_SHOWSYMBOL );
+
+ // create API struct for label values, set API label separator
namespace cssc = ::com::sun::star::chart2;
cssc::DataPointLabel aPointLabel( bShowValue, bShowPercent, bShowCateg, bShowSymbol );
rPropSet.SetProperty( EXC_CHPROP_LABEL, aPointLabel );
+ String aSep = mxLabelProps.is() ? mxLabelProps->maSeparator : String( sal_Unicode( '\n' ) );
+ if( aSep.Len() == 0 )
+ aSep = CREATE_STRING( "; " );
+ rPropSet.SetStringProperty( EXC_CHPROP_LABELSEPARATOR, aSep );
// text properties of attached label
if( bShowAny )
{
ConvertFont( rPropSet );
+ ConvertRotation( rPropSet, false );
// label placement
using namespace ::com::sun::star::chart::DataLabelPlacement;
sal_Int32 nPlacement = rTypeInfo.mnDefaultLabelPos;
@@ -1014,13 +1036,26 @@ Reference< XTitle > XclImpChText::CreateTitle() const
// more title formatting properties
ScfPropertySet aTitleProp( xTitle );
ConvertFrame( aTitleProp );
- ConvertRotationBase( GetChRoot(), aTitleProp );
+ ConvertRotation( aTitleProp, true );
}
}
}
return xTitle;
}
+void XclImpChText::ReadChFrLabelProps( XclImpStream& rStrm )
+{
+ if( GetBiff() == EXC_BIFF8 )
+ {
+ mxLabelProps.reset( new XclChFrLabelProps );
+ sal_uInt16 nSepLen;
+ rStrm.Ignore( 12 );
+ rStrm >> mxLabelProps->mnFlags >> nSepLen;
+ if( nSepLen > 0 )
+ mxLabelProps->maSeparator = rStrm.ReadUniString( nSepLen );
+ }
+}
+
namespace {
void lclUpdateText( XclImpChTextRef& rxText, XclImpChTextRef xDefText )
@@ -1745,6 +1780,14 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const
CreateCategSequence( EXC_CHPROP_ROLE_XVALUES );
if( xXValueSeq.is() )
aLabeledSeqVec.push_back( xXValueSeq );
+ // add size values of bubble charts
+ if( rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES )
+ {
+ Reference< XLabeledDataSequence > xSizeValueSeq =
+ lclCreateLabeledDataSequence( mxBubbleLink, EXC_CHPROP_ROLE_SIZEVALUES, mxTitleLink.get() );
+ if( xSizeValueSeq.is() )
+ aLabeledSeqVec.push_back( xSizeValueSeq );
+ }
}
// attach labeled data sequences to series
if( !aLabeledSeqVec.empty() )
@@ -2136,7 +2179,9 @@ void XclImpChChart3d::Convert( ScfPropertySet& rPropSet, bool b3dWallChart ) con
nPerspective = limit_cast< sal_Int32, sal_Int32 >( maData.mnEyeDist, 0, 100 );
// right-angled axes
bRightAngled = !::get_flag( maData.mnFlags, EXC_CHCHART3D_REAL3D );
- eProjMode = bRightAngled ? cssd::ProjectionMode_PARALLEL : cssd::ProjectionMode_PERSPECTIVE;
+ // projection mode (parallel axes, if right-angled, #i90360# or if perspective is at 0%)
+ bool bParallel = bRightAngled || (nPerspective == 0);
+ eProjMode = bParallel ? cssd::ProjectionMode_PARALLEL : cssd::ProjectionMode_PERSPECTIVE;
// ambient color (Gray 20%)
aAmbientColor.SetColor( RGB_COLORDATA( 204, 204, 204 ) );
// light color (Gray 60%)
@@ -2589,24 +2634,38 @@ void XclImpChLabelRange::ReadChLabelRange( XclImpStream& rStrm )
void XclImpChLabelRange::Convert( ScfPropertySet& rPropSet, ScaleData& rScaleData, bool bMirrorOrient ) const
{
- namespace cssc = ::com::sun::star::chart2;
-
- // do not overlap text
- rPropSet.SetBoolProperty( EXC_CHPROP_TEXTOVERLAP, false );
- // do not break text into several lines
- rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, false );
-
- // origin (max-cross not supported, fall back to auto-cross)
- bool bMaxCross = ::get_flag( maData.mnFlags, EXC_CHLABELRANGE_MAXCROSS );
- lclSetValueOrClearAny( rScaleData.Origin, static_cast< double >( maData.mnCross ), bMaxCross );
+ // do not overlap text unless all labels are visible
+ rPropSet.SetBoolProperty( EXC_CHPROP_TEXTOVERLAP, maData.mnLabelFreq == 1 );
+ // do not break text into several lines unless all labels are visible
+ rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, maData.mnLabelFreq == 1 );
+ // do not stagger labels in two lines
+ namespace cssc = ::com::sun::star::chart;
+ rPropSet.SetProperty( EXC_CHPROP_ARRANGEORDER, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE );
// reverse order
+ namespace cssc2 = ::com::sun::star::chart2;
bool bReverse = ::get_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient;
- rScaleData.Orientation = bReverse ? cssc::AxisOrientation_REVERSE : cssc::AxisOrientation_MATHEMATICAL;
+ rScaleData.Orientation = bReverse ? cssc2::AxisOrientation_REVERSE : cssc2::AxisOrientation_MATHEMATICAL;
//! TODO #i58731# show n-th category
}
+void XclImpChLabelRange::ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3dChart ) const
+{
+ /* Crossing mode (max-cross flag overrides other crossing settings). Excel
+ does not move the Y axis in 3D charts, regardless of actual settings.
+ But: the Y axis has to be moved to "end", if the X axis is mirrored,
+ to keep it at the left end of the chart. */
+ bool bMaxCross = ::get_flag( maData.mnFlags, b3dChart ? EXC_CHLABELRANGE_REVERSE : EXC_CHLABELRANGE_MAXCROSS );
+ namespace cssc = ::com::sun::star::chart;
+ cssc::ChartAxisPosition eAxisPos = bMaxCross ? cssc::ChartAxisPosition_END : cssc::ChartAxisPosition_VALUE;
+ rPropSet.SetProperty( EXC_CHPROP_CROSSOVERPOSITION, eAxisPos );
+
+ // crossing position
+ double fCrossingPos = b3dChart ? 1.0 : maData.mnCross;
+ rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos );
+}
+
// ----------------------------------------------------------------------------
XclImpChValueRange::XclImpChValueRange( const XclImpChRoot& rRoot ) :
@@ -2629,22 +2688,11 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co
// scaling algorithm
bool bLogScale = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE );
OUString aScalingService = bLogScale ? SERVICE_CHART2_LOGSCALING : SERVICE_CHART2_LINEARSCALING;
- Reference< XScaling > xScaling( ScfApiHelper::CreateInstance( aScalingService ), UNO_QUERY );
- Reference< XScaling > xLogScaling;
- if( xScaling.is() )
- {
- rScaleData.Scaling = xScaling;
- if( bLogScale )
- xLogScaling = xScaling->getInverseScaling();
- }
+ rScaleData.Scaling.set( ScfApiHelper::CreateInstance( aScalingService ), UNO_QUERY );
// min/max
- lclSetScaledValueOrClearAny( rScaleData.Minimum, maData.mfMin, xLogScaling, ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMIN ) );
- lclSetScaledValueOrClearAny( rScaleData.Maximum, maData.mfMax, xLogScaling, ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMAX ) );
-
- // origin (max-cross overrides crossing settings, fall back to auto-cross)
- const sal_uInt16 nAutoCrossFlags = EXC_CHVALUERANGE_AUTOCROSS | EXC_CHVALUERANGE_MAXCROSS;
- lclSetScaledValueOrClearAny( rScaleData.Origin, maData.mfCross, xLogScaling, ::get_flag( maData.mnFlags, nAutoCrossFlags ) );
+ lclSetExpValueOrClearAny( rScaleData.Minimum, maData.mfMin, bLogScale, ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMIN ) );
+ lclSetExpValueOrClearAny( rScaleData.Maximum, maData.mfMax, bLogScale, ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMAX ) );
// increment
bool bAutoMajor = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMAJOR );
@@ -2655,19 +2703,44 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co
// minor increment
Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements;
rSubIncrementSeq.realloc( 1 );
- sal_Int32 nCount = 0;
- if( !bAutoMajor && !bAutoMinor && (0.0 < maData.mfMinorStep) && (maData.mfMinorStep <= maData.mfMajorStep) )
+ Any& rIntervalCount = rSubIncrementSeq[ 0 ].IntervalCount;
+ if( bLogScale )
+ {
+ rIntervalCount <<= sal_Int32( 10 );
+ }
+ else
{
- double fCount = maData.mfMajorStep / maData.mfMinorStep + 0.5;
- if( fCount < 1001.0 )
- nCount = static_cast< sal_Int32 >( fCount );
+ sal_Int32 nCount = 0;
+ if( !bAutoMajor && !bAutoMinor && (0.0 < maData.mfMinorStep) && (maData.mfMinorStep <= maData.mfMajorStep) )
+ {
+ double fCount = maData.mfMajorStep / maData.mfMinorStep + 0.5;
+ if( fCount < 1001.0 )
+ nCount = static_cast< sal_Int32 >( fCount );
+ }
+ lclSetValueOrClearAny( rIntervalCount, nCount, nCount == 0 );
}
- lclSetValueOrClearAny( rSubIncrementSeq[ 0 ].IntervalCount, nCount, nCount == 0 );
// reverse order
- namespace cssc = ::com::sun::star::chart2;
+ namespace cssc2 = ::com::sun::star::chart2;
bool bReverse = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_REVERSE ) != bMirrorOrient;
- rScaleData.Orientation = bReverse ? cssc::AxisOrientation_REVERSE : cssc::AxisOrientation_MATHEMATICAL;
+ rScaleData.Orientation = bReverse ? cssc2::AxisOrientation_REVERSE : cssc2::AxisOrientation_MATHEMATICAL;
+}
+
+void XclImpChValueRange::ConvertAxisPosition( ScfPropertySet& rPropSet ) const
+{
+ bool bMaxCross = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_MAXCROSS );
+ bool bAutoCross = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS );
+ bool bLogScale = ::get_flag( maData.mnFlags, EXC_CHVALUERANGE_LOGSCALE );
+
+ // crossing mode (max-cross flag overrides other crossing settings)
+ namespace cssc = ::com::sun::star::chart;
+ cssc::ChartAxisPosition eAxisPos = bMaxCross ? cssc::ChartAxisPosition_END : cssc::ChartAxisPosition_VALUE;
+ rPropSet.SetProperty( EXC_CHPROP_CROSSOVERPOSITION, eAxisPos );
+
+ // crossing position
+ double fCrossingPos = bAutoCross ? 0.0 : maData.mfCross;
+ if( bLogScale ) fCrossingPos = pow( 10.0, fCrossingPos );
+ rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos );
}
// ----------------------------------------------------------------------------
@@ -2683,6 +2756,18 @@ sal_Int32 lclGetApiTickmarks( sal_uInt8 nXclTickPos )
return nApiTickmarks;
}
+::com::sun::star::chart::ChartAxisLabelPosition lclGetApiLabelPosition( sal_Int8 nXclLabelPos )
+{
+ using namespace ::com::sun::star::chart;
+ switch( nXclLabelPos )
+ {
+ case EXC_CHTICK_LOW: return ChartAxisLabelPosition_OUTSIDE_START;
+ case EXC_CHTICK_HIGH: return ChartAxisLabelPosition_OUTSIDE_END;
+ case EXC_CHTICK_NEXT: return ChartAxisLabelPosition_NEAR_AXIS;
+ }
+ return ChartAxisLabelPosition_NEAR_AXIS;
+}
+
} // namespace
XclImpChTick::XclImpChTick( const XclImpChRoot& rRoot ) :
@@ -2729,6 +2814,8 @@ void XclImpChTick::Convert( ScfPropertySet& rPropSet ) const
{
rPropSet.SetProperty( EXC_CHPROP_MAJORTICKS, lclGetApiTickmarks( maData.mnMajor ) );
rPropSet.SetProperty( EXC_CHPROP_MINORTICKS, lclGetApiTickmarks( maData.mnMinor ) );
+ rPropSet.SetProperty( EXC_CHPROP_LABELPOSITION, lclGetApiLabelPosition( maData.mnLabelPos ) );
+ rPropSet.SetProperty( EXC_CHPROP_MARKPOSITION, ::com::sun::star::chart::ChartAxisMarkPosition_AT_AXIS );
}
// ----------------------------------------------------------------------------
@@ -2817,8 +2904,10 @@ sal_uInt16 XclImpChAxis::GetRotation() const
return mxTick.is() ? mxTick->GetRotation() : EXC_CHART_AUTOROTATION;
}
-Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup, bool bPrimary ) const
+Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup, const XclImpChAxis* pCrossingAxis ) const
{
+ namespace cssc2 = ::com::sun::star::chart2;
+
// create the axis object (always)
Reference< XAxis > xAxis( ScfApiHelper::CreateInstance( SERVICE_CHART2_AXIS ), UNO_QUERY );
if( xAxis.is() )
@@ -2848,7 +2937,7 @@ Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup
else if( const XclImpChText* pDefText = GetChartData().GetDefaultText( EXC_CHTEXTTYPE_AXISLABEL ).get() )
pDefText->ConvertFont( aAxisProp );
// label text rotation
- ConvertRotationBase( GetChRoot(), aAxisProp );
+ ConvertRotationBase( GetChRoot(), aAxisProp, true );
// number format
sal_uInt32 nScNumFmt = GetNumFmtBuffer().GetScFormat( mnNumFmtIdx );
if( nScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND )
@@ -2860,42 +2949,46 @@ Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup
const XclChExtTypeInfo& rTypeInfo = rTypeGroup.GetTypeInfo();
ScaleData aScaleData = xAxis->getScaleData();
// set axis type
- namespace ApiAxisType = ::com::sun::star::chart2::AxisType;
switch( GetAxisType() )
{
case EXC_CHAXIS_X:
if( rTypeInfo.mbCategoryAxis )
{
- aScaleData.AxisType = ApiAxisType::CATEGORY;
+ aScaleData.AxisType = cssc2::AxisType::CATEGORY;
aScaleData.Categories = rTypeGroup.CreateCategSequence();
}
else
- aScaleData.AxisType = ApiAxisType::REALNUMBER;
+ aScaleData.AxisType = cssc2::AxisType::REALNUMBER;
break;
case EXC_CHAXIS_Y:
aScaleData.AxisType = rTypeGroup.IsPercent() ?
- ApiAxisType::PERCENT : ApiAxisType::REALNUMBER;
+ cssc2::AxisType::PERCENT : cssc2::AxisType::REALNUMBER;
break;
case EXC_CHAXIS_Z:
- aScaleData.AxisType = ApiAxisType::SERIES;
+ aScaleData.AxisType = cssc2::AxisType::SERIES;
break;
}
// axis scaling settings, dependent on axis type
switch( aScaleData.AxisType )
{
- case ApiAxisType::CATEGORY:
- case ApiAxisType::SERIES:
+ case cssc2::AxisType::CATEGORY:
+ case cssc2::AxisType::SERIES:
// #i71684# radar charts have reversed rotation direction
mxLabelRange->Convert( aAxisProp, aScaleData, rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR );
break;
- case ApiAxisType::REALNUMBER:
- case ApiAxisType::PERCENT:
+ case cssc2::AxisType::REALNUMBER:
+ case cssc2::AxisType::PERCENT:
// #i85167# pie/donut charts have reversed rotation direction (at Y axis!)
mxValueRange->Convert( aScaleData, rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE );
break;
default:
DBG_ERRORFILE( "XclImpChAxis::CreateAxis - unknown axis type" );
}
+
+ /* Do not set a value to the Origin member anymore (will be done via
+ new axis properties 'CrossoverPosition' and 'CrossoverValue'). */
+ aScaleData.Origin.clear();
+
// write back
xAxis->setScaleData( aScaleData );
@@ -2916,9 +3009,10 @@ Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup
mxMinorGrid->Convert( GetChRoot(), aSubGridProp, EXC_CHOBJTYPE_GRIDLINE );
}
- // axis position ------------------------------------------------------
+ // position of crossing axis ------------------------------------------
- aAxisProp.SetProperty( CREATE_OUSTRING( "CrossoverPosition" ), bPrimary ? ::com::sun::star::chart::ChartAxisPosition_START : ::com::sun::star::chart::ChartAxisPosition_END );
+ if( pCrossingAxis )
+ pCrossingAxis->ConvertAxisPosition( aAxisProp, rTypeGroup );
}
return xAxis;
}
@@ -2929,6 +3023,14 @@ void XclImpChAxis::ConvertWall( ScfPropertySet& rPropSet ) const
mxWallFrame->Convert( rPropSet );
}
+void XclImpChAxis::ConvertAxisPosition( ScfPropertySet& rPropSet, const XclImpChTypeGroup& rTypeGroup ) const
+{
+ if( ((GetAxisType() == EXC_CHAXIS_X) && rTypeGroup.GetTypeInfo().mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z) )
+ mxLabelRange->ConvertAxisPosition( rPropSet, rTypeGroup.Is3dChart() );
+ else
+ mxValueRange->ConvertAxisPosition( rPropSet );
+}
+
void XclImpChAxis::ReadChAxisLine( XclImpStream& rStrm )
{
XclImpChLineFormatRef* pxLineFmt = 0;
@@ -3036,13 +3138,13 @@ void XclImpChAxesSet::Finalize()
// invalid chart type groups are deleted now, check again with IsValidAxesSet()
if( IsValidAxesSet() )
{
- // create dummy X axis for charts supporting category ranges
- XclImpChTypeGroupRef xTypeGroup = GetFirstTypeGroup();
- if( !mxXAxis && xTypeGroup.is() && xTypeGroup->GetTypeInfo().mbCategoryAxis )
+ // always create missing axis objects
+ if( !mxXAxis )
mxXAxis.reset( new XclImpChAxis( GetChRoot(), EXC_CHAXIS_X ) );
- // create dummy Y axis for pie/doughnut charts
- if( !mxYAxis && xTypeGroup.is() && (xTypeGroup->GetTypeInfo().meTypeCateg == EXC_CHTYPECATEG_PIE) )
+ if( !mxYAxis )
mxYAxis.reset( new XclImpChAxis( GetChRoot(), EXC_CHAXIS_Y ) );
+ if( !mxZAxis && GetFirstTypeGroup()->Is3dDeepChart() )
+ mxZAxis.reset( new XclImpChAxis( GetChRoot(), EXC_CHAXIS_Z ) );
// finalize axes
if( mxXAxis.is() ) mxXAxis->Finalize();
@@ -3108,9 +3210,9 @@ void XclImpChAxesSet::Convert( Reference< XDiagram > xDiagram ) const
}
// create the axes with grids and axis titles and insert them into the diagram
- ConvertAxis( mxXAxis, mxXAxisTitle, xCoordSystem );
- ConvertAxis( mxYAxis, mxYAxisTitle, xCoordSystem );
- ConvertAxis( mxZAxis, mxZAxisTitle, xCoordSystem );
+ ConvertAxis( mxXAxis, mxXAxisTitle, xCoordSystem, mxYAxis.get() );
+ ConvertAxis( mxYAxis, mxYAxisTitle, xCoordSystem, mxXAxis.get() );
+ ConvertAxis( mxZAxis, mxZAxisTitle, xCoordSystem, 0 );
}
}
}
@@ -3212,12 +3314,12 @@ Reference< XCoordinateSystem > XclImpChAxesSet::CreateCoordSystem( Reference< XD
void XclImpChAxesSet::ConvertAxis(
XclImpChAxisRef xChAxis, XclImpChTextRef xChAxisTitle,
- Reference< XCoordinateSystem > xCoordSystem ) const
+ Reference< XCoordinateSystem > xCoordSystem, const XclImpChAxis* pCrossingAxis ) const
{
if( xChAxis.is() )
{
// create and attach the axis object
- Reference< XAxis > xAxis = CreateAxis( *xChAxis );
+ Reference< XAxis > xAxis = CreateAxis( *xChAxis, pCrossingAxis );
if( xAxis.is() )
{
// create and attach the axis title
@@ -3243,11 +3345,11 @@ void XclImpChAxesSet::ConvertAxis(
}
}
-Reference< XAxis > XclImpChAxesSet::CreateAxis( const XclImpChAxis& rChAxis ) const
+Reference< XAxis > XclImpChAxesSet::CreateAxis( const XclImpChAxis& rChAxis, const XclImpChAxis* pCrossingAxis ) const
{
Reference< XAxis > xAxis;
if( const XclImpChTypeGroup* pTypeGroup = GetFirstTypeGroup().get() )
- xAxis = rChAxis.CreateAxis( *pTypeGroup, GetAxesSetId() == EXC_CHAXESSET_PRIMARY );
+ xAxis = rChAxis.CreateAxis( *pTypeGroup, pCrossingAxis );
return xAxis;
}
@@ -3307,7 +3409,7 @@ void XclImpChChart::ReadSubRecord( XclImpStream& rStrm )
ReadChSeries( rStrm );
break;
case EXC_ID_CHPROPERTIES:
- rStrm >> maProps.mnFlags >> maProps.mnEmptyMode;
+ ReadChProperties( rStrm );
break;
case EXC_ID_CHDEFAULTTEXT:
ReadChDefaultText( rStrm );
@@ -3400,7 +3502,7 @@ void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, ScfProgressB
/* Create the diagram object and attach it to the chart document. Currently,
one diagram is used to carry all coordinate systems and data series. */
- Reference< XDiagram > xDiagram( ScfApiHelper::CreateInstance( SERVICE_CHART2_DIAGRAM ), UNO_QUERY );
+ Reference< XDiagram > xDiagram = CreateDiagram();
xChartDoc->setFirstDiagram( xDiagram );
// coordinate systems and chart types, convert axis settings
@@ -3411,6 +3513,15 @@ void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, ScfProgressB
if( xDiagram.is() && mxLegend.is() )
xDiagram->setLegend( mxLegend->CreateLegend() );
+ // set the IncludeHiddenCells property via the old API as only this ensures that the data provider and al created sequences get this flag correctly
+ Reference< com::sun::star::chart::XChartDocument > xStandardApiChartDoc( xChartDoc, UNO_QUERY );
+ if( xStandardApiChartDoc.is() )
+ {
+ ScfPropertySet aDiagramProp( xStandardApiChartDoc->getDiagram() );
+ bool bShowVisCells = (maProps.mnFlags & EXC_CHPROPS_SHOWVISIBLEONLY);
+ aDiagramProp.SetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS, !bShowVisCells );
+ }
+
// unlock the model
FinishConversion( rProgress );
}
@@ -3423,6 +3534,11 @@ void XclImpChChart::ReadChSeries( XclImpStream& rStrm )
maSeries.push_back( xSeries );
}
+void XclImpChChart::ReadChProperties( XclImpStream& rStrm )
+{
+ rStrm >> maProps.mnFlags >> maProps.mnEmptyMode;
+}
+
void XclImpChChart::ReadChAxesSet( XclImpStream& rStrm )
{
XclImpChAxesSetRef xAxesSet( new XclImpChAxesSet( GetChRoot(), EXC_CHAXESSET_NONE ) );
@@ -3539,6 +3655,28 @@ void XclImpChChart::FinalizeTitle()
lclFinalizeTitle( mxTitle, GetDefaultText( EXC_CHTEXTTYPE_TITLE ) );
}
+Reference< XDiagram > XclImpChChart::CreateDiagram() const
+{
+ // create a diagram object
+ Reference< XDiagram > xDiagram( ScfApiHelper::CreateInstance( SERVICE_CHART2_DIAGRAM ), UNO_QUERY );
+
+ // convert global chart settings
+ ScfPropertySet aDiaProp( xDiagram );
+
+ // treatment of missing values
+ using namespace ::com::sun::star::chart::MissingValueTreatment;
+ sal_Int32 nMissingValues = LEAVE_GAP;
+ switch( maProps.mnEmptyMode )
+ {
+ case EXC_CHPROPS_EMPTY_SKIP: nMissingValues = LEAVE_GAP; break;
+ case EXC_CHPROPS_EMPTY_ZERO: nMissingValues = USE_ZERO; break;
+ case EXC_CHPROPS_EMPTY_INTERPOLATE: nMissingValues = CONTINUE; break;
+ }
+ aDiaProp.SetProperty( EXC_CHPROP_MISSINGVALUETREATMENT, nMissingValues );
+
+ return xDiagram;
+}
+
// ----------------------------------------------------------------------------
XclImpChart::XclImpChart( const XclImpRoot& rRoot, bool bOwnTab ) :
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index d4c5ba5a1bcf..24c1999b581b 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -41,6 +41,7 @@
#include "scitems.hxx"
#include <svx/eeitem.hxx>
#include <svtools/intitem.hxx>
+#include <svtools/stritem.hxx>
#include <svx/flditem.hxx>
#include <svx/fhgtitem.hxx>
#include <svx/wghtitem.hxx>
@@ -67,6 +68,12 @@
#include "xiname.hxx"
#include "excform.hxx"
+#include "tabprotection.hxx"
+
+#include <memory>
+
+using ::com::sun::star::uno::Sequence;
+using ::std::auto_ptr;
// Shared string table ========================================================
@@ -1089,12 +1096,191 @@ ErrCode XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm )
case EXC_BIFF8: xDecr = lclReadFilepass8( rStrm ); break;
default: DBG_ERROR_BIFF();
};
+
+ if (!xDecr.is())
+ return EXC_ENCR_ERROR_UNSUPP_CRYPT;
+
// set decrypter at import stream
rStrm.SetDecrypter( xDecr );
- // remember encryption for export
- rStrm.GetRoot().GetExtDocOptions().GetDocSettings().mbEncrypted = true;
- return xDecr.is() ? xDecr->GetError() : EXC_ENCR_ERROR_UNSUPP_CRYPT;
+ // Store the document password for export.
+ SfxItemSet* pSet = rStrm.GetRoot().GetDocShell()->GetMedium()->GetItemSet();
+ if (pSet)
+ {
+ String aPass = xDecr->GetPassword();
+ pSet->Put( SfxStringItem(SID_PASSWORD, aPass) );
+ }
+
+ return xDecr->GetError();
+}
+
+// Document protection ========================================================
+
+XclImpDocProtectBuffer::XclImpDocProtectBuffer( const XclImpRoot& rRoot ) :
+ XclImpRoot( rRoot ),
+ mnPassHash(0x0000),
+ mbDocProtect(false),
+ mbWinProtect(false)
+{
+}
+
+void XclImpDocProtectBuffer::ReadDocProtect( XclImpStream& rStrm )
+{
+ mbDocProtect = rStrm.ReaduInt16() ? true : false;
+}
+
+void XclImpDocProtectBuffer::ReadWinProtect( XclImpStream& rStrm )
+{
+ mbWinProtect = rStrm.ReaduInt16() ? true : false;
+}
+
+void XclImpDocProtectBuffer::ReadPasswordHash( XclImpStream& rStrm )
+{
+ rStrm.EnableDecryption();
+ mnPassHash = rStrm.ReaduInt16();
+}
+
+void XclImpDocProtectBuffer::Apply() const
+{
+ if (!mbDocProtect && !mbWinProtect)
+ // Excel requires either the structure or windows protection is set.
+ // If neither is set then the document is not protected at all.
+ return;
+
+ auto_ptr<ScDocProtection> pProtect(new ScDocProtection);
+ pProtect->setProtected(true);
+
+#if ENABLE_SHEET_PROTECTION
+ if (mnPassHash)
+ {
+ // 16-bit password pash.
+ Sequence<sal_Int8> aPass(2);
+ aPass[0] = (mnPassHash >> 8) & 0xFF;
+ aPass[1] = mnPassHash & 0xFF;
+ pProtect->setPasswordHash(aPass, PASSHASH_XL);
+ }
+#endif
+
+ // document protection options
+ pProtect->setOption(ScDocProtection::STRUCTURE, mbDocProtect);
+ pProtect->setOption(ScDocProtection::WINDOWS, mbWinProtect);
+
+ GetDoc().SetDocProtection(pProtect.get());
+}
+
+// Sheet Protection ===========================================================
+
+XclImpSheetProtectBuffer::Sheet::Sheet() :
+ mbProtected(false),
+ mnPasswordHash(0x0000),
+ mnOptions(0x4400)
+{
+}
+
+// ----------------------------------------------------------------------------
+
+XclImpSheetProtectBuffer::Sheet::Sheet(const Sheet& r) :
+ mbProtected(r.mbProtected),
+ mnPasswordHash(r.mnPasswordHash),
+ mnOptions(r.mnOptions)
+{
+}
+
+XclImpSheetProtectBuffer::XclImpSheetProtectBuffer( const XclImpRoot& rRoot ) :
+ XclImpRoot( rRoot )
+{
+}
+
+void XclImpSheetProtectBuffer::ReadProtect( XclImpStream& rStrm, SCTAB nTab )
+{
+ if ( rStrm.ReaduInt16() )
+ {
+ Sheet* pSheet = GetSheetItem(nTab);
+ if (pSheet)
+ pSheet->mbProtected = true;
+ }
+}
+
+void XclImpSheetProtectBuffer::ReadOptions( XclImpStream& rStrm, SCTAB nTab )
+{
+ rStrm.Ignore(19);
+ sal_uInt16 nOptions;
+ rStrm >> nOptions;
+
+ Sheet* pSheet = GetSheetItem(nTab);
+ if (pSheet)
+ pSheet->mnOptions = nOptions;
+}
+
+void XclImpSheetProtectBuffer::ReadPasswordHash( XclImpStream& rStrm, SCTAB nTab )
+{
+ sal_uInt16 nHash;
+ rStrm >> nHash;
+ Sheet* pSheet = GetSheetItem(nTab);
+ if (pSheet)
+ pSheet->mnPasswordHash = nHash;
+}
+
+void XclImpSheetProtectBuffer::Apply() const
+{
+ for (ProtectedSheetMap::const_iterator itr = maProtectedSheets.begin(), itrEnd = maProtectedSheets.end();
+ itr != itrEnd; ++itr)
+ {
+ if (!itr->second.mbProtected)
+ // This sheet is (for whatever reason) not protected.
+ continue;
+
+ auto_ptr<ScTableProtection> pProtect(new ScTableProtection);
+ pProtect->setProtected(true);
+
+#if ENABLE_SHEET_PROTECTION
+ // 16-bit hash password
+ const sal_uInt16 nHash = itr->second.mnPasswordHash;
+ if (nHash)
+ {
+ Sequence<sal_Int8> aPass(2);
+ aPass[0] = (nHash >> 8) & 0xFF;
+ aPass[1] = nHash & 0xFF;
+ pProtect->setPasswordHash(aPass, PASSHASH_XL);
+ }
+#endif
+
+ // sheet protection options
+ const sal_uInt16 nOptions = itr->second.mnOptions;
+ pProtect->setOption( ScTableProtection::OBJECTS, (nOptions & 0x0001) );
+ pProtect->setOption( ScTableProtection::SCENARIOS, (nOptions & 0x0002) );
+ pProtect->setOption( ScTableProtection::FORMAT_CELLS, (nOptions & 0x0004) );
+ pProtect->setOption( ScTableProtection::FORMAT_COLUMNS, (nOptions & 0x0008) );
+ pProtect->setOption( ScTableProtection::FORMAT_ROWS, (nOptions & 0x0010) );
+ pProtect->setOption( ScTableProtection::INSERT_COLUMNS, (nOptions & 0x0020) );
+ pProtect->setOption( ScTableProtection::INSERT_ROWS, (nOptions & 0x0040) );
+ pProtect->setOption( ScTableProtection::INSERT_HYPERLINKS, (nOptions & 0x0080) );
+ pProtect->setOption( ScTableProtection::DELETE_COLUMNS, (nOptions & 0x0100) );
+ pProtect->setOption( ScTableProtection::DELETE_ROWS, (nOptions & 0x0200) );
+ pProtect->setOption( ScTableProtection::SELECT_LOCKED_CELLS, (nOptions & 0x0400) );
+ pProtect->setOption( ScTableProtection::SORT, (nOptions & 0x0800) );
+ pProtect->setOption( ScTableProtection::AUTOFILTER, (nOptions & 0x1000) );
+ pProtect->setOption( ScTableProtection::PIVOT_TABLES, (nOptions & 0x2000) );
+ pProtect->setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, (nOptions & 0x4000) );
+
+ // all done. now commit.
+ GetDoc().SetTabProtection(itr->first, pProtect.get());
+ }
+}
+
+XclImpSheetProtectBuffer::Sheet* XclImpSheetProtectBuffer::GetSheetItem( SCTAB nTab )
+{
+ ProtectedSheetMap::iterator itr = maProtectedSheets.find(nTab);
+ if (itr == maProtectedSheets.end())
+ {
+ // new sheet
+ if ( !maProtectedSheets.insert( ProtectedSheetMap::value_type(nTab, Sheet()) ).second )
+ return NULL;
+
+ itr = maProtectedSheets.find(nTab);
+ }
+
+ return &itr->second;
}
// ============================================================================
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 0e1b251f4f6a..98e8719414df 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -1644,23 +1644,19 @@ void XclImpNoteObj::SetNoteData( const ScAddress& rScPos, sal_uInt16 nNoteFlags
void XclImpNoteObj::DoProcessSdrObj( SdrObject& rSdrObj ) const
{
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( &rSdrObj );
- if( pTextObj && maScPos.IsValid() )
+ // create formatted text
+ XclImpTextObj::DoProcessSdrObj( rSdrObj );
+ OutlinerParaObject* pOutlinerObj = rSdrObj.GetOutlinerParaObject();
+ if( maScPos.IsValid() && pOutlinerObj )
{
- if( ScPostIt* pNote = GetDoc().GetOrCreateNote( maScPos ) )
- {
- if( SdrCaptionObj* pCaption = pNote->GetCaption() )
- {
- // create formatted text
- XclImpTextObj::DoProcessSdrObj( *pCaption );
- // set textbox rectangle from imported object
- pCaption->NbcSetLogicRect( pTextObj->GetLogicRect() );
- // copy all items from imported object (resets shadow items)
- pNote->SetCaptionItems( pTextObj->GetMergedItemSet() );
- // move caption to correct layer (visible/hidden)
- pNote->ShowCaption( ::get_flag( mnNoteFlags, EXC_NOTE_VISIBLE ) );
- }
- }
+ // create cell note with all data from drawing object
+ ScNoteUtil::CreateNoteFromObjectData(
+ GetDoc(), maScPos,
+ rSdrObj.GetMergedItemSet().Clone(), // new object on heap expected
+ new OutlinerParaObject( *pOutlinerObj ), // new object on heap expected
+ rSdrObj.GetLogicRect(),
+ ::get_flag( mnNoteFlags, EXC_NOTE_VISIBLE ),
+ false );
}
}
@@ -1702,7 +1698,7 @@ void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) co
aPropSet.SetStringProperty( CREATE_OUSTRING( "Name" ), rDrawObj.GetObjName() );
// control visible and printable?
-// aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() ); // waiting for #i88878#
+ aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() );
aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), rDrawObj.IsPrintable() );
// sheet links
@@ -2989,7 +2985,7 @@ XclImpSimpleDffManager::XclImpSimpleDffManager( const XclImpRoot& rRoot, SvStrea
SvxMSDffManager( rDffStrm, rRoot.GetBasePath(), 0, 0, rRoot.GetDoc().GetDrawLayer(), 1440, COL_DEFAULT, 24, 0, &rRoot.GetTracer().GetBaseTracer() ),
XclImpRoot( rRoot )
{
- SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS | SVXMSDFF_SETTINGS_IMPORT_EXCEL | SVXMSDFF_SETTINGS_IMPORT_IAS );
+ SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS | SVXMSDFF_SETTINGS_IMPORT_EXCEL );
}
XclImpSimpleDffManager::~XclImpSimpleDffManager()
@@ -3904,7 +3900,7 @@ void XclImpObjectManager::ReadNote3( XclImpStream& rStrm )
nTotalLen = 0;
}
}
- ScNoteUtil::CreateNoteFromString( GetDoc(), aScNotePos, aNoteText, false );
+ ScNoteUtil::CreateNoteFromString( GetDoc(), aScNotePos, aNoteText, false, false );
}
}
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 16a3edf46373..2c2426382178 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -263,6 +263,7 @@ void XclImpTabInfo::ReadTabid( XclImpStream& rStrm )
DBG_ASSERT_BIFF( rStrm.GetRoot().GetBiff() == EXC_BIFF8 );
if( rStrm.GetRoot().GetBiff() == EXC_BIFF8 )
{
+ rStrm.EnableDecryption();
sal_Size nReadCount = rStrm.GetRecLeft() / 2;
DBG_ASSERT( nReadCount <= 0xFFFF, "XclImpTabInfo::ReadTabid - record too long" );
maTabIdVec.clear();
diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx
index d5d11196e9a3..55ba4bdc4cb4 100644
--- a/sc/source/filter/excel/xiroot.cxx
+++ b/sc/source/filter/excel/xiroot.cxx
@@ -52,6 +52,7 @@
XclImpRootData::XclImpRootData( XclBiff eBiff, SfxMedium& rMedium,
SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) :
XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, false ),
+ mbPassQueried( false ),
mbHasCodePage( false )
{
}
@@ -86,6 +87,8 @@ XclImpRoot::XclImpRoot( XclImpRootData& rImpRootData ) :
GetOldRoot().pAutoFilterBuffer = new XclImpAutoFilterBuffer;
mrImpData.mxWebQueryBfr.reset( new XclImpWebQueryBuffer( GetRoot() ) );
mrImpData.mxPTableMgr.reset( new XclImpPivotTableManager( GetRoot() ) );
+ mrImpData.mxTabProtect.reset( new XclImpSheetProtectBuffer( GetRoot() ) );
+ mrImpData.mxDocProtect.reset( new XclImpDocProtectBuffer( GetRoot() ) );
}
mrImpData.mxPageSett.reset( new XclImpPageSettings( GetRoot() ) );
@@ -232,6 +235,18 @@ XclImpPivotTableManager& XclImpRoot::GetPivotTableManager() const
return *mrImpData.mxPTableMgr;
}
+XclImpSheetProtectBuffer& XclImpRoot::GetSheetProtectBuffer() const
+{
+ DBG_ASSERT( mrImpData.mxTabProtect.is(), "XclImpRoot::GetSheetProtectBuffer - invalid call, wrong BIFF" );
+ return *mrImpData.mxTabProtect;
+}
+
+XclImpDocProtectBuffer& XclImpRoot::GetDocProtectBuffer() const
+{
+ DBG_ASSERT( mrImpData.mxDocProtect.is(), "XclImpRoot::GetDocProtectBuffer - invalid call, wrong BIFF" );
+ return *mrImpData.mxDocProtect;
+}
+
XclImpPageSettings& XclImpRoot::GetPageSettings() const
{
return *mrImpData.mxPageSett;
@@ -255,5 +270,16 @@ String XclImpRoot::GetScAddInName( const String& rXclName ) const
return rXclName;
}
+const String& XclImpRoot::QueryPassword() const
+{
+ if( !mrImpData.mbPassQueried )
+ {
+ mrImpData.maPassw = ScfApiHelper::QueryPasswordForMedium( GetMedium() );
+ // set to true, even if dialog has been cancelled (never ask twice)
+ mrImpData.mbPassQueried = true;
+ }
+ return mrImpData.maPassw;
+}
+
// ============================================================================
diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index b7f0d3841645..e7780c065118 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -36,6 +36,8 @@
#include "xlstring.hxx"
#include "xiroot.hxx"
+#include <vector>
+
// ============================================================================
// Decryption
// ============================================================================
@@ -97,11 +99,21 @@ sal_uInt16 XclImpDecrypter::Read( SvStream& rStrm, void* pData, sal_uInt16 nByte
return nRet;
}
+const String XclImpDecrypter::GetPassword() const
+{
+ return maPass;
+}
+
void XclImpDecrypter::SetHasValidPassword( bool bValid )
{
mnError = bValid ? ERRCODE_NONE : EXC_ENCR_ERROR_WRONG_PASS;
}
+void XclImpDecrypter::SetPassword( const String& rPass )
+{
+ maPass = rPass;
+}
+
// ----------------------------------------------------------------------------
XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpRoot& rRoot, sal_uInt16 nKey, sal_uInt16 nHash )
@@ -157,6 +169,9 @@ void XclImpBiff5Decrypter::Init( const ByteString& rPass, sal_uInt16 nKey, sal_u
// init codec
maCodec.InitKey( mpnPassw );
bValid = maCodec.VerifyKey( nKey, nHash );
+
+ String aUniPass( rPass, RTL_TEXTENCODING_MS_1252 );
+ SetPassword( aUniPass );
}
SetHasValidPassword( bValid );
@@ -255,6 +270,8 @@ void XclImpBiff8Decrypter::Init(
// init codec
maCodec.InitKey( mpnPassw, mpnDocId );
bValid = maCodec.VerifyKey( pnSaltData, pnSaltHash );
+
+ SetPassword(rPass);
}
SetHasValidPassword( bValid );
diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx
index 76253fcb1f2f..dfe74405fbf6 100644
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -94,6 +94,16 @@ bool operator<( const XclChDataPointPos& rL, const XclChDataPointPos& rR )
((rL.mnSeriesIdx == rR.mnSeriesIdx) && (rL.mnPointIdx < rR.mnPointIdx));
}
+// ----------------------------------------------------------------------------
+
+XclChFrBlock::XclChFrBlock( sal_uInt16 nType ) :
+ mnType( nType ),
+ mnContext( 0 ),
+ mnValue1( 0 ),
+ mnValue2( 0 )
+{
+}
+
// Frame formatting ===========================================================
XclChFramePos::XclChFramePos() :
@@ -169,6 +179,13 @@ XclChObjectLink::XclChObjectLink() :
// ----------------------------------------------------------------------------
+XclChFrLabelProps::XclChFrLabelProps() :
+ mnFlags( 0 )
+{
+}
+
+// ----------------------------------------------------------------------------
+
XclChText::XclChText() :
maTextColor( COL_BLACK ),
mnHAlign( EXC_CHTEXT_ALIGN_CENTER ),
@@ -494,25 +511,26 @@ const sal_Char SERVICE_CHART2_LINE[] = "com.sun.star.chart2.LineChartType";
const sal_Char SERVICE_CHART2_NET[] = "com.sun.star.chart2.NetChartType";
const sal_Char SERVICE_CHART2_PIE[] = "com.sun.star.chart2.PieChartType";
const sal_Char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartType";
+const sal_Char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType";
const sal_Char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo
namespace csscd = ::com::sun::star::chart::DataLabelPlacement;
static const XclChTypeInfo spTypeInfos[] =
{
- // chart type chart type category record id service varied point color def label combi comb2d 3d polar area2d area3d 1stvis xcateg swap stack revers betw
+ // chart type chart type category record id service varied point color def label pos comb2d 3d polar area2d area3d 1stvis xcateg swap stack revers betw
{ EXC_CHTYPEID_BAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true },
{ EXC_CHTYPEID_HORBAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, false, true, false, true, true, false, true, true, true, false, true },
- { EXC_CHTYPEID_LINE, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_LINE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, true, false, false, true, false, true, false, true, false, true },
+ { EXC_CHTYPEID_LINE, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_LINE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, true, false, false, true, false, true, false, true, false, false },
{ EXC_CHTYPEID_AREA, EXC_CHTYPECATEG_LINE, EXC_ID_CHAREA, SERVICE_CHART2_AREA, EXC_CHVARPOINT_NONE, csscd::CENTER, true, true, false, true, true, false, true, false, true, true, false },
- { EXC_CHTYPEID_STOCK, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_CANDLE, EXC_CHVARPOINT_NONE, csscd::RIGHT, true, false, false, false, false, false, true, false, true, false, true },
+ { EXC_CHTYPEID_STOCK, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_CANDLE, EXC_CHVARPOINT_NONE, csscd::RIGHT, true, false, false, false, false, false, true, false, true, false, false },
{ EXC_CHTYPEID_RADARLINE, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARLINE, SERVICE_CHART2_NET, EXC_CHVARPOINT_SINGLE, csscd::TOP, false, false, true, false, true, false, true, false, false, false, false },
{ EXC_CHTYPEID_RADARAREA, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARAREA, SERVICE_CHART2_NET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, false, false },
{ EXC_CHTYPEID_PIE, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, true, true, false, false, false, false },
{ EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, true, false },
{ EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false },
{ EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false },
- { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false },
+ { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false },
{ EXC_CHTYPEID_SURFACE, EXC_CHTYPECATEG_SURFACE, EXC_ID_CHSURFACE, SERVICE_CHART2_SURFACE, EXC_CHVARPOINT_NONE, csscd::RIGHT, false, true, false, true, true, false, true, false, false, false, false },
{ EXC_CHTYPEID_UNKNOWN, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true }
};
@@ -664,8 +682,6 @@ const sal_Char* const sppcHatchNamesFilled[] = { "FillStyle", "HatchName", "Colo
/** Property names for bitmap area style. */
const sal_Char* const sppcBitmapNames[] = { "FillStyle", "FillBitmapName", "FillBitmapMode", 0 };
-/** Property names for text rotation properties. */
-const sal_Char* const sppcRotationNames[] = { "TextRotation", "StackCharacters", 0 };
/** Property names for legend properties. */
const sal_Char* const sppcLegendNames[] =
{ "Show", "AnchorPosition", "Expansion", "RelativePosition", 0 };
@@ -685,7 +701,6 @@ XclChPropSetHelper::XclChPropSetHelper() :
maHatchHlpCommon( sppcHatchNamesCommon ),
maHatchHlpFilled( sppcHatchNamesFilled ),
maBitmapHlp( sppcBitmapNames ),
- maRotationHlp( sppcRotationNames ),
maLegendHlp( sppcLegendNames )
{
}
@@ -934,13 +949,12 @@ void XclChPropSetHelper::ReadMarkerProperties(
}
}
-sal_uInt16 XclChPropSetHelper::ReadRotationProperties( const ScfPropertySet& rPropSet )
+sal_uInt16 XclChPropSetHelper::ReadRotationProperties( const ScfPropertySet& rPropSet, bool bSupportsStacked )
{
// chart2 handles rotation as double in the range [0,360)
- double fAngle(0);
- bool bStacked;
- maRotationHlp.ReadFromPropertySet( rPropSet );
- maRotationHlp >> fAngle >> bStacked;
+ double fAngle = 0.0;
+ rPropSet.GetProperty( fAngle, EXC_CHPROP_TEXTROTATION );
+ bool bStacked = bSupportsStacked && rPropSet.GetBoolProperty( EXC_CHPROP_STACKCHARACTERS );
return bStacked ? EXC_ROT_STACKED :
XclTools::GetXclRotation( static_cast< sal_Int32 >( fAngle * 100.0 + 0.5 ) );
}
@@ -1183,16 +1197,15 @@ void XclChPropSetHelper::WriteMarkerProperties(
}
void XclChPropSetHelper::WriteRotationProperties(
- ScfPropertySet& rPropSet, sal_uInt16 nRotation )
+ ScfPropertySet& rPropSet, sal_uInt16 nRotation, bool bSupportsStacked )
{
if( nRotation != EXC_CHART_AUTOROTATION )
{
// chart2 handles rotation as double in the range [0,360)
double fAngle = XclTools::GetScRotation( nRotation, 0 ) / 100.0;
- bool bStacked = nRotation == EXC_ROT_STACKED;
- maRotationHlp.InitializeWrite();
- maRotationHlp << fAngle << bStacked;
- maRotationHlp.WriteToPropertySet( rPropSet );
+ rPropSet.SetProperty( EXC_CHPROP_TEXTROTATION, fAngle );
+ if( bSupportsStacked )
+ rPropSet.SetProperty( EXC_CHPROP_STACKCHARACTERS, nRotation == EXC_ROT_STACKED );
}
}
diff --git a/sc/source/filter/excel/xlpage.cxx b/sc/source/filter/excel/xlpage.cxx
index 56ef285228b2..d1bea1addcec 100644
--- a/sc/source/filter/excel/xlpage.cxx
+++ b/sc/source/filter/excel/xlpage.cxx
@@ -44,7 +44,7 @@
struct XclPaperSize
{
- SvxPaper mePaper; /// SVX paper size identifier.
+ Paper mePaper; /// SVX paper size identifier.
long mnWidth; /// Paper width in twips.
long mnHeight; /// Paper height in twips.
};
@@ -54,97 +54,114 @@ struct XclPaperSize
static const XclPaperSize pPaperSizeTable[] =
{
-/* 0*/ { SVX_PAPER_USER, 0, 0 }, // undefined
- { SVX_PAPER_LETTER, IN2TWIPS( 8.5 ), IN2TWIPS( 11 ) }, // Letter
- { SVX_PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 11 ) }, // Letter Small
- { SVX_PAPER_TABLOID, IN2TWIPS( 11 ), IN2TWIPS( 17 ) }, // Tabloid
- { SVX_PAPER_USER, IN2TWIPS( 17 ), IN2TWIPS( 11 ) }, // Ledger
-/* 5*/ { SVX_PAPER_LEGAL, IN2TWIPS( 8.5 ), IN2TWIPS( 14 ) }, // Legal
- { SVX_PAPER_USER, IN2TWIPS( 5.5 ), IN2TWIPS( 8.5 ) }, // Statement
- { SVX_PAPER_USER, IN2TWIPS( 7.25 ), IN2TWIPS( 10.5 ) }, // Executive
- { SVX_PAPER_A3, MM2TWIPS( 297 ), MM2TWIPS( 420 ) }, // A3
- { SVX_PAPER_A4, MM2TWIPS( 210 ), MM2TWIPS( 297 ) }, // A4
-/* 10*/ { SVX_PAPER_USER, MM2TWIPS( 210 ), MM2TWIPS( 297 ) }, // A4 Small
- { SVX_PAPER_A5, MM2TWIPS( 148 ), MM2TWIPS( 210 ) }, // A5
- { SVX_PAPER_B4_JIS, MM2TWIPS( 257 ), MM2TWIPS( 364 ) }, // B4 (JIS)
- { SVX_PAPER_B5_JIS, MM2TWIPS( 182 ), MM2TWIPS( 257 ) }, // B5 (JIS)
- { SVX_PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 13 ) }, // Folio
-/* 15*/ { SVX_PAPER_USER, MM2TWIPS( 215 ), MM2TWIPS( 275 ) }, // Quarto
- { SVX_PAPER_USER, IN2TWIPS( 10 ), IN2TWIPS( 14 ) }, // 10x14
- { SVX_PAPER_USER, IN2TWIPS( 11 ), IN2TWIPS( 17 ) }, // 11x17
- { SVX_PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 11 ) }, // Note
- { SVX_PAPER_COM9, IN2TWIPS( 3.875 ), IN2TWIPS( 8.875 ) }, // Envelope #9
-/* 20*/ { SVX_PAPER_COM10, IN2TWIPS( 4.125 ), IN2TWIPS( 9.5 ) }, // Envelope #10
- { SVX_PAPER_COM11, IN2TWIPS( 4.5 ), IN2TWIPS( 10.375 ) }, // Envelope #11
- { SVX_PAPER_COM12, IN2TWIPS( 4.75 ), IN2TWIPS( 11 ) }, // Envelope #12
- { SVX_PAPER_USER, IN2TWIPS( 5 ), IN2TWIPS( 11.5 ) }, // Envelope #14
- { SVX_PAPER_C, IN2TWIPS( 17 ), IN2TWIPS( 22 ) }, // ANSI-C
-/* 25*/ { SVX_PAPER_D, IN2TWIPS( 22 ), IN2TWIPS( 34 ) }, // ANSI-D
- { SVX_PAPER_E, IN2TWIPS( 34 ), IN2TWIPS( 44 ) }, // ANSI-E
- { SVX_PAPER_DL, MM2TWIPS( 110 ), MM2TWIPS( 220 ) }, // Envelope DL
- { SVX_PAPER_C5, MM2TWIPS( 162 ), MM2TWIPS( 229 ) }, // Envelope C5
- { SVX_PAPER_USER, MM2TWIPS( 324 ), MM2TWIPS( 458 ) }, // Envelope C3
-/* 30*/ { SVX_PAPER_C4, MM2TWIPS( 229 ), MM2TWIPS( 324 ) }, // Envelope C4
- { SVX_PAPER_C6, MM2TWIPS( 114 ), MM2TWIPS( 162 ) }, // Envelope C6
- { SVX_PAPER_C65, MM2TWIPS( 114 ), MM2TWIPS( 229 ) }, // Envelope C65
- { SVX_PAPER_B4, MM2TWIPS( 250 ), MM2TWIPS( 353 ) }, // B4 (ISO)
- { SVX_PAPER_B5, MM2TWIPS( 176 ), MM2TWIPS( 250 ) }, // B5 (ISO)
-/* 35*/ { SVX_PAPER_B6, MM2TWIPS( 125 ), MM2TWIPS( 176 ) }, // B6 (ISO)
- { SVX_PAPER_USER, MM2TWIPS( 110 ), MM2TWIPS( 230 ) }, // Envelope Italy
- { SVX_PAPER_MONARCH, IN2TWIPS( 3.875 ), IN2TWIPS( 7.5 ) }, // Envelope Monarch
- { SVX_PAPER_COM675, IN2TWIPS( 3.625 ), IN2TWIPS( 6.5 ) }, // 6 3/4 Envelope
- { SVX_PAPER_USER, IN2TWIPS( 14.875 ), IN2TWIPS( 11 ) }, // US Std Fanfold
-/* 40*/ { SVX_PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 12 ) }, // German Std Fanfold
- { SVX_PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 13 ) }, // German Legal Fanfold
- { SVX_PAPER_B4, MM2TWIPS( 250 ), MM2TWIPS( 353 ) }, // B4 (ISO)
- { SVX_PAPER_USER, MM2TWIPS( 100 ), MM2TWIPS( 148 ) }, // Japanese Postcard
- { SVX_PAPER_USER, IN2TWIPS( 9 ), IN2TWIPS( 11 ) }, // 9x11
-/* 45*/ { SVX_PAPER_USER, IN2TWIPS( 10 ), IN2TWIPS( 11 ) }, // 10x11
- { SVX_PAPER_USER, IN2TWIPS( 15 ), IN2TWIPS( 11 ) }, // 15x11
- { SVX_PAPER_USER, MM2TWIPS( 220 ), MM2TWIPS( 220 ) }, // Envelope Invite
- { SVX_PAPER_USER, 0, 0 }, // undefined
- { SVX_PAPER_USER, 0, 0 }, // undefined
-/* 50*/ { SVX_PAPER_USER, IN2TWIPS( 9.5 ), IN2TWIPS( 12 ) }, // Letter Extra
- { SVX_PAPER_USER, IN2TWIPS( 9.5 ), IN2TWIPS( 15 ) }, // Legal Extra
- { SVX_PAPER_USER, IN2TWIPS( 11.69 ), IN2TWIPS( 18 ) }, // Tabloid Extra
- { SVX_PAPER_USER, MM2TWIPS( 235 ), MM2TWIPS( 322 ) }, // A4 Extra
- { SVX_PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 11 ) }, // Letter Transverse
-/* 55*/ { SVX_PAPER_USER, MM2TWIPS( 210 ), MM2TWIPS( 297 ) }, // A4 Transverse
- { SVX_PAPER_USER, IN2TWIPS( 9.5 ), IN2TWIPS( 12 ) }, // Letter Extra Transverse
- { SVX_PAPER_USER, MM2TWIPS( 227 ), MM2TWIPS( 356 ) }, // Super A/A4
- { SVX_PAPER_USER, MM2TWIPS( 305 ), MM2TWIPS( 487 ) }, // Super B/A3
- { SVX_PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 12.69 ) }, // Letter Plus
-/* 60*/ { SVX_PAPER_USER, MM2TWIPS( 210 ), MM2TWIPS( 330 ) }, // A4 Plus
- { SVX_PAPER_USER, MM2TWIPS( 148 ), MM2TWIPS( 210 ) }, // A5 Transverse
- { SVX_PAPER_USER, MM2TWIPS( 182 ), MM2TWIPS( 257 ) }, // B5 (JIS) Transverse
- { SVX_PAPER_USER, MM2TWIPS( 322 ), MM2TWIPS( 445 ) }, // A3 Extra
- { SVX_PAPER_USER, MM2TWIPS( 174 ), MM2TWIPS( 235 ) }, // A5 Extra
-/* 65*/ { SVX_PAPER_USER, MM2TWIPS( 201 ), MM2TWIPS( 276 ) }, // B5 (ISO) Extra
- { SVX_PAPER_A2, MM2TWIPS( 420 ), MM2TWIPS( 594 ) }, // A2
- { SVX_PAPER_USER, MM2TWIPS( 297 ), MM2TWIPS( 420 ) }, // A3 Transverse
- { SVX_PAPER_USER, MM2TWIPS( 322 ), MM2TWIPS( 445 ) }, // A3 Extra Transverse
- { SVX_PAPER_USER, MM2TWIPS( 200 ), MM2TWIPS( 148 ) }, // Double Japanese Postcard
-/* 70*/ { SVX_PAPER_USER, MM2TWIPS( 105 ), MM2TWIPS( 148 ) }, // A6
- { SVX_PAPER_USER, 0, 0 }, // undefined
- { SVX_PAPER_USER, 0, 0 }, // undefined
- { SVX_PAPER_USER, 0, 0 }, // undefined
- { SVX_PAPER_USER, 0, 0 }, // undefined
-/* 75*/ { SVX_PAPER_USER, IN2TWIPS( 11 ), IN2TWIPS( 8.5 ) }, // Letter Rotated
- { SVX_PAPER_USER, MM2TWIPS( 420 ), MM2TWIPS( 297 ) }, // A3 Rotated
- { SVX_PAPER_USER, MM2TWIPS( 297 ), MM2TWIPS( 210 ) }, // A4 Rotated
- { SVX_PAPER_USER, MM2TWIPS( 210 ), MM2TWIPS( 148 ) }, // A5 Rotated
- { SVX_PAPER_USER, MM2TWIPS( 364 ), MM2TWIPS( 257 ) }, // B4 (JIS) Rotated
-/* 80*/ { SVX_PAPER_USER, MM2TWIPS( 257 ), MM2TWIPS( 182 ) }, // B5 (JIS) Rotated
- { SVX_PAPER_USER, MM2TWIPS( 148 ), MM2TWIPS( 100 ) }, // Japanese Postcard Rotated
- { SVX_PAPER_USER, MM2TWIPS( 148 ), MM2TWIPS( 200 ) }, // Double Japanese Postcard Rotated
- { SVX_PAPER_USER, MM2TWIPS( 148 ), MM2TWIPS( 105 ) }, // A6 Rotated
- { SVX_PAPER_USER, 0, 0 }, // undefined
-/* 85*/ { SVX_PAPER_USER, 0, 0 }, // undefined
- { SVX_PAPER_USER, 0, 0 }, // undefined
- { SVX_PAPER_USER, 0, 0 }, // undefined
- { SVX_PAPER_B6_JIS, MM2TWIPS( 128 ), MM2TWIPS( 182 ) }, // B6 (JIS)
- { SVX_PAPER_USER, MM2TWIPS( 182 ), MM2TWIPS( 128 ) }, // B6 (JIS) Rotated
-/* 90*/ { SVX_PAPER_USER, IN2TWIPS( 12 ), IN2TWIPS( 11 ) } // 12x11
+/* 0*/ { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_LETTER, IN2TWIPS( 8.5 ), IN2TWIPS( 11 ) }, // Letter
+ { PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 11 ) }, // Letter Small
+ { PAPER_TABLOID, IN2TWIPS( 11 ), IN2TWIPS( 17 ) }, // Tabloid
+ { PAPER_LEDGER, IN2TWIPS( 17 ), IN2TWIPS( 11 ) }, // Ledger
+/* 5*/ { PAPER_LEGAL, IN2TWIPS( 8.5 ), IN2TWIPS( 14 ) }, // Legal
+ { PAPER_STATEMENT, IN2TWIPS( 5.5 ), IN2TWIPS( 8.5 ) }, // Statement
+ { PAPER_EXECUTIVE, IN2TWIPS( 7.25 ), IN2TWIPS( 10.5 ) }, // Executive
+ { PAPER_A3, MM2TWIPS( 297 ), MM2TWIPS( 420 ) }, // A3
+ { PAPER_A4, MM2TWIPS( 210 ), MM2TWIPS( 297 ) }, // A4
+/* 10*/ { PAPER_USER, MM2TWIPS( 210 ), MM2TWIPS( 297 ) }, // A4 Small
+ { PAPER_A5, MM2TWIPS( 148 ), MM2TWIPS( 210 ) }, // A5
+ //See: http://wiki.services.openoffice.org/wiki/DefaultPaperSize comments
+ //near DMPAPER_B4 in vcl
+ //i.e.
+ //http://msdn.microsoft.com/en-us/library/bb241398.aspx makes the claim:
+ //xlPaperB4 12 B4 (250 mm x 354 mm)
+ //xlPaperB5 13 A5 (148 mm x 210 mm)
+ //but, a paper enum called B5 is surely not actually "A5", and furthermore
+ //the XlPaperSize enumeration otherwise follows the DMPAPER values
+ //http://msdn.microsoft.com/en-us/library/ms776398(VS.85).aspx
+ //which has
+ //DMPAPER_B4 12 B4 (JIS) 250 x 354
+ //DMPAPER_B5 13 B5 (JIS) 182 x 257 mm
+ //which claim them to be the JIS sizes. Though that document then gives
+ //"B4 (JIS)" an *ISO* B4 size in the text, but
+ //http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
+ //claims that the MS DMPAPER_B4 and DMPAPER_B5 truly are the JIS sizes
+ //which at least makes some sort of sense. (cmc)
+ { PAPER_B4_JIS, MM2TWIPS( 257 ), MM2TWIPS( 364 ) }, // B4 (JIS)
+ { PAPER_B5_JIS, MM2TWIPS( 182 ), MM2TWIPS( 257 ) }, // B5 (JIS)
+ { PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 13 ) }, // Folio
+/* 15*/ { PAPER_QUARTO, MM2TWIPS( 215 ), MM2TWIPS( 275 ) }, // Quarto
+ { PAPER_10x14, IN2TWIPS( 10 ), IN2TWIPS( 14 ) }, // 10x14
+ { PAPER_USER, IN2TWIPS( 11 ), IN2TWIPS( 17 ) }, // 11x17
+ { PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 11 ) }, // Note
+ { PAPER_ENV_9, IN2TWIPS( 3.875 ), IN2TWIPS( 8.875 ) }, // Envelope #9
+/* 20*/ { PAPER_ENV_10, IN2TWIPS( 4.125 ), IN2TWIPS( 9.5 ) }, // Envelope #10
+ { PAPER_ENV_11, IN2TWIPS( 4.5 ), IN2TWIPS( 10.375 ) }, // Envelope #11
+ { PAPER_ENV_12, IN2TWIPS( 4.75 ), IN2TWIPS( 11 ) }, // Envelope #12
+ { PAPER_ENV_14, IN2TWIPS( 5 ), IN2TWIPS( 11.5 ) }, // Envelope #14
+ { PAPER_C, IN2TWIPS( 17 ), IN2TWIPS( 22 ) }, // ANSI-C
+/* 25*/ { PAPER_D, IN2TWIPS( 22 ), IN2TWIPS( 34 ) }, // ANSI-D
+ { PAPER_E, IN2TWIPS( 34 ), IN2TWIPS( 44 ) }, // ANSI-E
+ { PAPER_ENV_DL, MM2TWIPS( 110 ), MM2TWIPS( 220 ) }, // Envelope DL
+ { PAPER_ENV_C5, MM2TWIPS( 162 ), MM2TWIPS( 229 ) }, // Envelope C5
+ { PAPER_ENV_C3, MM2TWIPS( 324 ), MM2TWIPS( 458 ) }, // Envelope C3
+/* 30*/ { PAPER_ENV_C4, MM2TWIPS( 229 ), MM2TWIPS( 324 ) }, // Envelope C4
+ { PAPER_ENV_C6, MM2TWIPS( 114 ), MM2TWIPS( 162 ) }, // Envelope C6
+ { PAPER_ENV_C65, MM2TWIPS( 114 ), MM2TWIPS( 229 ) }, // Envelope C65
+ { PAPER_B4_ISO, MM2TWIPS( 250 ), MM2TWIPS( 353 ) }, // B4 (ISO)
+ { PAPER_B5_ISO, MM2TWIPS( 176 ), MM2TWIPS( 250 ) }, // B5 (ISO)
+/* 35*/ { PAPER_B6_ISO, MM2TWIPS( 125 ), MM2TWIPS( 176 ) }, // B6 (ISO)
+ { PAPER_ENV_ITALY, MM2TWIPS( 110 ), MM2TWIPS( 230 ) }, // Envelope Italy
+ { PAPER_ENV_MONARCH, IN2TWIPS( 3.875 ), IN2TWIPS( 7.5 ) }, // Envelope Monarch
+ { PAPER_ENV_PERSONAL, IN2TWIPS( 3.625 ), IN2TWIPS( 6.5 ) }, // 6 3/4 Envelope
+ { PAPER_FANFOLD_US, IN2TWIPS( 14.875 ), IN2TWIPS( 11 ) }, // US Std Fanfold
+/* 40*/ { PAPER_FANFOLD_DE, IN2TWIPS( 8.5 ), IN2TWIPS( 12 ) }, // German Std Fanfold
+ { PAPER_FANFOLD_LEGAL_DE, IN2TWIPS( 8.5 ), IN2TWIPS( 13 ) }, // German Legal Fanfold
+ { PAPER_B4_ISO, MM2TWIPS( 250 ), MM2TWIPS( 353 ) }, // B4 (ISO)
+ { PAPER_POSTCARD_JP,MM2TWIPS( 100 ), MM2TWIPS( 148 ) }, // Japanese Postcard
+ { PAPER_9x11, IN2TWIPS( 9 ), IN2TWIPS( 11 ) }, // 9x11
+/* 45*/ { PAPER_10x11, IN2TWIPS( 10 ), IN2TWIPS( 11 ) }, // 10x11
+ { PAPER_15x11, IN2TWIPS( 15 ), IN2TWIPS( 11 ) }, // 15x11
+ { PAPER_ENV_INVITE, MM2TWIPS( 220 ), MM2TWIPS( 220 ) }, // Envelope Invite
+ { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_USER, 0, 0 }, // undefined
+/* 50*/ { PAPER_USER, IN2TWIPS( 9.5 ), IN2TWIPS( 12 ) }, // Letter Extra
+ { PAPER_USER, IN2TWIPS( 9.5 ), IN2TWIPS( 15 ) }, // Legal Extra
+ { PAPER_USER, IN2TWIPS( 11.69 ), IN2TWIPS( 18 ) }, // Tabloid Extra
+ { PAPER_USER, MM2TWIPS( 235 ), MM2TWIPS( 322 ) }, // A4 Extra
+ { PAPER_USER, IN2TWIPS( 8.5 ), IN2TWIPS( 11 ) }, // Letter Transverse
+/* 55*/ { PAPER_USER, MM2TWIPS( 210 ), MM2TWIPS( 297 ) }, // A4 Transverse
+ { PAPER_USER, IN2TWIPS( 9.5 ), IN2TWIPS( 12 ) }, // Letter Extra Transverse
+ { PAPER_A_PLUS, MM2TWIPS( 227 ), MM2TWIPS( 356 ) }, // Super A/A4
+ { PAPER_B_PLUS, MM2TWIPS( 305 ), MM2TWIPS( 487 ) }, // Super B/A3
+ { PAPER_LETTER_PLUS,IN2TWIPS( 8.5 ), IN2TWIPS( 12.69 ) }, // Letter Plus
+/* 60*/ { PAPER_A4_PLUS, MM2TWIPS( 210 ), MM2TWIPS( 330 ) }, // A4 Plus
+ { PAPER_USER, MM2TWIPS( 148 ), MM2TWIPS( 210 ) }, // A5 Transverse
+ { PAPER_USER, MM2TWIPS( 182 ), MM2TWIPS( 257 ) }, // B5 (JIS) Transverse
+ { PAPER_USER, MM2TWIPS( 322 ), MM2TWIPS( 445 ) }, // A3 Extra
+ { PAPER_USER, MM2TWIPS( 174 ), MM2TWIPS( 235 ) }, // A5 Extra
+/* 65*/ { PAPER_USER, MM2TWIPS( 201 ), MM2TWIPS( 276 ) }, // B5 (ISO) Extra
+ { PAPER_A2, MM2TWIPS( 420 ), MM2TWIPS( 594 ) }, // A2
+ { PAPER_USER, MM2TWIPS( 297 ), MM2TWIPS( 420 ) }, // A3 Transverse
+ { PAPER_USER, MM2TWIPS( 322 ), MM2TWIPS( 445 ) }, // A3 Extra Transverse
+ { PAPER_DOUBLEPOSTCARD_JP, MM2TWIPS( 200 ), MM2TWIPS( 148 ) }, // Double Japanese Postcard
+/* 70*/ { PAPER_A6, MM2TWIPS( 105 ), MM2TWIPS( 148 ) }, // A6
+ { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_USER, 0, 0 }, // undefined
+/* 75*/ { PAPER_USER, IN2TWIPS( 11 ), IN2TWIPS( 8.5 ) }, // Letter Rotated
+ { PAPER_USER, MM2TWIPS( 420 ), MM2TWIPS( 297 ) }, // A3 Rotated
+ { PAPER_USER, MM2TWIPS( 297 ), MM2TWIPS( 210 ) }, // A4 Rotated
+ { PAPER_USER, MM2TWIPS( 210 ), MM2TWIPS( 148 ) }, // A5 Rotated
+ { PAPER_USER, MM2TWIPS( 364 ), MM2TWIPS( 257 ) }, // B4 (JIS) Rotated
+/* 80*/ { PAPER_USER, MM2TWIPS( 257 ), MM2TWIPS( 182 ) }, // B5 (JIS) Rotated
+ { PAPER_USER, MM2TWIPS( 148 ), MM2TWIPS( 100 ) }, // Japanese Postcard Rotated
+ { PAPER_USER, MM2TWIPS( 148 ), MM2TWIPS( 200 ) }, // Double Japanese Postcard Rotated
+ { PAPER_USER, MM2TWIPS( 148 ), MM2TWIPS( 105 ) }, // A6 Rotated
+ { PAPER_USER, 0, 0 }, // undefined
+/* 85*/ { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_B6_JIS, MM2TWIPS( 128 ), MM2TWIPS( 182 ) }, // B6 (JIS)
+ { PAPER_USER, MM2TWIPS( 182 ), MM2TWIPS( 128 ) }, // B6 (JIS) Rotated
+/* 90*/ { PAPER_12x11, IN2TWIPS( 12 ), IN2TWIPS( 11 ) } // 12x11
};
#undef IN2TWIPS
@@ -193,15 +210,14 @@ Size XclPageData::GetScPaperSize() const
pEntry += mnPaperSize;
Size aSize;
- if( pEntry->mePaper == SVX_PAPER_USER )
+ if( pEntry->mePaper == PAPER_USER )
aSize = Size( pEntry->mnWidth, pEntry->mnHeight );
else
aSize = SvxPaperInfo::GetPaperSize( pEntry->mePaper );
// invalid size -> back to default
if( !aSize.Width() || !aSize.Height() )
- aSize = SvxPaperInfo::GetPaperSize( SvxPaperInfo::GetDefaultSvxPaper(
- Application::GetSettings().GetLanguage() ) );
+ aSize = SvxPaperInfo::GetDefaultPaperSize();
if( !mbPortrait )
::std::swap( aSize.Width(), aSize.Height() );
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index bdc75df21c13..8f5ddadd0370 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -92,8 +92,7 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
mxRD( new RootData ),//!
mnCharWidth( 110 ),
mnScTab( 0 ),
- mbExport( bExport ),
- mbHasPassw( false )
+ mbExport( bExport )
{
// default script type, e.g. for empty cells
switch( ScGlobal::GetDefaultScriptType() )
@@ -199,17 +198,6 @@ void XclRoot::SetCharWidth( const XclFontData& rFontData )
}
}
-const String& XclRoot::QueryPassword() const
-{
- if( !mrData.mbHasPassw )
- {
- mrData.maPassw = ScfApiHelper::QueryPasswordForMedium( GetMedium() );
- // set to true, even if dialog has been cancelled (never ask twice)
- mrData.mbHasPassw = true;
- }
- return mrData.maPassw;
-}
-
bool XclRoot::HasVbaStorage() const
{
SotStorageRef xRootStrg = GetRootStorage();
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index 7f11a6ec173d..4e5bf9b7570a 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -661,8 +661,11 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData,
fApiHeight, fApiWeight, eApiPosture, nApiUnderl, nApiStrikeout );
// font escapement
- sal_Int16 nApiEscapement;
- sal_Int8 nApiEscHeight;
+ sal_Int16 nApiEscapement = 0;
+ sal_Int8 nApiEscHeight = 0;
+ maHlpChEscapement.ReadFromPropertySet( rPropSet );
+ maHlpChEscapement.ReadFromPropertySet( rPropSet );
+ maHlpChEscapement.ReadFromPropertySet( rPropSet );
maHlpChEscapement >> nApiEscapement >> nApiEscHeight;
rFontData.SetApiEscapement( nApiEscapement );
}
@@ -724,6 +727,7 @@ void XclFontPropSetHelper::WriteFontProperties(
// font escapement
if( rFontData.GetScEscapement() != SVX_ESCAPEMENT_OFF )
{
+ maHlpChEscapement.InitializeWrite();
maHlpChEscapement << rFontData.GetApiEscapement() << EXC_API_ESC_HEIGHT;
maHlpChEscapement.WriteToPropertySet( rPropSet );
}
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index d6a847e62d41..ac6a5ac5705f 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -141,7 +141,7 @@ const sal_Char __FAR_DATA ScHTMLExport::sIndentSource[nIndentMax+1] =
#define lcl_OUT_LF() rStrm << ScExportBase::sNewLine
#define TAG_ON_LF( tag ) (TAG_ON( tag ) << ScExportBase::sNewLine << GetIndentStr())
#define TAG_OFF_LF( tag ) (TAG_OFF( tag ) << ScExportBase::sNewLine << GetIndentStr())
-#define OUT_HR() TAG_ON_LF( sHTML_horzrule )
+#define OUT_HR() TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_horzrule )
#define OUT_COMMENT( comment ) (rStrm << sMyBegComment, OUT_STR( comment ) \
<< sMyEndComment << ScExportBase::sNewLine \
<< GetIndentStr())
@@ -376,14 +376,14 @@ Size ScHTMLExport::MMToPixel( const Size& rSize )
ULONG ScHTMLExport::Write()
{
- rStrm << '<' << sHTML_doctype << ' ' << sHTML_doctype32 << '>'
+ rStrm << '<' << OOO_STRING_SVTOOLS_HTML_doctype << ' ' << OOO_STRING_SVTOOLS_HTML_doctype32 << '>'
<< sNewLine << sNewLine;
- TAG_ON_LF( sHTML_html );
+ TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_html );
WriteHeader();
OUT_LF();
WriteBody();
OUT_LF();
- TAG_OFF_LF( sHTML_html );
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_html );
return rStrm.GetError();
}
@@ -391,7 +391,7 @@ ULONG ScHTMLExport::Write()
void ScHTMLExport::WriteHeader()
{
- IncIndent(1); TAG_ON_LF( sHTML_head );
+ IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_head );
if ( pDoc->IsClipOrUndo() )
{ // no real DocInfo available, but some META information like charset needed
@@ -426,12 +426,12 @@ void ScHTMLExport::WriteHeader()
// CSS1 StyleSheet
PageDefaults( bAll ? 0 : aRange.aStart.Tab() );
- IncIndent(1); TAG_ON_LF( sHTML_style );
+ IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_style );
rStrm << sMyBegComment; OUT_LF();
- rStrm << sHTML_body << "," << sHTML_division << "," << sHTML_table << ","
- << sHTML_thead << "," << sHTML_tbody << "," << sHTML_tfoot << ","
- << sHTML_tablerow << "," << sHTML_tableheader << ","
- << sHTML_tabledata << "," << sHTML_parabreak << " { " << sFontFamily;
+ rStrm << OOO_STRING_SVTOOLS_HTML_body << "," << OOO_STRING_SVTOOLS_HTML_division << "," << OOO_STRING_SVTOOLS_HTML_table << ","
+ << OOO_STRING_SVTOOLS_HTML_thead << "," << OOO_STRING_SVTOOLS_HTML_tbody << "," << OOO_STRING_SVTOOLS_HTML_tfoot << ","
+ << OOO_STRING_SVTOOLS_HTML_tablerow << "," << OOO_STRING_SVTOOLS_HTML_tableheader << ","
+ << OOO_STRING_SVTOOLS_HTML_tabledata << "," << OOO_STRING_SVTOOLS_HTML_parabreak << " { " << sFontFamily;
xub_StrLen nFonts = aHTMLStyle.aFontFamilyName.GetTokenCount( ';' );
if ( nFonts == 1 )
{
@@ -456,9 +456,9 @@ void ScHTMLExport::WriteHeader()
<< GetFontSizeCss( ( USHORT ) aHTMLStyle.nFontHeight ) << " }";
OUT_LF();
rStrm << sMyEndComment;
- IncIndent(-1); OUT_LF(); TAG_OFF_LF( sHTML_style );
+ IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_style );
- IncIndent(-1); OUT_LF(); TAG_OFF_LF( sHTML_head );
+ IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_head );
}
@@ -468,10 +468,10 @@ void ScHTMLExport::WriteOverview()
{
IncIndent(1);
OUT_HR();
- IncIndent(1); TAG_ON( sHTML_parabreak ); TAG_ON_LF( sHTML_center );
- TAG_ON( sHTML_head1 );
+ IncIndent(1); TAG_ON( OOO_STRING_SVTOOLS_HTML_parabreak ); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_center );
+ TAG_ON( OOO_STRING_SVTOOLS_HTML_head1 );
OUT_STR( ScGlobal::GetRscString( STR_OVERVIEW ) );
- TAG_OFF_LF( sHTML_head1 );
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_head1 );
String aStr;
@@ -486,12 +486,12 @@ void ScHTMLExport::WriteOverview()
<< "\">";
OUT_STR( aStr );
rStrm << "</A>";
- TAG_ON_LF( sHTML_linebreak );
+ TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_linebreak );
}
}
IncIndent(-1); OUT_LF();
- IncIndent(-1); TAG_OFF( sHTML_center ); TAG_OFF_LF( sHTML_parabreak );
+ IncIndent(-1); TAG_OFF( OOO_STRING_SVTOOLS_HTML_center ); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_parabreak );
}
}
@@ -577,7 +577,7 @@ void ScHTMLExport::WriteBody()
const SvxBrushItem* pBrushItem = (const SvxBrushItem*)&rSet.Get( ATTR_BACKGROUND );
// default Textfarbe schwarz
- rStrm << '<' << sHTML_body << ' ' << sHTML_O_text << "=\"#000000\"";
+ rStrm << '<' << OOO_STRING_SVTOOLS_HTML_body << ' ' << OOO_STRING_SVTOOLS_HTML_O_text << "=\"#000000\"";
if ( bAll && GPOS_NONE != pBrushItem->GetGraphicPos() )
{
@@ -622,7 +622,7 @@ void ScHTMLExport::WriteBody()
}
if( pLink )
{
- rStrm << ' ' << sHTML_O_background << "=\"";
+ rStrm << ' ' << OOO_STRING_SVTOOLS_HTML_O_background << "=\"";
OUT_STR( URIHelper::simpleNormalizedMakeRelative(
aBaseURL,
*pLink ) ) << '\"';
@@ -633,7 +633,7 @@ void ScHTMLExport::WriteBody()
// background of the browser. Also, HTMLOutFuncs::Out_Color() writes
// black #000000 for COL_AUTO which is the same as white #ffffff with
// transparency set to 0xff, our default background.
- OUT_SP_CSTR_ASS( sHTML_O_bgcolor );
+ OUT_SP_CSTR_ASS( OOO_STRING_SVTOOLS_HTML_O_bgcolor );
HTMLOutFuncs::Out_Color( rStrm, aHTMLStyle.aBackgroundColor );
}
@@ -644,7 +644,7 @@ void ScHTMLExport::WriteBody()
WriteTables();
- TAG_OFF_LF( sHTML_body );
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_body );
}
@@ -703,15 +703,15 @@ void ScHTMLExport::WriteTables()
rStrm << "<A NAME=\"table"
<< ByteString::CreateFromInt32( nTab ).GetBuffer()
<< "\">";
- TAG_ON( sHTML_head1 );
+ TAG_ON( OOO_STRING_SVTOOLS_HTML_head1 );
OUT_STR( aStrOut );
- TAG_ON( sHTML_emphasis );
+ TAG_ON( OOO_STRING_SVTOOLS_HTML_emphasis );
pDoc->GetName( nTab, aStr );
OUT_STR( aStr );
- TAG_OFF( sHTML_emphasis );
- TAG_OFF( sHTML_head1 );
+ TAG_OFF( OOO_STRING_SVTOOLS_HTML_emphasis );
+ TAG_OFF( OOO_STRING_SVTOOLS_HTML_head1 );
rStrm << "</A>"; OUT_LF();
}
}
@@ -726,11 +726,11 @@ void ScHTMLExport::WriteTables()
}
// <TABLE ...>
- ByteString aByteStrOut = sHTML_table;
-// aStrOut = sHTML_table;
+ ByteString aByteStrOut = OOO_STRING_SVTOOLS_HTML_table;
+// aStrOut = OOO_STRING_SVTOOLS_HTML_table;
// FRAME=VOID, we do the styling of the cells in <TD>
- (((aByteStrOut += ' ') += sHTML_frame) += '=') += sHTML_TF_void;
+ (((aByteStrOut += ' ') += OOO_STRING_SVTOOLS_HTML_frame) += '=') += OOO_STRING_SVTOOLS_HTML_TF_void;
bTabHasGraphics = bTabAlignedLeft = FALSE;
if ( bAll && pDrawLayer )
@@ -739,10 +739,10 @@ void ScHTMLExport::WriteTables()
// more <TABLE ...>
if ( bTabAlignedLeft )
- (((aByteStrOut += ' ') += sHTML_O_align) += '=') += sHTML_AL_left;
+ (((aByteStrOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '=') += OOO_STRING_SVTOOLS_HTML_AL_left;
// ALIGN=LEFT allow text and graphics to flow around
// CELLSPACING
- (((aByteStrOut += ' ' ) += sHTML_O_cellspacing ) += '=') +=
+ (((aByteStrOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_cellspacing ) += '=') +=
ByteString::CreateFromInt32( nCellSpacing );
// COLS=n
SCCOL nColCnt = 0;
@@ -752,21 +752,21 @@ void ScHTMLExport::WriteTables()
if ( !(pDoc->GetColFlags( nCol, nTab ) & CR_HIDDEN) )
++nColCnt;
}
- (((aByteStrOut += ' ') += sHTML_O_cols) += '=') += ByteString::CreateFromInt32( nColCnt );
+ (((aByteStrOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_cols) += '=') += ByteString::CreateFromInt32( nColCnt );
// RULES=NONE, we do the styling of the cells in <TD>
- (((aByteStrOut += ' ') += sHTML_O_rules) += '=') += sHTML_TR_none;
+ (((aByteStrOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_rules) += '=') += OOO_STRING_SVTOOLS_HTML_TR_none;
// BORDER=0, we do the styling of the cells in <TD>
- ((aByteStrOut += ' ') += sHTML_O_border) += "=0";
+ ((aByteStrOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_border) += "=0";
IncIndent(1); TAG_ON_LF( aByteStrOut.GetBuffer() );
// <COLGROUP>
- TAG_ON( sHTML_colgroup );
+ TAG_ON( OOO_STRING_SVTOOLS_HTML_colgroup );
// <COL WIDTH=x> as pre-info for long tables
- ByteString aByteStr = sHTML_col;
+ ByteString aByteStr = OOO_STRING_SVTOOLS_HTML_col;
aByteStr += ' ';
- aByteStr += sHTML_O_width;
+ aByteStr += OOO_STRING_SVTOOLS_HTML_O_width;
aByteStr += '=';
for ( nCol=nStartCol; nCol<=nEndCol; nCol++ )
{
@@ -778,10 +778,10 @@ void ScHTMLExport::WriteTables()
ToPixel( pDoc->GetColWidth( nCol, nTab ) ) );
TAG_ON( aByteStrOut.GetBuffer() );
}
- TAG_OFF_LF( sHTML_colgroup );
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_colgroup );
// <TBODY>
- IncIndent(1); TAG_ON_LF( sHTML_tbody );
+ IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tbody );
// At least old (3.x, 4.x?) Netscape doesn't follow <TABLE COLS=n> and
// <COL WIDTH=x> specified, but needs a width at every column.
bTableDataWidth = TRUE; // widths in first row
@@ -797,7 +797,7 @@ void ScHTMLExport::WriteTables()
continue; // for
}
- IncIndent(1); TAG_ON_LF( sHTML_tablerow );
+ IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
bTableDataHeight = TRUE; // height at every first cell of each row
for ( SCCOL nCol2=nStartCol; nCol2<=nEndCol; nCol2++ )
{
@@ -813,11 +813,11 @@ void ScHTMLExport::WriteTables()
if ( nRow == nEndRow )
IncIndent(-1);
- TAG_OFF_LF( sHTML_tablerow );
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
}
- IncIndent(-1); TAG_OFF_LF( sHTML_tbody );
+ IncIndent(-1); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tbody );
- IncIndent(-1); TAG_OFF_LF( sHTML_table );
+ IncIndent(-1); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_table );
if ( bTabHasGraphics )
{
@@ -831,8 +831,8 @@ void ScHTMLExport::WriteTables()
aGraphList.Clear();
if ( bTabAlignedLeft )
{ // clear <TABLE ALIGN=LEFT> with <BR CLEAR=LEFT>
- aByteStrOut = sHTML_linebreak;
- (((aByteStrOut += ' ') += sHTML_O_clear) += '=') += sHTML_AL_left;
+ aByteStrOut = OOO_STRING_SVTOOLS_HTML_linebreak;
+ (((aByteStrOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_clear) += '=') += OOO_STRING_SVTOOLS_HTML_AL_left;
TAG_ON_LF( aByteStrOut.GetBuffer() );
}
}
@@ -887,13 +887,13 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
nScriptType = aHTMLStyle.nDefaultScriptType;
- ByteString aStrTD = sHTML_tabledata;
+ ByteString aStrTD = OOO_STRING_SVTOOLS_HTML_tabledata;
// border of the cells
SvxBoxItem* pBorder = (SvxBoxItem*) pDoc->GetAttr( nCol, nRow, nTab, ATTR_BORDER );
if ( pBorder && (pBorder->GetTop() || pBorder->GetBottom() || pBorder->GetLeft() || pBorder->GetRight()) )
{
- ((aStrTD += ' ') += sHTML_style) += "=\"";
+ ((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_style) += "=\"";
bool bInsertSemicolon = false;
BorderToStyle( aStrTD, "top", pBorder->GetTop(), bInsertSemicolon );
@@ -921,7 +921,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
nC = rMergeAttr.GetColMerge();
if ( nC > 1 )
{
- (((aStrTD += ' ') += sHTML_O_colspan) += '=') += ByteString::CreateFromInt32( nC );
+ (((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_O_colspan) += '=') += ByteString::CreateFromInt32( nC );
nC = nC + nCol;
for ( jC=nCol, v=0; jC<nC; jC++ )
v += pDoc->GetColWidth( jC, nTab );
@@ -937,7 +937,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
nR = rMergeAttr.GetRowMerge();
if ( nR > 1 )
{
- (((aStrTD += ' ') += sHTML_O_rowspan) += '=') += ByteString::CreateFromInt32( nR );
+ (((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_O_rowspan) += '=') += ByteString::CreateFromInt32( nR );
nR += nRow;
v = pDoc->GetRowHeight( nRow, nR-1, nTab );
nHeightPixel = ToPixel( static_cast< USHORT >( v ) );
@@ -952,9 +952,9 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
}
if ( bTableDataWidth )
- (((aStrTD += ' ') += sHTML_O_width) += '=') += ByteString::CreateFromInt32( nWidthPixel );
+ (((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '=') += ByteString::CreateFromInt32( nWidthPixel );
if ( bTableDataHeight )
- (((aStrTD += ' ') += sHTML_O_height) += '=') += ByteString::CreateFromInt32( nHeightPixel );
+ (((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '=') += ByteString::CreateFromInt32( nHeightPixel );
const SvxFontItem& rFontItem = (const SvxFontItem&) pAttr->GetItem(
ScGlobal::GetScriptedWhichID( nScriptType, ATTR_FONT),
@@ -1021,32 +1021,32 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
switch( rHorJustifyItem.GetValue() )
{
case SVX_HOR_JUSTIFY_STANDARD:
- pChar = (bValueData ? sHTML_AL_right : sHTML_AL_left);
+ pChar = (bValueData ? OOO_STRING_SVTOOLS_HTML_AL_right : OOO_STRING_SVTOOLS_HTML_AL_left);
break;
- case SVX_HOR_JUSTIFY_CENTER: pChar = sHTML_AL_center; break;
- case SVX_HOR_JUSTIFY_BLOCK: pChar = sHTML_AL_justify; break;
- case SVX_HOR_JUSTIFY_RIGHT: pChar = sHTML_AL_right; break;
+ case SVX_HOR_JUSTIFY_CENTER: pChar = OOO_STRING_SVTOOLS_HTML_AL_center; break;
+ case SVX_HOR_JUSTIFY_BLOCK: pChar = OOO_STRING_SVTOOLS_HTML_AL_justify; break;
+ case SVX_HOR_JUSTIFY_RIGHT: pChar = OOO_STRING_SVTOOLS_HTML_AL_right; break;
case SVX_HOR_JUSTIFY_LEFT:
case SVX_HOR_JUSTIFY_REPEAT:
- default: pChar = sHTML_AL_left; break;
+ default: pChar = OOO_STRING_SVTOOLS_HTML_AL_left; break;
}
- (((aStrTD += ' ') += sHTML_O_align) += '=') += pChar;
+ (((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '=') += pChar;
switch( rVerJustifyItem.GetValue() )
{
- case SVX_VER_JUSTIFY_TOP: pChar = sHTML_VA_top; break;
- case SVX_VER_JUSTIFY_CENTER: pChar = sHTML_VA_middle; break;
- case SVX_VER_JUSTIFY_BOTTOM: pChar = sHTML_VA_bottom; break;
+ case SVX_VER_JUSTIFY_TOP: pChar = OOO_STRING_SVTOOLS_HTML_VA_top; break;
+ case SVX_VER_JUSTIFY_CENTER: pChar = OOO_STRING_SVTOOLS_HTML_VA_middle; break;
+ case SVX_VER_JUSTIFY_BOTTOM: pChar = OOO_STRING_SVTOOLS_HTML_VA_bottom; break;
case SVX_VER_JUSTIFY_STANDARD:
default: pChar = NULL;
}
if ( pChar )
- (((aStrTD += ' ') += sHTML_O_valign) += '=') += pChar;
+ (((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_O_valign) += '=') += pChar;
if ( aHTMLStyle.aBackgroundColor != aBgColor )
{
- ((aStrTD += ' ') += sHTML_O_bgcolor) += '=';
+ ((aStrTD += ' ') += OOO_STRING_SVTOOLS_HTML_O_bgcolor) += '=';
lcl_AppendHTMLColorTripel( aStrTD, aBgColor );
}
@@ -1078,17 +1078,17 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
TAG_ON( aStrTD.GetBuffer() );
- if ( bBold ) TAG_ON( sHTML_bold );
- if ( bItalic ) TAG_ON( sHTML_italic );
- if ( bUnderline ) TAG_ON( sHTML_underline );
+ if ( bBold ) TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
+ if ( bItalic ) TAG_ON( OOO_STRING_SVTOOLS_HTML_italic );
+ if ( bUnderline ) TAG_ON( OOO_STRING_SVTOOLS_HTML_underline );
if ( bSetFont )
{
- ByteString aStr = sHTML_font;
+ ByteString aStr = OOO_STRING_SVTOOLS_HTML_font;
if ( bSetFontName )
{
- ((aStr += ' ') += sHTML_O_face) += "=\"";
+ ((aStr += ' ') += OOO_STRING_SVTOOLS_HTML_O_face) += "=\"";
xub_StrLen nFonts = rFontItem.GetFamilyName().GetTokenCount( ';' );
if ( nFonts == 1 )
{
@@ -1115,7 +1115,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
}
if ( nSetFontSizeNumber )
{
- (((aStr += ' ') += sHTML_O_size) += '=')
+ (((aStr += ' ') += OOO_STRING_SVTOOLS_HTML_O_size) += '=')
+= ByteString::CreateFromInt32( nSetFontSizeNumber );
}
if ( bSetFontColor )
@@ -1126,7 +1126,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
if ( aColor.GetColor() == COL_AUTO )
aColor.SetColor( COL_BLACK );
- ((aStr += ' ') += sHTML_O_color) += '=';
+ ((aStr += ' ') += OOO_STRING_SVTOOLS_HTML_O_color) += '=';
lcl_AppendHTMLColorTripel( aStr, aColor );
}
TAG_ON( aStr.GetBuffer() );
@@ -1154,19 +1154,41 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
if ( !bFieldText )
{
if ( !aStrOut.Len() )
- TAG_ON( sHTML_linebreak ); // #42573# keine komplett leere Zelle
+ {
+ TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak ); // #42573# keine komplett leere Zelle
+ }
else
- OUT_STR( aStrOut );
+ {
+ xub_StrLen nPos = aStrOut.Search( _LF );
+ if ( nPos == STRING_NOTFOUND )
+ {
+ OUT_STR( aStrOut );
+ }
+ else
+ {
+ xub_StrLen nStartPos = 0;
+ do
+ {
+ String aSingleLine( aStrOut, nStartPos, nPos - nStartPos );
+ OUT_STR( aSingleLine );
+ TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak );
+ nStartPos = nPos + 1;
+ }
+ while( ( nPos = aStrOut.Search( _LF, nStartPos ) ) != STRING_NOTFOUND );
+ String aSingleLine( aStrOut, nStartPos, aStrOut.Len() - nStartPos );
+ OUT_STR( aSingleLine );
+ }
+ }
}
if ( pGraphEntry )
WriteGraphEntry( pGraphEntry );
- if ( bSetFont ) TAG_OFF( sHTML_font );
- if ( bUnderline ) TAG_OFF( sHTML_underline );
- if ( bItalic ) TAG_OFF( sHTML_italic );
- if ( bBold ) TAG_OFF( sHTML_bold );
+ if ( bSetFont ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_font );
+ if ( bUnderline ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_underline );
+ if ( bItalic ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_italic );
+ if ( bBold ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
- TAG_OFF_LF( sHTML_tabledata );
+ TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tabledata );
}
@@ -1194,7 +1216,7 @@ BOOL ScHTMLExport::WriteFieldText( const ScEditCell* pCell )
for ( USHORT nPar=0; nPar < nParas; nPar++ )
{
if ( nPar > 0 )
- rStrm << ' '; // blank between paragraphs
+ TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak );
SvUShorts aPortions;
rEngine.GetPortions( nPar, aPortions );
USHORT nCnt = aPortions.Count();
@@ -1217,11 +1239,11 @@ BOOL ScHTMLExport::WriteFieldText( const ScEditCell* pCell )
bUrl = TRUE;
const SvxURLField* pURLField = (const SvxURLField*)pField;
// String aFieldText = rEngine.GetText( aSel );
- rStrm << '<' << sHTML_anchor << ' ' << sHTML_O_href << "=\"";
+ rStrm << '<' << OOO_STRING_SVTOOLS_HTML_anchor << ' ' << OOO_STRING_SVTOOLS_HTML_O_href << "=\"";
OUT_STR( pURLField->GetURL() );
rStrm << "\">";
OUT_STR( pURLField->GetRepresentation() );
- rStrm << "</" << sHTML_anchor << '>';
+ rStrm << "</" << OOO_STRING_SVTOOLS_HTML_anchor << '>';
}
}
}
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index e32da2fe9227..b9705e66936d 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -141,15 +141,15 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
{
SdrObject* pObject = pE->pObject;
ByteString aOpt;
- (((aOpt += ' ') += sHTML_O_width) += '=') +=
+ (((aOpt += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '=') +=
ByteString::CreateFromInt32( pE->aSize.Width() );
- (((aOpt += ' ') += sHTML_O_height) += '=') +=
+ (((aOpt += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '=') +=
ByteString::CreateFromInt32( pE->aSize.Height() );
if ( pE->bInCell )
{
- (((aOpt += ' ') += sHTML_O_hspace) += '=') +=
+ (((aOpt += ' ') += OOO_STRING_SVTOOLS_HTML_O_hspace) += '=') +=
ByteString::CreateFromInt32( pE->aSpace.Width() );
- (((aOpt += ' ') += sHTML_O_vspace) += '=') +=
+ (((aOpt += ' ') += OOO_STRING_SVTOOLS_HTML_O_vspace) += '=') +=
ByteString::CreateFromInt32( pE->aSpace.Height() );
}
switch ( pObject->GetObjIdentifier() )
@@ -237,7 +237,7 @@ void ScHTMLExport::WriteImage( String& rLinkName, const Graphic& rGrf,
}
if( rLinkName.Len() )
{ // <IMG SRC="..."[ rImgOptions]>
- rStrm << '<' << sHTML_image << ' ' << sHTML_O_src << "=\"";
+ rStrm << '<' << OOO_STRING_SVTOOLS_HTML_image << ' ' << OOO_STRING_SVTOOLS_HTML_O_src << "=\"";
HTMLOutFuncs::Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(
aBaseURL,
rLinkName ), eDestEnc ) << '\"';
diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx
index abc7d2b21392..5591e8ec993e 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -99,7 +99,7 @@ ScHTMLImport::ScHTMLImport( ScDocument* pDocP, const String& rBaseURL, const ScR
if ( !aPageSize.Width() || !aPageSize.Height() )
{
DBG_ERRORFILE("PageSize Null ?!?!?");
- aPageSize = SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 );
+ aPageSize = SvxPaperInfo::GetPaperSize( PAPER_A4 );
}
aPageSize.Width() -= nLeftMargin + nRightMargin;
aPageSize.Height() -= nTopMargin + nBottomMargin;
@@ -109,7 +109,7 @@ ScHTMLImport::ScHTMLImport( ScDocument* pDocP, const String& rBaseURL, const ScR
{
DBG_ERRORFILE("kein StyleSheet?!?");
aPageSize = pDefaultDev->LogicToPixel(
- SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 ), MapMode( MAP_TWIP ) );
+ SvxPaperInfo::GetPaperSize( PAPER_A4 ), MapMode( MAP_TWIP ) );
}
if( bCalcWidthHeight )
mpParser = new ScHTMLLayoutParser( mpEngine, rBaseURL, aPageSize, pDocP );
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 38bd3e2dde65..36bbfe1d2787 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -49,10 +49,10 @@
#include <svx/udlnitem.hxx>
#include <svx/wghtitem.hxx>
#include <svx/boxitem.hxx>
-#include <sfx2/frmhtml.hxx>
#include <sfx2/objsh.hxx>
#include <svtools/eitem.hxx>
#include <svtools/filter.hxx>
+#include <svtools/parhtml.hxx>
#include <svtools/htmlkywd.hxx>
#include <svtools/htmltokn.h>
#include <sfx2/docfile.hxx>
@@ -173,7 +173,7 @@ ULONG ScHTMLLayoutParser::Read( SvStream& rStream, const String& rBaseURL )
aContentType.AppendAscii( pCharSet );
xValues = new SvKeyValueIterator;
- xValues->Append( SvKeyValue( String::CreateFromAscii( sHTML_META_content_type ), aContentType ) );
+ xValues->Append( SvKeyValue( String::CreateFromAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) );
pAttributes = xValues;
}
}
@@ -958,11 +958,11 @@ void ScHTMLLayoutParser::TableDataOn( ImportInfo* pInfo )
bHorJustifyCenterTH = FALSE;
SvxCellHorJustify eVal;
const String& rOptVal = pOption->GetString();
- if ( rOptVal.CompareIgnoreCaseToAscii( sHTML_AL_right ) == COMPARE_EQUAL )
+ if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_right ) == COMPARE_EQUAL )
eVal = SVX_HOR_JUSTIFY_RIGHT;
- else if ( rOptVal.CompareIgnoreCaseToAscii( sHTML_AL_center ) == COMPARE_EQUAL )
+ else if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_center ) == COMPARE_EQUAL )
eVal = SVX_HOR_JUSTIFY_CENTER;
- else if ( rOptVal.CompareIgnoreCaseToAscii( sHTML_AL_left ) == COMPARE_EQUAL )
+ else if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_left ) == COMPARE_EQUAL )
eVal = SVX_HOR_JUSTIFY_LEFT;
else
eVal = SVX_HOR_JUSTIFY_STANDARD;
@@ -974,11 +974,11 @@ void ScHTMLLayoutParser::TableDataOn( ImportInfo* pInfo )
{
SvxCellVerJustify eVal;
const String& rOptVal = pOption->GetString();
- if ( rOptVal.CompareIgnoreCaseToAscii( sHTML_VA_top ) == COMPARE_EQUAL )
+ if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_VA_top ) == COMPARE_EQUAL )
eVal = SVX_VER_JUSTIFY_TOP;
- else if ( rOptVal.CompareIgnoreCaseToAscii( sHTML_VA_middle ) == COMPARE_EQUAL )
+ else if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_VA_middle ) == COMPARE_EQUAL )
eVal = SVX_VER_JUSTIFY_CENTER;
- else if ( rOptVal.CompareIgnoreCaseToAscii( sHTML_VA_bottom ) == COMPARE_EQUAL )
+ else if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_VA_bottom ) == COMPARE_EQUAL )
eVal = SVX_VER_JUSTIFY_BOTTOM;
else
eVal = SVX_VER_JUSTIFY_STANDARD;
@@ -1544,25 +1544,12 @@ void ScHTMLLayoutParser::ProcToken( ImportInfo* pInfo )
{
case HTML_META:
{
- USHORT nContentOpt = HTML_O_CONTENT;
- rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
HTMLParser* pParser = (HTMLParser*) pInfo->pParser;
- const HTMLOptions* pOptions = pParser->GetOptions( &nContentOpt );
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
mpDoc->GetDocumentShell()->GetModel(), uno::UNO_QUERY_THROW);
- SfxFrameHTMLParser::ParseMetaOptions(
+ pParser->ParseMetaOptions(
xDPS->getDocumentProperties(),
- mpDoc->GetDocumentShell()->GetHeaderAttributes(),
- pOptions, eEnc );
- // If the encoding is set by a META tag, it may only overwrite the
- // current encoding if both, the current and the new encoding, are 1-BYTE
- // encodings. Everything else cannot lead to reasonable results.
- if ( rtl_isOctetTextEncoding( eEnc ) &&
- rtl_isOctetTextEncoding( pParser->GetSrcEncoding() ) )
- {
- eEnc = GetExtendedCompatibilityTextEncoding( eEnc );
- pParser->SetSrcEncoding( eEnc );
- }
+ mpDoc->GetDocumentShell()->GetHeaderAttributes() );
}
break;
case HTML_TITLE_ON:
@@ -1728,31 +1715,29 @@ void ScHTMLLayoutParser::ProcToken( ImportInfo* pInfo )
// ============================================================================
template< typename Type >
-inline Type bound( const Type& rValue, const Type& rMin, const Type& rMax )
+inline Type getLimitedValue( const Type& rValue, const Type& rMin, const Type& rMax )
{ return ::std::max( ::std::min( rValue, rMax ), rMin ); }
-
// ============================================================================
/** Iterates through all HTML tag options of the passed ImportInfo struct. */
class ScHTMLOptionIterator
{
private:
- const HTMLOptions* mpOptions; /// The options array.
- const HTMLOption* mpCurrOption; /// Current option.
- sal_uInt16 mnCount; /// Size of the options array.
- sal_uInt16 mnIndex; /// Next option to return.
+ const HTMLOptions* mpOptions; /// The options array.
+ const HTMLOption* mpCurrOption; /// Current option.
+ sal_uInt16 mnCount; /// Size of the options array.
+ sal_uInt16 mnIndex; /// Next option to return.
public:
- explicit ScHTMLOptionIterator( const ImportInfo& rInfo );
+ explicit ScHTMLOptionIterator( const ImportInfo& rInfo );
- inline bool is() const { return mnIndex < mnCount; }
- inline const HTMLOption* operator->() const { return mpCurrOption; }
- inline const HTMLOption& operator*() const { return *mpCurrOption; }
- ScHTMLOptionIterator& operator++();
+ inline bool is() const { return mnIndex < mnCount; }
+ inline const HTMLOption* operator->() const { return mpCurrOption; }
+ inline const HTMLOption& operator*() const { return *mpCurrOption; }
+ ScHTMLOptionIterator& operator++();
};
-
// ----------------------------------------------------------------------------
ScHTMLOptionIterator::ScHTMLOptionIterator( const ImportInfo& rInfo ) :
@@ -1777,7 +1762,6 @@ ScHTMLOptionIterator& ScHTMLOptionIterator::operator++()
return *this;
}
-
// ============================================================================
ScHTMLEntry::ScHTMLEntry( const SfxItemSet& rItemSet, ScHTMLTableId nTableId ) :
@@ -1832,14 +1816,15 @@ void ScHTMLEntry::Strip( const EditEngine& rEditEngine )
}
}
-
// ============================================================================
/** A map of ScHTMLTable objects.
- @descr Organizes the tables with a unique table key. Stores nested tables inside
- the parent table and forms in this way a tree structure of tables.
- An instance of this class ownes the contained table objects and deletes them
- on destruction. */
+
+ Organizes the tables with a unique table key. Stores nested tables inside
+ the parent table and forms in this way a tree structure of tables. An
+ instance of this class ownes the contained table objects and deletes them
+ on destruction.
+ */
class ScHTMLTableMap
{
private:
@@ -1851,36 +1836,35 @@ public:
typedef ScHTMLTableStdMap::const_iterator const_iterator;
private:
- ScHTMLTable& mrParentTable; /// Reference to parent table.
- ScHTMLTableStdMap maTables; /// Container for all table objects.
- mutable ScHTMLTable* mpCurrTable; /// Current table, used for fast search.
+ ScHTMLTable& mrParentTable; /// Reference to parent table.
+ ScHTMLTableStdMap maTables; /// Container for all table objects.
+ mutable ScHTMLTable* mpCurrTable; /// Current table, used for fast search.
public:
- explicit ScHTMLTableMap( ScHTMLTable& rParentTable );
- virtual ~ScHTMLTableMap();
+ explicit ScHTMLTableMap( ScHTMLTable& rParentTable );
+ virtual ~ScHTMLTableMap();
- inline iterator begin() { return maTables.begin(); }
- inline const_iterator begin() const { return maTables.begin(); }
- inline iterator end() { return maTables.end(); }
- inline const_iterator end() const { return maTables.end(); }
- inline bool empty() const { return maTables.empty(); }
+ inline iterator begin() { return maTables.begin(); }
+ inline const_iterator begin() const { return maTables.begin(); }
+ inline iterator end() { return maTables.end(); }
+ inline const_iterator end() const { return maTables.end(); }
+ inline bool empty() const { return maTables.empty(); }
/** Returns the specified table.
@param nTableId Unique identifier of the table.
@param bDeep true = searches deep in all nested table; false = only in this container. */
- ScHTMLTable* FindTable( ScHTMLTableId nTableId, bool bDeep = true ) const;
+ ScHTMLTable* FindTable( ScHTMLTableId nTableId, bool bDeep = true ) const;
/** Inserts a new table into the container. This container owns the created table.
@param bPreFormText true = New table is based on preformatted text (<pre> tag). */
- ScHTMLTable* CreateTable( const ImportInfo& rInfo, bool bPreFormText );
+ ScHTMLTable* CreateTable( const ImportInfo& rInfo, bool bPreFormText );
private:
/** Sets a working table with its index for search optimization. */
- inline void SetCurrTable( ScHTMLTable* pTable ) const
- { if( pTable ) mpCurrTable = pTable; }
+ inline void SetCurrTable( ScHTMLTable* pTable ) const
+ { if( pTable ) mpCurrTable = pTable; }
};
-
// ----------------------------------------------------------------------------
ScHTMLTableMap::ScHTMLTableMap( ScHTMLTable& rParentTable ) :
@@ -1921,28 +1905,29 @@ ScHTMLTable* ScHTMLTableMap::CreateTable( const ImportInfo& rInfo, bool bPreForm
return pTable;
}
-
// ----------------------------------------------------------------------------
/** Simplified forward iterator for convenience.
- @descr Before the iterator can be dereferenced, it must be tested with the
- is() method. The iterator may be invalid directly after construction
- (i.e. empty container). */
+
+ Before the iterator can be dereferenced, it must be tested with the is()
+ method. The iterator may be invalid directly after construction (e.g. empty
+ container).
+ */
class ScHTMLTableIterator
{
-private:
- ScHTMLTableMap::const_iterator maIter;
- ScHTMLTableMap::const_iterator maEnd;
-
public:
/** Constructs the iterator for the passed table map.
@param pTableMap Pointer to the table map (is allowed to be NULL). */
- explicit ScHTMLTableIterator( const ScHTMLTableMap* pTableMap );
+ explicit ScHTMLTableIterator( const ScHTMLTableMap* pTableMap );
- inline bool is() const { return maIter != maEnd; }
- inline ScHTMLTable* operator->() { return maIter->second.get(); }
- inline ScHTMLTable& operator*() { return *maIter->second; }
+ inline bool is() const { return maIter != maEnd; }
+ inline ScHTMLTable* operator->() { return maIter->second.get(); }
+ inline ScHTMLTable& operator*() { return *maIter->second; }
inline ScHTMLTableIterator& operator++() { ++maIter; return *this; }
+
+private:
+ ScHTMLTableMap::const_iterator maIter;
+ ScHTMLTableMap::const_iterator maEnd;
};
ScHTMLTableIterator::ScHTMLTableIterator( const ScHTMLTableMap* pTableMap )
@@ -1954,7 +1939,6 @@ ScHTMLTableIterator::ScHTMLTableIterator( const ScHTMLTableMap* pTableMap )
}
}
-
// ============================================================================
ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ) :
@@ -1964,7 +1948,6 @@ ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ) :
++mrnUnusedId;
}
-
// ----------------------------------------------------------------------------
ScHTMLTable::ScHTMLTable( ScHTMLTable& rParentTable, const ImportInfo& rInfo, bool bPreFormText ) :
@@ -2023,7 +2006,7 @@ ScHTMLTable::ScHTMLTable( SfxItemPool& rPool, EditEngine& rEditEngine, ScEEParse
// open the first "cell" of the document
ImplRowOn();
ImplDataOn( ScHTMLSize( 1, 1 ) );
- mpCurrEntry = CreateEntry();
+ mxCurrEntry = CreateEntry();
}
ScHTMLTable::~ScHTMLTable()
@@ -2033,45 +2016,46 @@ ScHTMLTable::~ScHTMLTable()
const SfxItemSet& ScHTMLTable::GetCurrItemSet() const
{
// first try cell item set, then row item set, then table item set
- return mpDataItemSet.get() ? *mpDataItemSet : (mpRowItemSet.get() ? *mpRowItemSet : maTableItemSet);
+ return mxDataItemSet.get() ? *mxDataItemSet : (mxRowItemSet.get() ? *mxRowItemSet : maTableItemSet);
}
ScHTMLSize ScHTMLTable::GetSpan( const ScHTMLPos& rCellPos ) const
{
ScHTMLSize aSpan( 1, 1 );
- if( ScRange* pRange = maLockList.Find( rCellPos.MakeAddr() ) )
+ ScRange* pRange = 0;
+ if( ((pRange = maVMergedCells.Find( rCellPos.MakeAddr() )) != 0) || ((pRange = maHMergedCells.Find( rCellPos.MakeAddr() )) != 0) )
aSpan.Set( pRange->aEnd.Col() - pRange->aStart.Col() + 1, pRange->aEnd.Row() - pRange->aStart.Row() + 1 );
return aSpan;
}
ScHTMLTable* ScHTMLTable::FindNestedTable( ScHTMLTableId nTableId ) const
{
- return mpNestedTables.get() ? mpNestedTables->FindTable( nTableId, true ) : 0;
+ return mxNestedTables.get() ? mxNestedTables->FindTable( nTableId, true ) : 0;
}
void ScHTMLTable::PutItem( const SfxPoolItem& rItem )
{
- DBG_ASSERT( mpCurrEntry.get(), "ScHTMLTable::PutItem - no current entry" );
- if( mpCurrEntry.get() && mpCurrEntry->IsEmpty() )
- mpCurrEntry->GetItemSet().Put( rItem );
+ DBG_ASSERT( mxCurrEntry.get(), "ScHTMLTable::PutItem - no current entry" );
+ if( mxCurrEntry.get() && mxCurrEntry->IsEmpty() )
+ mxCurrEntry->GetItemSet().Put( rItem );
}
void ScHTMLTable::PutText( const ImportInfo& rInfo )
{
- DBG_ASSERT( mpCurrEntry.get(), "ScHTMLTable::PutText - no current entry" );
- if( mpCurrEntry.get() )
+ DBG_ASSERT( mxCurrEntry.get(), "ScHTMLTable::PutText - no current entry" );
+ if( mxCurrEntry.get() )
{
- if( !mpCurrEntry->HasContents() && IsSpaceCharInfo( rInfo ) )
- mpCurrEntry->AdjustStart( rInfo );
+ if( !mxCurrEntry->HasContents() && IsSpaceCharInfo( rInfo ) )
+ mxCurrEntry->AdjustStart( rInfo );
else
- mpCurrEntry->AdjustEnd( rInfo );
+ mxCurrEntry->AdjustEnd( rInfo );
}
}
void ScHTMLTable::InsertPara( const ImportInfo& rInfo )
{
- if( mpCurrEntry.get() && mbDataOn && !IsEmptyCell() )
- mpCurrEntry->SetImportAlways();
+ if( mxCurrEntry.get() && mbDataOn && !IsEmptyCell() )
+ mxCurrEntry->SetImportAlways();
PushEntry( rInfo );
CreateNewEntry( rInfo );
InsertLeadingEmptyLine();
@@ -2097,10 +2081,10 @@ void ScHTMLTable::InsertLeadingEmptyLine()
void ScHTMLTable::AnchorOn()
{
- DBG_ASSERT( mpCurrEntry.get(), "ScHTMLTable::AnchorOn - no current entry" );
+ DBG_ASSERT( mxCurrEntry.get(), "ScHTMLTable::AnchorOn - no current entry" );
// don't skip entries with single hyperlinks
- if( mpCurrEntry.get() )
- mpCurrEntry->SetImportAlways();
+ if( mxCurrEntry.get() )
+ mxCurrEntry->SetImportAlways();
}
ScHTMLTable* ScHTMLTable::TableOn( const ImportInfo& rInfo )
@@ -2131,7 +2115,7 @@ void ScHTMLTable::RowOn( const ImportInfo& rInfo )
if( mpParentTable && !mbPreFormText ) // no rows allowed in global and preformatted tables
{
ImplRowOn();
- ProcessFormatOptions( *mpRowItemSet, rInfo );
+ ProcessFormatOptions( *mxRowItemSet, rInfo );
}
CreateNewEntry( rInfo );
}
@@ -2157,10 +2141,10 @@ void ScHTMLTable::DataOn( const ImportInfo& rInfo )
switch( aIter->GetToken() )
{
case HTML_O_COLSPAN:
- aSpanSize.mnCols = static_cast< SCCOL >( bound( aIter->GetString().ToInt32(), static_cast<sal_Int32>(1), static_cast<sal_Int32>(256) ) );
+ aSpanSize.mnCols = static_cast< SCCOL >( getLimitedValue< sal_Int32 >( aIter->GetString().ToInt32(), 1, 256 ) );
break;
case HTML_O_ROWSPAN:
- aSpanSize.mnRows = static_cast< SCROW >( bound( aIter->GetString().ToInt32(), static_cast<sal_Int32>(1), static_cast<sal_Int32>(256) ) );
+ aSpanSize.mnRows = static_cast< SCROW >( getLimitedValue< sal_Int32 >( aIter->GetString().ToInt32(), 1, 256 ) );
break;
case HTML_O_SDVAL:
pValStr.reset( new String( aIter->GetString() ) );
@@ -2172,10 +2156,10 @@ void ScHTMLTable::DataOn( const ImportInfo& rInfo )
}
ImplDataOn( aSpanSize );
- ProcessFormatOptions( *mpDataItemSet, rInfo );
+ ProcessFormatOptions( *mxDataItemSet, rInfo );
CreateNewEntry( rInfo );
- mpCurrEntry->pValStr = pValStr.release();
- mpCurrEntry->pNumStr = pNumStr.release();
+ mxCurrEntry->pValStr = pValStr.release();
+ mxCurrEntry->pNumStr = pNumStr.release();
}
else
CreateNewEntry( rInfo );
@@ -2199,7 +2183,7 @@ void ScHTMLTable::BodyOn( const ImportInfo& rInfo )
ImplRowOn();
if( bPushed || !mbDataOn )
ImplDataOn( ScHTMLSize( 1, 1 ) );
- ProcessFormatOptions( *mpDataItemSet, rInfo );
+ ProcessFormatOptions( *mxDataItemSet, rInfo );
}
CreateNewEntry( rInfo );
}
@@ -2233,29 +2217,33 @@ ScHTMLTable* ScHTMLTable::CloseTable( const ImportInfo& rInfo )
SCCOLROW ScHTMLTable::GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const
{
- const ScSizeVec& rSizes = maSizes[ eOrient ];
- return (static_cast< size_t >( nCellPos ) < rSizes.size()) ? rSizes[ nCellPos ] : 0;
+ const ScSizeVec& rSizes = maCumSizes[ eOrient ];
+ size_t nIndex = static_cast< size_t >( nCellPos );
+ if( nIndex >= rSizes.size() ) return 0;
+ return (nIndex == 0) ? rSizes.front() : (rSizes[ nIndex ] - rSizes[ nIndex - 1 ]);
}
SCCOLROW ScHTMLTable::GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellBegin, SCCOLROW nCellEnd ) const
{
- SCCOLROW nSize = 0;
- for( SCCOLROW nCellPos = nCellBegin; nCellPos < nCellEnd; ++nCellPos )
- nSize += GetDocSize( eOrient, nCellPos );
- return nSize;
+ const ScSizeVec& rSizes = maCumSizes[ eOrient ];
+ size_t nBeginIdx = static_cast< size_t >( ::std::max< SCCOLROW >( nCellBegin, 0 ) );
+ size_t nEndIdx = static_cast< size_t >( ::std::min< SCCOLROW >( nCellEnd, static_cast< SCCOLROW >( rSizes.size() ) ) );
+ if (nBeginIdx >= nEndIdx ) return 0;
+ return rSizes[ nEndIdx - 1 ] - ((nBeginIdx == 0) ? 0 : rSizes[ nBeginIdx - 1 ]);
}
SCCOLROW ScHTMLTable::GetDocSize( ScHTMLOrient eOrient ) const
{
- return GetDocSize( eOrient, 0, maSize.Get( eOrient ) );
+ const ScSizeVec& rSizes = maCumSizes[ eOrient ];
+ return rSizes.empty() ? 0 : rSizes.back();
}
ScHTMLSize ScHTMLTable::GetDocSize( const ScHTMLPos& rCellPos ) const
{
- ScHTMLSize aCellSpan( GetSpan( rCellPos ) );
+ ScHTMLSize aCellSpan = GetSpan( rCellPos );
return ScHTMLSize(
- static_cast<SCCOL>(GetDocSize( tdCol, rCellPos.mnCol, rCellPos.mnCol + aCellSpan.mnCols )),
- static_cast<SCROW>(GetDocSize( tdRow, static_cast<SCCOLROW>(rCellPos.mnRow), static_cast<SCCOLROW>(rCellPos.mnRow + aCellSpan.mnRows) )) );
+ static_cast< SCCOL >( GetDocSize( tdCol, rCellPos.mnCol, rCellPos.mnCol + aCellSpan.mnCols ) ),
+ static_cast< SCROW >( GetDocSize( tdRow, rCellPos.mnRow, rCellPos.mnRow + aCellSpan.mnRows ) ) );
}
SCCOLROW ScHTMLTable::GetDocPos( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const
@@ -2265,13 +2253,15 @@ SCCOLROW ScHTMLTable::GetDocPos( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const
ScHTMLPos ScHTMLTable::GetDocPos( const ScHTMLPos& rCellPos ) const
{
- return ScHTMLPos( static_cast<SCCOL>(GetDocPos( tdCol, static_cast<SCCOLROW>(rCellPos.mnCol)) ), static_cast<SCROW>(GetDocPos( tdRow, static_cast<SCCOLROW>(rCellPos.mnRow) )) );
+ return ScHTMLPos(
+ static_cast< SCCOL >( GetDocPos( tdCol, rCellPos.mnCol ) ),
+ static_cast< SCROW >( GetDocPos( tdRow, rCellPos.mnRow ) ) );
}
void ScHTMLTable::GetDocRange( ScRange& rRange ) const
{
rRange.aStart = rRange.aEnd = maDocBasePos.MakeAddr();
- rRange.aEnd.Move( static_cast<SCsCOL>(GetDocSize( tdCol )) - 1, GetDocSize( tdRow ) - 1, 0 );
+ rRange.aEnd.Move( static_cast< SCsCOL >( GetDocSize( tdCol ) ) - 1, static_cast< SCsROW >( GetDocSize( tdRow ) ) - 1, 0 );
}
void ScHTMLTable::ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const
@@ -2294,8 +2284,8 @@ void ScHTMLTable::ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos
{
SvxBorderLine* pLeftLine = (nCol == 0) ? &aOuterLine : &aInnerLine;
SvxBorderLine* pRightLine = (nCol == nLastCol) ? &aOuterLine : &aInnerLine;
- SCCOL nCellCol1 = static_cast<SCCOL>(GetDocPos( tdCol, nCol )) + rFirstPos.Col();
- SCCOL nCellCol2 = nCellCol1 + static_cast<SCCOL>(GetDocSize( tdCol, nCol )) - 1;
+ SCCOL nCellCol1 = static_cast< SCCOL >( GetDocPos( tdCol, nCol ) ) + rFirstPos.Col();
+ SCCOL nCellCol2 = nCellCol1 + static_cast< SCCOL >( GetDocSize( tdCol, nCol ) ) - 1;
for( SCROW nRow = 0; nRow <= nLastRow; ++nRow )
{
SvxBorderLine* pTopLine = (nRow == 0) ? &aOuterLine : &aInnerLine;
@@ -2317,11 +2307,10 @@ void ScHTMLTable::ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos
}
}
- for( ScHTMLTableIterator aIter( mpNestedTables.get() ); aIter.is(); ++aIter )
+ for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
aIter->ApplyCellBorders( pDoc, rFirstPos );
}
-
// ----------------------------------------------------------------------------
bool ScHTMLTable::IsEmptyCell() const
@@ -2341,37 +2330,39 @@ ScHTMLTable::ScHTMLEntryPtr ScHTMLTable::CreateEntry() const
void ScHTMLTable::CreateNewEntry( const ImportInfo& rInfo )
{
- DBG_ASSERT( !mpCurrEntry.get(), "ScHTMLTable::CreateNewEntry - old entry still present" );
- mpCurrEntry = CreateEntry();
- mpCurrEntry->aSel = rInfo.aSelection;
+ DBG_ASSERT( !mxCurrEntry.get(), "ScHTMLTable::CreateNewEntry - old entry still present" );
+ mxCurrEntry = CreateEntry();
+ mxCurrEntry->aSel = rInfo.aSelection;
}
-void ScHTMLTable::ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rpEntry )
+void ScHTMLTable::ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rxEntry )
{
// HTML entry list does not own the entries
- rEntryList.push_back( rpEntry.get() );
+ rEntryList.push_back( rxEntry.get() );
// mrEEParseList (reference to member of ScEEParser) owns the entries
- mrEEParseList.Insert( rpEntry.release(), LIST_APPEND );
+ mrEEParseList.Insert( rxEntry.release(), LIST_APPEND );
}
-bool ScHTMLTable::PushEntry( ScHTMLEntryPtr& rpEntry )
+bool ScHTMLTable::PushEntry( ScHTMLEntryPtr& rxEntry )
{
bool bPushed = false;
- if( rpEntry.get() && rpEntry->HasContents() )
+ if( rxEntry.get() && rxEntry->HasContents() )
{
if( mpCurrEntryList )
{
if( mbPushEmptyLine )
{
- ScHTMLEntryPtr pEmptyEntry = CreateEntry();
- ImplPushEntryToList( *mpCurrEntryList, pEmptyEntry );
+ ScHTMLEntryPtr xEmptyEntry = CreateEntry();
+ ImplPushEntryToList( *mpCurrEntryList, xEmptyEntry );
mbPushEmptyLine = false;
}
- ImplPushEntryToList( *mpCurrEntryList, rpEntry );
+ ImplPushEntryToList( *mpCurrEntryList, rxEntry );
bPushed = true;
}
else if( mpParentTable )
- bPushed = mpParentTable->PushEntry( rpEntry );
+ {
+ bPushed = mpParentTable->PushEntry( rxEntry );
+ }
else
{
DBG_ERRORFILE( "ScHTMLTable::PushEntry - cannot push entry, no parent found" );
@@ -2382,24 +2373,24 @@ bool ScHTMLTable::PushEntry( ScHTMLEntryPtr& rpEntry )
bool ScHTMLTable::PushEntry( const ImportInfo& rInfo, bool bLastInCell )
{
- DBG_ASSERT( mpCurrEntry.get(), "ScHTMLTable::PushEntry - no current entry" );
+ DBG_ASSERT( mxCurrEntry.get(), "ScHTMLTable::PushEntry - no current entry" );
bool bPushed = false;
- if( mpCurrEntry.get() )
+ if( mxCurrEntry.get() )
{
- mpCurrEntry->AdjustEnd( rInfo );
- mpCurrEntry->Strip( mrEditEngine );
+ mxCurrEntry->AdjustEnd( rInfo );
+ mxCurrEntry->Strip( mrEditEngine );
// import entry always, if it is the last in cell, and cell is still empty
if( bLastInCell && IsEmptyCell() )
{
- mpCurrEntry->SetImportAlways();
+ mxCurrEntry->SetImportAlways();
// don't insert empty lines before single empty entries
- if( mpCurrEntry->IsEmpty() )
+ if( mxCurrEntry->IsEmpty() )
mbPushEmptyLine = false;
}
- bPushed = PushEntry( mpCurrEntry );
- mpCurrEntry.reset();
+ bPushed = PushEntry( mxCurrEntry );
+ mxCurrEntry.reset();
}
return bPushed;
}
@@ -2410,27 +2401,27 @@ bool ScHTMLTable::PushTableEntry( ScHTMLTableId nTableId )
bool bPushed = false;
if( nTableId != SC_HTML_GLOBAL_TABLE )
{
- ScHTMLEntryPtr pEntry( new ScHTMLEntry( maTableItemSet, nTableId ) );
- bPushed = PushEntry( pEntry );
+ ScHTMLEntryPtr xEntry( new ScHTMLEntry( maTableItemSet, nTableId ) );
+ bPushed = PushEntry( xEntry );
}
return bPushed;
}
ScHTMLTable* ScHTMLTable::GetExistingTable( ScHTMLTableId nTableId ) const
{
- ScHTMLTable* pTable = ((nTableId != SC_HTML_GLOBAL_TABLE) && mpNestedTables.get()) ?
- mpNestedTables->FindTable( nTableId, false ) : 0;
+ ScHTMLTable* pTable = ((nTableId != SC_HTML_GLOBAL_TABLE) && mxNestedTables.get()) ?
+ mxNestedTables->FindTable( nTableId, false ) : 0;
DBG_ASSERT( pTable || (nTableId == SC_HTML_GLOBAL_TABLE), "ScHTMLTable::GetExistingTable - table not found" );
return pTable;
}
ScHTMLTable* ScHTMLTable::InsertNestedTable( const ImportInfo& rInfo, bool bPreFormText )
{
- if( !mpNestedTables.get() )
- mpNestedTables.reset( new ScHTMLTableMap( *this ) );
+ if( !mxNestedTables.get() )
+ mxNestedTables.reset( new ScHTMLTableMap( *this ) );
if( bPreFormText ) // enclose new preformatted table with empty lines
InsertLeadingEmptyLine();
- return mpNestedTables->CreateTable( rInfo, bPreFormText );
+ return mxNestedTables->CreateTable( rInfo, bPreFormText );
}
void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize )
@@ -2438,20 +2429,29 @@ void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize )
ScRange* pRange;
// find an unused cell
- while( (pRange = maLockList.Find( maCurrCell.MakeAddr() )) != 0 )
+ while( (pRange = maVMergedCells.Find( maCurrCell.MakeAddr() )) != 0 )
maCurrCell.mnCol = pRange->aEnd.Col() + 1;
mpCurrEntryList = &maEntryMap[ maCurrCell ];
// try to find collisions, shrink existing ranges
SCCOL nColEnd = maCurrCell.mnCol + rSpanSize.mnCols;
for( ScAddress aAddr( maCurrCell.MakeAddr() ); aAddr.Col() < nColEnd; aAddr.IncCol() )
- if( (pRange = maLockList.Find( aAddr )) != 0 )
+ if( (pRange = maVMergedCells.Find( aAddr )) != 0 )
pRange->aEnd.SetRow( maCurrCell.mnRow - 1 );
- // insert the new range into the lock list
+ // insert the new range into the cell lists
ScRange aNewRange( maCurrCell.MakeAddr() );
aNewRange.aEnd.Move( rSpanSize.mnCols - 1, rSpanSize.mnRows - 1, 0 );
- maLockList.Append( aNewRange );
+ if( rSpanSize.mnCols > 1 )
+ {
+ maVMergedCells.Append( aNewRange );
+ }
+ else
+ {
+ if( rSpanSize.mnRows > 1 )
+ maHMergedCells.Append( aNewRange );
+ maUsedCells.Join( aNewRange );
+ }
// adjust table size
maSize.mnCols = ::std::max< SCCOL >( maSize.mnCols, aNewRange.aEnd.Col() + 1 );
@@ -2462,7 +2462,7 @@ void ScHTMLTable::ImplRowOn()
{
if( mbRowOn )
ImplRowOff();
- mpRowItemSet.reset( new SfxItemSet( maTableItemSet ) );
+ mxRowItemSet.reset( new SfxItemSet( maTableItemSet ) );
maCurrCell.mnCol = 0;
mbRowOn = true;
mbDataOn = false;
@@ -2474,7 +2474,7 @@ void ScHTMLTable::ImplRowOff()
ImplDataOff();
if( mbRowOn )
{
- mpRowItemSet.reset();
+ mxRowItemSet.reset();
++maCurrCell.mnRow;
mbRowOn = mbDataOn = false;
}
@@ -2486,7 +2486,7 @@ void ScHTMLTable::ImplDataOn( const ScHTMLSize& rSpanSize )
ImplDataOff();
if( !mbRowOn )
ImplRowOn();
- mpDataItemSet.reset( new SfxItemSet( *mpRowItemSet ) );
+ mxDataItemSet.reset( new SfxItemSet( *mxRowItemSet ) );
InsertNewCell( rSpanSize );
mbDataOn = true;
mbPushEmptyLine = false;
@@ -2496,7 +2496,7 @@ void ScHTMLTable::ImplDataOff()
{
if( mbDataOn )
{
- mpDataItemSet.reset();
+ mxDataItemSet.reset();
++maCurrCell.mnCol;
mpCurrEntryList = 0;
mbDataOn = false;
@@ -2520,11 +2520,11 @@ void ScHTMLTable::ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo&
{
SvxCellHorJustify eVal = SVX_HOR_JUSTIFY_STANDARD;
const String& rOptVal = aIter->GetString();
- if( rOptVal.EqualsIgnoreCaseAscii( sHTML_AL_right ) )
+ if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_right ) )
eVal = SVX_HOR_JUSTIFY_RIGHT;
- else if( rOptVal.EqualsIgnoreCaseAscii( sHTML_AL_center ) )
+ else if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_center ) )
eVal = SVX_HOR_JUSTIFY_CENTER;
- else if( rOptVal.EqualsIgnoreCaseAscii( sHTML_AL_left ) )
+ else if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_left ) )
eVal = SVX_HOR_JUSTIFY_LEFT;
if( eVal != SVX_HOR_JUSTIFY_STANDARD )
rItemSet.Put( SvxHorJustifyItem( eVal, ATTR_HOR_JUSTIFY ) );
@@ -2535,11 +2535,11 @@ void ScHTMLTable::ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo&
{
SvxCellVerJustify eVal = SVX_VER_JUSTIFY_STANDARD;
const String& rOptVal = aIter->GetString();
- if( rOptVal.EqualsIgnoreCaseAscii( sHTML_VA_top ) )
+ if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_VA_top ) )
eVal = SVX_VER_JUSTIFY_TOP;
- else if( rOptVal.EqualsIgnoreCaseAscii( sHTML_VA_middle ) )
+ else if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_VA_middle ) )
eVal = SVX_VER_JUSTIFY_CENTER;
- else if( rOptVal.EqualsIgnoreCaseAscii( sHTML_VA_bottom ) )
+ else if( rOptVal.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_VA_bottom ) )
eVal = SVX_VER_JUSTIFY_BOTTOM;
if( eVal != SVX_VER_JUSTIFY_STANDARD )
rItemSet.Put( SvxVerJustifyItem( eVal, ATTR_VER_JUSTIFY ) );
@@ -2559,11 +2559,17 @@ void ScHTMLTable::ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo&
void ScHTMLTable::SetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW nSize )
{
- ScSizeVec& rSizes = maSizes[ eOrient ];
- if( static_cast< size_t >( nCellPos ) >= rSizes.size() )
- rSizes.resize( static_cast< size_t >( nCellPos + 1 ), 1 ); // expand with minimum height/width == 1
- if( rSizes[ nCellPos ] < nSize )
- rSizes[ nCellPos ] = nSize;
+ DBG_ASSERT( nCellPos >= 0, "ScHTMLTable::SetDocSize - unexpected negative position" );
+ ScSizeVec& rSizes = maCumSizes[ eOrient ];
+ size_t nIndex = static_cast< size_t >( nCellPos );
+ // expand with height/width == 1
+ while( nIndex >= rSizes.size() )
+ rSizes.push_back( rSizes.empty() ? 1 : (rSizes.back() + 1) );
+ // update size of passed position and all following
+ SCsCOLROW nDiff = nSize - ((nIndex == 0) ? rSizes.front() : (rSizes[ nIndex ] - rSizes[ nIndex - 1 ]));
+ if( nDiff != 0 )
+ for( ScSizeVec::iterator aIt = rSizes.begin() + nIndex, aEnd = rSizes.end(); aIt != aEnd; ++aIt )
+ *aIt += nDiff;
}
void ScHTMLTable::CalcNeededDocSize(
@@ -2582,31 +2588,35 @@ void ScHTMLTable::CalcNeededDocSize(
SetDocSize( eOrient, nCellPos, nRealDocSize );
}
-
// ----------------------------------------------------------------------------
void ScHTMLTable::FillEmptyCells()
{
- for( ScHTMLTableIterator aIter( mpNestedTables.get() ); aIter.is(); ++aIter )
+ for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
aIter->FillEmptyCells();
+ for( const ScRange* pRange = maVMergedCells.First(); pRange; pRange = maVMergedCells.Next() )
+ maUsedCells.Join( *pRange );
+
for( ScAddress aAddr; aAddr.Row() < maSize.mnRows; aAddr.IncRow() )
{
for( aAddr.SetCol( 0 ); aAddr.Col() < maSize.mnCols; aAddr.IncCol() )
{
- if( !maLockList.Find( aAddr ) )
+ if( !maUsedCells.Find( aAddr ) )
{
// create a range for the lock list (used to calc. cell span)
ScRange aRange( aAddr );
do
+ {
aRange.aEnd.IncCol();
- while( (aRange.aEnd.Col() < maSize.mnCols) && !maLockList.Find( aRange.aEnd ) );
+ }
+ while( (aRange.aEnd.Col() < maSize.mnCols) && !maUsedCells.Find( aRange.aEnd ) );
aRange.aEnd.IncCol( -1 );
- maLockList.Append( aRange );
+ maUsedCells.Join( aRange );
// insert a dummy entry
- ScHTMLEntryPtr pEntry = CreateEntry();
- ImplPushEntryToList( maEntryMap[ ScHTMLPos( aAddr ) ], pEntry );
+ ScHTMLEntryPtr xEntry = CreateEntry();
+ ImplPushEntryToList( maEntryMap[ ScHTMLPos( aAddr ) ], xEntry );
}
}
}
@@ -2615,7 +2625,7 @@ void ScHTMLTable::FillEmptyCells()
void ScHTMLTable::RecalcDocSize()
{
// recalc table sizes recursively from inner to outer
- for( ScHTMLTableIterator aIter( mpNestedTables.get() ); aIter.is(); ++aIter )
+ for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
aIter->RecalcDocSize();
/* Two passes: first calculates the sizes of single columns/rows, then
@@ -2630,7 +2640,7 @@ void ScHTMLTable::RecalcDocSize()
for( ScHTMLEntryMap::const_iterator aMapIter = maEntryMap.begin(); aMapIter != aMapIterEnd; ++aMapIter )
{
const ScHTMLPos& rCellPos = aMapIter->first;
- ScHTMLSize aCellSpan( GetSpan( rCellPos ) );
+ ScHTMLSize aCellSpan = GetSpan( rCellPos );
const ScHTMLEntryList& rEntryList = aMapIter->second;
ScHTMLEntryList::const_iterator aListIter;
@@ -2650,7 +2660,7 @@ void ScHTMLTable::RecalcDocSize()
ScHTMLTable* pTable = GetExistingTable( (*aListIter)->GetTableId() );
// find entry with maximum width
if( bProcessColWidth && pTable )
- aDocSize.mnCols = ::std::max( aDocSize.mnCols, static_cast<SCCOL>(pTable->GetDocSize( tdCol )) );
+ aDocSize.mnCols = ::std::max( aDocSize.mnCols, static_cast< SCCOL >( pTable->GetDocSize( tdCol ) ) );
// add up height of each entry
if( bProcessRowHeight )
aDocSize.mnRows += pTable ? pTable->GetDocSize( tdRow ) : 1;
@@ -2659,9 +2669,9 @@ void ScHTMLTable::RecalcDocSize()
aDocSize.mnRows = 1;
if( bProcessColWidth )
- CalcNeededDocSize( tdCol, static_cast<SCCOLROW>(rCellPos.mnCol), static_cast<SCCOLROW>(aCellSpan.mnCols), static_cast<SCCOLROW>(aDocSize.mnCols) );
+ CalcNeededDocSize( tdCol, rCellPos.mnCol, aCellSpan.mnCols, aDocSize.mnCols );
if( bProcessRowHeight )
- CalcNeededDocSize( tdRow, static_cast<SCCOLROW>(rCellPos.mnRow), static_cast<SCCOLROW>(aCellSpan.mnRows), static_cast<SCCOLROW>(aDocSize.mnRows) );
+ CalcNeededDocSize( tdRow, rCellPos.mnRow, aCellSpan.mnRows, aDocSize.mnRows );
}
}
}
@@ -2695,12 +2705,12 @@ void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos )
pTable->RecalcDocPos( aEntryDocPos ); // recalc nested table
pEntry->nCol = SCCOL_MAX;
pEntry->nRow = SCROW_MAX;
- SCROW nTableRows = static_cast<SCROW>(pTable->GetDocSize( tdRow ));
+ SCROW nTableRows = static_cast< SCROW >( pTable->GetDocSize( tdRow ) );
// use this entry to pad empty space right of table
if( mpParentTable ) // ... but not in global table
{
- SCCOL nStartCol = aEntryDocPos.mnCol + static_cast<SCCOL>(pTable->GetDocSize( tdCol ));
+ SCCOL nStartCol = aEntryDocPos.mnCol + static_cast< SCCOL >( pTable->GetDocSize( tdCol ) );
SCCOL nNextCol = aEntryDocPos.mnCol + aCellDocSize.mnCols;
if( nStartCol < nNextCol )
{
@@ -2736,11 +2746,11 @@ void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos )
SCROW nFirstUnusedRow = aCellDocPos.mnRow + aCellDocSize.mnRows;
while( aEntryDocPos.mnRow < nFirstUnusedRow )
{
- ScHTMLEntryPtr pDummyEntry( new ScHTMLEntry( pEntry->GetItemSet() ) );
- pDummyEntry->nCol = aEntryDocPos.mnCol;
- pDummyEntry->nRow = aEntryDocPos.mnRow;
- pDummyEntry->nColOverlap = aCellDocSize.mnCols;
- ImplPushEntryToList( rEntryList, pDummyEntry );
+ ScHTMLEntryPtr xDummyEntry( new ScHTMLEntry( pEntry->GetItemSet() ) );
+ xDummyEntry->nCol = aEntryDocPos.mnCol;
+ xDummyEntry->nRow = aEntryDocPos.mnRow;
+ xDummyEntry->nColOverlap = aCellDocSize.mnCols;
+ ImplPushEntryToList( rEntryList, xDummyEntry );
++aEntryDocPos.mnRow;
}
}
@@ -2748,7 +2758,6 @@ void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos )
}
}
-
// ============================================================================
ScHTMLGlobalTable::ScHTMLGlobalTable( SfxItemPool& rPool, EditEngine& rEditEngine, ScEEParseList& rEEParseList, ScHTMLTableId& rnUnusedId ) :
@@ -2770,7 +2779,6 @@ void ScHTMLGlobalTable::Recalc()
RecalcDocPos( GetDocPos() );
}
-
// ============================================================================
ScHTMLQueryParser::ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc ) :
@@ -2778,8 +2786,8 @@ ScHTMLQueryParser::ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc
mnUnusedId( SC_HTML_GLOBAL_TABLE ),
mbTitleOn( false )
{
- mpGlobTable.reset( new ScHTMLGlobalTable( *pPool, *pEdit, *pList, mnUnusedId ) );
- mpCurrTable = mpGlobTable.get();
+ mxGlobTable.reset( new ScHTMLGlobalTable( *pPool, *pEdit, *pList, mnUnusedId ) );
+ mpCurrTable = mxGlobTable.get();
}
ScHTMLQueryParser::~ScHTMLQueryParser()
@@ -2807,7 +2815,7 @@ ULONG ScHTMLQueryParser::Read( SvStream& rStrm, const String& rBaseURL )
aContentType.AppendAscii( pCharSet );
xValues = new SvKeyValueIterator;
- xValues->Append( SvKeyValue( String::CreateFromAscii( sHTML_META_content_type ), aContentType ) );
+ xValues->Append( SvKeyValue( String::CreateFromAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) );
pAttributes = xValues;
}
}
@@ -2817,16 +2825,16 @@ ULONG ScHTMLQueryParser::Read( SvStream& rStrm, const String& rBaseURL )
ULONG nErr = pEdit->Read( rStrm, rBaseURL, EE_FORMAT_HTML, pAttributes );
pEdit->SetImportHdl( aOldLink );
- mpGlobTable->Recalc();
- nColMax = static_cast<SCCOL>(mpGlobTable->GetDocSize( tdCol ) - 1);
- nRowMax = static_cast<SCROW>(mpGlobTable->GetDocSize( tdRow ) - 1);
+ mxGlobTable->Recalc();
+ nColMax = static_cast< SCCOL >( mxGlobTable->GetDocSize( tdCol ) - 1 );
+ nRowMax = static_cast< SCROW >( mxGlobTable->GetDocSize( tdRow ) - 1 );
return nErr;
}
const ScHTMLTable* ScHTMLQueryParser::GetGlobalTable() const
{
- return mpGlobTable.get();
+ return mxGlobTable.get();
}
void ScHTMLQueryParser::ProcessToken( const ImportInfo& rInfo )
@@ -2941,7 +2949,7 @@ void ScHTMLQueryParser::FontOn( const ImportInfo& rInfo )
break;
case HTML_O_SIZE :
{
- sal_uInt32 nSize = bound( aIter->GetNumber(), static_cast<sal_uInt32>(1UL), SC_HTML_FONTSIZES );
+ sal_uInt32 nSize = getLimitedValue< sal_uInt32 >( aIter->GetNumber(), 1, SC_HTML_FONTSIZES );
mpCurrTable->PutItem( SvxFontHeightItem( maFontHeights[ nSize - 1 ], 100, ATTR_FONT_HEIGHT ) );
}
break;
@@ -2960,26 +2968,13 @@ void ScHTMLQueryParser::MetaOn( const ImportInfo& rInfo )
{
if( mpDoc->GetDocumentShell() )
{
- sal_uInt16 nContentOpt = HTML_O_CONTENT;
- rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
HTMLParser* pParser = static_cast< HTMLParser* >( rInfo.pParser );
- const HTMLOptions* pOptions = pParser->GetOptions( &nContentOpt );
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
mpDoc->GetDocumentShell()->GetModel(), uno::UNO_QUERY_THROW);
- SfxFrameHTMLParser::ParseMetaOptions(
+ pParser->ParseMetaOptions(
xDPS->getDocumentProperties(),
- mpDoc->GetDocumentShell()->GetHeaderAttributes(),
- pOptions, eEnc );
- // If the encoding is set by a META tag, it may only overwrite the
- // current encoding if both, the current and the new encoding, are 1-BYTE
- // encodings. Everything else cannot lead to reasonable results.
- if( rtl_isOctetTextEncoding( eEnc ) &&
- rtl_isOctetTextEncoding( pParser->GetSrcEncoding() ) )
- {
- eEnc = GetExtendedCompatibilityTextEncoding( eEnc );
- pParser->SetSrcEncoding( eEnc );
- }
+ mpDoc->GetDocumentShell()->GetHeaderAttributes() );
}
}
@@ -3030,7 +3025,6 @@ void ScHTMLQueryParser::CloseTable( const ImportInfo& rInfo )
mpCurrTable = mpCurrTable->CloseTable( rInfo );
}
-
// ----------------------------------------------------------------------------
IMPL_LINK( ScHTMLQueryParser, HTMLImportHdl, const ImportInfo*, pInfo )
@@ -3065,6 +3059,5 @@ IMPL_LINK( ScHTMLQueryParser, HTMLImportHdl, const ImportInfo*, pInfo )
return 0;
}
-
// ============================================================================
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index fe496af6de3e..2dd2570353be 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -620,14 +620,13 @@ private:
XclExpChTrTabIdBuffer* pTabIdBuffer;
ScDocument* pTempDoc; // empty document
- ScChangeTrack* pTempChangeTrack; // copy of <pOrigChangeTrack>
sal_uInt32 nNewAction; // action number, 1-based
XclExpChTrHeader* pHeader; // header record for last GUID
sal_uInt8 aGUID[ 16 ]; // GUID for action info records
sal_Bool bValidGUID;
- sal_Bool CreateTempChangeTrack();
+ ScChangeTrack* CreateTempChangeTrack();
void PushActionRecord( const ScChangeAction& rAction );
sal_Bool WriteUserNamesStream();
diff --git a/sc/source/filter/inc/biffdump.hxx b/sc/source/filter/inc/biffdump.hxx
deleted file mode 100644
index 777e22fa9463..000000000000
--- a/sc/source/filter/inc/biffdump.hxx
+++ /dev/null
@@ -1,564 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: biffdump.hxx,v $
- * $Revision: 1.22 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_BIFFDUMP_HXX
-#define SC_BIFFDUMP_HXX
-
-#if OSL_DEBUG_LEVEL > 1
-
-// ============================================================================
-
-// 1 = Compile with BIFF dumper.
-#define EXC_INCL_DUMPER 0
-
-// ============================================================================
-
-#if EXC_INCL_DUMPER
-
-#include <vector>
-#include <map>
-#include <tools/string.hxx>
-#include <tools/list.hxx>
-#include "excform.hxx"
-#include "xiroot.hxx"
-
-
-#define MODE_DUMP 0x0000
-#define MODE_SKIP 0x0001
-
-#define MODE_HEX 0x0002
-#define MODE_BODY 0x0000
-#define MODE_NAMEONLY 0x0008
-
-#define MODE_PLAIN 0x0000
-#define MODE_DETAIL 0x0004
-
-
-#define CT_EOL 0x01
-#define CT_NUM 0x02
-#define CT_ALPHA 0x04
-#define CT_ALPHANUM 0x08
-#define CT_HEX 0x10
-#define CT_LOWERALPHA 0x20
-#define CT_UPPERALPHA 0x40
-#define CT_BLANK 0x80
-
-
-#define DELANDNULL(p) {delete p;p=NULL;}
-
-inline void CopyStrpOnStrp( ByteString*& rpToString, const ByteString* pFromString );
-
-
-struct DUMP_ERR
-{
- DUMP_ERR* pNext;
- UINT32 nLine;
- ByteString aText;
- ByteString* pHint;
-
- inline DUMP_ERR( const UINT32 nLine, const ByteString& rText, const ByteString& rHint );
- inline DUMP_ERR( const UINT32 nLine, const ByteString& rText );
- ~DUMP_ERR();
-};
-
-
-
-
-enum _KEYWORD { KW_Unknown, Skipdump, Contload, Parsep, Maxbodylines,
- Include, Exclude, Hex, Body, Comment, Output, Title,
- NameOnly, ClearFile, SkipOffset, ReadContRecs, NoWarnings,
- BlankLine, ExportBookStream };
-
-
-
-
-struct IdRange
-{
- UINT16 nFirst;
- UINT16 nLast;
- IdRange( const UINT16 nF, const UINT16 nL ) : nFirst( nF ), nLast( nL ) {}
-};
-
-
-
-
-class IdRangeList : protected List
-{
-private:
-protected:
-public:
- virtual ~IdRangeList();
-
- using List::Count;
-
- inline const IdRange* First( void );
- inline const IdRange* Next( void );
- inline const IdRange* Get( const UINT32 n ) const;
-
- inline void Append( const UINT16 nFirst, const UINT16 nNext );
-
- void Clear( void );
- };
-
-
-
-
-class Biff8RecDumper : public XclImpRoot
-{
-protected:
- typedef ::std::vector< ByteString > ByteStringVec;
- typedef ::std::map< sal_uInt32, sal_uInt32 > StrmPortionMap;
- typedef ::std::pair< sal_uInt32, sal_uInt16 > XclDumpCtrlPortion;
- typedef ::std::vector< XclDumpCtrlPortion > XclDumpCtrlPortionVec;
-
-
- static const sal_Char* pLevelPreString;
- static const sal_Char* pLevelPreStringNT;
- const sal_Char* pLevelPre;
- UINT16 nLevelCnt;
-
- ByteString* pTitle;
- ByteString* pOutName;
-
- SvFileStream* pDumpStream;
- XclImpStream* pIn;
-
- StrmPortionMap maCtlsPosMap; /// Control data in 'Ctls' stream.
- XclDumpCtrlPortionVec maCtrlStorages;
- XclDumpCtrlPortionVec maCtrlPortions;
- ByteStringVec maNames; /// Defined names.
-
- UINT32 nMaxBodyLines;
- BOOL bEndLoading;
- BOOL bSkip;
- BOOL bSkipOffset;
- BOOL bReadContRecs;
- BOOL bWarnings;
- BOOL bClearFile;
- BOOL bBlankLine;
- BOOL bExportBookStream;
- BOOL bBIFF8;
- bool bEncrypted;
-
- UINT32 nFieldCnt;
- UINT32 nItemCnt;
- UINT32 nTabIndexCnt;
- sal_uInt32 mnEscherPos;
- UINT16 nFontIndex;
- sal_uInt16 mnSubstream;
-
- static const UINT16 nRecCnt;
- UINT16* pDumpModes;
- ByteString** ppRecNames;
-
- static UINT32 nInstances;
-
- static sal_Char* pBlankLine;
- static const UINT16 nLenBlankLine;
-
- static UINT8* pCharType;
- static UINT8* pCharVal;
-
- DUMP_ERR* pFirst;
- DUMP_ERR* pLast;
- DUMP_ERR* pAct;
-
- sal_Char cParSep;
- sal_Char cComm1;
- sal_Char cComm2;
-
- void Print( const ByteString& rStr );
- void Print( const sal_Char* pStr );
-
- UINT16 DumpXF( XclImpStream& rIn, const sal_Char* pPre );
- void DumpValidPassword( XclImpStream& rIn, const sal_Char* pPre );
- void RecDump( BOOL bSubStream = FALSE );
- void EscherDump( const ULONG nL, bool bDumpOffset );
- void ObjDump( const ULONG nL );
- void ContDump( const ULONG nL );
- void FormulaDump( const UINT16 nL, const FORMULA_TYPE eFT );
-
- void DumpBinary( SvStream& rInStrm, ULONG nSize = STREAM_SEEK_TO_END );
-
- void DumpControlContents( SvStream& rInStrm, sal_uInt16 nCtrlType );
- void DumpControlContainer( SvStream& rInStrm, sal_uInt16 nCtrlType );
-
- void DumpBinaryStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath );
- void DumpTextStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath );
- void DumpRecordStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath );
- void DumpCtlsStream();
- void DumpControlFrameStream( SotStorageRef xInStrg, sal_uInt16 nCtrlType, const String& rStrgPath );
- void DumpControlObjectsStream( SotStorageRef xInStrg, const String& rStrgPath );
-
- void DumpAnyStorage( SotStorageRef xParentStrg, const String& rStrgName, const String& rStrgPath );
- void DumpUserFormStorage( SotStorageRef xParentStrg, const String& rStrgName, sal_uInt16 nCtrlType, const String& rStrgPath );
- void DumpVbaProjectStorage();
-
- void PreDumpDecrypted( ULONG nL );
- static const sal_Char* GetBlanks( const UINT16 nNumOfBlanks );
- static BOOL IsLineEnd( const sal_Char c, sal_Char& rNext, SvStream& rIn, INT32& rLeft );
- void Init( void );
- static _KEYWORD GetKeyType( const ByteString& rString );
- BOOL ExecCommand( const UINT32 nLine, const ByteString& rCommand,
- const ByteString* pVal = NULL );
- BOOL ExecSetVal( const UINT32 nLine, const ByteString& rId,
- const ByteString* pName, const ByteString* pInExClude,
- const ByteString* pHexBody );
-
- inline void SetMode( const UINT16 nRecNum, const UINT16 nMode );
- inline UINT16 GetMode( const UINT16 nRecNum ) const;
- inline UINT16* GetModeRef( const UINT16 nRecNum ) const;
- inline BOOL HasMode( const UINT16 nRecNum, const UINT16 nRefMode ) const;
- inline BOOL HasModeDump( const UINT16 nRecNum ) const;
- inline BOOL HasModeSkip( const UINT16 nRecNum ) const;
- inline BOOL HasModeHex( const UINT16 nRecNum ) const;
- inline BOOL HasModeBody( const UINT16 nRecNum ) const;
- inline BOOL HasModePlain( const UINT16 nRecNum ) const;
- inline BOOL HasModeDetail( const UINT16 nRecNum ) const;
- inline BOOL HasModeNameOnly( const UINT16 nRecNum ) const;
- void SetFlag( const UINT16 nFirst, const UINT16 nLast, const UINT16 nFlags );
- void ClrFlag( const UINT16 nFirst, const UINT16 nLast, const UINT16 nFlags );
-
- inline void SetName( const UINT16 nRecNum, const sal_Char* pName );
- inline void SetName( const UINT16 nRecNum, const ByteString& rName );
- void SetName( const UINT16 nRecNum, ByteString* pName );
- inline const ByteString* GetName( const UINT16 nRecNum );
-
- inline static BOOL IsNum( const sal_Char c );
- inline static BOOL IsAlpha( const sal_Char c );
- inline static BOOL IsAlphaNum( const sal_Char c );
- inline static BOOL IsHex( const sal_Char c );
- inline static BOOL IsEndOfLine( const sal_Char c );
- inline static BOOL IsBlank( const sal_Char c );
- static UINT32 GetVal( const ByteString& rString );
- BOOL FillIdRangeList( const UINT32 nLine, IdRangeList& rRangeList,
- const ByteString& rVals );
- inline static UINT8 GetVal( const sal_Char c );
- BOOL CreateOutStream();
- static SvFileStream* CreateInStream( const sal_Char* pName );
- static SvFileStream* CreateInStream( const sal_Char* pPath, const sal_Char* pName );
-
- void AddError( const UINT32 nLine, const ByteString& rText, const ByteString& rHint );
- inline void AddError( const UINT32 nLine, const sal_Char* pText, const ByteString& rHint );
- inline void AddError( const UINT32 nLine, const ByteString& rText );
- inline void AddError( const UINT32 nLine, const sal_Char* pText );
- inline const DUMP_ERR* FirstErr( void );
- inline const DUMP_ERR* NextErr( void );
-public:
- Biff8RecDumper( const XclImpRoot& rRoot, BOOL bBIFF8 );
- ~Biff8RecDumper();
- BOOL Dump( XclImpStream& rIn );
- // = TRUE -> nicht weiter laden
-
- inline static BOOL IsPrintable( const UINT8 nC );
- };
-
-
-
-
-inline void CopyStrpOnStrp( ByteString*& rp, const ByteString* p )
-{
- if( p )
- {
- if( rp )
- *rp = *p;
- else
- rp = new ByteString( *p );
- }
- else if( rp )
- {
- delete rp;
- rp = NULL;
- }
-}
-
-
-
-
-inline DUMP_ERR::DUMP_ERR( const UINT32 n, const ByteString& rT, const ByteString& rH ) :
- nLine( n ), aText( rT ), pNext( NULL )
-{
- pHint = new ByteString( rH );
-}
-
-
-inline DUMP_ERR::DUMP_ERR( const UINT32 n, const ByteString& rT ) :
- nLine( n ), aText( rT ), pHint( NULL ), pNext( NULL )
-{
-}
-
-
-
-
-inline const IdRange* IdRangeList::First( void )
-{
- return ( const IdRange* ) List::First();
-}
-
-
-inline const IdRange* IdRangeList::Next( void )
-{
- return ( const IdRange* ) List::Next();
-}
-
-
-inline const IdRange* IdRangeList::Get( const UINT32 n ) const
-{
- return ( const IdRange* ) List::GetObject( n );
-}
-
-
-inline void IdRangeList::Append( const UINT16 n1, const UINT16 n2 )
-{
- List::Insert( new IdRange( n1, n2 ), LIST_APPEND );
-}
-
-
-
-
-inline void Biff8RecDumper::SetMode( const UINT16 n, const UINT16 nM )
-{
- if( n < nRecCnt )
- pDumpModes[ n ] = nM;
-}
-
-
-inline UINT16 Biff8RecDumper::GetMode( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return pDumpModes[ n ];
- else
- return 0xFFFF;
-}
-
-
-inline UINT16* Biff8RecDumper::GetModeRef( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return pDumpModes + n;
- else
- return NULL;
-}
-
-
-inline BOOL Biff8RecDumper::HasMode( const UINT16 n, const UINT16 nM ) const
-{
- if( n < nRecCnt )
- return ( pDumpModes[ n ] & nM ) == nM;
- else
- return FALSE;
-}
-
-
-inline BOOL Biff8RecDumper::HasModeDump( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return ( pDumpModes[ n ] & MODE_SKIP ) == 0;
- else
- return FALSE;
-}
-
-
-inline BOOL Biff8RecDumper::HasModeSkip( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return ( pDumpModes[ n ] & MODE_SKIP ) != 0;
- else
- return FALSE;
-}
-
-
-inline BOOL Biff8RecDumper::HasModeHex( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return ( pDumpModes[ n ] & MODE_HEX ) != 0;
- else
- return FALSE;
-}
-
-
-inline BOOL Biff8RecDumper::HasModeBody( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return ( pDumpModes[ n ] & MODE_HEX ) == 0;
- else
- return FALSE;
-}
-
-
-inline BOOL Biff8RecDumper::HasModePlain( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return ( pDumpModes[ n ] & MODE_DETAIL ) == 0;
- else
- return FALSE;
-}
-
-
-inline BOOL Biff8RecDumper::HasModeDetail( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return ( pDumpModes[ n ] & MODE_DETAIL ) != 0;
- else
- return FALSE;
-}
-
-
-inline BOOL Biff8RecDumper::HasModeNameOnly( const UINT16 n ) const
-{
- if( n < nRecCnt )
- return ( pDumpModes[ n ] & MODE_NAMEONLY ) != 0;
- else
- return FALSE;
-}
-
-
-inline void Biff8RecDumper::SetName( const UINT16 n, const sal_Char* p )
-{
- if( n < nRecCnt )
- {
- if( ppRecNames[ n ] )
- *ppRecNames[ n ] = p;
- else
- ppRecNames[ n ] = new ByteString( p );
- }
-}
-
-
-inline void Biff8RecDumper::SetName( const UINT16 n, const ByteString& r )
-{
- if( n < nRecCnt )
- {
- if( ppRecNames[ n ] )
- *ppRecNames[ n ] = r;
- else
- ppRecNames[ n ] = new ByteString( r );
- }
-}
-
-
-inline const ByteString* Biff8RecDumper::GetName( const UINT16 n )
-{
- if( n < nRecCnt )
- return ppRecNames[ n ];
- else
- return NULL;
-}
-
-
-inline BOOL Biff8RecDumper::IsNum( const sal_Char c )
-{
- return ( pCharType[ ( UINT8 ) c ] & CT_NUM ) != 0;
-}
-
-
-inline BOOL Biff8RecDumper::IsAlpha( const sal_Char c )
-{
- return ( pCharType[ ( UINT8 ) c ] & CT_ALPHA ) != 0;
-}
-
-
-inline BOOL Biff8RecDumper::IsAlphaNum( const sal_Char c )
-{
- return ( pCharType[ ( UINT8 ) c ] & CT_ALPHANUM ) != 0;
-}
-
-
-inline BOOL Biff8RecDumper::IsHex( const sal_Char c )
-{
- return ( pCharType[ ( UINT8 ) c ] & CT_HEX ) != 0;
-}
-
-
-inline BOOL Biff8RecDumper::IsEndOfLine( const sal_Char c )
-{
- return ( pCharType[ ( UINT8 ) c ] & CT_EOL ) != 0;
-}
-
-
-inline BOOL Biff8RecDumper::IsBlank( const sal_Char c )
-{
- return ( pCharType[ ( UINT8 ) c ] & CT_BLANK ) != 0;
-}
-
-
-inline UINT8 Biff8RecDumper::GetVal( const sal_Char c )
-{
- return pCharVal[ ( UINT8 ) c ];
-}
-
-
-inline void Biff8RecDumper::AddError( const UINT32 n, const sal_Char* p, const ByteString& r )
-{
- AddError( n, ByteString( p ), r );
-}
-
-
-inline void Biff8RecDumper::AddError( const UINT32 nLine, const ByteString& rText )
-{
- AddError( nLine, rText, ByteString::EmptyString() );
-}
-
-
-inline void Biff8RecDumper::AddError( const UINT32 nLine, const sal_Char* pText )
-{
- AddError( nLine, ByteString( pText ), ByteString::EmptyString() );
-}
-
-
-inline const DUMP_ERR* Biff8RecDumper::FirstErr( void )
-{
- pAct = pFirst;
- return pAct;
-}
-
-
-inline const DUMP_ERR* Biff8RecDumper::NextErr( void )
-{
- if( pAct )
- pAct = pAct->pNext;
-
- return pAct;
-}
-
-
-inline BOOL Biff8RecDumper::IsPrintable( const UINT8 n )
-{
- return n >= ' ';
-}
-
-
-#endif
-#else
-// never use the dumper in product builds
-#define EXC_INCL_DUMPER 0
-#endif
-#endif
-
diff --git a/sc/source/filter/inc/dif.hxx b/sc/source/filter/inc/dif.hxx
index ed7b810b231a..9fc63f72f72b 100644
--- a/sc/source/filter/inc/dif.hxx
+++ b/sc/source/filter/inc/dif.hxx
@@ -82,7 +82,11 @@ private:
SvNumberFormatter* pNumFormatter;
SvStream& rIn;
BOOL bPlain;
+ String aLookAheadLine;
+ bool ReadNextLine( String& rStr );
+ bool LookAhead();
+ DATASET GetNumberDataset( const sal_Unicode* pPossibleNumericData );
static inline BOOL IsBOT( const sal_Unicode* pRef );
static inline BOOL IsEOD( const sal_Unicode* pRef );
static inline BOOL Is1_0( const sal_Unicode* pRef );
diff --git a/sc/source/filter/inc/excimp8.hxx b/sc/source/filter/inc/excimp8.hxx
index 0acf4c09501b..8a30d6f9e9c5 100644
--- a/sc/source/filter/inc/excimp8.hxx
+++ b/sc/source/filter/inc/excimp8.hxx
@@ -62,7 +62,6 @@ class ImportExcel8 : public ImportExcel
void Precision( void ); // 0x0E
void Delta( void ); // 0x10
void Iteration( void ); // 0x11
- void WinProtection( void ); // 0x19
void Boundsheet( void ); // 0x85
void FilterMode( void ); // 0x9B
void AutoFilterInfo( void ); // 0x9D
@@ -74,6 +73,7 @@ class ImportExcel8 : public ImportExcel
void Hlink( void ); // 0x01B8
void Codename( BOOL bWBGlobals ); // 0x01BA
+ void SheetProtection( void ); // 0x0867
virtual void EndSheet( void );
virtual void PostDocLoad( void );
diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx
index da4115fc8003..1f2eee05fd55 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -246,10 +246,23 @@ class XclExpWindowProtection : public XclExpBoolRecord
};
// EXC_ID_PROTECT Document Protection
-class XclExpDocProtection : public XclExpBoolRecord
+class XclExpProtection : public XclExpBoolRecord
{
public:
- XclExpDocProtection(bool bValue);
+ XclExpProtection(bool bValue);
+};
+
+class XclExpPassHash : public XclExpRecord
+{
+public:
+ XclExpPassHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aHash);
+ virtual ~XclExpPassHash();
+
+private:
+ virtual void WriteBody(XclExpStream& rStrm);
+
+private:
+ sal_uInt16 mnHash;
};
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index b75a44c618db..e3f53a5ddc5b 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -218,30 +218,29 @@ const ScHTMLTableId SC_HTML_GLOBAL_TABLE = 0;
/** Used as table index for normal (non-table) entries in ScHTMLEntry structs. */
const ScHTMLTableId SC_HTML_NO_TABLE = 0;
-
// ============================================================================
/** A 2D cell position in an HTML table. */
struct ScHTMLPos
{
- SCCOL mnCol;
- SCROW mnRow;
-
- inline explicit ScHTMLPos() : mnCol( 0 ), mnRow( 0 ) {}
- inline explicit ScHTMLPos( SCCOL nCol, SCROW nRow ) :
- mnCol( nCol ), mnRow( nRow ) {}
- inline explicit ScHTMLPos( const ScAddress& rAddr ) { Set( rAddr ); }
-
- inline SCCOLROW Get( ScHTMLOrient eOrient ) const
- { return (eOrient == tdCol) ? static_cast<SCCOLROW>(mnCol) : static_cast<SCCOLROW>(mnRow); }
- inline void Set( SCCOL nCol, SCROW nRow )
- { mnCol = nCol; mnRow = nRow; }
- inline void Set( const ScAddress& rAddr )
- { Set( rAddr.Col(), rAddr.Row() ); }
- inline void Move( SCsCOL nColDiff, SCsROW nRowDiff )
- { mnCol = mnCol + nColDiff; mnRow = mnRow + nRowDiff; }
- inline ScAddress MakeAddr() const
- { return ScAddress( mnCol, mnRow, 0 ); }
+ SCCOL mnCol;
+ SCROW mnRow;
+
+ inline explicit ScHTMLPos() : mnCol( 0 ), mnRow( 0 ) {}
+ inline explicit ScHTMLPos( SCCOL nCol, SCROW nRow ) :
+ mnCol( nCol ), mnRow( nRow ) {}
+ inline explicit ScHTMLPos( const ScAddress& rAddr ) { Set( rAddr ); }
+
+ inline SCCOLROW Get( ScHTMLOrient eOrient ) const
+ { return (eOrient == tdCol) ? mnCol : mnRow; }
+ inline void Set( SCCOL nCol, SCROW nRow )
+ { mnCol = nCol; mnRow = nRow; }
+ inline void Set( const ScAddress& rAddr )
+ { Set( rAddr.Col(), rAddr.Row() ); }
+ inline void Move( SCsCOL nColDiff, SCsROW nRowDiff )
+ { mnCol = mnCol + nColDiff; mnRow = mnRow + nRowDiff; }
+ inline ScAddress MakeAddr() const
+ { return ScAddress( mnCol, mnRow, 0 ); }
};
inline bool operator==( const ScHTMLPos& rPos1, const ScHTMLPos& rPos2 )
@@ -254,25 +253,24 @@ inline bool operator<( const ScHTMLPos& rPos1, const ScHTMLPos& rPos2 )
return (rPos1.mnRow < rPos2.mnRow) || ((rPos1.mnRow == rPos2.mnRow) && (rPos1.mnCol < rPos2.mnCol));
}
-
// ----------------------------------------------------------------------------
/** A 2D cell size in an HTML table. */
struct ScHTMLSize
{
- SCCOL mnCols;
- SCROW mnRows;
-
- inline explicit ScHTMLSize() : mnCols( 0 ), mnRows( 0 ) {}
- inline explicit ScHTMLSize( SCCOL nCols, SCROW nRows ) :
- mnCols( nCols ), mnRows( nRows ) {}
-
- inline SCCOLROW Get( ScHTMLOrient eOrient ) const
- { return (eOrient == tdCol) ? static_cast<SCCOLROW>(mnCols) : static_cast<SCCOLROW>(mnRows); }
- inline void Set( SCCOL nCols, SCROW nRows )
- { mnCols = nCols; mnRows = nRows; }
- inline void Expand( SCsCOL nColDiff, SCsROW nRowDiff )
- { mnCols = mnCols + nColDiff; mnRows = mnRows + nRowDiff; }
+ SCCOL mnCols;
+ SCROW mnRows;
+
+ inline explicit ScHTMLSize() : mnCols( 0 ), mnRows( 0 ) {}
+ inline explicit ScHTMLSize( SCCOL nCols, SCROW nRows ) :
+ mnCols( nCols ), mnRows( nRows ) {}
+
+ inline SCCOLROW Get( ScHTMLOrient eOrient ) const
+ { return (eOrient == tdCol) ? mnCols : mnRows; }
+ inline void Set( SCCOL nCols, SCROW nRows )
+ { mnCols = nCols; mnRows = nRows; }
+ inline void Expand( SCsCOL nColDiff, SCsROW nRowDiff )
+ { mnCols = mnCols + nColDiff; mnRows = mnRows + nRowDiff; }
};
inline bool operator==( const ScHTMLSize& rSize1, const ScHTMLSize& rSize2 )
@@ -280,183 +278,182 @@ inline bool operator==( const ScHTMLSize& rSize1, const ScHTMLSize& rSize2 )
return (rSize1.mnRows == rSize2.mnRows) && (rSize1.mnCols == rSize2.mnCols);
}
-
// ============================================================================
/** A single entry containing a line of text or representing a table. */
struct ScHTMLEntry : public ScEEParseEntry
{
public:
- explicit ScHTMLEntry(
- const SfxItemSet& rItemSet,
- ScHTMLTableId nTableId = SC_HTML_NO_TABLE );
+ explicit ScHTMLEntry(
+ const SfxItemSet& rItemSet,
+ ScHTMLTableId nTableId = SC_HTML_NO_TABLE );
/** Returns true, if the selection of the entry is empty. */
- inline bool IsEmpty() const { return !aSel.HasRange(); }
+ inline bool IsEmpty() const { return !aSel.HasRange(); }
/** Returns true, if the entry has any content to be imported. */
- bool HasContents() const;
+ bool HasContents() const;
/** Returns true, if the entry represents a table. */
- inline bool IsTable() const { return nTab != SC_HTML_NO_TABLE; }
+ inline bool IsTable() const { return nTab != SC_HTML_NO_TABLE; }
/** Returns true, if the entry represents a table. */
- inline ScHTMLTableId GetTableId() const { return nTab; }
+ inline ScHTMLTableId GetTableId() const { return nTab; }
/** Sets or cleares the import always state. */
- inline void SetImportAlways( bool bSet = true ) { mbImportAlways = bSet; }
+ inline void SetImportAlways( bool bSet = true ) { mbImportAlways = bSet; }
/** Sets start point of the entry selection to the start of the import info object. */
- void AdjustStart( const ImportInfo& rInfo );
+ void AdjustStart( const ImportInfo& rInfo );
/** Sets end point of the entry selection to the end of the import info object. */
- void AdjustEnd( const ImportInfo& rInfo );
+ void AdjustEnd( const ImportInfo& rInfo );
/** Deletes leading and trailing empty paragraphs from the entry. */
- void Strip( const EditEngine& rEditEngine );
+ void Strip( const EditEngine& rEditEngine );
/** Returns read/write access to the item set of this entry. */
- inline SfxItemSet& GetItemSet() { return aItemSet; }
+ inline SfxItemSet& GetItemSet() { return aItemSet; }
/** Returns read-only access to the item set of this entry. */
- inline const SfxItemSet& GetItemSet() const { return aItemSet; }
+ inline const SfxItemSet& GetItemSet() const { return aItemSet; }
private:
- bool mbImportAlways; /// true = Always import this entry.
+ bool mbImportAlways; /// true = Always import this entry.
};
-
// ============================================================================
/** This struct handles creation of unique table identifiers. */
struct ScHTMLTableAutoId
{
- const ScHTMLTableId mnTableId; /// The created unique table identifier.
- ScHTMLTableId& mrnUnusedId; /// Reference to global unused identifier variable.
+ const ScHTMLTableId mnTableId; /// The created unique table identifier.
+ ScHTMLTableId& mrnUnusedId; /// Reference to global unused identifier variable.
/** The constructor assigns an unused identifier to member mnTableId. */
- explicit ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId );
+ explicit ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId );
};
-
// ----------------------------------------------------------------------------
class ScHTMLTableMap;
/** Stores data for one table in an HTML document.
- @descr This class does the main work for importing an HTML document. It manages
- the correct insertion of parse entries into the correct cells and the creation
- of nested tables. Recalculation of resulting document size and position is done
- recursively in all nested tables. */
+
+ This class does the main work for importing an HTML document. It manages
+ the correct insertion of parse entries into the correct cells and the
+ creation of nested tables. Recalculation of resulting document size and
+ position is done recursively in all nested tables.
+ */
class ScHTMLTable
{
public:
/** Creates a new HTML table without content.
- @descr Internally handles a current cell position. This position is invalid
- until first calls of RowOn() and DataOn().
+ @descr Internally handles a current cell position. This position is
+ invalid until first calls of RowOn() and DataOn().
@param rParentTable Reference to the parent table that owns this table.
@param bPreFormText true = Table is based on preformatted text (<pre> tag). */
- explicit ScHTMLTable(
- ScHTMLTable& rParentTable,
- const ImportInfo& rInfo,
- bool bPreFormText );
+ explicit ScHTMLTable(
+ ScHTMLTable& rParentTable,
+ const ImportInfo& rInfo,
+ bool bPreFormText );
- virtual ~ScHTMLTable();
+ virtual ~ScHTMLTable();
/** Returns the name of the table, specified in the TABLE tag. */
- inline const String& GetTableName() const { return maTableName; }
+ inline const String& GetTableName() const { return maTableName; }
/** Returns the unique identifier of the table. */
- inline ScHTMLTableId GetTableId() const { return maTableId.mnTableId; }
+ inline ScHTMLTableId GetTableId() const { return maTableId.mnTableId; }
/** Returns the table size. */
- inline const ScHTMLSize& GetSize() const { return maSize; }
+ inline const ScHTMLSize& GetSize() const { return maSize; }
/** Returns the cell spanning of the specified cell. */
- ScHTMLSize GetSpan( const ScHTMLPos& rCellPos ) const;
+ ScHTMLSize GetSpan( const ScHTMLPos& rCellPos ) const;
/** Searches in all nested tables for the specified table.
@param nTableId Unique identifier of the table. */
- ScHTMLTable* FindNestedTable( ScHTMLTableId nTableId ) const;
+ ScHTMLTable* FindNestedTable( ScHTMLTableId nTableId ) const;
/** Puts the item into the item set of the current entry. */
- void PutItem( const SfxPoolItem& rItem );
+ void PutItem( const SfxPoolItem& rItem );
/** Inserts a text portion into current entry. */
- void PutText( const ImportInfo& rInfo );
+ void PutText( const ImportInfo& rInfo );
/** Inserts a new line, if in preformatted text, else does nothing. */
- void InsertPara( const ImportInfo& rInfo );
+ void InsertPara( const ImportInfo& rInfo );
/** Inserts a line break (<br> tag).
@descr Inserts the current entry regardless if it is empty. */
- void BreakOn();
+ void BreakOn();
/** Inserts a heading line (<p> and <h*> tags). */
- void HeadingOn();
+ void HeadingOn();
/** Processes a hyperlink (<a> tag). */
- void AnchorOn();
+ void AnchorOn();
/** Starts a *new* table nested in this table (<table> tag).
@return Pointer to the new table. */
- ScHTMLTable* TableOn( const ImportInfo& rInfo );
+ ScHTMLTable* TableOn( const ImportInfo& rInfo );
/** Closes *this* table (</table> tag).
@return Pointer to the parent table. */
- ScHTMLTable* TableOff( const ImportInfo& rInfo );
+ ScHTMLTable* TableOff( const ImportInfo& rInfo );
/** Starts a *new* table based on preformatted text (<pre> tag).
@return Pointer to the new table. */
- ScHTMLTable* PreOn( const ImportInfo& rInfo );
+ ScHTMLTable* PreOn( const ImportInfo& rInfo );
/** Closes *this* table based on preformatted text (</pre> tag).
@return Pointer to the parent table. */
- ScHTMLTable* PreOff( const ImportInfo& rInfo );
+ ScHTMLTable* PreOff( const ImportInfo& rInfo );
/** Starts next row (<tr> tag).
@descr Cell address is invalid until first call of DataOn(). */
- void RowOn( const ImportInfo& rInfo );
+ void RowOn( const ImportInfo& rInfo );
/** Closes the current row (<tr> tag).
@descr Cell address is invalid until call of RowOn() and DataOn(). */
- void RowOff( const ImportInfo& rInfo );
+ void RowOff( const ImportInfo& rInfo );
/** Starts the next cell (<td> or <th> tag). */
- void DataOn( const ImportInfo& rInfo );
+ void DataOn( const ImportInfo& rInfo );
/** Closes the current cell (</td> or </th> tag).
@descr Cell address is invalid until next call of DataOn(). */
- void DataOff( const ImportInfo& rInfo );
+ void DataOff( const ImportInfo& rInfo );
/** Starts the body of the HTML document (<body> tag). */
- void BodyOn( const ImportInfo& rInfo );
+ void BodyOn( const ImportInfo& rInfo );
/** Closes the body of the HTML document (</body> tag). */
- void BodyOff( const ImportInfo& rInfo );
+ void BodyOff( const ImportInfo& rInfo );
/** Closes *this* table (</table> tag) or preformatted text (</pre> tag).
@descr Used to close this table object regardless on opening tag type.
@return Pointer to the parent table, or this, if no parent found. */
- ScHTMLTable* CloseTable( const ImportInfo& rInfo );
+ ScHTMLTable* CloseTable( const ImportInfo& rInfo );
/** Returns the resulting document row/column count of the specified HTML row/column. */
- SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const;
- /** Returns the resulting document row/column count in the range [nCellBegin, nCellEnd). */
- SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellBegin, SCCOLROW nCellEnd ) const;
+ SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos ) const;
+ /** Returns the resulting document row/column count in the half-open range [nCellBegin, nCellEnd). */
+ SCCOLROW GetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellBegin, SCCOLROW nCellEnd ) const;
/** Returns the total document row/column count in the specified direction. */
- SCCOLROW GetDocSize( ScHTMLOrient eOrient ) const;
+ SCCOLROW GetDocSize( ScHTMLOrient eOrient ) const;
/** Returns the total document row/column count of the specified HTML cell. */
- ScHTMLSize GetDocSize( const ScHTMLPos& rCellPos ) const;
+ ScHTMLSize GetDocSize( const ScHTMLPos& rCellPos ) const;
/** Returns the resulting Calc position of the top left edge of the table. */
- inline const ScHTMLPos& GetDocPos() const { return maDocBasePos; }
+ inline const ScHTMLPos& GetDocPos() const { return maDocBasePos; }
/** Calculates the resulting Calc position of the specified HTML column/row. */
- SCCOLROW GetDocPos( ScHTMLOrient eOrient, SCCOLROW nCellPos = 0 ) const;
+ SCCOLROW GetDocPos( ScHTMLOrient eOrient, SCCOLROW nCellPos = 0 ) const;
/** Calculates the resulting Calc position of the specified HTML cell. */
- ScHTMLPos GetDocPos( const ScHTMLPos& rCellPos ) const;
+ ScHTMLPos GetDocPos( const ScHTMLPos& rCellPos ) const;
/** Calculates the current Calc document area of this table. */
- void GetDocRange( ScRange& rRange ) const;
+ void GetDocRange( ScRange& rRange ) const;
/** Applies border formatting to the passed document. */
- void ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const;
+ void ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const;
protected:
/** Creates a new HTML table without parent.
@descr This constructor is used to create the "global table". */
- explicit ScHTMLTable(
- SfxItemPool& rPool,
- EditEngine& rEditEngine,
- ScEEParseList& rEEParseList,
- ScHTMLTableId& rnUnusedId );
+ explicit ScHTMLTable(
+ SfxItemPool& rPool,
+ EditEngine& rEditEngine,
+ ScEEParseList& rEEParseList,
+ ScHTMLTableId& rnUnusedId );
/** Fills all empty cells in this and nested tables with dummy parse entries. */
- void FillEmptyCells();
+ void FillEmptyCells();
/** Recalculates the size of all columns/rows in the table, regarding nested tables. */
- void RecalcDocSize();
+ void RecalcDocSize();
/** Recalculates the position of all cell entries and nested tables.
@param rBasePos The origin of the table in the Calc document. */
- void RecalcDocPos( const ScHTMLPos& rBasePos );
+ void RecalcDocPos( const ScHTMLPos& rBasePos );
private:
typedef ::std::auto_ptr< ScHTMLTableMap > ScHTMLTableMapPtr;
@@ -467,172 +464,174 @@ private:
typedef ::std::auto_ptr< ScHTMLEntry > ScHTMLEntryPtr;
/** Returns true, if the current cell does not contain an entry yet. */
- bool IsEmptyCell() const;
+ bool IsEmptyCell() const;
/** Returns the item set from cell, row, or table, depending on current state. */
- const SfxItemSet& GetCurrItemSet() const;
+ const SfxItemSet& GetCurrItemSet() const;
/** Returns true, if import info represents a space character. */
- static bool IsSpaceCharInfo( const ImportInfo& rInfo );
+ static bool IsSpaceCharInfo( const ImportInfo& rInfo );
/** Creates and returns a new empty flying entry at position (0,0). */
- ScHTMLEntryPtr CreateEntry() const;
+ ScHTMLEntryPtr CreateEntry() const;
/** Creates a new flying entry.
@param rInfo Contains the initial edit engine selection for the entry. */
- void CreateNewEntry( const ImportInfo& rInfo );
+ void CreateNewEntry( const ImportInfo& rInfo );
/** Inserts an empty line in front of the next entry. */
- void InsertLeadingEmptyLine();
+ void InsertLeadingEmptyLine();
/** Pushes the passed entry into the list of the current cell. */
- void ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rpEntry );
+ void ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rxEntry );
/** Tries to insert the entry into the current cell.
@descr If insertion is not possible (i.e., currently no cell open), the
entry will be inserted into the parent table.
@return true = Entry as been pushed into the current cell; false = Entry dropped. */
- bool PushEntry( ScHTMLEntryPtr& rpEntry );
+ bool PushEntry( ScHTMLEntryPtr& rxEntry );
/** Puts the current entry into the entry list, if it is not empty.
@param rInfo The import info struct containing the end position of the current entry.
@param bLastInCell true = If cell is still empty, put this entry always.
@return true = Entry as been pushed into the current cell; false = Entry dropped. */
- bool PushEntry( const ImportInfo& rInfo, bool bLastInCell = false );
+ bool PushEntry( const ImportInfo& rInfo, bool bLastInCell = false );
/** Pushes a new entry into current cell which references a nested table.
@return true = Entry as been pushed into the current cell; false = Entry dropped. */
- bool PushTableEntry( ScHTMLTableId nTableId );
+ bool PushTableEntry( ScHTMLTableId nTableId );
/** Tries to find a table from the table container.
@descr Assumes that the table is located in the current container or
that the passed table identifier is 0.
@param nTableId Unique identifier of the table or 0. */
- ScHTMLTable* GetExistingTable( ScHTMLTableId nTableId ) const;
+ ScHTMLTable* GetExistingTable( ScHTMLTableId nTableId ) const;
/** Inserts a nested table in the current cell at the specified position.
@param bPreFormText true = New table is based on preformatted text (<pre> tag). */
- ScHTMLTable* InsertNestedTable( const ImportInfo& rInfo, bool bPreFormText );
+ ScHTMLTable* InsertNestedTable( const ImportInfo& rInfo, bool bPreFormText );
/** Inserts a new cell in an unused position, starting from current cell position. */
- void InsertNewCell( const ScHTMLSize& rSpanSize );
+ void InsertNewCell( const ScHTMLSize& rSpanSize );
/** Set internal states for a new table row. */
- void ImplRowOn();
+ void ImplRowOn();
/** Set internal states for leaving a table row. */
- void ImplRowOff();
+ void ImplRowOff();
/** Set internal states for entering a new table cell. */
- void ImplDataOn( const ScHTMLSize& rSpanSize );
+ void ImplDataOn( const ScHTMLSize& rSpanSize );
/** Set internal states for leaving a table cell. */
- void ImplDataOff();
+ void ImplDataOff();
/** Inserts additional formatting options from import info into the item set. */
- void ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo& rInfo );
+ void ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo& rInfo );
/** Updates the document column/row size of the specified column or row.
@descr Only increases the present count, never decreases. */
- void SetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW nSize );
+ void SetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW nSize );
/** Calculates and sets the resulting size the cell needs in the document.
@descr Reduces the needed size in merged cells.
@param nCellPos The first column/row position of the (merged) cell.
@param nCellSpan The cell spanning in the specified orientation.
@param nRealDocSize The raw document size of all entries of the cell. */
- void CalcNeededDocSize(
- ScHTMLOrient eOrient, SCCOLROW nCellPos,
- SCCOLROW nCellSpan, SCCOLROW nRealDocSize );
+ void CalcNeededDocSize(
+ ScHTMLOrient eOrient, SCCOLROW nCellPos,
+ SCCOLROW nCellSpan, SCCOLROW nRealDocSize );
private:
- ScHTMLTable* mpParentTable; /// Pointer to parent table.
- ScHTMLTableMapPtr mpNestedTables; /// Table of nested HTML tables.
- String maTableName; /// Table name from <table id> option.
- ScHTMLTableAutoId maTableId; /// Unique identifier of this table.
- SfxItemSet maTableItemSet; /// Items for the entire table.
- SfxItemSetPtr mpRowItemSet; /// Items for the current table row.
- SfxItemSetPtr mpDataItemSet; /// Items for the current cell.
- ScRangeList maLockList; /// Locked cells (needed for merged cells).
- EditEngine& mrEditEngine; /// Edit engine (from ScEEParser).
- ScEEParseList& mrEEParseList; /// List that owns the parse entries (from ScEEParser).
- ScHTMLEntryMap maEntryMap; /// List of entries for each cell.
- ScHTMLEntryList* mpCurrEntryList; /// Current entry list from map for faster access.
- ScHTMLEntryPtr mpCurrEntry; /// Working entry, not yet inserted in a list.
- ScSizeVec maSizes[ 2 ]; /// Calc cell count of each HTML table column/row.
- ScHTMLSize maSize; /// Size of the table.
- ScHTMLPos maCurrCell; /// Address of current cell to fill.
- ScHTMLPos maDocBasePos; /// Resulting base address in a Calc document.
- bool mbBorderOn; /// true = Table borders on.
- bool mbPreFormText; /// true = Table from preformatted text (<pre> tag).
- bool mbRowOn; /// true = Inside of <tr> </tr>.
- bool mbDataOn; /// true = Inside of <td> </td> or <th> </th>.
- bool mbPushEmptyLine; /// true = Insert empty line before current entry.
+ ScHTMLTable* mpParentTable; /// Pointer to parent table.
+ ScHTMLTableMapPtr mxNestedTables; /// Table of nested HTML tables.
+ String maTableName; /// Table name from <table id> option.
+ ScHTMLTableAutoId maTableId; /// Unique identifier of this table.
+ SfxItemSet maTableItemSet; /// Items for the entire table.
+ SfxItemSetPtr mxRowItemSet; /// Items for the current table row.
+ SfxItemSetPtr mxDataItemSet; /// Items for the current cell.
+ ScRangeList maHMergedCells; /// List of all horizontally merged cells.
+ ScRangeList maVMergedCells; /// List of all vertically merged cells.
+ ScRangeList maUsedCells; /// List of all used cells.
+ EditEngine& mrEditEngine; /// Edit engine (from ScEEParser).
+ ScEEParseList& mrEEParseList; /// List that owns the parse entries (from ScEEParser).
+ ScHTMLEntryMap maEntryMap; /// List of entries for each cell.
+ ScHTMLEntryList* mpCurrEntryList; /// Current entry list from map for faster access.
+ ScHTMLEntryPtr mxCurrEntry; /// Working entry, not yet inserted in a list.
+ ScSizeVec maCumSizes[ 2 ]; /// Cumulated cell counts for each HTML table column/row.
+ ScHTMLSize maSize; /// Size of the table.
+ ScHTMLPos maCurrCell; /// Address of current cell to fill.
+ ScHTMLPos maDocBasePos; /// Resulting base address in a Calc document.
+ bool mbBorderOn; /// true = Table borders on.
+ bool mbPreFormText; /// true = Table from preformatted text (<pre> tag).
+ bool mbRowOn; /// true = Inside of <tr> </tr>.
+ bool mbDataOn; /// true = Inside of <td> </td> or <th> </th>.
+ bool mbPushEmptyLine; /// true = Insert empty line before current entry.
};
-
// ----------------------------------------------------------------------------
/** The "global table" representing the entire HTML document. */
class ScHTMLGlobalTable : public ScHTMLTable
{
public:
- explicit ScHTMLGlobalTable(
- SfxItemPool& rPool,
- EditEngine& rEditEngine,
- ScEEParseList& rEEParseList,
- ScHTMLTableId& rnUnusedId );
+ explicit ScHTMLGlobalTable(
+ SfxItemPool& rPool,
+ EditEngine& rEditEngine,
+ ScEEParseList& rEEParseList,
+ ScHTMLTableId& rnUnusedId );
- virtual ~ScHTMLGlobalTable();
+ virtual ~ScHTMLGlobalTable();
/** Recalculates sizes and resulting positions of all document entries. */
- void Recalc();
+ void Recalc();
};
-
// ============================================================================
/** The HTML parser for data queries. Focuses on data import, not on layout.
- @descr Builds the table structure correctly, ignores extended formatting
- like pictures or column widths. */
+
+ Builds the table structure correctly, ignores extended formatting like
+ pictures or column widths.
+ */
class ScHTMLQueryParser : public ScHTMLParser
{
public:
- explicit ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc );
- virtual ~ScHTMLQueryParser();
+ explicit ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc );
+ virtual ~ScHTMLQueryParser();
- virtual ULONG Read( SvStream& rStrm, const String& rBaseURL );
+ virtual ULONG Read( SvStream& rStrm, const String& rBaseURL );
/** Returns the "global table" which contains the entire HTML document. */
- virtual const ScHTMLTable* GetGlobalTable() const;
+ virtual const ScHTMLTable* GetGlobalTable() const;
private:
/** Handles all possible tags in the HTML document. */
- void ProcessToken( const ImportInfo& rInfo );
+ void ProcessToken( const ImportInfo& rInfo );
/** Inserts a text portion into current entry. */
- void InsertText( const ImportInfo& rInfo );
+ void InsertText( const ImportInfo& rInfo );
/** Processes the <font> tag. */
- void FontOn( const ImportInfo& rInfo );
+ void FontOn( const ImportInfo& rInfo );
/** Processes the <meta> tag. */
- void MetaOn( const ImportInfo& rInfo );
+ void MetaOn( const ImportInfo& rInfo );
/** Opens the title of the HTML document (<title> tag). */
- void TitleOn( const ImportInfo& rInfo );
+ void TitleOn( const ImportInfo& rInfo );
/** Closes the title of the HTML document (</title> tag). */
- void TitleOff( const ImportInfo& rInfo );
+ void TitleOff( const ImportInfo& rInfo );
/** Opens a new table at the current position. */
- void TableOn( const ImportInfo& rInfo );
+ void TableOn( const ImportInfo& rInfo );
/** Closes the current table. */
- void TableOff( const ImportInfo& rInfo );
+ void TableOff( const ImportInfo& rInfo );
/** Opens a new table based on preformatted text. */
- void PreOn( const ImportInfo& rInfo );
+ void PreOn( const ImportInfo& rInfo );
/** Closes the current preformatted text table. */
- void PreOff( const ImportInfo& rInfo );
+ void PreOff( const ImportInfo& rInfo );
/** Closes the current table, regardless on opening tag. */
- void CloseTable( const ImportInfo& rInfo );
+ void CloseTable( const ImportInfo& rInfo );
DECL_LINK( HTMLImportHdl, const ImportInfo* );
private:
typedef ::std::auto_ptr< ScHTMLGlobalTable > ScHTMLGlobalTablePtr;
- String maTitle; /// The title of the document.
- ScHTMLGlobalTablePtr mpGlobTable; /// Contains the entire imported document.
- ScHTMLTable* mpCurrTable; /// Pointer to current table (performance).
- ScHTMLTableId mnUnusedId; /// First unused table identifier.
- bool mbTitleOn; /// true = Inside of <title> </title>.
+ String maTitle; /// The title of the document.
+ ScHTMLGlobalTablePtr mxGlobTable; /// Contains the entire imported document.
+ ScHTMLTable* mpCurrTable; /// Pointer to current table (performance).
+ ScHTMLTableId mnUnusedId; /// First unused table identifier.
+ bool mbTitleOn; /// true = Inside of <title> </title>.
};
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index 66a58ffb67a4..f8dad9a45c48 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -135,9 +135,11 @@ protected:
void Bof2( void ); // 0x09
void Eof( void ); // 0x0A
void DocProtect( void ); // 0x12
- void Protect( void ); // 0x12 Sheet Protection
- BOOL Password( void ); // 0x13
+ void SheetProtect( void ); // 0x12 Sheet Protection
+ void DocPasssword( void ); // 0x13 document password
+ void SheetPassword( void ); // 0x13 sheet password
void Externsheet( void ); // 0x17
+ void WinProtection( void ); // 0x19
void Columndefault( void ); // 0x20
void Array25( void ); // 0x21
void Rec1904( void ); // 0x22
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index d01f81ba8013..649a7bd02702 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -35,6 +35,8 @@
#include "xcl97esc.hxx"
#include "xlstyle.hxx"
+#include <vector>
+
// --- class XclMsodrawing_Base --------------------------------------
class XclMsodrawing_Base
@@ -57,29 +59,26 @@ public:
// --- class XclMsodrawinggroup --------------------------------------
-class XclMsodrawinggroup : public XclMsodrawing_Base, public ExcRecord
+class XclMsodrawinggroup : public XclMsodrawing_Base, public XclExpRecord
{
private:
- virtual void SaveCont( XclExpStream& rStrm );
+ virtual void WriteBody( XclExpStream& rStrm );
public:
XclMsodrawinggroup( RootData& rRoot,
UINT16 nEscherType = 0 );
virtual ~XclMsodrawinggroup();
-
- virtual UINT16 GetNum() const;
- virtual sal_Size GetLen() const;
};
// --- class XclMsodrawing -------------------------------------------
-class XclMsodrawing : public XclMsodrawing_Base, public ExcRecord
+class XclMsodrawing : public XclMsodrawing_Base, public XclExpRecord
{
private:
- virtual void SaveCont( XclExpStream& rStrm );
+ virtual void WriteBody( XclExpStream& rStrm );
public:
XclMsodrawing(
@@ -87,9 +86,6 @@ public:
UINT16 nEscherType = 0,
sal_Size nInitialSize = 0 );
virtual ~XclMsodrawing();
-
- virtual UINT16 GetNum() const;
- virtual sal_Size GetLen() const;
};
@@ -464,23 +460,24 @@ public:
virtual sal_Size GetLen() const;
};
+// ============================================================================
-// ---- class XclProtection ------------------------------------------
-
-class XclProtection : public ExcDummyRec
+/** Represents a SHEETPROTECTION record that stores sheet protection
+ options. Note that a sheet still needs to save its sheet protection
+ options even when it's not protected. */
+class XclExpSheetProtectOptions : public XclExpRecord
{
- // replacement for records PROTECT, SCENPROTECT, OBJPROTECT...
-private:
- static const BYTE pMyData[];
- static const sal_Size nMyLen;
public:
- virtual sal_Size GetLen( void ) const;
- virtual const BYTE* GetData( void ) const;
-};
+ explicit XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab );
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
-// -------------------------------------------------------------------
+private:
+ sal_uInt16 mnOptions; /// Encoded sheet protection options.
+};
+// ============================================================================
class XclCalccount : public ExcRecord
{
@@ -544,5 +541,162 @@ public:
virtual void SaveXml( XclExpXmlStream& rStrm );
};
+// ============================================================================
+
+class XclExpFilePass : public XclExpRecord
+{
+public:
+ explicit XclExpFilePass( const XclExpRoot& rRoot );
+ virtual ~XclExpFilePass();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+
+private:
+ const XclExpRoot& mrRoot;
+};
+
+// ============================================================================
+
+class XclExpFnGroupCount : public XclExpRecord
+{
+public:
+ explicit XclExpFnGroupCount();
+ virtual ~XclExpFnGroupCount();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+/** Beginning of User Interface Records */
+class XclExpInterfaceHdr : public XclExpRecord
+{
+public:
+ explicit XclExpInterfaceHdr();
+ virtual ~XclExpInterfaceHdr();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+/** Beginning of User Interface Records */
+class XclExpInterfaceEnd : public XclExpRecord
+{
+public:
+ explicit XclExpInterfaceEnd();
+ virtual ~XclExpInterfaceEnd();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+/** ADDMENU/DELMENU Record Group Count */
+class XclExpMMS : public XclExpRecord
+{
+public:
+ explicit XclExpMMS();
+ virtual ~XclExpMMS();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+/** Write Access User Name - This record contains the user name, which is
+ the name you type when you install Excel. */
+class XclExpWriteAccess : public XclExpRecord
+{
+public:
+ explicit XclExpWriteAccess();
+ virtual ~XclExpWriteAccess();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+class XclExpCodePage : public XclExpRecord
+{
+public:
+ explicit XclExpCodePage();
+ virtual ~XclExpCodePage();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+class XclExpDSF : public XclExpRecord
+{
+public:
+ explicit XclExpDSF();
+ virtual ~XclExpDSF();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+class XclExpProt4Rev : public XclExpRecord
+{
+public:
+ explicit XclExpProt4Rev();
+ virtual ~XclExpProt4Rev();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+class XclExpProt4RevPass : public XclExpRecord
+{
+public:
+ explicit XclExpProt4RevPass();
+ virtual ~XclExpProt4RevPass();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+/** What's this record for? It is a zero-byte record. */
+class XclExpExcel9File : public XclExpRecord
+{
+public:
+ explicit XclExpExcel9File();
+ virtual ~XclExpExcel9File();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+// ============================================================================
+
+class XclExpRecalcId : public XclExpDummyRecord
+{
+public:
+ explicit XclExpRecalcId();
+};
+
+// ============================================================================
+
+class XclExpBookExt : public XclExpDummyRecord
+{
+public:
+ explicit XclExpBookExt();
+};
+
#endif // _XCL97REC_HXX
diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx
index 854d848a1e22..8a724aab1457 100644
--- a/sc/source/filter/inc/xechart.hxx
+++ b/sc/source/filter/inc/xechart.hxx
@@ -70,7 +70,12 @@ namespace com { namespace sun { namespace star {
class XclExpChRootData;
class XclExpChChart;
-/** Base class for complex chart classes, provides access to other components of the chart. */
+/** Base class for complex chart classes, provides access to other components
+ of the chart.
+
+ Keeps also track of future record levels and writes the needed future
+ records on demand.
+ */
class XclExpChRoot : public XclExpRoot
{
public:
@@ -127,6 +132,14 @@ public:
/** Reads the pie rotation property and returns the converted angle. */
static sal_uInt16 ConvertPieRotation( const ScfPropertySet& rPropSet );
+protected:
+ /** Called from XclExpChGroupBase::Save, registers a new future record level. */
+ void RegisterFutureRecBlock( const XclChFrBlock& rFrBlock );
+ /** Called from XclExpChFutureRecordBase::Save, Initializes the current future record level. */
+ void InitializeFutureRecBlock( XclExpStream& rStrm );
+ /** Called from XclExpChGroupBase::Save, finalizes the current future record level. */
+ void FinalizeFutureRecBlock( XclExpStream& rStrm );
+
private:
typedef ScfRef< XclExpChRootData > XclExpChRootDataRef;
XclExpChRootDataRef mxChData; /// Reference to the root data object.
@@ -139,11 +152,11 @@ private:
A chart record group consists of a header record, followed by a CHBEGIN
record, followed by group sub records, and finished with a CHEND record.
*/
-class XclExpChGroupBase : public XclExpRecord
+class XclExpChGroupBase : public XclExpRecord, protected XclExpChRoot
{
public:
- /** @param bWriteBeginEnd true = write CHBEGIN/CHEND records enclosing sub records. */
explicit XclExpChGroupBase(
+ const XclExpChRoot& rRoot, sal_uInt16 nFrType,
sal_uInt16 nRecId, sal_Size nRecSize = 0 );
virtual ~XclExpChGroupBase();
@@ -153,6 +166,29 @@ public:
virtual bool HasSubRecords() const;
/** Derived classes implement writing any records embedded in this group. */
virtual void WriteSubRecords( XclExpStream& rStrm ) = 0;
+
+protected:
+ /** Sets context information for future record blocks. */
+ void SetFutureRecordContext( sal_uInt16 nFrContext,
+ sal_uInt16 nFrValue1 = 0, sal_uInt16 nFrValue2 = 0 );
+
+private:
+ XclChFrBlock maFrBlock; /// Future records block settings.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Base class for chart future records. On saving, the record writes missing
+ CHFRBLOCKBEGIN records automatically.
+ */
+class XclExpChFutureRecordBase : public XclExpFutureRecord, protected XclExpChRoot
+{
+public:
+ explicit XclExpChFutureRecordBase( const XclExpChRoot& rRoot,
+ XclFutureRecType eRecType, sal_uInt16 nRecId, sal_Size nRecSize = 0 );
+
+ /** Writes missing CHFRBLOCKBEGIN records and this record. */
+ virtual void Save( XclExpStream& rStrm );
};
// Frame formatting ===========================================================
@@ -232,8 +268,7 @@ public:
explicit XclExpChEscherFormat( const XclExpChRoot& rRoot );
/** Converts complex area formatting from the passed property set. */
- void Convert( const XclExpChRoot& rRoot,
- const ScfPropertySet& rPropSet, XclChObjectType eObjType );
+ void Convert( const ScfPropertySet& rPropSet, XclChObjectType eObjType );
/** Returns true, if the object contains valid formatting data. */
bool IsValid() const;
@@ -247,7 +282,7 @@ public:
private:
/** Inserts a color from the contained Escher property set into the color palette. */
- sal_uInt32 RegisterColor( const XclExpChRoot& rRoot, sal_uInt16 nPropId );
+ sal_uInt32 RegisterColor( sal_uInt16 nPropId );
virtual void WriteBody( XclExpStream& rStrm );
@@ -301,7 +336,7 @@ private:
The CHFRAME group consists of: CHFRAME, CHBEGIN, CHLINEFORMAT,
CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
*/
-class XclExpChFrame : public XclExpChGroupBase, public XclExpChFrameBase, protected XclExpChRoot
+class XclExpChFrame : public XclExpChGroupBase, public XclExpChFrameBase
{
public:
explicit XclExpChFrame( const XclExpChRoot& rRoot, XclChObjectType eObjType );
@@ -395,6 +430,29 @@ typedef ScfRef< XclExpChObjectLink > XclExpChObjectLinkRef;
// ----------------------------------------------------------------------------
+/** Additional data label settings in the future record CHFRLABELPROPS. */
+class XclExpChFrLabelProps : public XclExpChFutureRecordBase
+{
+public:
+ explicit XclExpChFrLabelProps( const XclExpChRoot& rRoot );
+
+ /** Converts separator and the passed data label flags. */
+ void Convert(
+ const ScfPropertySet& rPropSet, bool bShowSeries,
+ bool bShowCateg, bool bShowValue,
+ bool bShowPercent, bool bShowBubble );
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+
+private:
+ XclChFrLabelProps maData; /// Contents of the CHFRLABELPROPS record.
+};
+
+typedef ScfRef< XclExpChFrLabelProps > XclExpChFrLabelPropsRef;
+
+// ----------------------------------------------------------------------------
+
/** Base class for objects with font settings. Provides font conversion helper functions. */
class XclExpChFontBase
{
@@ -411,7 +469,7 @@ public:
/** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
void ConvertFontBase( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet );
/** Converts rotation settings, calls virtual function SetRotation(). */
- void ConvertRotationBase( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet );
+ void ConvertRotationBase( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, bool bSupportsStacked );
};
// ----------------------------------------------------------------------------
@@ -421,7 +479,7 @@ public:
The CHTEXT group consists of: CHTEXT, CHBEGIN, CHFRAMEPOS, CHFONT,
CHFORMATRUNS, CHSOURCELINK, CHSTRING, CHFRAME group, CHOBJECTLINK, and CHEND.
*/
-class XclExpChText : public XclExpChGroupBase, public XclExpChFontBase, protected XclExpChRoot
+class XclExpChText : public XclExpChGroupBase, public XclExpChFontBase
{
public:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > XTitleRef;
@@ -462,6 +520,7 @@ private:
XclExpChFrameRef mxFrame; /// Text object frame properties (CHFRAME group).
XclExpChFontRef mxFont; /// Index into font buffer (CHFONT record).
XclExpChObjectLinkRef mxObjLink; /// Link target for this text object.
+ XclExpChFrLabelPropsRef mxLabelProps; /// Extended data label properties (CHFRLABELPROPS record).
sal_uInt32 mnTextColorId; /// Text color identifier.
};
@@ -556,7 +615,7 @@ typedef ScfRef< XclExpChAttachedLabel > XclExpChAttLabelRef;
CHMARKERFORMAT, CHPIEFORMAT, CH3DDATAFORMAT, CHSERIESFORMAT,
CHATTACHEDLABEL, CHEND.
*/
-class XclExpChDataFormat : public XclExpChGroupBase, public XclExpChFrameBase, protected XclExpChRoot
+class XclExpChDataFormat : public XclExpChGroupBase, public XclExpChFrameBase
{
public:
explicit XclExpChDataFormat( const XclExpChRoot& rRoot,
@@ -647,7 +706,7 @@ typedef ScfRef< XclExpChSerErrorBar > XclExpChSerErrorBarRef;
CHDATAFORMAT groups, CHSERGROUP, CHSERPARENT, CHSERERRORBAR,
CHSERTRENDLINE, CHEND.
*/
-class XclExpChSeries : public XclExpChGroupBase, protected XclExpChRoot
+class XclExpChSeries : public XclExpChGroupBase
{
public:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
@@ -776,7 +835,7 @@ typedef ScfRef< XclExpChChart3d > XclExpChChart3dRef;
The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAME group,
CHTEXT group, CHEND.
*/
-class XclExpChLegend : public XclExpChGroupBase, protected XclExpChRoot
+class XclExpChLegend : public XclExpChGroupBase
{
public:
explicit XclExpChLegend( const XclExpChRoot& rRoot );
@@ -808,10 +867,10 @@ typedef ScfRef< XclExpChLegend > XclExpChLegendRef;
class XclExpChDropBar : public XclExpChGroupBase, public XclExpChFrameBase
{
public:
- explicit XclExpChDropBar( XclChObjectType eObjType );
+ explicit XclExpChDropBar( const XclExpChRoot& rRoot, XclChObjectType eObjType );
/** Converts and writes the contained frame data to the passed property set. */
- void Convert( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet );
+ void Convert( const ScfPropertySet& rPropSet );
/** Writes all embedded records. */
virtual void WriteSubRecords( XclExpStream& rStrm );
@@ -835,7 +894,7 @@ typedef ScfRef< XclExpChDropBar > XclExpChDropBarRef;
CHDROPBAR groups, CHCHARTLINE groups (CHCHARTLINE with CHLINEFORMAT),
CHDATAFORMAT group, CHEND.
*/
-class XclExpChTypeGroup : public XclExpChGroupBase, protected XclExpChRoot
+class XclExpChTypeGroup : public XclExpChGroupBase
{
public:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
@@ -912,19 +971,15 @@ typedef ScfRef< XclExpChTypeGroup > XclExpChTypeGroupRef;
class XclExpChLabelRange : public XclExpRecord, protected XclExpChRoot
{
public:
- typedef ::com::sun::star::chart2::ScaleData ScaleData;
-
-public:
explicit XclExpChLabelRange( const XclExpChRoot& rRoot );
/** Converts category axis scaling settings. */
- void Convert( const ScaleData& rScaleData, bool bMirrorOrient );
+ void Convert( const ::com::sun::star::chart2::ScaleData& rScaleData, bool bMirrorOrient );
+ /** Converts position settings of a crossing axis at this axis. */
+ void ConvertAxisPosition( const ScfPropertySet& rPropSet );
/** Sets flag for tickmark position between categories or on categories. */
inline void SetTicksBetweenCateg( bool bTicksBetween )
{ ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_BETWEEN, bTicksBetween ); }
- /** Swaps flag for crossing axis at maximum position. */
- inline void SwapAxisMaxCross()
- { ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_MAXCROSS, !::get_flag( maData.mnFlags, EXC_CHLABELRANGE_MAXCROSS ) ); }
private:
virtual void WriteBody( XclExpStream& rStrm );
@@ -940,13 +995,12 @@ typedef ScfRef< XclExpChLabelRange > XclExpChLabelRangeRef;
class XclExpChValueRange : public XclExpRecord, protected XclExpChRoot
{
public:
- typedef ::com::sun::star::chart2::ScaleData ScaleData;
-
-public:
explicit XclExpChValueRange( const XclExpChRoot& rRoot );
/** Converts value axis scaling settings. */
- void Convert( const ScaleData& rScaleData );
+ void Convert( const ::com::sun::star::chart2::ScaleData& rScaleData );
+ /** Converts position settings of a crossing axis at this axis. */
+ void ConvertAxisPosition( const ScfPropertySet& rPropSet );
private:
virtual void WriteBody( XclExpStream& rStrm );
@@ -965,13 +1019,11 @@ public:
explicit XclExpChTick( const XclExpChRoot& rRoot );
/** Converts axis tick mark settings. */
- void Convert( const ScfPropertySet& rPropSet );
+ void Convert( const ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo, sal_uInt16 nAxisType );
/** Sets font color and color identifier to internal data structures. */
void SetFontColor( const Color& rColor, sal_uInt32 nColorId );
/** Sets text rotation to internal data structures. */
void SetRotation( sal_uInt16 nRotation );
- /** Sets position of axis labels relative to axis. */
- inline void SetLabelPos( sal_uInt8 nLabelPos ) { maData.mnLabelPos = nLabelPos; }
private:
virtual void WriteBody( XclExpStream& rStrm );
@@ -991,7 +1043,7 @@ typedef ScfRef< XclExpChTick > XclExpChTickRef;
CHVALUERANGE, CHFORMAT, CHTICK, CHFONT, CHAXISLINE groups (CHAXISLINE with
CHLINEFORMAT, CHAREAFORMAT, and CHESCHERFORMAT group), CHEND.
*/
-class XclExpChAxis : public XclExpChGroupBase, public XclExpChFontBase, protected XclExpChRoot
+class XclExpChAxis : public XclExpChGroupBase, public XclExpChFontBase
{
public:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
@@ -1006,7 +1058,7 @@ public:
virtual void SetRotation( sal_uInt16 nRotation );
/** Converts formatting and scaling settings from the passed axis. */
- void Convert( XAxisRef xAxis, const XclChExtTypeInfo& rTypeInfo, sal_Int32 nApiAxesSetIdx );
+ void Convert( XAxisRef xAxis, XAxisRef xCrossingAxis, const XclChExtTypeInfo& rTypeInfo );
/** Converts and writes 3D wall/floor properties from the passed diagram. */
void ConvertWall( XDiagramRef xDiagram );
@@ -1044,7 +1096,7 @@ typedef ScfRef< XclExpChAxis > XclExpChAxisRef;
groups, CHTEXT groups, CHPLOTFRAME group (CHPLOTFRAME with CHFRAME group),
CHTYPEGROUP group, CHEND.
*/
-class XclExpChAxesSet : public XclExpChGroupBase, protected XclExpChRoot
+class XclExpChAxesSet : public XclExpChGroupBase
{
public:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
@@ -1078,7 +1130,8 @@ private:
/** Converts a complete axis object including axis title. */
void ConvertAxis( XclExpChAxisRef& rxChAxis, sal_uInt16 nAxisType,
XclExpChTextRef& rxChAxisTitle, sal_uInt16 nTitleTarget,
- XCoordSystemRef xCoordSystem, const XclChExtTypeInfo& rTypeInfo );
+ XCoordSystemRef xCoordSystem, const XclChExtTypeInfo& rTypeInfo,
+ sal_Int32 nCrossingAxisDim );
virtual void WriteBody( XclExpStream& rStrm );
@@ -1106,7 +1159,7 @@ typedef ScfRef< XclExpChAxesSet > XclExpChAxesSetRef;
group, CHSERIES groups, CHPROPERTIES, CHDEFAULTTEXT groups (CHDEFAULTTEXT
with CHTEXT groups), CHUSEDAXESSETS, CHAXESSET groups, CHTEXT groups, CHEND.
*/
-class XclExpChChart : public XclExpChGroupBase, protected XclExpChRoot
+class XclExpChChart : public XclExpChGroupBase
{
public:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef;
diff --git a/sc/source/filter/inc/xerecord.hxx b/sc/source/filter/inc/xerecord.hxx
index 355541234651..8abd4d0c3eae 100644
--- a/sc/source/filter/inc/xerecord.hxx
+++ b/sc/source/filter/inc/xerecord.hxx
@@ -169,7 +169,7 @@ public:
/** Writes the record header and calls WriteBody(). */
virtual void Save( XclExpStream& rStrm );
-private:
+protected:
/** Writes the body of the record (without record header).
@descr Usually this method will be overwritten by derived classes. */
virtual void WriteBody( XclExpStream& rStrm );
@@ -311,6 +311,21 @@ private:
const void* mpData; /// The record data.
};
+// Future records =============================================================
+
+class XclExpFutureRecord : public XclExpRecord
+{
+public:
+ explicit XclExpFutureRecord( XclFutureRecType eRecType,
+ sal_uInt16 nRecId, sal_Size nRecSize = 0 );
+
+ /** Writes the extended record header and calls WriteBody(). */
+ virtual void Save( XclExpStream& rStrm );
+
+private:
+ XclFutureRecType meRecType;
+};
+
// List of records ============================================================
/** A list of Excel record objects.
diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx
index d050ea82ac81..178bb19763f8 100644
--- a/sc/source/filter/inc/xeroot.hxx
+++ b/sc/source/filter/inc/xeroot.hxx
@@ -154,7 +154,12 @@ public:
@param nRecId Identifier that specifies which record is returned. */
XclExpRecordRef CreateRecord( sal_uInt16 nRecId ) const;
+ bool IsDocumentEncrypted() const;
+
+ const String GetPassword() const;
+
private:
+
/** Returns the local or global link manager, depending on current context. */
XclExpRootData::XclExpLinkMgrRef GetLocalLinkMgrRef() const;
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 8792f26c6582..676b0d550875 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -43,6 +43,9 @@
#include "xlstream.hxx"
#include "xestring.hxx"
+#include <svx/mscodec.hxx>
+#include <vector>
+
/* ============================================================================
Output stream class for Excel export
- CONTINUE record handling
@@ -50,6 +53,8 @@ Output stream class for Excel export
============================================================================ */
class XclExpRoot;
+class XclExpBiff8Encrypter;
+typedef ScfRef< XclExpBiff8Encrypter > XclExpEncrypterRef;
/** This class is used to export Excel record streams.
@descr An instance is constructed with an SvStream and the maximum size of Excel
@@ -108,14 +113,14 @@ public:
/** Sets data slice length. 0 = no slices. */
void SetSliceSize( sal_uInt16 nSize );
- inline XclExpStream& operator<<( sal_Int8 nValue );
- inline XclExpStream& operator<<( sal_uInt8 nValue );
- inline XclExpStream& operator<<( sal_Int16 nValue );
- inline XclExpStream& operator<<( sal_uInt16 nValue );
- inline XclExpStream& operator<<( sal_Int32 nValue );
- inline XclExpStream& operator<<( sal_uInt32 nValue );
- inline XclExpStream& operator<<( float fValue );
- inline XclExpStream& operator<<( double fValue );
+ XclExpStream& operator<<( sal_Int8 nValue );
+ XclExpStream& operator<<( sal_uInt8 nValue );
+ XclExpStream& operator<<( sal_Int16 nValue );
+ XclExpStream& operator<<( sal_uInt16 nValue );
+ XclExpStream& operator<<( sal_Int32 nValue );
+ XclExpStream& operator<<( sal_uInt32 nValue );
+ XclExpStream& operator<<( float fValue );
+ XclExpStream& operator<<( double fValue );
/** Writes nBytes bytes from memory. */
sal_Size Write( const void* pData, sal_Size nBytes );
@@ -158,6 +163,14 @@ public:
/** Returns the absolute position of the system stream. */
inline sal_Size GetSvStreamPos() const { return mrStrm.Tell(); }
+ void SetEncrypter( XclExpEncrypterRef xEncrypter );
+
+ bool HasValidEncrypter() const;
+
+ void EnableEncryption( bool bEnable = true );
+
+ void DisableEncryption();
+
private:
/** Writes header data, internal setup. */
void InitRecord( sal_uInt16 nRecId );
@@ -180,6 +193,9 @@ private:
SvStream& mrStrm; /// Reference to the system output stream.
const XclExpRoot& mrRoot; /// Filter root data.
+ bool mbUseEncrypter;
+ XclExpEncrypterRef mxEncrypter;
+
// length data
sal_uInt16 mnMaxRecSize; /// Maximum size of record content.
sal_uInt16 mnMaxContSize; /// Maximum size of CONTINUE content.
@@ -197,64 +213,50 @@ private:
// ----------------------------------------------------------------------------
-inline XclExpStream& XclExpStream::operator<<( sal_Int8 nValue )
-{
- PrepareWrite( 1 );
- mrStrm << nValue;
- return *this;
-}
-inline XclExpStream& XclExpStream::operator<<( sal_uInt8 nValue )
-{
- PrepareWrite( 1 );
- mrStrm << nValue;
- return *this;
-}
+// ============================================================================
-inline XclExpStream& XclExpStream::operator<<( sal_Int16 nValue )
+class XclExpBiff8Encrypter
{
- PrepareWrite( 2 );
- mrStrm << nValue;
- return *this;
-}
+public:
+ explicit XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16],
+ const sal_uInt8 nSalt[16] );
+ ~XclExpBiff8Encrypter();
-inline XclExpStream& XclExpStream::operator<<( sal_uInt16 nValue )
-{
- PrepareWrite( 2 );
- mrStrm << nValue;
- return *this;
-}
+ bool IsValid() const;
-inline XclExpStream& XclExpStream::operator<<( sal_Int32 nValue )
-{
- PrepareWrite( 4 );
- mrStrm << nValue;
- return *this;
-}
+ void GetSaltDigest( sal_uInt8 nSaltDigest[16] ) const;
-inline XclExpStream& XclExpStream::operator<<( sal_uInt32 nValue )
-{
- PrepareWrite( 4 );
- mrStrm << nValue;
- return *this;
-}
+ void Encrypt( SvStream& rStrm, sal_uInt8 nData );
+ void Encrypt( SvStream& rStrm, sal_uInt16 nData );
+ void Encrypt( SvStream& rStrm, sal_uInt32 nData );
-inline XclExpStream& XclExpStream::operator<<( float fValue )
-{
- PrepareWrite( 4 );
- mrStrm << fValue;
- return *this;
-}
+ void Encrypt( SvStream& rStrm, sal_Int8 nData );
+ void Encrypt( SvStream& rStrm, sal_Int16 nData );
+ void Encrypt( SvStream& rStrm, sal_Int32 nData );
-inline XclExpStream& XclExpStream::operator<<( double fValue )
-{
- PrepareWrite( 8 );
- mrStrm << fValue;
- return *this;
-}
+ void Encrypt( SvStream& rStrm, float fValue );
+ void Encrypt( SvStream& rStrm, double fValue );
+ void EncryptBytes( SvStream& rStrm, ::std::vector<sal_uInt8>& aBytes );
-// ============================================================================
+private:
+ void Init( const String& aPass, const sal_uInt8 nDocId[16],
+ const sal_uInt8 nSalt[16] );
+
+ sal_uInt32 GetBlockPos( sal_Size nStrmPos ) const;
+ sal_uInt16 GetOffsetInBlock( sal_Size nStrmPos ) const;
+
+private:
+ ::svx::MSCodec_Std97 maCodec; /// Crypto algorithm implementation.
+ sal_uInt16 mnPassw[16]; /// Cached password data for copy construction.
+ sal_uInt8 mnDocId[16]; /// Cached document ID for copy construction.
+ sal_uInt8 mnSaltDigest[16];
+
+ const XclExpRoot& mrRoot;
+ sal_Size mnOldPos; /// Last known stream position
+ bool mbValid;
+};
// ----------------------------------------------------------------------------
@@ -335,7 +337,7 @@ public:
// only needed for import; ignore
virtual bool importDocument() throw();
virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
- virtual const oox::vml::DrawingPtr getDrawings();
+ virtual oox::vml::Drawing* getVmlDrawing();
virtual const oox::drawingml::Theme* getCurrentTheme() const;
virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
virtual oox::drawingml::chart::ChartConverter& getChartConverter();
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index 2e1f89641b77..fb2ea876c279 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -643,10 +643,13 @@ public:
@param nXFFlags Additional flags allowing to control the creation of an XF.
@param nForceScNumFmt The number format to be exported, e.g. formula
result type. This format will always overwrite the cell's number format.
+ @param bForceLineBreak true = Set line break flag unconditionally.
+ This is required for cells that contain multi-line text.
@return A unique XF record ID. */
sal_uInt32 InsertWithNumFmt(
const ScPatternAttr* pPattern, sal_Int16 nScript,
- ULONG nForceScNumFmt );
+ ULONG nForceScNumFmt,
+ bool bForceLineBreak );
/** Inserts the passed cell style. Creates a style XF record and a STYLE record.
@return A unique XF record ID. */
sal_uInt32 InsertStyle( const SfxStyleSheetBase* pStyleSheet );
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 7be4f406ee23..5322b0c47f01 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -1088,7 +1088,5 @@ private:
XclExpDvalRef mxDval; /// Data validation with DVAL and DV records.
};
-// ============================================================================
-
#endif
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index 0ec9ca48d8f8..1798242df3c6 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -44,8 +44,6 @@
#include "xistring.hxx"
#include "xiroot.hxx"
-#include <boost/shared_ptr.hpp>
-
namespace com { namespace sun { namespace star {
namespace frame
{
@@ -375,6 +373,7 @@ public:
public:
explicit XclImpChSourceLink( const XclImpChRoot& rRoot );
+ virtual ~XclImpChSourceLink();
/** Reads the CHSOURCELINK record (link to source data). */
void ReadChSourceLink( XclImpStream& rStrm );
@@ -407,10 +406,7 @@ public:
private:
XclChSourceLink maData; /// Contents of the CHSOURCELINK record.
XclImpStringRef mxString; /// Text data (CHSTRING record).
-
- // Tokens representing data ranges. This must be ref-counted to allow the
- // parent class to be stored in a STL container.
- ::boost::shared_ptr<ScTokenArray> mpTokenArray;
+ ScfRef< ScTokenArray> mxTokenArray; /// Token array representing the data ranges.
};
typedef ScfRef< XclImpChSourceLink > XclImpChSourceLinkRef;
@@ -433,7 +429,7 @@ public:
/** Converts and writes the contained font settings to the passed property set. */
void ConvertFontBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet ) const;
/** Converts and writes the contained rotation settings to the passed property set. */
- void ConvertRotationBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet ) const;
+ void ConvertRotationBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, bool bSupportsStacked ) const;
};
// ----------------------------------------------------------------------------
@@ -500,6 +496,8 @@ public:
/** Converts and writes the contained font settings to the passed property set. */
void ConvertFont( ScfPropertySet& rPropSet ) const;
+ /** Converts and writes the contained rotation settings to the passed property set. */
+ void ConvertRotation( ScfPropertySet& rPropSet, bool bSupportsStacked ) const;
/** Converts and writes the contained frame data to the passed property set. */
void ConvertFrame( ScfPropertySet& rPropSet ) const;
/** Converts and writes the contained number format to the passed property set. */
@@ -512,13 +510,19 @@ public:
private:
using XclImpChRoot::ConvertFont;
+ /** Reads a CHFRLABELPROPS record. */
+ void ReadChFrLabelProps( XclImpStream& rStrm );
+
private:
+ typedef ScfRef< XclChFrLabelProps > XclChFrLabelPropsRef;
+
XclChText maData; /// Contents of the CHTEXT record.
XclChObjectLink maObjLink; /// Link target for this text object.
XclFormatRunVec maFormats; /// Formatting runs (CHFORMATRUNS record).
XclImpChSourceLinkRef mxSrcLink; /// Linked data (CHSOURCELINK with CHSTRING record).
XclImpChFrameRef mxFrame; /// Text object frame properties (CHFRAME group).
XclImpChFontRef mxFont; /// Index into font buffer (CHFONT record).
+ XclChFrLabelPropsRef mxLabelProps; /// Extended data label properties (CHFRLABELPROPS record).
};
typedef ScfRef< XclImpChText > XclImpChTextRef;
@@ -1100,6 +1104,8 @@ public:
void ReadChLabelRange( XclImpStream& rStrm );
/** Converts category axis scaling settings. */
void Convert( ScfPropertySet& rPropSet, ScaleData& rScaleData, bool bMirrorOrient ) const;
+ /** Converts position settings of this axis at a crossing axis. */
+ void ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3dChart ) const;
private:
XclChLabelRange maData; /// Contents of the CHLABELRANGE record.
@@ -1120,6 +1126,8 @@ public:
void ReadChValueRange( XclImpStream& rStrm );
/** Converts value axis scaling settings. */
void Convert( ScaleData& rScaleData, bool bMirrorOrient ) const;
+ /** Converts position settings of this axis at a crossing axis. */
+ void ConvertAxisPosition( ScfPropertySet& rPropSet ) const;
private:
XclChValueRange maData; /// Contents of the CHVALUERANGE record.
@@ -1196,9 +1204,11 @@ public:
inline bool HasMinorGrid() const { return mxMinorGrid.is(); }
/** Creates an API axis object. */
- XAxisRef CreateAxis( const XclImpChTypeGroup& rTypeGroup, bool bPrimary ) const;
+ XAxisRef CreateAxis( const XclImpChTypeGroup& rTypeGroup, const XclImpChAxis* pCrossingAxis ) const;
/** Converts and writes 3D wall/floor properties to the passed property set. */
void ConvertWall( ScfPropertySet& rPropSet ) const;
+ /** Converts position settings of this axis at a crossing axis. */
+ void ConvertAxisPosition( ScfPropertySet& rPropSet, const XclImpChTypeGroup& rTypeGroup ) const;
private:
/** Reads a CHAXISLINE record specifying the target for following line properties. */
@@ -1282,9 +1292,9 @@ private:
XCoordSystemRef CreateCoordSystem( XDiagramRef xDiagram ) const;
/** Creates and inserts an axis into the container and registers the coordinate system. */
void ConvertAxis( XclImpChAxisRef xChAxis, XclImpChTextRef xChAxisTitle,
- XCoordSystemRef xCoordSystem ) const;
+ XCoordSystemRef xCoordSystem, const XclImpChAxis* pCrossingAxis ) const;
/** Creates and returns an API axis object. */
- XAxisRef CreateAxis( const XclImpChAxis& rChAxis ) const;
+ XAxisRef CreateAxis( const XclImpChAxis& rChAxis, const XclImpChAxis* pCrossingAxis ) const;
/** Writes all properties of the background area to the passed diagram. */
void ConvertBackground( XDiagramRef xDiagram ) const;
@@ -1316,7 +1326,8 @@ typedef ScfRef< XclImpChAxesSet > XclImpChAxesSetRef;
class XclImpChChart : public XclImpChGroupBase, protected XclImpChRoot
{
public:
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
public:
explicit XclImpChChart( const XclImpRoot& rRoot );
@@ -1347,6 +1358,8 @@ public:
private:
/** Reads a CHSERIES group (data series source and formatting). */
void ReadChSeries( XclImpStream& rStrm );
+ /** Reads a CHPROPERTIES record (global chart properties). */
+ void ReadChProperties( XclImpStream& rStrm );
/** Reads a CHAXESSET group (primary/secondary axes set). */
void ReadChAxesSet( XclImpStream& rStrm );
/** Reads a CHTEXT group (chart title and series/point captions). */
@@ -1361,6 +1374,9 @@ private:
/** Finalizes chart title, tries to detect title auto-generated from series name. */
void FinalizeTitle();
+ /** Creates and returns a new diagram object and converts global chart settings. */
+ XDiagramRef CreateDiagram() const;
+
private:
typedef ::std::vector< XclImpChSeriesRef > XclImpChSeriesVec;
typedef ScfRefMap< XclChDataPointPos, XclImpChDataFormat > XclImpChDataFormatMap;
diff --git a/sc/source/filter/inc/xicontent.hxx b/sc/source/filter/inc/xicontent.hxx
index 2b777e57600c..53ed10583249 100644
--- a/sc/source/filter/inc/xicontent.hxx
+++ b/sc/source/filter/inc/xicontent.hxx
@@ -37,6 +37,8 @@
#include "xistring.hxx"
#include "xiroot.hxx"
+#include <map>
+
/* ============================================================================
Classes to import the big Excel document contents (related to several cells or
globals for the document).
@@ -249,5 +251,64 @@ public:
// ============================================================================
+// Document protection ========================================================
+
+class XclImpDocProtectBuffer : protected XclImpRoot
+{
+public:
+ explicit XclImpDocProtectBuffer( const XclImpRoot& rRoot );
+
+ /** document structure protection flag */
+ void ReadDocProtect( XclImpStream& rStrm );
+
+ /** document windows properties protection flag */
+ void ReadWinProtect( XclImpStream& rStrm );
+
+ void ReadPasswordHash( XclImpStream& rStrm );
+
+ void Apply() const;
+
+private:
+ sal_uInt16 mnPassHash;
+ bool mbDocProtect:1;
+ bool mbWinProtect:1;
+};
+
+// Sheet protection ===========================================================
+
+class XclImpSheetProtectBuffer : protected XclImpRoot
+{
+public:
+ explicit XclImpSheetProtectBuffer( const XclImpRoot& rRoot );
+
+ void ReadProtect( XclImpStream& rStrm, SCTAB nTab );
+
+ void ReadOptions( XclImpStream& rStrm, SCTAB nTab );
+
+ void ReadPasswordHash( XclImpStream& rStrm, SCTAB nTab );
+
+ void Apply() const;
+
+private:
+ struct Sheet
+ {
+ bool mbProtected;
+ sal_uInt16 mnPasswordHash;
+ sal_uInt16 mnOptions;
+
+ Sheet();
+ Sheet(const Sheet& r);
+ };
+
+ Sheet* GetSheetItem( SCTAB nTab );
+
+private:
+ typedef ::std::map<SCTAB, Sheet> ProtectedSheetMap;
+ ProtectedSheetMap maProtectedSheets;
+};
+
+
+// ============================================================================
+
#endif
diff --git a/sc/source/filter/inc/xiroot.hxx b/sc/source/filter/inc/xiroot.hxx
index dfa2ca030efe..915f9610a1f3 100644
--- a/sc/source/filter/inc/xiroot.hxx
+++ b/sc/source/filter/inc/xiroot.hxx
@@ -61,6 +61,8 @@ class XclImpPivotTableManager;
class XclImpPageSettings;
class XclImpDocViewSettings;
class XclImpTabViewSettings;
+class XclImpSheetProtectBuffer;
+class XclImpDocProtectBuffer;
class _ScRangeListTabs;
class ExcelToSc;
@@ -87,6 +89,8 @@ struct XclImpRootData : public XclRootData
typedef ScfRef< XclImpPageSettings > XclImpPageSettRef;
typedef ScfRef< XclImpDocViewSettings > XclImpDocViewSettRef;
typedef ScfRef< XclImpTabViewSettings > XclImpTabViewSettRef;
+ typedef ScfRef< XclImpSheetProtectBuffer > XclImpTabProtectRef;
+ typedef ScfRef< XclImpDocProtectBuffer > XclImpDocProtectRef;
XclImpAddrConvRef mxAddrConv; /// The address converter.
XclImpFmlaCompRef mxFmlaComp; /// The formula compiler.
@@ -110,6 +114,11 @@ struct XclImpRootData : public XclRootData
XclImpPageSettRef mxPageSett; /// Page settings for current sheet.
XclImpDocViewSettRef mxDocViewSett; /// View settings for entire document.
XclImpTabViewSettRef mxTabViewSett; /// View settings for current sheet.
+ XclImpTabProtectRef mxTabProtect; /// Sheet protection options for current sheet.
+ XclImpDocProtectRef mxDocProtect; /// Document protection options.
+
+ String maPassw; /// Entered password for stream decryption.
+ bool mbPassQueried; /// true = Password already querried.
bool mbHasCodePage; /// true = CODEPAGE record exists.
@@ -181,6 +190,10 @@ public:
XclImpWebQueryBuffer& GetWebQueryBuffer() const;
/** Returns the pivot table manager. */
XclImpPivotTableManager& GetPivotTableManager() const;
+ /** Returns the sheet protection options of the current sheet. */
+ XclImpSheetProtectBuffer& GetSheetProtectBuffer() const;
+ /** Returns the document protection options. */
+ XclImpDocProtectBuffer& GetDocProtectBuffer() const;
/** Returns the page settings of the current sheet. */
XclImpPageSettings& GetPageSettings() const;
@@ -192,6 +205,9 @@ public:
/** Returns the Calc add-in function name for an Excel function name. */
String GetScAddInName( const String& rXclName ) const;
+ /** Queries a password from the user and returns it (empty string -> input cancelled). */
+ const String& QueryPassword() const;
+
private:
mutable XclImpRootData& mrImpData; /// Reference to the global import data struct.
};
diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx
index aa1cae84d8f6..ccaaccdc0357 100644
--- a/sc/source/filter/inc/xistream.hxx
+++ b/sc/source/filter/inc/xistream.hxx
@@ -73,6 +73,8 @@ public:
@return Count of bytes really read. */
sal_uInt16 Read( SvStream& rStrm, void* pData, sal_uInt16 nBytes );
+ const String GetPassword() const;
+
protected:
/** Protected copy c'tor for OnClone(). */
explicit XclImpDecrypter( const XclImpDecrypter& rSrc );
@@ -80,6 +82,8 @@ protected:
/** Sets the decrypter to a state showing whether the password was correct. */
void SetHasValidPassword( bool bValid );
+ void SetPassword( const String& rPass );
+
private:
/** Implementation of cloning this object. */
virtual XclImpDecrypter* OnClone() const = 0;
@@ -89,6 +93,7 @@ private:
virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ) = 0;
private:
+ String maPass; /// Stored password (needed for export)
ErrCode mnError; /// Decrypter error code.
sal_Size mnOldPos; /// Last known stream position.
sal_uInt16 mnRecSize; /// Current record size.
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index b6ac422b1c89..7e3873b1f1cf 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -74,11 +74,14 @@ namespace com { namespace sun { namespace star {
#define SERVICE_CHART2_TITLE CREATE_OUSTRING( "com.sun.star.chart2.Title" )
// property names
+#define EXC_CHPROP_ARRANGEORDER CREATE_OUSTRING( "ArrangeOrder" )
#define EXC_CHPROP_ATTAXISINDEX CREATE_OUSTRING( "AttachedAxisIndex" )
#define EXC_CHPROP_ATTRIBDATAPOINTS CREATE_OUSTRING( "AttributedDataPoints" )
#define EXC_CHPROP_BLACKDAY CREATE_OUSTRING( "BlackDay" )
#define EXC_CHPROP_COLOR CREATE_OUSTRING( "Color" )
#define EXC_CHPROP_CONNECTBARS CREATE_OUSTRING( "ConnectBars" )
+#define EXC_CHPROP_CROSSOVERPOSITION CREATE_OUSTRING( "CrossoverPosition" )
+#define EXC_CHPROP_CROSSOVERVALUE CREATE_OUSTRING( "CrossoverValue" )
#define EXC_CHPROP_CURVESTYLE CREATE_OUSTRING( "CurveStyle" )
#define EXC_CHPROP_D3DCAMERAGEOMETRY CREATE_OUSTRING( "D3DCameraGeometry" )
#define EXC_CHPROP_D3DSCENEAMBIENTCOLOR CREATE_OUSTRING( "D3DSceneAmbientColor" )
@@ -97,11 +100,16 @@ namespace com { namespace sun { namespace star {
#define EXC_CHPROP_FILLSTYLE CREATE_OUSTRING( "FillStyle" )
#define EXC_CHPROP_GAPWIDTHSEQ CREATE_OUSTRING( "GapwidthSequence" )
#define EXC_CHPROP_GEOMETRY3D CREATE_OUSTRING( "Geometry3D" )
+#define EXC_CHPROP_INCLUDEHIDDENCELLS CREATE_OUSTRING( "IncludeHiddenCells" )
#define EXC_CHPROP_JAPANESE CREATE_OUSTRING( "Japanese" )
#define EXC_CHPROP_LABEL CREATE_OUSTRING( "Label" )
#define EXC_CHPROP_LABELPLACEMENT CREATE_OUSTRING( "LabelPlacement" )
+#define EXC_CHPROP_LABELPOSITION CREATE_OUSTRING( "LabelPosition" )
+#define EXC_CHPROP_LABELSEPARATOR CREATE_OUSTRING( "LabelSeparator" )
#define EXC_CHPROP_MAJORTICKS CREATE_OUSTRING( "MajorTickmarks" )
+#define EXC_CHPROP_MARKPOSITION CREATE_OUSTRING( "MarkPosition" )
#define EXC_CHPROP_MINORTICKS CREATE_OUSTRING( "MinorTickmarks" )
+#define EXC_CHPROP_MISSINGVALUETREATMENT CREATE_OUSTRING( "MissingValueTreatment" )
#define EXC_CHPROP_NEGATIVEERROR CREATE_OUSTRING( "NegativeError" )
#define EXC_CHPROP_NUMBERFORMAT CREATE_OUSTRING( "NumberFormat" )
#define EXC_CHPROP_OFFSET CREATE_OUSTRING( "Offset" )
@@ -121,12 +129,14 @@ namespace com { namespace sun { namespace star {
#define EXC_CHPROP_SHOWHIGHLOW CREATE_OUSTRING( "ShowHighLow" )
#define EXC_CHPROP_SHOWNEGATIVEERROR CREATE_OUSTRING( "ShowNegativeError" )
#define EXC_CHPROP_SHOWPOSITIVEERROR CREATE_OUSTRING( "ShowPositiveError" )
+#define EXC_CHPROP_STACKCHARACTERS CREATE_OUSTRING( "StackCharacters" )
#define EXC_CHPROP_STACKINGDIR CREATE_OUSTRING( "StackingDirection" )
#define EXC_CHPROP_STARTINGANGLE CREATE_OUSTRING( "StartingAngle" )
#define EXC_CHPROP_SWAPXANDYAXIS CREATE_OUSTRING( "SwapXAndYAxis" )
#define EXC_CHPROP_SYMBOL CREATE_OUSTRING( "Symbol" )
#define EXC_CHPROP_TEXTBREAK CREATE_OUSTRING( "TextBreak" )
#define EXC_CHPROP_TEXTOVERLAP CREATE_OUSTRING( "TextOverlap" )
+#define EXC_CHPROP_TEXTROTATION CREATE_OUSTRING( "TextRotation" )
#define EXC_CHPROP_USERINGS CREATE_OUSTRING( "UseRings" )
#define EXC_CHPROP_VARYCOLORSBY CREATE_OUSTRING( "VaryColorsByPoint" )
#define EXC_CHPROP_WEIGHT CREATE_OUSTRING( "Weight" )
@@ -146,6 +156,7 @@ namespace com { namespace sun { namespace star {
#define EXC_CHPROP_ROLE_CLOSEVALUES CREATE_OUSTRING( "values-last" )
#define EXC_CHPROP_ROLE_LOWVALUES CREATE_OUSTRING( "values-min" )
#define EXC_CHPROP_ROLE_HIGHVALUES CREATE_OUSTRING( "values-max" )
+#define EXC_CHPROP_ROLE_SIZEVALUES CREATE_OUSTRING( "values-size" )
// Constants and Enumerations =================================================
@@ -160,6 +171,52 @@ const sal_Int32 EXC_CHART_AXESSET_NONE = -1; /// For internal use
const sal_Int32 EXC_CHART_AXESSET_PRIMARY = 0; /// API primary axes set index.
const sal_Int32 EXC_CHART_AXESSET_SECONDARY = 1; /// API secondary axes set index.
+// (0x0850) CHFRINFO ----------------------------------------------------------
+
+const sal_uInt16 EXC_ID_CHFRINFO = 0x0850;
+
+const sal_uInt8 EXC_CHFRINFO_EXCEL2000 = 9;
+const sal_uInt8 EXC_CHFRINFO_EXCELXP2003 = 10;
+const sal_uInt8 EXC_CHFRINFO_EXCEL2007 = 11;
+
+// (0x0852, 0x0853) CHFRBLOCKBEGIN, CHFRBLOCKEND ------------------------------
+
+const sal_uInt16 EXC_ID_CHFRBLOCKBEGIN = 0x0852;
+const sal_uInt16 EXC_ID_CHFRBLOCKEND = 0x0853;
+
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_AXESSET = 0;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_TEXT = 2;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_AXIS = 4;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_TYPEGROUP = 5;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_DATATABLE = 6;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_FRAME = 7;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_LEGEND = 9;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_LEGENDEX = 10;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_SERIES = 12;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_CHART = 13;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_DATAFORMAT = 14;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_DROPBAR = 15;
+const sal_uInt16 EXC_CHFRBLOCK_TYPE_UNKNOWN = 0xFFFF; /// For internal use only.
+
+const sal_uInt16 EXC_CHFRBLOCK_TEXT_TITLE = 0;
+const sal_uInt16 EXC_CHFRBLOCK_TEXT_DEFTEXT = 2;
+const sal_uInt16 EXC_CHFRBLOCK_TEXT_AXISTITLE = 4;
+const sal_uInt16 EXC_CHFRBLOCK_TEXT_DATALABEL = 5;
+
+const sal_uInt16 EXC_CHFRBLOCK_FRAME_STANDARD = 0;
+const sal_uInt16 EXC_CHFRBLOCK_FRAME_PLOTFRAME = 1;
+const sal_uInt16 EXC_CHFRBLOCK_FRAME_BACKGROUND = 2;
+
+// (0x086B) CHFRLABELPROPS ----------------------------------------------------
+
+const sal_uInt16 EXC_ID_CHFRLABELPROPS = 0x086B;
+
+const sal_uInt16 EXC_CHFRLABELPROPS_SHOWSERIES = 0x0001;
+const sal_uInt16 EXC_CHFRLABELPROPS_SHOWCATEG = 0x0002;
+const sal_uInt16 EXC_CHFRLABELPROPS_SHOWVALUE = 0x0004;
+const sal_uInt16 EXC_CHFRLABELPROPS_SHOWPERCENT = 0x0008;
+const sal_uInt16 EXC_CHFRLABELPROPS_SHOWBUBBLE = 0x0010;
+
// (0x1001) CHUNITS -----------------------------------------------------------
const sal_uInt16 EXC_ID_CHUNITS = 0x1001;
@@ -545,7 +602,7 @@ const sal_uInt16 EXC_CHAXESSET_NONE = 0xFFFF; /// For internal use
const sal_uInt16 EXC_ID_CHPROPERTIES = 0x1044;
const sal_uInt16 EXC_CHPROPS_MANSERIES = 0x0001; /// Manual series allocation.
-const sal_uInt16 EXC_CHPROPS_SHOWVISCELLS = 0x0002; /// Show visible cells only.
+const sal_uInt16 EXC_CHPROPS_SHOWVISIBLEONLY = 0x0002; /// Show visible cells only.
const sal_uInt16 EXC_CHPROPS_NORESIZE = 0x0004; /// Do not resize chart with window.
const sal_uInt16 EXC_CHPROPS_MANPLOTAREA = 0x0008; /// Plot area with CHFRAMEPOS records.
@@ -698,6 +755,20 @@ struct XclChDataPointPos
bool operator<( const XclChDataPointPos& rL, const XclChDataPointPos& rR );
+// ----------------------------------------------------------------------------
+
+/** Contains the type and context of a block of future records which are
+ guarded by CHFRBLOCKBEGIN and CHFRBLOCKEND records. */
+struct XclChFrBlock
+{
+ sal_uInt16 mnType; /// Type of the future record block.
+ sal_uInt16 mnContext; /// Context dependent on type.
+ sal_uInt16 mnValue1; /// Optional primary value for current context.
+ sal_uInt16 mnValue2; /// Optional secondary value for current context.
+
+ explicit XclChFrBlock( sal_uInt16 nType );
+};
+
// Frame formatting ===========================================================
struct XclChFramePos
@@ -796,6 +867,16 @@ struct XclChObjectLink
// ----------------------------------------------------------------------------
+struct XclChFrLabelProps
+{
+ String maSeparator; /// Separator between label values.
+ sal_uInt16 mnFlags; /// Flags indicating which values to be displayed.
+
+ explicit XclChFrLabelProps();
+};
+
+// ----------------------------------------------------------------------------
+
struct XclChText
{
XclChRectangle maRect; /// Position of the text object.
@@ -1280,7 +1361,8 @@ public:
sal_uInt16 nFormatIdx );
/** Reads rotation properties from the passed property set. */
sal_uInt16 ReadRotationProperties(
- const ScfPropertySet& rPropSet );
+ const ScfPropertySet& rPropSet,
+ bool bSupportsStacked );
/** Reads all legend properties from the passed property set. */
void ReadLegendProperties(
XclChLegend& rLegend,
@@ -1313,7 +1395,8 @@ public:
/** Writes rotation properties to the passed property set. */
void WriteRotationProperties(
ScfPropertySet& rPropSet,
- sal_uInt16 nRotation );
+ sal_uInt16 nRotation,
+ bool bSupportsStacked );
/** Writes all legend properties to the passed property set. */
void WriteLegendProperties(
ScfPropertySet& rPropSet,
@@ -1340,7 +1423,6 @@ private:
ScfPropSetHelper maHatchHlpCommon; /// Properties for hatches in common objects.
ScfPropSetHelper maHatchHlpFilled; /// Properties for hatches in filled series.
ScfPropSetHelper maBitmapHlp; /// Properties for bitmaps.
- ScfPropSetHelper maRotationHlp; /// Properties for text rotation.
ScfPropSetHelper maLegendHlp; /// Properties for legend.
};
diff --git a/sc/source/filter/inc/xlconst.hxx b/sc/source/filter/inc/xlconst.hxx
index 2d3135bc0816..eebaa76e4702 100644
--- a/sc/source/filter/inc/xlconst.hxx
+++ b/sc/source/filter/inc/xlconst.hxx
@@ -230,6 +230,19 @@ const sal_uInt16 EXC_ID_USESELFS = 0x0160;
const sal_uInt16 EXC_ID_USERSVIEWBEGIN = 0x01AA;
const sal_uInt16 EXC_ID_USERSVIEWEND = 0x01AB;
+// (0x8xx) Future records -----------------------------------------------------
+
+/** Enumerates different header types of future records. */
+enum XclFutureRecType
+{
+ EXC_FUTUREREC_SIMPLE, /// Record identifier and empty flags field.
+ EXC_FUTUREREC_UNUSEDREF /// Record identifier, empty flags field, unused range address.
+};
+
+const sal_uInt16 EXC_FUTUREREC_EMPTYFLAGS = 0x0000;
+const sal_uInt16 EXC_FUTUREREC_HASREF = 0x0001;
+const sal_uInt16 EXC_FUTUREREC_ALERT = 0x0002;
+
// ============================================================================
#endif
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index 12ab2808a1ab..36056ead2fe2 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -92,7 +92,6 @@ struct XclRootData
ScDocument& mrDoc; /// The source or destination document.
String maDocUrl; /// Document URL of imported/exported file.
String maBasePath; /// Base path of imported/exported file (path of maDocUrl).
- String maPassw; /// Entered password for stream encryption/decryption.
rtl_TextEncoding meTextEnc; /// Text encoding to import/export byte strings.
LanguageType meSysLang; /// System language.
LanguageType meDocLang; /// Document language (import: from file, export: from system).
@@ -116,7 +115,6 @@ struct XclRootData
long mnCharWidth; /// Width of '0' in default font (twips).
SCTAB mnScTab; /// Current Calc sheet index.
const bool mbExport; /// false = Import, true = Export.
- bool mbHasPassw; /// true = Password already querried.
explicit XclRootData( XclBiff eBiff, SfxMedium& rMedium,
SotStorageRef xRootStrg, ScDocument& rDoc,
@@ -184,8 +182,6 @@ public:
inline const String& GetDocUrl() const { return mrData.maDocUrl; }
/** Returns the base path of the imported/exported file. */
inline const String& GetBasePath() const { return mrData.maBasePath; }
- /** Queries a password from the user and returns it (empty string -> input cancelled). */
- const String& QueryPassword() const;
/** Returns the OLE2 root storage of the imported/exported file.
@return Pointer to root storage or 0, if the file is a simple stream. */
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index dab66815947e..92cb49e786eb 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -466,7 +466,7 @@ void OP_Note123( SvStream& r, UINT16 n)
delete [] pText;
ScAddress aPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab) );
- ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false );
+ ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false, false );
}
void OP_HorAlign123( BYTE nAlignPattern, SfxItemSet& rPatternItemSet )
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index cc31fcbede8b..52627c7848e4 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -71,7 +71,7 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt
readString( aLabel, getLength() - 7 );
nStyle = nStyle >> 3;
pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
- pDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aLabel ), (BOOL) TRUE );
+ pDoc->PutCell( nCol, nRow, nTab, ScBaseCell::CreateTextCell( aLabel, pDoc ), (BOOL) TRUE );
}
break;
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 3d4d50d46374..aee41be1a441 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -84,8 +84,8 @@ ScRTFExport::~ScRTFExport()
ULONG ScRTFExport::Write()
{
- rStrm << '{' << sRTF_RTF;
- rStrm << sRTF_ANSI << sNewLine;
+ rStrm << '{' << OOO_STRING_SVTOOLS_RTF_RTF;
+ rStrm << OOO_STRING_SVTOOLS_RTF_ANSI << sNewLine;
#if 0
// das ist noch nicht ausgegoren
@@ -101,9 +101,9 @@ ULONG ScRTFExport::Write()
// fonttbl
String aFontFamilyName(
((const SvxFontItem&)(rSetPara.Get( ATTR_FONT ))).GetFamilyName() );
- rStrm << sRTF_DEFF << '0'
- << '{' << sRTF_FONTTBL
- << '{' << sRTF_F << '0' << sRTF_FNIL << ' ' << aFontFamilyName.GetStr() << ";}"
+ rStrm << OOO_STRING_SVTOOLS_RTF_DEFF << '0'
+ << '{' << OOO_STRING_SVTOOLS_RTF_FONTTBL
+ << '{' << OOO_STRING_SVTOOLS_RTF_F << '0' << OOO_STRING_SVTOOLS_RTF_FNIL << ' ' << aFontFamilyName.GetStr() << ";}"
<< '}' << sNewLine;
// hier kaeme die colortbl
@@ -111,8 +111,8 @@ ULONG ScRTFExport::Write()
// stylesheet
UINT32 nFontHeight =
((const SvxFontHeightItem&)(rSetPara.Get( ATTR_FONT_HEIGHT ))).GetHeight();
- rStrm << '{' << sRTF_STYLESHEET
- << '{' << sRTF_FS << String( UINT32(nFontHeight / TWIPS_PER_POINT) ).GetStr()
+ rStrm << '{' << OOO_STRING_SVTOOLS_RTF_STYLESHEET
+ << '{' << OOO_STRING_SVTOOLS_RTF_FS << String( UINT32(nFontHeight / TWIPS_PER_POINT) ).GetStr()
<< ' ' << pStyleSheet->GetName().GetStr() << ";}"
<< '}' << sNewLine;
*/
@@ -122,7 +122,7 @@ ULONG ScRTFExport::Write()
for ( SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); nTab++ )
{
if ( nTab > aRange.aStart.Tab() )
- rStrm << sRTF_PAR;
+ rStrm << OOO_STRING_SVTOOLS_RTF_PAR;
WriteTab( nTab );
}
@@ -156,8 +156,8 @@ void ScRTFExport::WriteTab( SCTAB nTab )
void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
{
- rStrm << sRTF_TROWD << sRTF_TRGAPH << "30" << sRTF_TRLEFT << "-30";
- rStrm << sRTF_TRRH << ByteString::CreateFromInt32( pDoc->GetRowHeight( nRow, nTab ) ).GetBuffer();
+ rStrm << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH << "30" << OOO_STRING_SVTOOLS_RTF_TRLEFT << "-30";
+ rStrm << OOO_STRING_SVTOOLS_RTF_TRRH << ByteString::CreateFromInt32( pDoc->GetRowHeight( nRow, nTab ) ).GetBuffer();
SCCOL nCol;
SCCOL nEndCol = aRange.aEnd.Col();
for ( nCol = aRange.aStart.Col(); nCol <= nEndCol; nCol++ )
@@ -169,30 +169,30 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
const sal_Char* pChar;
if ( rMergeAttr.GetColMerge() != 0 )
- rStrm << sRTF_CLMGF;
+ rStrm << OOO_STRING_SVTOOLS_RTF_CLMGF;
else
{
const ScMergeFlagAttr& rMergeFlagAttr = (const ScMergeFlagAttr&) pAttr->GetItem( ATTR_MERGE_FLAG );
if ( rMergeFlagAttr.IsHorOverlapped() )
- rStrm << sRTF_CLMRG;
+ rStrm << OOO_STRING_SVTOOLS_RTF_CLMRG;
}
switch( rVerJustifyItem.GetValue() )
{
- case SVX_VER_JUSTIFY_TOP: pChar = sRTF_CLVERTALT; break;
- case SVX_VER_JUSTIFY_CENTER: pChar = sRTF_CLVERTALC; break;
- case SVX_VER_JUSTIFY_BOTTOM: pChar = sRTF_CLVERTALB; break;
- case SVX_VER_JUSTIFY_STANDARD: pChar = sRTF_CLVERTALB; break; //! Bottom
+ case SVX_VER_JUSTIFY_TOP: pChar = OOO_STRING_SVTOOLS_RTF_CLVERTALT; break;
+ case SVX_VER_JUSTIFY_CENTER: pChar = OOO_STRING_SVTOOLS_RTF_CLVERTALC; break;
+ case SVX_VER_JUSTIFY_BOTTOM: pChar = OOO_STRING_SVTOOLS_RTF_CLVERTALB; break;
+ case SVX_VER_JUSTIFY_STANDARD: pChar = OOO_STRING_SVTOOLS_RTF_CLVERTALB; break; //! Bottom
default: pChar = NULL; break;
}
if ( pChar )
rStrm << pChar;
- rStrm << sRTF_CELLX << ByteString::CreateFromInt32( pCellX[nCol+1] ).GetBuffer();
+ rStrm << OOO_STRING_SVTOOLS_RTF_CELLX << ByteString::CreateFromInt32( pCellX[nCol+1] ).GetBuffer();
if ( (nCol & 0x0F) == 0x0F )
rStrm << sNewLine; // Zeilen nicht zu lang werden lassen
}
- rStrm << sRTF_PARD << sRTF_PLAIN << sRTF_INTBL << sNewLine;
+ rStrm << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << OOO_STRING_SVTOOLS_RTF_INTBL << sNewLine;
ULONG nStrmPos = rStrm.Tell();
for ( nCol = aRange.aStart.Col(); nCol <= nEndCol; nCol++ )
@@ -204,7 +204,7 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
nStrmPos = rStrm.Tell();
}
}
- rStrm << sRTF_ROW << sNewLine;
+ rStrm << OOO_STRING_SVTOOLS_RTF_ROW << sNewLine;
}
@@ -215,7 +215,7 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol )
const ScMergeFlagAttr& rMergeFlagAttr = (const ScMergeFlagAttr&) pAttr->GetItem( ATTR_MERGE_FLAG );
if ( rMergeFlagAttr.IsHorOverlapped() )
{
- rStrm << sRTF_CELL;
+ rStrm << OOO_STRING_SVTOOLS_RTF_CELL;
return ;
}
@@ -268,41 +268,41 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol )
switch( rHorJustifyItem.GetValue() )
{
case SVX_HOR_JUSTIFY_STANDARD:
- pChar = (bValueData ? sRTF_QR : sRTF_QL);
+ pChar = (bValueData ? OOO_STRING_SVTOOLS_RTF_QR : OOO_STRING_SVTOOLS_RTF_QL);
break;
- case SVX_HOR_JUSTIFY_CENTER: pChar = sRTF_QC; break;
- case SVX_HOR_JUSTIFY_BLOCK: pChar = sRTF_QJ; break;
- case SVX_HOR_JUSTIFY_RIGHT: pChar = sRTF_QR; break;
+ case SVX_HOR_JUSTIFY_CENTER: pChar = OOO_STRING_SVTOOLS_RTF_QC; break;
+ case SVX_HOR_JUSTIFY_BLOCK: pChar = OOO_STRING_SVTOOLS_RTF_QJ; break;
+ case SVX_HOR_JUSTIFY_RIGHT: pChar = OOO_STRING_SVTOOLS_RTF_QR; break;
case SVX_HOR_JUSTIFY_LEFT:
case SVX_HOR_JUSTIFY_REPEAT:
- default: pChar = sRTF_QL; break;
+ default: pChar = OOO_STRING_SVTOOLS_RTF_QL; break;
}
rStrm << pChar;
if ( rWeightItem.GetWeight() >= WEIGHT_BOLD )
{ // bold
bResetAttr = TRUE;
- rStrm << sRTF_B;
+ rStrm << OOO_STRING_SVTOOLS_RTF_B;
}
if ( rPostureItem.GetPosture() != ITALIC_NONE )
{ // italic
bResetAttr = TRUE;
- rStrm << sRTF_I;
+ rStrm << OOO_STRING_SVTOOLS_RTF_I;
}
if ( rUnderlineItem.GetLineStyle() != UNDERLINE_NONE )
{ // underline
bResetAttr = TRUE;
- rStrm << sRTF_UL;
+ rStrm << OOO_STRING_SVTOOLS_RTF_UL;
}
rStrm << ' ';
RTFOutFuncs::Out_String( rStrm, aContent );
- rStrm << sRTF_CELL;
+ rStrm << OOO_STRING_SVTOOLS_RTF_CELL;
if ( bResetPar )
- rStrm << sRTF_PARD << sRTF_INTBL;
+ rStrm << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
if ( bResetAttr )
- rStrm << sRTF_PLAIN;
+ rStrm << OOO_STRING_SVTOOLS_RTF_PLAIN;
}
diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index 511c706abdfb..e2a7d9e4d538 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -81,6 +81,7 @@
#include "postit.hxx"
#include "globstr.hrc"
#include "ftools.hxx"
+#include "tabprotection.hxx"
#include "fprogressbar.hxx"
@@ -1087,9 +1088,11 @@ void Sc10Import::LoadProtect()
//rStream.Read(&SheetProtect, sizeof(SheetProtect));
lcl_ReadSheetProtect(rStream, SheetProtect);
nError = rStream.GetError();
- uno::Sequence<sal_Int8> aPass;
- SvPasswordHelper::GetHashPassword(aPass, SC10TOSTRING( SheetProtect.PassWord ));
- pDoc->SetDocProtection( SheetProtect.Protect, aPass);
+
+ ScDocProtection aProtection;
+ aProtection.setProtected(static_cast<bool>(SheetProtect.Protect));
+ aProtection.setPassword(SC10TOSTRING(SheetProtect.PassWord));
+ pDoc->SetDocProtection(&aProtection);
}
@@ -1441,10 +1444,11 @@ void Sc10Import::LoadTables()
//rStream.Read(&TabProtect, sizeof(TabProtect));
lcl_ReadTabProtect(rStream, TabProtect);
- uno::Sequence<sal_Int8> aPass;
- SvPasswordHelper::GetHashPassword(aPass, SC10TOSTRING( TabProtect.PassWord ));
- pDoc->SetTabProtection( static_cast<SCTAB>(Tab), TabProtect.Protect, aPass);
+ ScTableProtection aProtection;
+ aProtection.setProtected(static_cast<bool>(TabProtect.Protect));
+ aProtection.setPassword(SC10TOSTRING(TabProtect.PassWord));
+ pDoc->SetTabProtection(static_cast<SCTAB>(Tab), &aProtection);
rStream >> TabNo;
@@ -1710,7 +1714,7 @@ void Sc10Import::LoadCol(SCCOL Col, SCTAB Tab)
String aNoteText( SC10TOSTRING(pNote));
delete [] pNote;
ScAddress aPos( Col, static_cast<SCROW>(Row), Tab );
- ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false );
+ ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false, false );
}
}
pPrgrsBar->Progress();
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 48f5a790f5bb..a38b023d4f55 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -491,6 +491,7 @@ void XclExpChTrTabId::Copy( const XclExpChTrTabIdBuffer& rBuffer )
void XclExpChTrTabId::SaveCont( XclExpStream& rStrm )
{
+ rStrm.EnableEncryption();
if( pBuffer )
for( sal_uInt16* pElem = pBuffer; pElem < (pBuffer + nTabCount); pElem++ )
rStrm << *pElem;
@@ -1072,7 +1073,6 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
aTabIdBufferList(),
pTabIdBuffer( NULL ),
pTempDoc( NULL ),
- pTempChangeTrack( NULL ),
nNewAction( 1 ),
pHeader( NULL ),
bValidGUID( sal_False )
@@ -1081,7 +1081,8 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
if( !GetOldRoot().pTabId )
return;
- if( !CreateTempChangeTrack() )
+ ScChangeTrack* pTempChangeTrack = CreateTempChangeTrack();
+ if (!pTempChangeTrack)
return;
pTabIdBuffer = new XclExpChTrTabIdBuffer( GetTabInfo().GetXclTabCount() );
@@ -1143,25 +1144,23 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
XclExpChangeTrack::~XclExpChangeTrack()
{
- if( pTempChangeTrack )
- delete pTempChangeTrack;
if( pTempDoc )
delete pTempDoc;
}
-sal_Bool XclExpChangeTrack::CreateTempChangeTrack()
+ScChangeTrack* XclExpChangeTrack::CreateTempChangeTrack()
{
// get original change track
ScChangeTrack* pOrigChangeTrack = GetDoc().GetChangeTrack();
DBG_ASSERT( pOrigChangeTrack, "XclExpChangeTrack::CreateTempChangeTrack - no change track data" );
if( !pOrigChangeTrack )
- return sal_False;
+ return NULL;
// create empty document
pTempDoc = new ScDocument;
DBG_ASSERT( pTempDoc, "XclExpChangeTrack::CreateTempChangeTrack - no temp document" );
if( !pTempDoc )
- return sal_False;
+ return NULL;
// adjust table count
SCTAB nOrigCount = GetDoc().GetTableCount();
@@ -1176,26 +1175,13 @@ sal_Bool XclExpChangeTrack::CreateTempChangeTrack()
if( nOrigCount != pTempDoc->GetTableCount() )
return sal_False;
- // create empty change track
- pTempChangeTrack = new ScChangeTrack( pTempDoc );
- DBG_ASSERT( pTempChangeTrack, "XclExpChangeTrack::CreateTempChangeTrack - no temp change track" );
- if( !pTempChangeTrack )
- return sal_False;
-
- // copy original change track
- SvMemoryStream aMemStrm;
- if( !pOrigChangeTrack->Store( aMemStrm ) )
- return sal_False;
- aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
- if( !pTempChangeTrack->Load( aMemStrm, (USHORT) pTempDoc->GetSrcVersion() ) )
- return sal_False;
-
- return sal_True;
+ return pOrigChangeTrack->Clone(pTempDoc);
}
void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction )
{
XclExpChTrAction* pXclAction = NULL;
+ ScChangeTrack* pTempChangeTrack = pTempDoc->GetChangeTrack();
switch( rAction.GetType() )
{
case SC_CAT_CONTENT:
@@ -1205,7 +1191,8 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction )
case SC_CAT_INSERT_COLS:
case SC_CAT_DELETE_ROWS:
case SC_CAT_DELETE_COLS:
- pXclAction = new XclExpChTrInsert( rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack );
+ if (pTempChangeTrack)
+ pXclAction = new XclExpChTrInsert( rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack );
break;
case SC_CAT_INSERT_TABS:
{
@@ -1217,7 +1204,8 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction )
}
break;
case SC_CAT_MOVE:
- pXclAction = new XclExpChTrMoveRange( (const ScChangeActionMove&) rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack );
+ if (pTempChangeTrack)
+ pXclAction = new XclExpChTrMoveRange( (const ScChangeActionMove&) rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack );
break;
default:;
}
diff --git a/sc/source/filter/xcl97/makefile.mk b/sc/source/filter/xcl97/makefile.mk
index c40209d40819..58e2b8cb3074 100644
--- a/sc/source/filter/xcl97/makefile.mk
+++ b/sc/source/filter/xcl97/makefile.mk
@@ -51,7 +51,6 @@ VISIBILITY_HIDDEN=TRUE
# --- Files --------------------------------------------------------
SLOFILES = \
- $(SLO)$/xcl97dum.obj \
$(SLO)$/xcl97esc.obj \
$(SLO)$/xcl97rec.obj \
$(SLO)$/XclImpChangeTrack.obj \
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 93dc77c71a01..ac71dbb01fbb 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -78,6 +78,7 @@
#include "scextopt.hxx"
#include "docoptio.hxx"
#include "patattr.hxx"
+#include "tabprotection.hxx"
#include <oox/core/tokens.hxx>
@@ -135,9 +136,9 @@ sal_Size XclMsodrawing_Base::GetDataLen() const
// --- class XclMsodrawinggroup --------------------------------------
-XclMsodrawinggroup::XclMsodrawinggroup( RootData& rRoot, UINT16 nEscherType )
- :
- XclMsodrawing_Base( *rRoot.pEscher )
+XclMsodrawinggroup::XclMsodrawinggroup( RootData& rRoot, UINT16 nEscherType ) :
+ XclMsodrawing_Base( *rRoot.pEscher ),
+ XclExpRecord(0x00EB, 2) // bogus record size since we don't know the actual size yet.
{
if ( nEscherType )
{
@@ -182,7 +183,7 @@ XclMsodrawinggroup::~XclMsodrawinggroup()
}
-void XclMsodrawinggroup::SaveCont( XclExpStream& rStrm )
+void XclMsodrawinggroup::WriteBody( XclExpStream& rStrm )
{
DBG_ASSERT( GetEscherEx()->GetStreamPos() == GetEscherEx()->GetOffsetFromMap( nStartPos ),
"XclMsodrawinggroup::SaveCont: Escher stream position mismatch" );
@@ -190,23 +191,11 @@ void XclMsodrawinggroup::SaveCont( XclExpStream& rStrm )
}
-UINT16 XclMsodrawinggroup::GetNum() const
-{
- return 0x00EB;
-}
-
-
-sal_Size XclMsodrawinggroup::GetLen() const
-{
- return GetDataLen();
-}
-
-
-
// --- class XclMsodrawing --------------------------------------
XclMsodrawing::XclMsodrawing( const XclExpRoot& rRoot, UINT16 nEscherType, sal_Size nInitialSize ) :
- XclMsodrawing_Base( *rRoot.GetOldRoot().pEscher, nInitialSize )
+ XclMsodrawing_Base( *rRoot.GetOldRoot().pEscher, nInitialSize ),
+ XclExpRecord( 0x00EC, nInitialSize )
{
if ( nEscherType )
{
@@ -232,7 +221,7 @@ XclMsodrawing::~XclMsodrawing()
}
-void XclMsodrawing::SaveCont( XclExpStream& rStrm )
+void XclMsodrawing::WriteBody( XclExpStream& rStrm )
{
DBG_ASSERT( GetEscherEx()->GetStreamPos() == GetEscherEx()->GetOffsetFromMap( nStartPos ),
"XclMsodrawing::SaveCont: Escher stream position mismatch" );
@@ -240,16 +229,6 @@ void XclMsodrawing::SaveCont( XclExpStream& rStrm )
}
-UINT16 XclMsodrawing::GetNum() const
-{
- return 0x00EC;
-}
-
-
-sal_Size XclMsodrawing::GetLen() const
-{
- return GetDataLen();
-}
// --- class XclObjList ----------------------------------------------
@@ -887,6 +866,7 @@ ExcBof8_Base::ExcBof8_Base()
void ExcBof8_Base::SaveCont( XclExpStream& rStrm )
{
+ rStrm.DisableEncryption();
rStrm << nVers << nDocType << nRupBuild << nRupYear
<< nFileHistory << nLowestBiffVer;
}
@@ -946,7 +926,10 @@ void ExcBundlesheet8::SaveCont( XclExpStream& rStrm )
{
nOwnPos = rStrm.GetSvStreamPos();
// write dummy position, real position comes later
- rStrm << sal_uInt32( 0 ) << nGrbit << GetName();
+ rStrm.DisableEncryption();
+ rStrm << sal_uInt32(0);
+ rStrm.EnableEncryption();
+ rStrm << nGrbit << GetName();
}
@@ -1254,33 +1237,73 @@ sal_Size ExcEScenarioManager::GetLen() const
return 8;
}
+// ============================================================================
-
-// ---- class XclProtection ------------------------------------------
-
-const BYTE XclProtection::pMyData[] =
+struct XclExpTabProtectOption
{
- 0x12, 0x00, 0x02, 0x00, 0x01, 0x00, // PROTECT
- 0xDD, 0x00, 0x02, 0x00, 0x01, 0x00, // SCENPROTECT
- 0x63, 0x00, 0x02, 0x00, 0x01, 0x00 // OBJPROTECT
+ ScTableProtection::Option eOption;
+ sal_uInt16 nMask;
};
-const sal_Size XclProtection::nMyLen = sizeof( XclProtection::pMyData );
-sal_Size XclProtection::GetLen( void ) const
+XclExpSheetProtectOptions::XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab ) :
+ XclExpRecord( 0x0867, 23 )
{
- return nMyLen;
-}
-
+ static const XclExpTabProtectOption aTable[] =
+ {
+ { ScTableProtection::OBJECTS, 0x0001 },
+ { ScTableProtection::SCENARIOS, 0x0002 },
+ { ScTableProtection::FORMAT_CELLS, 0x0004 },
+ { ScTableProtection::FORMAT_COLUMNS, 0x0008 },
+ { ScTableProtection::FORMAT_ROWS, 0x0010 },
+ { ScTableProtection::INSERT_COLUMNS, 0x0020 },
+ { ScTableProtection::INSERT_ROWS, 0x0040 },
+ { ScTableProtection::INSERT_HYPERLINKS, 0x0080 },
+
+ { ScTableProtection::DELETE_COLUMNS, 0x0100 },
+ { ScTableProtection::DELETE_ROWS, 0x0200 },
+ { ScTableProtection::SELECT_LOCKED_CELLS, 0x0400 },
+ { ScTableProtection::SORT, 0x0800 },
+ { ScTableProtection::AUTOFILTER, 0x1000 },
+ { ScTableProtection::PIVOT_TABLES, 0x2000 },
+ { ScTableProtection::SELECT_UNLOCKED_CELLS, 0x4000 },
+
+ { ScTableProtection::NONE, 0x0000 }
+ };
+
+ mnOptions = 0x0000;
+ ScTableProtection* pProtect = rRoot.GetDoc().GetTabProtection(nTab);
+ if (!pProtect)
+ return;
-const BYTE* XclProtection::GetData( void ) const
-{
- return pMyData;
+ for (int i = 0; aTable[i].nMask != 0x0000; ++i)
+ {
+ if ( pProtect->isOptionEnabled(aTable[i].eOption) )
+ mnOptions |= aTable[i].nMask;
+ }
}
+void XclExpSheetProtectOptions::WriteBody( XclExpStream& rStrm )
+{
+ sal_uInt16 nBytes = 0x0867;
+ rStrm << nBytes;
+ sal_uChar nZero = 0x00;
+ for (int i = 0; i < 9; ++i)
+ rStrm << nZero;
+ nBytes = 0x0200;
+ rStrm << nBytes;
+ nBytes = 0x0100;
+ rStrm << nBytes;
+ nBytes = 0xFFFF;
+ rStrm << nBytes << nBytes;
+ rStrm << mnOptions;
+ nBytes = 0;
+ rStrm << nBytes;
+}
+// ============================================================================
@@ -1385,8 +1408,253 @@ void XclDelta::SaveXml( XclExpXmlStream& rStrm )
FSEND );
}
+// ============================================================================
+
+XclExpFilePass::XclExpFilePass( const XclExpRoot& rRoot ) :
+ XclExpRecord(0x002F, 54),
+ mrRoot(rRoot)
+{
+}
+
+XclExpFilePass::~XclExpFilePass()
+{
+}
+
+void XclExpFilePass::WriteBody( XclExpStream& rStrm )
+{
+ static const sal_uInt8 nDocId[] = {
+ 0x17, 0xf7, 0x01, 0x08, 0xea, 0xad, 0x30, 0x5c,
+ 0x1a, 0x95, 0xa5, 0x75, 0xd6, 0x79, 0xcd, 0x8d };
+
+
+ static const sal_uInt8 nSalt[] = {
+ 0xa4, 0x5b, 0xf7, 0xe9, 0x9f, 0x55, 0x21, 0xc5,
+ 0xc5, 0x56, 0xa8, 0x0d, 0x39, 0x05, 0x3a, 0xb4 };
+
+ // 0x0000 - neither standard nor strong encryption
+ // 0x0001 - standard or strong encryption
+ rStrm << static_cast<sal_uInt16>(0x0001);
+
+ // 0x0000 - non standard encryption
+ // 0x0001 - standard encryption
+ sal_uInt16 nStdEnc = 0x0001;
+ rStrm << nStdEnc << nStdEnc;
+
+ sal_uInt8 nSaltHash[16];
+ XclExpEncrypterRef xEnc( new XclExpBiff8Encrypter(mrRoot, nDocId, nSalt) );
+ xEnc->GetSaltDigest(nSaltHash);
+
+ rStrm.Write(nDocId, 16);
+ rStrm.Write(nSalt, 16);
+ rStrm.Write(nSaltHash, 16);
+
+ rStrm.SetEncrypter(xEnc);
+}
+
+// ============================================================================
+
+XclExpFnGroupCount::XclExpFnGroupCount() :
+ XclExpRecord(0x009C, 2)
+{
+}
+
+XclExpFnGroupCount::~XclExpFnGroupCount()
+{
+}
+
+void XclExpFnGroupCount::WriteBody( XclExpStream& rStrm )
+{
+ rStrm << static_cast<sal_uInt16>(14);
+}
+
+// ============================================================================
+XclExpInterfaceHdr::XclExpInterfaceHdr() :
+ XclExpRecord(0x00E1, 2)
+{
+}
+
+XclExpInterfaceHdr::~XclExpInterfaceHdr()
+{
+}
+
+void XclExpInterfaceHdr::WriteBody( XclExpStream& rStrm )
+{
+ // The value must be the same value as the CODEPAGE record.
+ rStrm.DisableEncryption();
+ rStrm << static_cast<sal_uInt16>(0x04B0);
+}
+
+// ============================================================================
+
+XclExpInterfaceEnd::XclExpInterfaceEnd() :
+ XclExpRecord(0x00E2, 0)
+{
+}
+
+XclExpInterfaceEnd::~XclExpInterfaceEnd()
+{
+}
+
+void XclExpInterfaceEnd::WriteBody( XclExpStream& /*rStrm*/ )
+{
+}
+
+// ============================================================================
+
+XclExpMMS::XclExpMMS() :
+ XclExpRecord(0x00C1, 2)
+{
+}
+
+XclExpMMS::~XclExpMMS()
+{
+}
+
+void XclExpMMS::WriteBody( XclExpStream& rStrm )
+{
+ rStrm << static_cast<sal_uInt16>(0x0000);
+}
+
+// ============================================================================
+
+XclExpWriteAccess::XclExpWriteAccess() :
+ XclExpRecord(0x005C, 112)
+{
+}
+
+XclExpWriteAccess::~XclExpWriteAccess()
+{
+}
+
+void XclExpWriteAccess::WriteBody( XclExpStream& rStrm )
+{
+ static const sal_uInt8 aData[] = {
+ 0x04, 0x00, 0x00, 'C', 'a', 'l', 'c', 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
+
+ sal_Size nDataSize = sizeof(aData);
+ for (sal_Size i = 0; i < nDataSize; ++i)
+ rStrm << aData[i];
+}
+
+// ============================================================================
+
+XclExpCodePage::XclExpCodePage() :
+ XclExpRecord(0x0042, 2)
+{
+}
+
+XclExpCodePage::~XclExpCodePage()
+{
+}
+
+void XclExpCodePage::WriteBody( XclExpStream& rStrm )
+{
+ // 0x04B0 : UTF-16 (BIFF8)
+ rStrm << static_cast<sal_uInt16>(0x04B0);
+}
+
+// ============================================================================
+
+XclExpDSF::XclExpDSF() :
+ XclExpRecord(0x0161, 2)
+{
+}
+
+XclExpDSF::~XclExpDSF()
+{
+}
+
+void XclExpDSF::WriteBody( XclExpStream& rStrm )
+{
+ rStrm << static_cast<sal_uInt16>(0x0000);
+}
+
+// ============================================================================
+
+XclExpProt4Rev::XclExpProt4Rev() :
+ XclExpRecord(0x01AF, 2)
+{
+}
+
+XclExpProt4Rev::~XclExpProt4Rev()
+{
+}
+
+void XclExpProt4Rev::WriteBody( XclExpStream& rStrm )
+{
+ rStrm << static_cast<sal_uInt16>(0x0000);
+}
+
+// ============================================================================
+
+XclExpProt4RevPass::XclExpProt4RevPass() :
+ XclExpRecord(0x01BC, 2)
+{
+}
+
+XclExpProt4RevPass::~XclExpProt4RevPass()
+{
+}
+
+void XclExpProt4RevPass::WriteBody( XclExpStream& rStrm )
+{
+ rStrm << static_cast<sal_uInt16>(0x0000);
+}
+
+// ============================================================================
+
+XclExpExcel9File::XclExpExcel9File() :
+ XclExpRecord(0x01C0, 0)
+{
+}
+
+XclExpExcel9File::~XclExpExcel9File()
+{
+}
+
+void XclExpExcel9File::WriteBody( XclExpStream& /*rStrm*/ )
+{
+}
+
+// ============================================================================
+
+static const sal_uInt8 nDataRecalcId[] = {
+ 0xC1, 0x01, 0x00, 0x00, 0x54, 0x8D, 0x01, 0x00
+};
+
+XclExpRecalcId::XclExpRecalcId() :
+ XclExpDummyRecord(0x01C1, nDataRecalcId, sizeof(nDataRecalcId))
+{
+}
+
+// ============================================================================
+
+static const sal_uInt8 nDataBookExt[] = {
+ 0x63, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02
+};
+
+XclExpBookExt::XclExpBookExt() :
+ XclExpDummyRecord(0x0863, nDataBookExt, sizeof(nDataBookExt))
+{
+}
+// ============================================================================
XclRefmode::XclRefmode( const ScDocument& rDoc ) :
XclExpBoolRecord( 0x000F, rDoc.GetAddressConvention() != formula::FormulaGrammar::CONV_XL_R1C1 )
diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx
index e0a20ad4353e..84fdba343630 100644
--- a/sc/source/filter/xml/XMLConverter.cxx
+++ b/sc/source/filter/xml/XMLConverter.cxx
@@ -31,20 +31,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
-
-//___________________________________________________________________
#include "XMLConverter.hxx"
+#include <com/sun/star/util/DateTime.hpp>
+#include <tools/datetime.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
#include "rangelst.hxx"
#include "rangeutl.hxx"
#include "docuno.hxx"
#include "convuno.hxx"
#include "document.hxx"
-#include <tools/datetime.hxx>
-#include <xmloff/xmltoken.hxx>
-#include <xmloff/xmluconv.hxx>
-#include <com/sun/star/util/DateTime.hpp>
+#include "ftools.hxx"
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -385,3 +382,292 @@ void ScXMLConverter::ConvertAPIToCoreDateTime(const util::DateTime& aDateTime, D
rDateTime = aTempDateTime;
}
+// ============================================================================
+
+namespace {
+
+/** Enumerates different types of condition tokens. */
+enum ScXMLConditionTokenType
+{
+ XML_COND_TYPE_KEYWORD, /// Simple keyword without parentheses, e.g. 'and'.
+ XML_COND_TYPE_COMPARISON, /// Comparison rule, e.g. 'cell-content()<=2'.
+ XML_COND_TYPE_FUNCTION0, /// Function without parameters, e.g. 'cell-content-is-whole-number()'.
+ XML_COND_TYPE_FUNCTION1, /// Function with 1 parameter, e.g. 'is-true-formula(1+1=2)'.
+ XML_COND_TYPE_FUNCTION2 /// Function with 2 parameters, e.g. 'cell-content-is-between(1,2)'.
+};
+
+struct ScXMLConditionInfo
+{
+ ScXMLConditionToken meToken;
+ ScXMLConditionTokenType meType;
+ sheet::ValidationType meValidation;
+ sheet::ConditionOperator meOperator;
+ const sal_Char* mpcIdentifier;
+ sal_Int32 mnIdentLength;
+};
+
+static const ScXMLConditionInfo spConditionInfos[] =
+{
+ { XML_COND_AND, XML_COND_TYPE_KEYWORD, sheet::ValidationType_ANY, sheet::ConditionOperator_NONE, RTL_CONSTASCII_STRINGPARAM( "and" ) },
+ { XML_COND_CELLCONTENT, XML_COND_TYPE_COMPARISON, sheet::ValidationType_ANY, sheet::ConditionOperator_NONE, RTL_CONSTASCII_STRINGPARAM( "cell-content" ) },
+ { XML_COND_ISBETWEEN, XML_COND_TYPE_FUNCTION2, sheet::ValidationType_ANY, sheet::ConditionOperator_BETWEEN, RTL_CONSTASCII_STRINGPARAM( "cell-content-is-between" ) },
+ { XML_COND_ISNOTBETWEEN, XML_COND_TYPE_FUNCTION2, sheet::ValidationType_ANY, sheet::ConditionOperator_NOT_BETWEEN, RTL_CONSTASCII_STRINGPARAM( "cell-content-is-not-between" ) },
+ { XML_COND_ISWHOLENUMBER, XML_COND_TYPE_FUNCTION0, sheet::ValidationType_WHOLE, sheet::ConditionOperator_NONE, RTL_CONSTASCII_STRINGPARAM( "cell-content-is-whole-number" ) },
+ { XML_COND_ISDECIMALNUMBER, XML_COND_TYPE_FUNCTION0, sheet::ValidationType_DECIMAL, sheet::ConditionOperator_NONE, RTL_CONSTASCII_STRINGPARAM( "cell-content-is-decimal-number" ) },
+ { XML_COND_ISDATE, XML_COND_TYPE_FUNCTION0, sheet::ValidationType_DATE, sheet::ConditionOperator_NONE, RTL_CONSTASCII_STRINGPARAM( "cell-content-is-date" ) },
+ { XML_COND_ISTIME, XML_COND_TYPE_FUNCTION0, sheet::ValidationType_TIME, sheet::ConditionOperator_NONE, RTL_CONSTASCII_STRINGPARAM( "cell-content-is-time" ) },
+ { XML_COND_ISINLIST, XML_COND_TYPE_FUNCTION1, sheet::ValidationType_LIST, sheet::ConditionOperator_EQUAL, RTL_CONSTASCII_STRINGPARAM( "cell-content-is-in-list" ) },
+ { XML_COND_TEXTLENGTH, XML_COND_TYPE_COMPARISON, sheet::ValidationType_TEXT_LEN, sheet::ConditionOperator_NONE, RTL_CONSTASCII_STRINGPARAM( "cell-content-text-length" ) },
+ { XML_COND_TEXTLENGTH_ISBETWEEN, XML_COND_TYPE_FUNCTION2, sheet::ValidationType_TEXT_LEN, sheet::ConditionOperator_BETWEEN, RTL_CONSTASCII_STRINGPARAM( "cell-content-text-length-is-between" ) },
+ { XML_COND_TEXTLENGTH_ISNOTBETWEEN, XML_COND_TYPE_FUNCTION2, sheet::ValidationType_TEXT_LEN, sheet::ConditionOperator_NOT_BETWEEN, RTL_CONSTASCII_STRINGPARAM( "cell-content-text-length-is-not-between" ) },
+ { XML_COND_ISTRUEFORMULA, XML_COND_TYPE_FUNCTION1, sheet::ValidationType_CUSTOM, sheet::ConditionOperator_FORMULA, RTL_CONSTASCII_STRINGPARAM( "is-true-formula" ) }
+};
+
+void lclSkipWhitespace( const sal_Unicode*& rpcString, const sal_Unicode* pcEnd )
+{
+ while( (rpcString < pcEnd) && (*rpcString <= ' ') ) ++rpcString;
+}
+
+const ScXMLConditionInfo* lclGetConditionInfo( const sal_Unicode*& rpcString, const sal_Unicode* pcEnd )
+{
+ lclSkipWhitespace( rpcString, pcEnd );
+ /* Search the end of an identifier name; assuming that valid identifiers
+ consist of [a-z-] only. */
+ const sal_Unicode* pcIdStart = rpcString;
+ while( (rpcString < pcEnd) && (((*rpcString >= 'a') && (*rpcString <= 'z')) || (*rpcString == '-')) ) ++rpcString;
+ sal_Int32 nLength = static_cast< sal_Int32 >( rpcString - pcIdStart );
+
+ // search the table for an entry
+ if( nLength > 0 )
+ for( const ScXMLConditionInfo* pInfo = spConditionInfos; pInfo < STATIC_TABLE_END( spConditionInfos ); ++pInfo )
+ if( (nLength == pInfo->mnIdentLength) && (::rtl_ustr_ascii_shortenedCompare_WithLength( pcIdStart, nLength, pInfo->mpcIdentifier, nLength ) == 0) )
+ return pInfo;
+
+ return 0;
+}
+
+sheet::ConditionOperator lclGetConditionOperator( const sal_Unicode*& rpcString, const sal_Unicode* pcEnd )
+{
+ // check for double-char operators
+ if( (rpcString + 1 < pcEnd) && (rpcString[ 1 ] == '=') )
+ {
+ sheet::ConditionOperator eOperator = sheet::ConditionOperator_NONE;
+ switch( *rpcString )
+ {
+ case '!': eOperator = sheet::ConditionOperator_NOT_EQUAL; break;
+ case '<': eOperator = sheet::ConditionOperator_LESS_EQUAL; break;
+ case '>': eOperator = sheet::ConditionOperator_GREATER_EQUAL; break;
+ }
+ if( eOperator != sheet::ConditionOperator_NONE )
+ {
+ rpcString += 2;
+ return eOperator;
+ }
+ }
+
+ // check for single-char operators
+ if( rpcString < pcEnd )
+ {
+ sheet::ConditionOperator eOperator = sheet::ConditionOperator_NONE;
+ switch( *rpcString )
+ {
+ case '=': eOperator = sheet::ConditionOperator_EQUAL; break;
+ case '<': eOperator = sheet::ConditionOperator_LESS; break;
+ case '>': eOperator = sheet::ConditionOperator_GREATER; break;
+ }
+ if( eOperator != sheet::ConditionOperator_NONE )
+ {
+ ++rpcString;
+ return eOperator;
+ }
+ }
+
+ return sheet::ConditionOperator_NONE;
+}
+
+/** Skips a literal string in a formula expression.
+
+ @param rpcString
+ (in-out) On call, must point to the first character of the string
+ following the leading string delimiter character. On return, points to
+ the trailing string delimiter character if existing, otherwise to
+ pcEnd.
+
+ @param pcEnd
+ The end of the string to parse.
+
+ @param cQuoteChar
+ The string delimiter character enclosing the string.
+ */
+void lclSkipExpressionString( const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cQuoteChar )
+{
+ if( rpcString < pcEnd )
+ {
+ sal_Int32 nLength = static_cast< sal_Int32 >( pcEnd - rpcString );
+ sal_Int32 nNextQuote = ::rtl_ustr_indexOfChar_WithLength( rpcString, nLength, cQuoteChar );
+ if( nNextQuote >= 0 )
+ rpcString += nNextQuote;
+ else
+ rpcString = pcEnd;
+ }
+}
+
+/** Skips a formula expression. Processes embedded parentheses, braces, and
+ literal strings.
+
+ @param rpcString
+ (in-out) On call, must point to the first character of the expression.
+ On return, points to the passed end character if existing, otherwise to
+ pcEnd.
+
+ @param pcEnd
+ The end of the string to parse.
+
+ @param cEndChar
+ The termination character following the expression.
+ */
+void lclSkipExpression( const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar )
+{
+ while( rpcString < pcEnd )
+ {
+ if( *rpcString == cEndChar )
+ return;
+ switch( *rpcString )
+ {
+ case '(': lclSkipExpression( ++rpcString, pcEnd, ')' ); break;
+ case '{': lclSkipExpression( ++rpcString, pcEnd, '}' ); break;
+ case '"': lclSkipExpressionString( ++rpcString, pcEnd, '"' ); break;
+ case '\'': lclSkipExpressionString( ++rpcString, pcEnd, '\'' ); break;
+ }
+ if( rpcString < pcEnd ) ++rpcString;
+ }
+}
+
+/** Extracts a formula expression. Processes embedded parentheses, braces, and
+ literal strings.
+
+ @param rpcString
+ (in-out) On call, must point to the first character of the expression.
+ On return, points *behind* the passed end character if existing,
+ otherwise to pcEnd.
+
+ @param pcEnd
+ The end of the string to parse.
+
+ @param cEndChar
+ The termination character following the expression.
+ */
+OUString lclGetExpression( const sal_Unicode*& rpcString, const sal_Unicode* pcEnd, sal_Unicode cEndChar )
+{
+ OUString aExp;
+ const sal_Unicode* pcExpStart = rpcString;
+ lclSkipExpression( rpcString, pcEnd, cEndChar );
+ if( rpcString < pcEnd )
+ {
+ aExp = OUString( pcExpStart, static_cast< sal_Int32 >( rpcString - pcExpStart ) ).trim();
+ ++rpcString;
+ }
+ return aExp;
+}
+
+/** Tries to skip an empty pair of parentheses (which may contain whitespace
+ characters).
+
+ @return
+ True on success, rpcString points behind the closing parentheses then.
+ */
+bool lclSkipEmptyParentheses( const sal_Unicode*& rpcString, const sal_Unicode* pcEnd )
+{
+ if( (rpcString < pcEnd) && (*rpcString == '(') )
+ {
+ lclSkipWhitespace( ++rpcString, pcEnd );
+ if( (rpcString < pcEnd) && (*rpcString == ')') )
+ {
+ ++rpcString;
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+/*static*/ void ScXMLConditionHelper::parseCondition(
+ ScXMLConditionParseResult& rParseResult, const OUString& rAttribute, sal_Int32 nStartIndex )
+{
+ rParseResult.meToken = XML_COND_INVALID;
+ if( (nStartIndex < 0) || (nStartIndex >= rAttribute.getLength()) ) return;
+
+ // try to find an identifier
+ const sal_Unicode* pcBegin = rAttribute.getStr();
+ const sal_Unicode* pcString = pcBegin + nStartIndex;
+ const sal_Unicode* pcEnd = pcBegin + rAttribute.getLength();
+ if( const ScXMLConditionInfo* pCondInfo = lclGetConditionInfo( pcString, pcEnd ) )
+ {
+ // insert default values into parse result (may be changed below)
+ rParseResult.meValidation = pCondInfo->meValidation;
+ rParseResult.meOperator = pCondInfo->meOperator;
+ // continue parsing dependent on token type
+ switch( pCondInfo->meType )
+ {
+ case XML_COND_TYPE_KEYWORD:
+ // nothing specific has to follow, success
+ rParseResult.meToken = pCondInfo->meToken;
+ break;
+
+ case XML_COND_TYPE_COMPARISON:
+ // format is <condition>()<operator><expression>
+ if( lclSkipEmptyParentheses( pcString, pcEnd ) )
+ {
+ rParseResult.meOperator = lclGetConditionOperator( pcString, pcEnd );
+ if( rParseResult.meOperator != sheet::ConditionOperator_NONE )
+ {
+ lclSkipWhitespace( pcString, pcEnd );
+ if( pcString < pcEnd )
+ {
+ rParseResult.meToken = pCondInfo->meToken;
+ // comparison must be at end of attribute, remaining text is the formula
+ rParseResult.maOperand1 = OUString( pcString, static_cast< sal_Int32 >( pcEnd - pcString ) );
+ }
+ }
+ }
+ break;
+
+ case XML_COND_TYPE_FUNCTION0:
+ // format is <condition>()
+ if( lclSkipEmptyParentheses( pcString, pcEnd ) )
+ rParseResult.meToken = pCondInfo->meToken;
+ break;
+
+ case XML_COND_TYPE_FUNCTION1:
+ // format is <condition>(<expression>)
+ if( (pcString < pcEnd) && (*pcString == '(') )
+ {
+ rParseResult.maOperand1 = lclGetExpression( ++pcString, pcEnd, ')' );
+ if( rParseResult.maOperand1.getLength() > 0 )
+ rParseResult.meToken = pCondInfo->meToken;
+ }
+ break;
+
+ case XML_COND_TYPE_FUNCTION2:
+ // format is <condition>(<expression1>,<expression2>)
+ if( (pcString < pcEnd) && (*pcString == '(') )
+ {
+ rParseResult.maOperand1 = lclGetExpression( ++pcString, pcEnd, ',' );
+ if( rParseResult.maOperand1.getLength() > 0 )
+ {
+ rParseResult.maOperand2 = lclGetExpression( pcString, pcEnd, ')' );
+ if( rParseResult.maOperand2.getLength() > 0 )
+ rParseResult.meToken = pCondInfo->meToken;
+ }
+ }
+ break;
+ }
+ rParseResult.mnEndIndex = static_cast< sal_Int32 >( pcString - pcBegin );
+ }
+}
+
+// ============================================================================
+
diff --git a/sc/source/filter/xml/XMLConverter.hxx b/sc/source/filter/xml/XMLConverter.hxx
index 75254a7b3300..090a3553aa91 100644
--- a/sc/source/filter/xml/XMLConverter.hxx
+++ b/sc/source/filter/xml/XMLConverter.hxx
@@ -36,8 +36,10 @@
#include "detdata.hxx"
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/sheet/ConditionOperator.hpp>
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/sheet/ValidationType.hpp>
#include <com/sun/star/util/DateTime.hpp>
class ScDocument;
@@ -117,6 +119,62 @@ public:
static void ConvertAPIToCoreDateTime(const com::sun::star::util::DateTime& aDateTime, DateTime& rDateTime);
};
+// ============================================================================
+
+enum ScXMLConditionToken
+{
+ XML_COND_INVALID, /// Token not recognized.
+ XML_COND_AND, /// The 'and' token.
+ XML_COND_CELLCONTENT, /// The 'cell-content' token.
+ XML_COND_ISBETWEEN, /// The 'cell-content-is-between' token.
+ XML_COND_ISNOTBETWEEN, /// The 'cell-content-is-not-between' token.
+ XML_COND_ISWHOLENUMBER, /// The 'cell-content-is-whole-number' token.
+ XML_COND_ISDECIMALNUMBER, /// The 'cell-content-is-decimal-number' token.
+ XML_COND_ISDATE, /// The 'cell-content-is-date' token.
+ XML_COND_ISTIME, /// The 'cell-content-is-time' token.
+ XML_COND_ISINLIST, /// The 'cell-content-is-in-list' token.
+ XML_COND_TEXTLENGTH, /// The 'cell-content-text-length' token.
+ XML_COND_TEXTLENGTH_ISBETWEEN, /// The 'cell-content-text-length-is-between' token.
+ XML_COND_TEXTLENGTH_ISNOTBETWEEN, /// The 'cell-content-text-length-is-not-between' token.
+ XML_COND_ISTRUEFORMULA /// The 'is-true-formula' token.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Result of an attempt to parse a single condition in a 'condition' attribute
+ value of e.g. conditional formatting or data validation.
+ */
+struct ScXMLConditionParseResult
+{
+ ScXMLConditionToken meToken; /// The leading condition token.
+ ::com::sun::star::sheet::ValidationType
+ meValidation; /// A data validation type if existing.
+ ::com::sun::star::sheet::ConditionOperator
+ meOperator; /// A comparison operator if existing.
+ ::rtl::OUString maOperand1; /// First operand of the token or comparison value.
+ ::rtl::OUString maOperand2; /// Second operand of 'between' conditions.
+ sal_Int32 mnEndIndex; /// Index of first character following the condition.
+};
+
+// ----------------------------------------------------------------------------
+
+class ScXMLConditionHelper
+{
+public:
+ /** Parses the next condition in a 'condition' attribute value of e.g.
+ conditional formatting or data validation.
+ */
+ static void parseCondition(
+ ScXMLConditionParseResult& rParseResult,
+ const ::rtl::OUString& rAttribute,
+ sal_Int32 nStartIndex );
+
+private:
+ ScXMLConditionHelper();
+ ~ScXMLConditionHelper();
+};
+
+// ============================================================================
#endif
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index 3ea002b71372..32cf92e08d1a 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -693,7 +693,8 @@ void ScXMLExportDataPilot::WriteDimension(ScDPSaveDimension* pDim, const ScDPDim
SvXMLElementExport aElemDPF(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD, sal_True, sal_True);
WriteFieldReference(pDim);
WriteLevels(pDim);
- WriteGroupDimElements(pDim, pDimData);
+ if( pDim->GetOrientation() != sheet::DataPilotFieldOrientation_DATA )
+ WriteGroupDimElements(pDim, pDimData);
}
void ScXMLExportDataPilot::WriteDimensions(ScDPSaveData* pDPSave)
diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
index 4ca83809843d..b9d9b4936961 100644
--- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
+++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
@@ -203,44 +203,56 @@ void ScXMLExportDatabaseRanges::WriteImportDescriptor(const uno::Sequence <beans
}
}
-rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const sheet::FilterOperator aFilterOperator, const sal_Bool bUseRegularExpressions) const
+rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const long aFilterOperator, const sal_Bool bUseRegularExpressions) const
{
switch (aFilterOperator)
{
- case sheet::FilterOperator_EQUAL :
+ case sheet::FilterOperator2::EQUAL :
{
if (bUseRegularExpressions)
return GetXMLToken(XML_MATCH);
else
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("="));
}
- case sheet::FilterOperator_NOT_EQUAL :
+ case sheet::FilterOperator2::NOT_EQUAL :
{
if (bUseRegularExpressions)
return GetXMLToken(XML_NOMATCH);
else
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("!="));
}
- case sheet::FilterOperator_BOTTOM_PERCENT :
+ case sheet::FilterOperator2::BOTTOM_PERCENT :
return GetXMLToken(XML_BOTTOM_PERCENT);
- case sheet::FilterOperator_BOTTOM_VALUES :
+ case sheet::FilterOperator2::BOTTOM_VALUES :
return GetXMLToken(XML_BOTTOM_VALUES);
- case sheet::FilterOperator_EMPTY :
+ case sheet::FilterOperator2::EMPTY :
return GetXMLToken(XML_EMPTY);
- case sheet::FilterOperator_GREATER :
+ case sheet::FilterOperator2::GREATER :
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">"));
- case sheet::FilterOperator_GREATER_EQUAL :
+ case sheet::FilterOperator2::GREATER_EQUAL :
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">="));
- case sheet::FilterOperator_LESS :
+ case sheet::FilterOperator2::LESS :
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<"));
- case sheet::FilterOperator_LESS_EQUAL :
+ case sheet::FilterOperator2::LESS_EQUAL :
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<="));
- case sheet::FilterOperator_NOT_EMPTY :
+ case sheet::FilterOperator2::NOT_EMPTY :
return GetXMLToken(XML_NOEMPTY);
- case sheet::FilterOperator_TOP_PERCENT :
+ case sheet::FilterOperator2::TOP_PERCENT :
return GetXMLToken(XML_TOP_PERCENT);
- case sheet::FilterOperator_TOP_VALUES :
+ case sheet::FilterOperator2::TOP_VALUES :
return GetXMLToken(XML_TOP_VALUES);
+ case sheet::FilterOperator2::CONTAINS :
+ return GetXMLToken(XML_CONTAINS);
+ case sheet::FilterOperator2::DOES_NOT_CONTAIN :
+ return GetXMLToken(XML_DOES_NOT_CONTAIN);
+ case sheet::FilterOperator2::BEGINS_WITH :
+ return GetXMLToken(XML_BEGINS_WITH);
+ case sheet::FilterOperator2::DOES_NOT_BEGIN_WITH :
+ return GetXMLToken(XML_DOES_NOT_BEGIN_WITH);
+ case sheet::FilterOperator2::ENDS_WITH :
+ return GetXMLToken(XML_ENDS_WITH);
+ case sheet::FilterOperator2::DOES_NOT_END_WITH :
+ return GetXMLToken(XML_DOES_NOT_END_WITH);
default:
{
// added to avoid warnings
@@ -249,7 +261,7 @@ rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const sheet::FilterOpera
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("="));
}
-void ScXMLExportDatabaseRanges::WriteCondition(const sheet::TableFilterField& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions)
+void ScXMLExportDatabaseRanges::WriteCondition(const sheet::TableFilterField2& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions)
{
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, rtl::OUString::valueOf(aFilterField.Field));
if (bIsCaseSensitive)
@@ -267,9 +279,9 @@ void ScXMLExportDatabaseRanges::WriteCondition(const sheet::TableFilterField& aF
SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, sal_True, sal_True);
}
-void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference <sheet::XSheetFilterDescriptor>& xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName)
+void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference <sheet::XSheetFilterDescriptor2>& xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName)
{
- uno::Sequence <sheet::TableFilterField> aTableFilterFields(xSheetFilterDescriptor->getFilterFields());
+ uno::Sequence< sheet::TableFilterField2 > aTableFilterFields( xSheetFilterDescriptor->getFilterFields2() );
sal_Int32 nTableFilterFields = aTableFilterFields.getLength();
if (nTableFilterFields > 0)
{
@@ -336,7 +348,7 @@ void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference <shee
else
{
SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_OR, sal_True, sal_True);
- sheet::TableFilterField aPrevFilterField = aTableFilterFields[0];
+ sheet::TableFilterField2 aPrevFilterField = aTableFilterFields[0];
sheet::FilterConnection aConnection = aTableFilterFields[1].Connection;
sal_Bool bOpenAndElement;
rtl::OUString aName = rExport.GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TABLE, GetXMLToken(XML_FILTER_AND));
@@ -632,7 +644,9 @@ void ScXMLExportDatabaseRanges::WriteDatabaseRanges(const com::sun::star::uno::R
if (::cppu::any2bool(xPropertySetDatabaseRange->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_STRIPDAT)))))
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_HAS_PERSISTENT_DATA, XML_FALSE);
}
- uno::Reference <sheet::XSheetFilterDescriptor> xSheetFilterDescriptor(xDatabaseRange->getFilterDescriptor());
+
+ uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor(
+ xDatabaseRange->getFilterDescriptor(), uno::UNO_QUERY );
uno::Sequence <beans::PropertyValue> aSortProperties(xDatabaseRange->getSortDescriptor());
if (xSheetFilterDescriptor.is())
{
diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.hxx b/sc/source/filter/xml/XMLExportDatabaseRanges.hxx
index c4829ffd3fdd..81d1399e16b3 100644
--- a/sc/source/filter/xml/XMLExportDatabaseRanges.hxx
+++ b/sc/source/filter/xml/XMLExportDatabaseRanges.hxx
@@ -33,9 +33,9 @@
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/sheet/FilterOperator.hpp>
-#include <com/sun/star/sheet/TableFilterField.hpp>
-#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp>
+#include <com/sun/star/sheet/FilterOperator2.hpp>
+#include <com/sun/star/sheet/TableFilterField2.hpp>
+#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
#include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
@@ -49,9 +49,9 @@ class ScXMLExportDatabaseRanges
ScDocument* pDoc;
void WriteImportDescriptor(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aImportDescriptor);
- rtl::OUString getOperatorXML(const com::sun::star::sheet::FilterOperator aFilterOperator, const sal_Bool bUseRegularExpressions) const;
- void WriteCondition(const com::sun::star::sheet::TableFilterField& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions);
- void WriteFilterDescriptor(const com::sun::star::uno::Reference <com::sun::star::sheet::XSheetFilterDescriptor>& xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName);
+ rtl::OUString getOperatorXML(const long aFilterOperator, const sal_Bool bUseRegularExpressions) const;
+ void WriteCondition(const com::sun::star::sheet::TableFilterField2& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions);
+ void WriteFilterDescriptor(const com::sun::star::uno::Reference <com::sun::star::sheet::XSheetFilterDescriptor2>& xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName);
void WriteSortDescriptor(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortProperties);
void WriteSubTotalDescriptor(const com::sun::star::uno::Reference <com::sun::star::sheet::XSubTotalDescriptor> xSubTotalDescriptor, const rtl::OUString sDatabaseRangeName);
public:
diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx
index 761e34ab6ced..72194c8be11c 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -568,6 +568,7 @@ ScMyCell::ScMyCell() :
aShapeList(),
aDetectiveObjVec(),
nValidationIndex(-1),
+ pBaseCell(NULL),
bIsAutoStyle( sal_False ),
bHasShape( sal_False ),
bIsMergedBase( sal_False ),
@@ -807,11 +808,11 @@ sal_Bool ScMyNotEmptyCellsIterator::GetNext(ScMyCell& aCell, ScFormatRangeStyles
HasAnnotation( aCell );
SetMatrixCellData( aCell );
sal_Bool bIsAutoStyle;
- sal_Bool bRemoveStyleRange((aLastAddress.Row == aCell.aCellAddress.Row) &&
- (aLastAddress.Column + 1 == aCell.aCellAddress.Column));
+ // Ranges before the previous cell are not needed by ExportFormatRanges anymore and can be removed
+ sal_Int32 nRemoveBeforeRow = aLastAddress.Row;
aCell.nStyleIndex = pCellStyles->GetStyleNameIndex(aCell.aCellAddress.Sheet,
aCell.aCellAddress.Column, aCell.aCellAddress.Row,
- bIsAutoStyle, aCell.nValidationIndex, aCell.nNumberFormat, bRemoveStyleRange);
+ bIsAutoStyle, aCell.nValidationIndex, aCell.nNumberFormat, nRemoveBeforeRow);
aLastAddress = aCell.aCellAddress;
aCell.bIsAutoStyle = bIsAutoStyle;
diff --git a/sc/source/filter/xml/XMLExportIterator.hxx b/sc/source/filter/xml/XMLExportIterator.hxx
index bcd6b4e5ae6b..d15ef94f99e6 100644
--- a/sc/source/filter/xml/XMLExportIterator.hxx
+++ b/sc/source/filter/xml/XMLExportIterator.hxx
@@ -48,6 +48,7 @@ class ScHorizontalCellIterator;
struct ScMyCell;
class ScXMLExport;
class ScFormatRangeStyles;
+class ScBaseCell;
//==============================================================================
@@ -312,6 +313,8 @@ struct ScMyCell
sal_Int32 nNumberFormat;
com::sun::star::table::CellContentType nType;
+ ScBaseCell* pBaseCell;
+
sal_Bool bIsAutoStyle;
sal_Bool bHasShape;
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 9abb3339d01d..6482fe571b62 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -944,7 +944,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable,
}
sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow,
- sal_Bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Bool bRemoveRange)
+ sal_Bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Int32 nRemoveBeforeRow)
{
DBG_ASSERT(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]);
@@ -977,7 +977,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const s
}
else
{
- if (bRemoveRange && (*aItr).aRangeAddress.EndRow < nRow)
+ if ((*aItr).aRangeAddress.EndRow < nRemoveBeforeRow)
aItr = pFormatRanges->erase(aItr);
else
++aItr;
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx b/sc/source/filter/xml/XMLStylesExportHelper.hxx
index 25fc9e040995..a9e42afcd585 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx
@@ -224,7 +224,7 @@ public:
sal_Bool& bIsAutoStyle) const;
// deletes not necessary ranges if wanted
sal_Int32 GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow,
- sal_Bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Bool bRemoveRange = sal_True );
+ sal_Bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Int32 nRemoveBeforeRow);
void GetFormatRanges(const sal_Int32 nStartColumn, const sal_Int32 nEndColumn, const sal_Int32 nRow,
const sal_Int32 nTable, ScRowFormatRanges* pFormatRanges);
void AddRangeStyleName(const com::sun::star::table::CellRangeAddress aCellRangeAddress, const sal_Int32 nStringIndex,
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index d1320a8c737f..2d8eac1dfc76 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -109,6 +109,7 @@ class ScXMLCellContentDeletionContext : public SvXMLImportContext
{
rtl::OUString sFormulaAddress;
rtl::OUString sFormula;
+ rtl::OUString sFormulaNmsp;
rtl::OUString sInputString;
ScBigRange aBigRange;
double fValue;
@@ -298,7 +299,8 @@ public:
ScXMLChangeCellContext( ScXMLImport& rImport, USHORT nPrfx, const ::rtl::OUString& rLName,
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList>& xAttrList,
- ScBaseCell*& rOldCell, rtl::OUString& sAddress, rtl::OUString& sFormula,
+ ScBaseCell*& rOldCell, rtl::OUString& sAddress,
+ rtl::OUString& rFormula, rtl::OUString& rFormulaNmsp,
formula::FormulaGrammar::Grammar& rGrammar,
rtl::OUString& rInputString, double& fValue, sal_uInt16& nType,
sal_uInt8& nMatrixFlag, sal_Int32& nMatrixCols, sal_Int32& nMatrixRows);
@@ -322,6 +324,7 @@ class ScXMLPreviousContext : public SvXMLImportContext
{
rtl::OUString sFormulaAddress;
rtl::OUString sFormula;
+ rtl::OUString sFormulaNmsp;
rtl::OUString sInputString;
double fValue;
ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
@@ -329,7 +332,7 @@ class ScXMLPreviousContext : public SvXMLImportContext
sal_uInt32 nID;
sal_Int32 nMatrixCols;
sal_Int32 nMatrixRows;
- formula::FormulaGrammar::Grammar eGrammar;
+ formula::FormulaGrammar::Grammar eGrammar;
sal_uInt16 nType;
sal_uInt8 nMatrixFlag;
@@ -831,7 +834,7 @@ SvXMLImportContext *ScXMLCellContentDeletionContext::CreateChildContext( USHORT
{
bContainsCell = sal_True;
pContext = new ScXMLChangeCellContext(GetScImport(), nPrefix, rLocalName, xAttrList,
- pCell, sFormulaAddress, sFormula, eGrammar, sInputString, fValue, nType, nMatrixFlag, nMatrixCols, nMatrixRows );
+ pCell, sFormulaAddress, sFormula, sFormulaNmsp, eGrammar, sInputString, fValue, nType, nMatrixFlag, nMatrixCols, nMatrixRows );
}
else if (IsXMLToken(rLocalName, XML_CELL_ADDRESS))
{
@@ -1115,7 +1118,8 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport,
USHORT nPrfx,
const ::rtl::OUString& rLName,
const uno::Reference<xml::sax::XAttributeList>& xAttrList,
- ScBaseCell*& rTempOldCell, rtl::OUString& rAddress, rtl::OUString& rFormula,
+ ScBaseCell*& rTempOldCell, rtl::OUString& rAddress,
+ rtl::OUString& rFormula, rtl::OUString& rFormulaNmsp,
formula::FormulaGrammar::Grammar& rGrammar,
rtl::OUString& rTempInputString, double& fDateTimeValue, sal_uInt16& nType,
sal_uInt8& nMatrixFlag, sal_Int32& nMatrixCols, sal_Int32& nMatrixRows ) :
@@ -1130,7 +1134,6 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport,
bString(sal_True),
bFormula(sal_False)
{
- const formula::FormulaGrammar::Grammar eStorageGrammar = rGrammar = GetScImport().GetDocument()->GetStorageGrammar();
sal_Bool bIsMatrix(sal_False);
sal_Bool bIsCoveredMatrix(sal_False);
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
@@ -1147,12 +1150,7 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport,
if (IsXMLToken(aLocalName, XML_FORMULA))
{
bEmpty = sal_False;
- sal_uInt16 nFormulaPrefix = GetImport().GetNamespaceMap().
- _GetKeyByAttrName( sValue, &rFormula, sal_False );
-
- if (!ScXMLImport::IsAcceptedFormulaNamespace( nFormulaPrefix,
- sValue, rGrammar, eStorageGrammar))
- rFormula = sValue;
+ GetScImport().ExtractFormulaNamespaceGrammar( rFormula, rFormulaNmsp, rGrammar, sValue );
bFormula = sal_True;
}
else if (IsXMLToken(aLocalName, XML_CELL_ADDRESS))
@@ -1339,8 +1337,6 @@ ScXMLPreviousContext::ScXMLPreviousContext( ScXMLImport& rImport,
const uno::Reference<xml::sax::XAttributeList>& xAttrList,
ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
SvXMLImportContext( rImport, nPrfx, rLName ),
- sFormulaAddress(),
- sFormula(),
pChangeTrackingImportHelper(pTempChangeTrackingImportHelper),
pOldCell(NULL),
nID(0),
@@ -1380,7 +1376,7 @@ SvXMLImportContext *ScXMLPreviousContext::CreateChildContext( USHORT nPrefix,
if ((nPrefix == XML_NAMESPACE_TABLE) && (IsXMLToken(rLocalName, XML_CHANGE_TRACK_TABLE_CELL)))
pContext = new ScXMLChangeCellContext(GetScImport(), nPrefix, rLocalName, xAttrList,
- pOldCell, sFormulaAddress, sFormula, eGrammar, sInputString, fValue, nType, nMatrixFlag, nMatrixCols, nMatrixRows);
+ pOldCell, sFormulaAddress, sFormula, sFormulaNmsp, eGrammar, sInputString, fValue, nType, nMatrixFlag, nMatrixCols, nMatrixRows);
if( !pContext )
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
diff --git a/sc/source/filter/xml/xmlannoi.cxx b/sc/source/filter/xml/xmlannoi.cxx
index 5160b17a1a9d..f8081b7b8f48 100644
--- a/sc/source/filter/xml/xmlannoi.cxx
+++ b/sc/source/filter/xml/xmlannoi.cxx
@@ -31,13 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
// INCLUDE ---------------------------------------------------------------
#include "xmlannoi.hxx"
#include "xmlimprt.hxx"
-#include "xmlcelli.hxx"
#include "xmlconti.hxx"
#include "XMLTableShapeImportHelper.hxx"
@@ -45,25 +42,34 @@
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
-#include <svx/unoshape.hxx>
-#include <svx/svdobj.hxx>
-#include <svx/outlobj.hxx>
using namespace com::sun::star;
using namespace xmloff::token;
//------------------------------------------------------------------
+ScXMLAnnotationData::ScXMLAnnotationData() :
+ mbUseShapePos( false ),
+ mbShown( false )
+{
+}
+
+ScXMLAnnotationData::~ScXMLAnnotationData()
+{
+}
+
+//------------------------------------------------------------------
+
ScXMLAnnotationContext::ScXMLAnnotationContext( ScXMLImport& rImport,
USHORT nPrfx,
const ::rtl::OUString& rLName,
const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ ScXMLAnnotationData& rAnnotationData,
ScXMLTableRowCellContext* pTempCellContext) :
SvXMLImportContext( rImport, nPrfx, rLName ),
+ mrAnnotationData( rAnnotationData ),
nParagraphCount(0),
- bDisplay(sal_False),
bHasTextP(sal_False),
- bHasPos(sal_False),
pCellContext(pTempCellContext),
pShapeContext(NULL)
{
@@ -91,32 +97,32 @@ ScXMLAnnotationContext::ScXMLAnnotationContext( ScXMLImport& rImport,
{
case XML_TOK_TABLE_ANNOTATION_ATTR_AUTHOR:
{
- sAuthorBuffer = sValue;
+ maAuthorBuffer = sValue;
}
break;
case XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE:
{
- sCreateDateBuffer = sValue;
+ maCreateDateBuffer = sValue;
}
break;
case XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE_STRING:
{
- sCreateDateStringBuffer = sValue;
+ maCreateDateStringBuffer = sValue;
}
break;
case XML_TOK_TABLE_ANNOTATION_ATTR_DISPLAY:
{
- bDisplay = IsXMLToken(sValue, XML_TRUE);
+ mrAnnotationData.mbShown = IsXMLToken(sValue, XML_TRUE);
}
break;
case XML_TOK_TABLE_ANNOTATION_ATTR_X:
{
- bHasPos = sal_True;
+ mrAnnotationData.mbUseShapePos = true;
}
break;
case XML_TOK_TABLE_ANNOTATION_ATTR_Y:
{
- bHasPos = sal_True;
+ mrAnnotationData.mbUseShapePos = true;
}
break;
}
@@ -144,28 +150,28 @@ SvXMLImportContext *ScXMLAnnotationContext::CreateChildContext( USHORT nPrefix,
{
if( IsXMLToken( rLName, XML_CREATOR ) )
pContext = new ScXMLContentContext(GetScImport(), nPrefix,
- rLName, xAttrList, sAuthorBuffer);
+ rLName, xAttrList, maAuthorBuffer);
else if( IsXMLToken( rLName, XML_DATE ) )
pContext = new ScXMLContentContext(GetScImport(), nPrefix,
- rLName, xAttrList, sCreateDateBuffer);
+ rLName, xAttrList, maCreateDateBuffer);
}
else if( XML_NAMESPACE_META == nPrefix )
{
if( IsXMLToken( rLName, XML_DATE_STRING ) )
pContext = new ScXMLContentContext(GetScImport(), nPrefix,
- rLName, xAttrList, sCreateDateStringBuffer);
+ rLName, xAttrList, maCreateDateStringBuffer);
}
/* else if ((nPrefix == XML_NAMESPACE_TEXT) && IsXMLToken(rLName, XML_P) )
{
if (!bHasTextP)
{
bHasTextP = sal_True;
- sOUText.setLength(0);
+ maTextBuffer.setLength(0);
}
if(nParagraphCount)
- sOUText.append(static_cast<sal_Unicode>('\n'));
+ maTextBuffer.append(static_cast<sal_Unicode>('\n'));
++nParagraphCount;
- pContext = new ScXMLContentContext( GetScImport(), nPrefix, rLName, xAttrList, sOUText);
+ pContext = new ScXMLContentContext( GetScImport(), nPrefix, rLName, xAttrList, maTextBuffer);
}*/
if( !pContext && pShapeContext )
@@ -180,7 +186,7 @@ SvXMLImportContext *ScXMLAnnotationContext::CreateChildContext( USHORT nPrefix,
void ScXMLAnnotationContext::Characters( const ::rtl::OUString& rChars )
{
if (!bHasTextP)
- sOUText.append(rChars);
+ maTextBuffer.append(rChars);
}
void ScXMLAnnotationContext::EndElement()
@@ -191,41 +197,19 @@ void ScXMLAnnotationContext::EndElement()
delete pShapeContext;
}
- ScMyImportAnnotation* pMyAnnotation = new ScMyImportAnnotation();
- pMyAnnotation->sAuthor = sAuthorBuffer.makeStringAndClear();
- pMyAnnotation->sCreateDate = sCreateDateBuffer.makeStringAndClear();
- if (!pMyAnnotation->sCreateDate.getLength())
- pMyAnnotation->sCreateDate = sCreateDateStringBuffer.makeStringAndClear();
- pMyAnnotation->sText = sOUText.makeStringAndClear();
- pMyAnnotation->bDisplay = bDisplay;
-
- if (xShape.is() && xShapes.is())
- {
- SvxShape* pShapeImp = SvxShape::getImplementation(xShape);
- if (pShapeImp)
- {
- SdrObject *pSdrObj = pShapeImp->GetSdrObject();
- if (pSdrObj)
- {
- if (bHasPos)
- {
- pMyAnnotation->pItemSet = pSdrObj->GetMergedItemSet().Clone();
- awt::Point aPos = xShape->getPosition();
- awt::Size aSize = xShape->getSize();
- Rectangle aRect(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height));
- pMyAnnotation->pRect = new Rectangle(aRect);
- }
-
- if( OutlinerParaObject* pOPO = pSdrObj->GetOutlinerParaObject() )
- pMyAnnotation->pOPO = new OutlinerParaObject( *pOPO );
-
- xShapes->remove(xShape);
- }
- }
- }
+ mrAnnotationData.maAuthor = maAuthorBuffer.makeStringAndClear();
+ mrAnnotationData.maCreateDate = maCreateDateBuffer.makeStringAndClear();
+ if (!mrAnnotationData.maCreateDate.getLength())
+ mrAnnotationData.maCreateDate = maCreateDateStringBuffer.makeStringAndClear();
+ mrAnnotationData.maSimpleText = maTextBuffer.makeStringAndClear();
XMLTableShapeImportHelper* pTableShapeImport = (XMLTableShapeImportHelper*)GetScImport().GetShapeImport().get();
pTableShapeImport->SetAnnotation(NULL);
+}
- pCellContext->AddAnnotation(pMyAnnotation);
+void ScXMLAnnotationContext::SetShape( const uno::Reference< drawing::XShape >& rxShape, const uno::Reference< drawing::XShapes >& rxShapes )
+{
+ mrAnnotationData.mxShape = rxShape;
+ mrAnnotationData.mxShapes = rxShapes;
}
+
diff --git a/sc/source/filter/xml/xmlannoi.hxx b/sc/source/filter/xml/xmlannoi.hxx
index 3a65d5b444ff..c509b72124ed 100644
--- a/sc/source/filter/xml/xmlannoi.hxx
+++ b/sc/source/filter/xml/xmlannoi.hxx
@@ -30,6 +30,7 @@
#ifndef SC_XMLANNOI_HXX
#define SC_XMLANNOI_HXX
+#include <memory>
#include <xmloff/xmlictxt.hxx>
#include <xmloff/xmlimp.hxx>
#include <rtl/ustrbuf.hxx>
@@ -39,30 +40,31 @@
class ScXMLImport;
class ScXMLTableRowCellContext;
-class ScXMLAnnotationContext : public SvXMLImportContext
+struct ScXMLAnnotationData
{
- rtl::OUStringBuffer sOUText;
- rtl::OUStringBuffer sAuthorBuffer;
- rtl::OUStringBuffer sCreateDateBuffer;
- rtl::OUStringBuffer sCreateDateStringBuffer;
- sal_Int32 nParagraphCount;
- sal_Bool bDisplay;
- sal_Bool bHasTextP;
- sal_Bool bHasPos;
- ScXMLTableRowCellContext* pCellContext;
- SvXMLImportContext* pShapeContext;
- com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape;
- com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ mxShape;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ mxShapes;
+ ::rtl::OUString maAuthor;
+ ::rtl::OUString maCreateDate;
+ ::rtl::OUString maSimpleText;
+ bool mbUseShapePos;
+ bool mbShown;
- const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
- ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
+ explicit ScXMLAnnotationData();
+ ~ScXMLAnnotationData();
+};
+class ScXMLAnnotationContext : public SvXMLImportContext
+{
public:
ScXMLAnnotationContext( ScXMLImport& rImport, USHORT nPrfx,
const ::rtl::OUString& rLName,
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ ScXMLAnnotationData& rAnnotationData,
ScXMLTableRowCellContext* pCellContext);
virtual ~ScXMLAnnotationContext();
@@ -78,8 +80,23 @@ public:
virtual void EndElement();
- void SetShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xTempShape,
- const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& xTempShapes) { xShape.set(xTempShape); xShapes.set(xTempShapes); }
+ void SetShape(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+
+private:
+ ScXMLAnnotationData& mrAnnotationData;
+ rtl::OUStringBuffer maTextBuffer;
+ rtl::OUStringBuffer maAuthorBuffer;
+ rtl::OUStringBuffer maCreateDateBuffer;
+ rtl::OUStringBuffer maCreateDateStringBuffer;
+ sal_Int32 nParagraphCount;
+ sal_Bool bHasTextP;
+ ScXMLTableRowCellContext* pCellContext;
+ SvXMLImportContext* pShapeContext;
+
+ const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
+ ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
};
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index fd9562a9b1fb..048f1ec0c549 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -52,6 +52,7 @@
#include "XMLTrackedChangesContext.hxx"
#include "XMLEmptyContext.hxx"
#include "scerrors.hxx"
+#include "tabprotection.hxx"
#include <xmloff/xmltkmap.hxx>
#include <xmloff/xmltoken.hxx>
@@ -62,7 +63,10 @@
#include <sal/types.h>
#include <tools/debug.hxx>
+#include <memory>
+
using rtl::OUString;
+
using namespace com::sun::star;
using namespace xmloff::token;
@@ -281,10 +285,17 @@ void ScXMLBodyContext::EndElement()
// #i37959# handle document protection after the sheet settings
if (bProtected)
{
+ ::std::auto_ptr<ScDocProtection> pProtection(new ScDocProtection);
+ pProtection->setProtected(true);
+
uno::Sequence<sal_Int8> aPass;
if (sPassword.getLength())
+ {
SvXMLUnitConverter::decodeBase64(aPass, sPassword);
- pDoc->SetDocProtection(bProtected, aPass);
+ pProtection->setPasswordHash(aPass, PASSHASH_OOO);
+ }
+
+ pDoc->SetDocProtection(pProtection.get());
}
}
GetScImport().UnlockSolarMutex();
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 06c84ac83366..f0a4569cc86e 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -68,6 +68,7 @@
#include <svx/svdocapt.hxx>
#include <svx/outlobj.hxx>
#include <svx/editobj.hxx>
+#include <svx/unoapi.hxx>
#include <svtools/languageoptions.hxx>
#include <com/sun/star/frame/XModel.hpp>
@@ -99,15 +100,6 @@ using namespace xmloff::token;
//------------------------------------------------------------------
-ScMyImportAnnotation::~ScMyImportAnnotation()
-{
- delete pRect;
- delete pItemSet;
- delete pOPO;
-}
-
-//------------------------------------------------------------------
-
ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
USHORT nPrfx,
const ::rtl::OUString& rLName,
@@ -117,7 +109,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
const sal_Int32 nTempRepeatedRows ) :
SvXMLImportContext( rImport, nPrfx, rLName ),
pContentValidationName(NULL),
- pMyAnnotation(NULL),
pDetectiveObjVec(NULL),
pCellRangeSource(NULL),
fValue(0.0),
@@ -138,7 +129,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
bSolarMutexLocked(sal_False),
bFormulaTextResult(sal_False)
{
- formula::FormulaGrammar::Grammar eStorageGrammar = eGrammar = GetScImport().GetDocument()->GetStorageGrammar();
rXMLImport.SetRemoveLastChar(sal_False);
rXMLImport.GetTables().AddColumn(bTempIsCovered);
const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
@@ -241,25 +231,9 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
if (sValue.getLength())
{
DBG_ASSERT(!pOUFormula, "here should be only one formula");
- rtl::OUString sFormula;
- sal_uInt16 nFormulaPrefix = GetImport().GetNamespaceMap().
- _GetKeyByAttrName( sValue, &sFormula, sal_False );
-
- if (ScXMLImport::IsAcceptedFormulaNamespace(
- nFormulaPrefix, sValue, eGrammar,
- eStorageGrammar))
- {
- // Namespaces we accept.
- pOUFormula.reset( sFormula);
- }
- else
- {
- // No namespace => entire string.
- // Also unknown namespace included in formula,
- // so hopefully will result in string or
- // compile error.
- pOUFormula.reset( sValue);
- }
+ rtl::OUString aFormula, aFormulaNmsp;
+ rXMLImport.ExtractFormulaNamespaceGrammar( aFormula, aFormulaNmsp, eGrammar, sValue );
+ pOUFormula.reset( FormulaWithNamespace( aFormula, aFormulaNmsp ) );
}
}
break;
@@ -283,8 +257,6 @@ ScXMLTableRowCellContext::~ScXMLTableRowCellContext()
{
if (pContentValidationName)
delete pContentValidationName;
- if (pMyAnnotation)
- delete pMyAnnotation;
if (pDetectiveObjVec)
delete pDetectiveObjVec;
if (pCellRangeSource)
@@ -425,8 +397,10 @@ SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( USHORT nPrefix
case XML_TOK_TABLE_ROW_CELL_ANNOTATION:
{
bIsEmpty = sal_False;
+ DBG_ASSERT( !mxAnnotationData.get(), "ScXMLTableRowCellContext::CreateChildContext - multiple annotations in one cell" );
+ mxAnnotationData.reset( new ScXMLAnnotationData );
pContext = new ScXMLAnnotationContext( rXMLImport, nPrefix, rLName,
- xAttrList, this);
+ xAttrList, *mxAnnotationData, this);
}
break;
case XML_TOK_TABLE_ROW_CELL_DETECTIVE:
@@ -539,7 +513,7 @@ void ScXMLTableRowCellContext::SetContentValidation(com::sun::star::uno::Referen
if (pContentValidationName)
{
ScMyImportValidation aValidation;
- aValidation.eGrammar = GetScImport().GetDocument()->GetStorageGrammar();
+ aValidation.eGrammar1 = aValidation.eGrammar2 = GetScImport().GetDocument()->GetStorageGrammar();
if (rXMLImport.GetValidation(*pContentValidationName, aValidation))
{
uno::Reference<beans::XPropertySet> xPropertySet(xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_VALIXML))), uno::UNO_QUERY);
@@ -568,8 +542,11 @@ void ScXMLTableRowCellContext::SetContentValidation(com::sun::star::uno::Referen
// #b4974740# source position must be set as string, because it may
// refer to a sheet that hasn't been loaded yet.
xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SOURCESTR)), uno::makeAny(aValidation.sBaseCellAddress));
- // Transport grammar.
- xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_GRAMMAR)), uno::makeAny(static_cast<sal_Int32>(aValidation.eGrammar)));
+ // Transport grammar and formula namespace
+ xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_FORMULANMSP1)), uno::makeAny(aValidation.sFormulaNmsp1));
+ xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_FORMULANMSP2)), uno::makeAny(aValidation.sFormulaNmsp2));
+ xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_GRAMMAR1)), uno::makeAny(static_cast<sal_Int32>(aValidation.eGrammar1)));
+ xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_GRAMMAR2)), uno::makeAny(static_cast<sal_Int32>(aValidation.eGrammar2)));
}
}
xPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_VALIXML)), uno::makeAny(xPropertySet));
@@ -607,71 +584,98 @@ void ScXMLTableRowCellContext::SetCellProperties(const uno::Reference<table::XCe
void ScXMLTableRowCellContext::SetAnnotation(const table::CellAddress& aCellAddress)
{
- /*uno::Reference<sheet::XSheetAnnotationAnchor> xSheetAnnotationAnchor(xCell, uno::UNO_QUERY);
- if (xSheetAnnotationAnchor.is())
+ ScDocument* pDoc = rXMLImport.GetDocument();
+ if( !pDoc || !mxAnnotationData.get() )
+ return;
+
+ LockSolarMutex();
+
+ ScAddress aPos;
+ ScUnoConversion::FillScAddress( aPos, aCellAddress );
+ ScPostIt* pNote = 0;
+
+ uno::Reference< drawing::XShapes > xShapes = rXMLImport.GetTables().GetCurrentXShapes();
+ uno::Reference< container::XIndexAccess > xShapesIA( xShapes, uno::UNO_QUERY );
+ sal_Int32 nOldShapeCount = xShapesIA.is() ? xShapesIA->getCount() : 0;
+
+ DBG_ASSERT( !mxAnnotationData->mxShape.is() || mxAnnotationData->mxShapes.is(),
+ "ScXMLTableRowCellContext::SetAnnotation - shape without drawing page" );
+ if( mxAnnotationData->mxShape.is() && mxAnnotationData->mxShapes.is() )
{
- uno::Reference <sheet::XSheetAnnotation> xSheetAnnotation (xSheetAnnotationAnchor->getAnnotation());
- uno::Reference<text::XSimpleText> xSimpleText(xSheetAnnotation, uno::UNO_QUERY);
- if (xSheetAnnotation.is() && xSimpleText.is())
+ DBG_ASSERT( mxAnnotationData->mxShapes.get() == xShapes.get(), "ScXMLTableRowCellContext::SetAnnotation - diffenet drawing pages" );
+ SdrObject* pObject = ::GetSdrObjectFromXShape( mxAnnotationData->mxShape );
+ DBG_ASSERT( pObject, "ScXMLTableRowCellContext::SetAnnotation - cannot get SdrObject from shape" );
+
+ /* Try to reuse the drawing object already created (but only if the
+ note is visible, and the object is a caption object). */
+ if( mxAnnotationData->mbShown && mxAnnotationData->mbUseShapePos )
{
- xSimpleText->setString(aMyAnnotation.sText);
- //xSheetAnnotation->setAuthor(aMyAnnotation.sAuthor);
- //xSheetAnnotation->setDate();
- xSheetAnnotation->setIsVisible(aMyAnnotation.bDisplay);
+ if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
+ {
+ OSL_ENSURE( !pCaption->GetLogicRect().IsEmpty(), "ScXMLTableRowCellContext::SetAnnotation - invalid caption rectangle" );
+ // create the cell note with the caption object
+ pNote = ScNoteUtil::CreateNoteFromCaption( *pDoc, aPos, *pCaption, true );
+ // forget pointer to object (do not create note again below)
+ pObject = 0;
+ }
}
- }*/
- if( pMyAnnotation )
- {
- double fDate;
- rXMLImport.GetMM100UnitConverter().convertDateTime(fDate, pMyAnnotation->sCreateDate);
- ScDocument* pDoc = rXMLImport.GetDocument();
- if (pDoc)
+
+ // drawing object has not been used to create a note -> use shape data
+ if( pObject )
{
- LockSolarMutex();
- SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
- sal_uInt32 nfIndex = pNumForm->GetFormatIndex(NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM);
- String sDate;
- Color* pColor = NULL;
- Color** ppColor = &pColor;
- pNumForm->GetOutputString(fDate, nfIndex, sDate, ppColor);
+ // rescue settings from drawing object before the shape is removed
+ ::std::auto_ptr< SfxItemSet > xItemSet( new SfxItemSet( pObject->GetMergedItemSet() ) );
+ ::std::auto_ptr< OutlinerParaObject > xOutlinerObj;
+ if( OutlinerParaObject* pOutlinerObj = pObject->GetOutlinerParaObject() )
+ xOutlinerObj.reset( new OutlinerParaObject( *pOutlinerObj ) );
+ Rectangle aCaptionRect;
+ if( mxAnnotationData->mbUseShapePos )
+ aCaptionRect = pObject->GetLogicRect();
+ // remove the shape from the drawing page, this invalidates pObject
+ mxAnnotationData->mxShapes->remove( mxAnnotationData->mxShape );
+ pObject = 0;
+ // update current number of existing objects
+ if( xShapesIA.is() )
+ nOldShapeCount = xShapesIA->getCount();
- ScAddress aPos;
- ScUnoConversion::FillScAddress( aPos, aCellAddress );
- if( ScPostIt* pNote = pDoc->GetOrCreateNote( aPos ) )
+ // an outliner object is required (empty note captions not allowed)
+ if( xOutlinerObj.get() )
{
- pNote->SetDate( sDate );
- pNote->SetAuthor( pMyAnnotation->sAuthor );
- if( SdrCaptionObj* pCaption = pNote->GetCaption() )
- {
- if( pMyAnnotation->pOPO )
- {
- // transfer outliner object to caption
- pCaption->SetOutlinerParaObject( pMyAnnotation->pOPO );
- // do not delete the object in ScMyImportAnnotation d'tor
- pMyAnnotation->pOPO = 0;
- }
- else
- pCaption->SetText( pMyAnnotation->sText );
- // copy all items and reset shadow items
- if( pMyAnnotation->pItemSet )
- pNote->SetCaptionItems( *pMyAnnotation->pItemSet );
- else
- pNote->SetCaptionDefaultItems(); // default items need to be applied to text
- if( pMyAnnotation->pRect )
- pCaption->SetLogicRect( *pMyAnnotation->pRect );
-
- uno::Reference<container::XIndexAccess> xShapesIndex (rXMLImport.GetTables().GetCurrentXShapes(), uno::UNO_QUERY); // make draw page
- if (xShapesIndex.is())
- {
- sal_Int32 nShapes = xShapesIndex->getCount();
- uno::Reference < drawing::XShape > xShape;
- rXMLImport.GetShapeImport()->shapeWithZIndexAdded(xShape, nShapes);
- }
- }
- pNote->ShowCaption( pMyAnnotation->bDisplay );
+ // create cell note with all data from drawing object
+ pNote = ScNoteUtil::CreateNoteFromObjectData( *pDoc, aPos,
+ xItemSet.release(), xOutlinerObj.release(),
+ aCaptionRect, mxAnnotationData->mbShown, false );
}
}
}
+ else if( mxAnnotationData->maSimpleText.getLength() > 0 )
+ {
+ // create note from simple text
+ pNote = ScNoteUtil::CreateNoteFromString( *pDoc, aPos,
+ mxAnnotationData->maSimpleText, mxAnnotationData->mbShown, false );
+ }
+
+ // set author and date
+ if( pNote )
+ {
+ double fDate;
+ rXMLImport.GetMM100UnitConverter().convertDateTime( fDate, mxAnnotationData->maCreateDate );
+ SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
+ sal_uInt32 nfIndex = pNumForm->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM );
+ String aDate;
+ Color* pColor = 0;
+ Color** ppColor = &pColor;
+ pNumForm->GetOutputString( fDate, nfIndex, aDate, ppColor );
+ pNote->SetDate( aDate );
+ pNote->SetAuthor( mxAnnotationData->maAuthor );
+ }
+
+ // register a shape that has been newly created in the ScNoteUtil functions
+ if( xShapesIA.is() && (nOldShapeCount < xShapesIA->getCount()) )
+ {
+ uno::Reference< drawing::XShape > xShape;
+ rXMLImport.GetShapeImport()->shapeWithZIndexAdded( xShape, xShapesIA->getCount() );
+ }
}
// core implementation
@@ -798,7 +802,7 @@ void ScXMLTableRowCellContext::EndElement()
// uno::Reference <table::XCell> xCell;
table::CellAddress aCurrentPos( aCellPos );
if ((pContentValidationName && pContentValidationName->getLength()) ||
- pMyAnnotation || pDetectiveObjVec || pCellRangeSource)
+ mxAnnotationData.get() || pDetectiveObjVec || pCellRangeSource)
bIsEmpty = sal_False;
ScMyTables& rTables = rXMLImport.GetTables();
@@ -980,7 +984,7 @@ void ScXMLTableRowCellContext::EndElement()
}
else
{
- if (!bWasEmpty || (pMyAnnotation))
+ if (!bWasEmpty || mxAnnotationData.get())
{
if (aCurrentPos.Row > MAXROW)
rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_ROW_OVERFLOW);
@@ -1028,7 +1032,7 @@ void ScXMLTableRowCellContext::EndElement()
//SetType(xTempCell);
}
}
- else
+ else // if ( !pOUFormula )
{
if (CellExists(aCellPos))
{
@@ -1041,7 +1045,7 @@ void ScXMLTableRowCellContext::EndElement()
{
DBG_ERRORFILE("It seems here are to many columns or rows");
}
- if (xCell.is() && pOUFormula)
+ if (xCell.is())
{
SetCellProperties(xCell); // set now only the validation
DBG_ASSERT(((nCellsRepeated == 1) && (nRepeatedRows == 1)), "repeated cells with formula not possible now");
@@ -1054,7 +1058,7 @@ void ScXMLTableRowCellContext::EndElement()
xCell));
if (pCellObj)
{
- pCellObj->SetFormulaWithGrammar( *pOUFormula, eGrammar);
+ pCellObj->SetFormulaWithGrammar( pOUFormula->first, pOUFormula->second, eGrammar);
if (bFormulaTextResult && pOUTextValue && pOUTextValue->getLength())
pCellObj->SetFormulaResultString( *pOUTextValue);
else if (fValue != 0.0)
@@ -1069,7 +1073,7 @@ void ScXMLTableRowCellContext::EndElement()
aCellPos.Column, aCellPos.Row,
aCellPos.Column + nMatrixCols - 1,
aCellPos.Row + nMatrixRows - 1,
- *pOUFormula, eGrammar);
+ pOUFormula->first, pOUFormula->second, eGrammar);
}
}
SetAnnotation( aCellPos );
@@ -1086,7 +1090,7 @@ void ScXMLTableRowCellContext::EndElement()
rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_COLUMN_OVERFLOW);
}
- }
+ } // if ( !pOUFormula )
}
UnlockSolarMutex();
}
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 67b619a15ed3..fe2bfd116348 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -30,6 +30,7 @@
#ifndef SC_XMLCELLI_HXX
#define SC_XMLCELLI_HXX
+#include <memory>
#include "XMLDetectiveContext.hxx"
#include "XMLCellRangeSourceContext.hxx"
#include <xmloff/xmlictxt.hxx>
@@ -37,7 +38,6 @@
#include <com/sun/star/table/XCell.hpp>
#include <tools/time.hxx>
#include <com/sun/star/util/DateTime.hpp>
-#include <sal/types.h>
#include <com/sun/star/table/XCellRange.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/table/CellAddress.hpp>
@@ -48,31 +48,18 @@
#include <boost/optional.hpp>
class ScXMLImport;
-class OutlinerParaObject;
-
-struct ScMyImportAnnotation
-{
- rtl::OUString sAuthor;
- rtl::OUString sCreateDate;
- rtl::OUString sText;
- sal_Bool bDisplay;
- Rectangle* pRect;
- SfxItemSet* pItemSet;
- OutlinerParaObject* pOPO;
-
- ScMyImportAnnotation() : bDisplay(sal_False), pRect(NULL), pItemSet(NULL), pOPO(NULL) {}
- ~ScMyImportAnnotation();
-};
+struct ScXMLAnnotationData;
class ScXMLTableRowCellContext : public SvXMLImportContext
{
+ typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > FormulaWithNamespace;
com::sun::star::uno::Reference<com::sun::star::table::XCell> xBaseCell;
com::sun::star::uno::Reference<com::sun::star::document::XActionLockable> xLockable;
::boost::optional< rtl::OUString > pOUTextValue;
::boost::optional< rtl::OUString > pOUTextContent;
- ::boost::optional< rtl::OUString > pOUFormula;
+ ::boost::optional< FormulaWithNamespace > pOUFormula;
rtl::OUString* pContentValidationName;
- ScMyImportAnnotation* pMyAnnotation;
+ ::std::auto_ptr< ScXMLAnnotationData > mxAnnotationData;
ScMyImpDetectiveObjVec* pDetectiveObjVec;
ScMyImpCellRangeSource* pCellRangeSource;
double fValue;
@@ -140,8 +127,6 @@ public:
void SetCellRangeSource( const ::com::sun::star::table::CellAddress& rPosition );
virtual void EndElement();
-
- void AddAnnotation(ScMyImportAnnotation* pValue) { pMyAnnotation = pValue; }
};
#endif
diff --git a/sc/source/filter/xml/xmlcvali.cxx b/sc/source/filter/xml/xmlcvali.cxx
index d8d8eb0d7cc2..aeff28f3eed6 100644
--- a/sc/source/filter/xml/xmlcvali.cxx
+++ b/sc/source/filter/xml/xmlcvali.cxx
@@ -51,6 +51,8 @@
using namespace com::sun::star;
using namespace xmloff::token;
+using namespace ::formula;
+using ::rtl::OUString;
class ScXMLContentValidationContext : public SvXMLImportContext
{
@@ -62,7 +64,6 @@ class ScXMLContentValidationContext : public SvXMLImportContext
rtl::OUString sErrorMessageType;
rtl::OUString sBaseCellAddress;
rtl::OUString sCondition;
- formula::FormulaGrammar::Grammar eGrammar;
sal_Int16 nShowList;
sal_Bool bAllowEmptyCell;
sal_Bool bDisplayHelp;
@@ -73,11 +74,10 @@ class ScXMLContentValidationContext : public SvXMLImportContext
const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
- void GetAlertStyle(const rtl::OUString& sMessageType, com::sun::star::sheet::ValidationAlertStyle& aAlertStyle);
- void SetFormulas(const rtl::OUString& sFormulas, rtl::OUString& sFormula1, rtl::OUString& sFormula2) const;
- void GetCondition(const rtl::OUString& sCondition, rtl::OUString& sFormula1, rtl::OUString& sFormula2,
- com::sun::star::sheet::ValidationType& aValidationType,
- com::sun::star::sheet::ConditionOperator& aOperator);
+ com::sun::star::sheet::ValidationAlertStyle GetAlertStyle() const;
+ void SetFormula( OUString& rFormula, OUString& rFormulaNmsp, FormulaGrammar::Grammar& reGrammar,
+ const OUString& rCondition, const OUString& rGlobNmsp, FormulaGrammar::Grammar eGlobGrammar, bool bHasNmsp ) const;
+ void GetCondition( ScMyImportValidation& rValidation ) const;
public:
@@ -235,20 +235,11 @@ ScXMLContentValidationContext::ScXMLContentValidationContext( ScXMLImport& rImpo
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList>& xAttrList) :
SvXMLImportContext( rImport, nPrfx, rLName ),
- sName(),
- sHelpTitle(),
- sHelpMessage(),
- sErrorTitle(),
- sErrorMessage(),
- sErrorMessageType(),
- sBaseCellAddress(),
- sCondition(),
nShowList(sheet::TableValidationVisibility::UNSORTED),
bAllowEmptyCell(sal_True),
bDisplayHelp(sal_False),
bDisplayError(sal_False)
{
- const formula::FormulaGrammar::Grammar eStorageGrammar = eGrammar = GetScImport().GetDocument()->GetStorageGrammar();
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetContentValidationAttrTokenMap();
for( sal_Int16 i=0; i < nAttrCount; ++i )
@@ -265,14 +256,7 @@ ScXMLContentValidationContext::ScXMLContentValidationContext( ScXMLImport& rImpo
sName = sValue;
break;
case XML_TOK_CONTENT_VALIDATION_CONDITION:
- {
- sal_uInt16 nCondPrefix = GetImport().GetNamespaceMap().
- _GetKeyByAttrName( sValue, &sCondition, sal_False );
-
- if (!ScXMLImport::IsAcceptedFormulaNamespace( nCondPrefix,
- sValue, eGrammar, eStorageGrammar))
- sCondition = sValue;
- }
+ sCondition = sValue;
break;
case XML_TOK_CONTENT_VALIDATION_BASE_CELL_ADDRESS:
sBaseCellAddress = sValue;
@@ -336,189 +320,116 @@ SvXMLImportContext *ScXMLContentValidationContext::CreateChildContext( USHORT nP
return pContext;
}
-void ScXMLContentValidationContext::GetAlertStyle(const rtl::OUString& sMessageType, com::sun::star::sheet::ValidationAlertStyle& aAlertStyle)
+sheet::ValidationAlertStyle ScXMLContentValidationContext::GetAlertStyle() const
{
- if (IsXMLToken(sMessageType, XML_MACRO))
- aAlertStyle = sheet::ValidationAlertStyle_MACRO;
- else if (IsXMLToken(sMessageType, XML_STOP))
- aAlertStyle = sheet::ValidationAlertStyle_STOP;
- else if (IsXMLToken(sMessageType, XML_WARNING))
- aAlertStyle = sheet::ValidationAlertStyle_WARNING;
- else if (IsXMLToken(sMessageType, XML_INFORMATION))
- aAlertStyle = sheet::ValidationAlertStyle_INFO;
- else // don't leave uninitialized
- aAlertStyle = sheet::ValidationAlertStyle_STOP;
+ if (IsXMLToken(sErrorMessageType, XML_MACRO))
+ return sheet::ValidationAlertStyle_MACRO;
+ if (IsXMLToken(sErrorMessageType, XML_STOP))
+ return sheet::ValidationAlertStyle_STOP;
+ if (IsXMLToken(sErrorMessageType, XML_WARNING))
+ return sheet::ValidationAlertStyle_WARNING;
+ if (IsXMLToken(sErrorMessageType, XML_INFORMATION))
+ return sheet::ValidationAlertStyle_INFO;
+ // default for unknown
+ return sheet::ValidationAlertStyle_STOP;
}
-void ScXMLContentValidationContext::SetFormulas(const rtl::OUString& sFormulas, rtl::OUString& sFormula1, rtl::OUString& sFormula2) const
+void ScXMLContentValidationContext::SetFormula( OUString& rFormula, OUString& rFormulaNmsp, FormulaGrammar::Grammar& reGrammar,
+ const OUString& rCondition, const OUString& rGlobNmsp, FormulaGrammar::Grammar eGlobGrammar, bool bHasNmsp ) const
{
- sal_Int32 i = 0;
- sal_Bool bString = sal_False;
- sal_Int32 nBrakes = 0;
- while ((sFormulas[i] != ',' || nBrakes > 0 || bString) && i < sFormulas.getLength())
+ reGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
+ if( bHasNmsp )
{
- if (sFormulas[i] == '(')
- ++nBrakes;
- if (sFormulas[i] == ')')
- --nBrakes;
- if (sFormulas[i] == '"')
- bString = !bString;
- ++i;
+ // the entire attribute contains a namespace: internal namespace not allowed
+ rFormula = rCondition;
+ rFormulaNmsp = rGlobNmsp;
+ reGrammar = eGlobGrammar;
}
- if (sFormulas[i] == ',')
+ else
{
- sFormula1 = sFormulas.copy(0, i);
- sFormula2 = sFormulas.copy(i + 1);
+ // the attribute does not contain a namespace: try to find a namespace of an external grammar
+ GetScImport().ExtractFormulaNamespaceGrammar( rFormula, rFormulaNmsp, reGrammar, rCondition, true );
+ if( reGrammar != FormulaGrammar::GRAM_EXTERNAL )
+ reGrammar = eGlobGrammar;
}
}
-void ScXMLContentValidationContext::GetCondition(const rtl::OUString& sTempCondition, rtl::OUString& sFormula1, rtl::OUString& sFormula2,
- com::sun::star::sheet::ValidationType& aValidationType,
- com::sun::star::sheet::ConditionOperator& aOperator)
+void ScXMLContentValidationContext::GetCondition( ScMyImportValidation& rValidation ) const
{
- aValidationType = sheet::ValidationType_ANY; // #b6343997# default if no condition is given
- aOperator = sheet::ConditionOperator_NONE;
+ rValidation.aValidationType = sheet::ValidationType_ANY; // #b6343997# default if no condition is given
+ rValidation.aOperator = sheet::ConditionOperator_NONE;
- rtl::OUString sLocalCondition(sTempCondition);
- if (sLocalCondition.getLength())
+ if( sCondition.getLength() > 0 )
{
- // ToDo: erase all blanks in the condition, but not in formulas or strings
- rtl::OUString scell_content(RTL_CONSTASCII_USTRINGPARAM("cell_content"));
- rtl::OUString scell_content_is_date(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-date"));
- rtl::OUString scell_content_is_time(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-time"));
- rtl::OUString scell_content_is_between(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-between"));
- rtl::OUString scell_content_is_in_list(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-in-list"));
- rtl::OUString scell_content_text_length(RTL_CONSTASCII_USTRINGPARAM("cell-content-text-length"));
- rtl::OUString scell_content_is_not_between(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-not-between"));
- rtl::OUString scell_content_is_whole_number(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-whole-number"));
- rtl::OUString scell_content_is_decimal_number(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-decimal-number"));
- rtl::OUString scell_content_text_length_is_between(RTL_CONSTASCII_USTRINGPARAM("cell-content-text-length-is-between"));
- rtl::OUString scell_content_text_length_is_not_between(RTL_CONSTASCII_USTRINGPARAM("cell-content-text-length-is-not-between"));
- sal_Int32 i = 0;
- sal_Bool bAnd(sal_True);
- while (sLocalCondition[i] != '(' && i < sLocalCondition.getLength())
- ++i;
- if (sLocalCondition[i] == '(')
+ // extract leading namespace from condition string
+ OUString aCondition, aConditionNmsp;
+ FormulaGrammar::Grammar eGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
+ GetScImport().ExtractFormulaNamespaceGrammar( aCondition, aConditionNmsp, eGrammar, sCondition );
+ bool bHasNmsp = aCondition.getLength() < sCondition.getLength();
+
+ // parse a condition from the attribute string
+ ScXMLConditionParseResult aParseResult;
+ ScXMLConditionHelper::parseCondition( aParseResult, aCondition, 0 );
+
+ /* Check the result. A valid value in aParseResult.meToken implies
+ that the other members of aParseResult are filled with valid data
+ for that token. */
+ bool bSecondaryPart = false;
+ switch( aParseResult.meToken )
{
- if (i != scell_content_text_length.getLength() &&
- i != scell_content_text_length_is_between.getLength() &&
- i != scell_content_text_length_is_not_between.getLength() &&
- i != scell_content_is_in_list.getLength())
- {
- if (i == scell_content_is_time.getLength())
- {
- rtl::OUString sTemp = sLocalCondition.copy(0, i);
- if (sTemp == scell_content_is_time)
- aValidationType = sheet::ValidationType_TIME;
- else
- aValidationType = sheet::ValidationType_DATE;
- }
- else if (i == scell_content_is_whole_number.getLength())
- aValidationType = sheet::ValidationType_WHOLE;
- else if (i == scell_content_is_decimal_number.getLength())
- aValidationType = sheet::ValidationType_DECIMAL;
- sLocalCondition = sLocalCondition.copy(i + 2);
- rtl::OUString sTemp = sLocalCondition.copy(0, 5);
- if (sTemp.compareToAscii(" and ") == 0)
- sLocalCondition = sLocalCondition.copy(5);
- else
- bAnd = sal_False;
- }
- if (sLocalCondition.getLength() && bAnd)
+ case XML_COND_TEXTLENGTH: // condition is 'cell-content-text-length()<operator><expression>'
+ case XML_COND_TEXTLENGTH_ISBETWEEN: // condition is 'cell-content-text-length-is-between(<expression1>,<expression2>)'
+ case XML_COND_TEXTLENGTH_ISNOTBETWEEN: // condition is 'cell-content-text-length-is-not-between(<expression1>,<expression2>)'
+ case XML_COND_ISINLIST: // condition is 'cell-content-is-in-list(<expression>)'
+ rValidation.aValidationType = aParseResult.meValidation;
+ rValidation.aOperator = aParseResult.meOperator;
+ break;
+
+ case XML_COND_ISWHOLENUMBER: // condition is 'cell-content-is-whole-number() and <condition>'
+ case XML_COND_ISDECIMALNUMBER: // condition is 'cell-content-is-decimal-number() and <condition>'
+ case XML_COND_ISDATE: // condition is 'cell-content-is-date() and <condition>'
+ case XML_COND_ISTIME: // condition is 'cell-content-is-time() and <condition>'
+ rValidation.aValidationType = aParseResult.meValidation;
+ bSecondaryPart = true;
+ break;
+
+ default:; // unacceptable or unknown condition
+ }
+
+ /* Parse the following 'and <condition>' part of some conditions. This
+ updates the members of aParseResult that will contain the operands
+ and comparison operator then. */
+ if( bSecondaryPart )
+ {
+ ScXMLConditionHelper::parseCondition( aParseResult, aCondition, aParseResult.mnEndIndex );
+ if( aParseResult.meToken == XML_COND_AND )
{
- i = 0;
- while (sLocalCondition[i] != '(' && i < sLocalCondition.getLength())
- ++i;
- if (sLocalCondition[i] == '(')
+ ScXMLConditionHelper::parseCondition( aParseResult, aCondition, aParseResult.mnEndIndex );
+ switch( aParseResult.meToken )
{
- rtl::OUString sTemp = sLocalCondition.copy(0, i);
- sLocalCondition = sLocalCondition.copy(i + 1);
- if (i == scell_content_is_between.getLength() ||
- i == scell_content_text_length_is_between.getLength())
- {
- if (sTemp == scell_content_is_in_list)
- {
- aValidationType = sheet::ValidationType_LIST;
- sFormula1 = sLocalCondition.copy(0, sLocalCondition.getLength() - 1);
- aOperator = sheet::ConditionOperator_EQUAL;
- }
- else
- {
- if (i == scell_content_text_length_is_between.getLength())
- aValidationType = sheet::ValidationType_TEXT_LEN;
- aOperator = sheet::ConditionOperator_BETWEEN;
- sLocalCondition = sLocalCondition.copy(0, sLocalCondition.getLength() - 1);
- SetFormulas(sLocalCondition, sFormula1, sFormula2);
- }
- }
- else if (i == scell_content_is_not_between.getLength() ||
- i == scell_content_text_length_is_not_between.getLength())
- {
- if (i == scell_content_text_length_is_not_between.getLength())
- aValidationType = sheet::ValidationType_TEXT_LEN;
- aOperator = sheet::ConditionOperator_NOT_BETWEEN;
- sLocalCondition = sLocalCondition.copy(0, sLocalCondition.getLength() - 1);
- SetFormulas(sLocalCondition, sFormula1, sFormula2);
- }
- else if (i == scell_content.getLength() ||
- i == scell_content_text_length.getLength())
- {
- if (i == scell_content_text_length.getLength())
- aValidationType = sheet::ValidationType_TEXT_LEN;
- sLocalCondition = sLocalCondition.copy(1);
- switch (sLocalCondition[0])
- {
- case '<' :
- {
- if (sLocalCondition[1] == '=')
- {
- aOperator = sheet::ConditionOperator_LESS_EQUAL;
- sLocalCondition = sLocalCondition.copy(2);
- }
- else
- {
- aOperator = sheet::ConditionOperator_LESS;
- sLocalCondition = sLocalCondition.copy(1);
- }
- }
- break;
- case '>' :
- {
- if (sLocalCondition[1] == '=')
- {
- aOperator = sheet::ConditionOperator_GREATER_EQUAL;
- sLocalCondition = sLocalCondition.copy(2);
- }
- else
- {
- aOperator = sheet::ConditionOperator_GREATER;
- sLocalCondition = sLocalCondition.copy(1);
- }
- }
- break;
- case '=' :
- {
- aOperator = sheet::ConditionOperator_EQUAL;
- sLocalCondition = sLocalCondition.copy(1);
- }
- break;
- case '!' :
- {
- aOperator = sheet::ConditionOperator_NOT_EQUAL;
- sLocalCondition = sLocalCondition.copy(1);
- }
- break;
- }
- sFormula1 = sLocalCondition;
- }
+ case XML_COND_CELLCONTENT: // condition is 'and cell-content()<operator><expression>'
+ case XML_COND_ISBETWEEN: // condition is 'and cell-content-is-between(<expression1>,<expression2>)'
+ case XML_COND_ISNOTBETWEEN: // condition is 'and cell-content-is-not-between(<expression1>,<expression2>)'
+ rValidation.aOperator = aParseResult.meOperator;
+ break;
+ default:; // unacceptable or unknown condition
}
}
}
- }
- // a validation type (date, integer) without a condition isn't possible
- if ( aOperator == sheet::ConditionOperator_NONE )
- aValidationType = sheet::ValidationType_ANY;
+ // a validation type (date, integer) without a condition isn't possible
+ if( rValidation.aOperator == sheet::ConditionOperator_NONE )
+ rValidation.aValidationType = sheet::ValidationType_ANY;
+
+ // parse the formulas
+ if( rValidation.aValidationType != sheet::ValidationType_ANY )
+ {
+ SetFormula( rValidation.sFormula1, rValidation.sFormulaNmsp1, rValidation.eGrammar1,
+ aParseResult.maOperand1, aConditionNmsp, eGrammar, bHasNmsp );
+ SetFormula( rValidation.sFormula2, rValidation.sFormulaNmsp2, rValidation.eGrammar2,
+ aParseResult.maOperand2, aConditionNmsp, eGrammar, bHasNmsp );
+ }
+ }
}
void ScXMLContentValidationContext::EndElement()
@@ -546,15 +457,15 @@ void ScXMLContentValidationContext::EndElement()
}
ScMyImportValidation aValidation;
- aValidation.eGrammar = eGrammar;
+ aValidation.eGrammar1 = aValidation.eGrammar2 = GetScImport().GetDocument()->GetStorageGrammar();
aValidation.sName = sName;
aValidation.sBaseCellAddress = sBaseCellAddress;
aValidation.sImputTitle = sHelpTitle;
aValidation.sImputMessage = sHelpMessage;
aValidation.sErrorTitle = sErrorTitle;
aValidation.sErrorMessage = sErrorMessage;
- GetCondition(sCondition, aValidation.sFormula1, aValidation.sFormula2, aValidation.aValidationType, aValidation.aOperator);
- GetAlertStyle(sErrorMessageType, aValidation.aAlertStyle);
+ GetCondition( aValidation );
+ aValidation.aAlertStyle = GetAlertStyle();
aValidation.bShowErrorMessage = bDisplayError;
aValidation.bShowImputMessage = bDisplayHelp;
aValidation.bIgnoreBlanks = bAllowEmptyCell;
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index e2aa6fcd7504..55a1859211d0 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -381,7 +381,8 @@ void ScXMLDatabaseRangeContext::EndElement()
pDBData->SetSortParam(aSortParam);
}
- uno::Reference <sheet::XSheetFilterDescriptor> xSheetFilterDescriptor(xDatabaseRange->getFilterDescriptor());
+ uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor(
+ xDatabaseRange->getFilterDescriptor(), uno::UNO_QUERY );
if (xSheetFilterDescriptor.is())
{
uno::Reference <beans::XPropertySet> xFilterPropertySet (xSheetFilterDescriptor, uno::UNO_QUERY);
@@ -396,7 +397,7 @@ void ScXMLDatabaseRangeContext::EndElement()
xFilterPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_USEREGEX)), uno::makeAny(bFilterUseRegularExpressions));
xFilterPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_OUTPOS)), uno::makeAny(aFilterOutputPosition));
}
- xSheetFilterDescriptor->setFilterFields(aFilterFields);
+ xSheetFilterDescriptor->setFilterFields2(aFilterFields);
if (bFilterConditionSourceRange)
{
ScRange aAdvSource;
diff --git a/sc/source/filter/xml/xmldrani.hxx b/sc/source/filter/xml/xmldrani.hxx
index 36c668b0f77f..be55e5b143cc 100644
--- a/sc/source/filter/xml/xmldrani.hxx
+++ b/sc/source/filter/xml/xmldrani.hxx
@@ -36,7 +36,7 @@
#include <com/sun/star/sheet/SubTotalColumn.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/sheet/TableFilterField.hpp>
+#include <com/sun/star/sheet/TableFilterField2.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/table/TableOrientation.hpp>
@@ -79,7 +79,7 @@ class ScXMLDatabaseRangeContext : public SvXMLImportContext
rtl::OUString sDatabaseName;
rtl::OUString sSourceObject;
com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortSequence;
- com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField> aFilterFields;
+ com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField2> aFilterFields;
std::vector < ScSubTotalRule > aSubTotalRules;
com::sun::star::table::CellAddress aFilterOutputPosition;
com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress;
@@ -146,7 +146,7 @@ public:
void SetFilterIsCaseSensitive(const sal_Bool bTemp) { bFilterIsCaseSensitive = bTemp; }
void SetFilterSkipDuplicates(const sal_Bool bTemp) { bFilterSkipDuplicates = bTemp; }
void SetFilterUseRegularExpressions(const sal_Bool bTemp) { bFilterUseRegularExpressions = bTemp; }
- void SetFilterFields(const com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField>& aTemp) { aFilterFields = aTemp; }
+ void SetFilterFields(const com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField2>& aTemp) { aFilterFields = aTemp; }
void SetFilterOutputPosition(const com::sun::star::table::CellAddress& aTemp) { aFilterOutputPosition = aTemp; }
void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress& aTemp) { aFilterConditionSourceRangeAddress = aTemp;
bFilterConditionSourceRange = sal_True; }
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 8dda5e3c0eec..98965cba07bc 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -68,6 +68,8 @@
#include "convuno.hxx"
#include "postit.hxx"
#include "externalrefmgr.hxx"
+#include "editutil.hxx"
+#include "tabprotection.hxx"
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -180,6 +182,35 @@ OUString lcl_RangeSequenceToString(
}
return aResult.makeStringAndClear();
}
+
+OUString lcl_GetRawString( ScDocument* pDoc, const ScAddress& rPos )
+{
+ // return text/edit cell string content, with line feeds in edit cells
+
+ String aVal; // document uses tools-strings
+ if (pDoc)
+ {
+ ScBaseCell* pCell = pDoc->GetCell( rPos );
+ if (pCell)
+ {
+ CellType eType = pCell->GetCellType();
+ if ( eType == CELLTYPE_STRING )
+ static_cast<ScStringCell*>(pCell)->GetString(aVal); // string cell: content
+ else if ( eType == CELLTYPE_EDIT )
+ {
+ // edit cell: text with line breaks
+ const EditTextObject* pData = static_cast<ScEditCell*>(pCell)->GetData();
+ if (pData)
+ {
+ EditEngine& rEngine = pDoc->GetEditEngine();
+ rEngine.SetText( *pData );
+ aVal = rEngine.GetText( LINEEND_LF );
+ }
+ }
+ }
+ }
+ return aVal;
+}
} // anonymous namespace
//----------------------------------------------------------------------------
@@ -565,6 +596,7 @@ void ScXMLExport::CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCo
if (!pSharedData)
CreateSharedData(nTableCount);
pCellStyles->AddNewTable(nTableCount - 1);
+ pDoc->InitializeAllNoteCaptions( true );
if (HasDrawPages(xSpreadDoc))
{
rtl::OUString sCaptionPoint( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ));
@@ -1439,7 +1471,11 @@ void ScXMLExport::SetBodyAttributes()
{
AddAttribute(XML_NAMESPACE_TABLE, XML_STRUCTURE_PROTECTED, XML_TRUE);
rtl::OUStringBuffer aBuffer;
- SvXMLUnitConverter::encodeBase64(aBuffer, pDoc->GetDocPassword());
+ uno::Sequence<sal_Int8> aPassHash;
+ const ScDocProtection* p = pDoc->GetDocProtection();
+ if (p)
+ aPassHash = p->getPasswordHash(PASSHASH_OOO);
+ SvXMLUnitConverter::encodeBase64(aBuffer, aPassHash);
if (aBuffer.getLength())
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
}
@@ -1513,7 +1549,11 @@ void ScXMLExport::_ExportContent()
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE);
rtl::OUStringBuffer aBuffer;
if (pDoc)
- SvXMLUnitConverter::encodeBase64(aBuffer, pDoc->GetTabPassword(static_cast<SCTAB>(nTable)));
+ {
+ ScTableProtection* pProtect = pDoc->GetTabProtection(static_cast<SCTAB>(nTable));
+ if (pProtect)
+ SvXMLUnitConverter::encodeBase64(aBuffer, pProtect->getPasswordHash(PASSHASH_OOO));
+ }
if (aBuffer.getLength())
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
}
@@ -2335,9 +2375,7 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
{
if (GetCellText(aCell, aCellPos))
{
- rtl::OUString sFormula(ScCellObj::GetInputString_Impl(pDoc, aCellPos, TRUE));
- if (sFormula[0] == '\'')
- sFormula = sFormula.copy(1);
+ rtl::OUString sFormula(lcl_GetRawString(pDoc, aCellPos));
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
sFormula, aCell.sStringValue, sal_True, sal_True);
}
@@ -2427,7 +2465,8 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
if (!bIsEmpty)
{
- if ((aCell.nType == table::CellContentType_TEXT) && IsEditCell(aCell))
+ if ((aCell.nType == table::CellContentType_TEXT && IsEditCell(aCell)) ||
+ (aCell.nType == table::CellContentType_FORMULA && IsMultiLineFormulaCell(aCell)))
{
bEditCell = sal_True;
uno::Reference<text::XText> xText(xCurrentTableCellRange->getCellByPosition(aCell.aCellAddress.Column, aCell.aCellAddress.Row), uno::UNO_QUERY);
@@ -2842,12 +2881,15 @@ sal_Bool ScXMLExport::IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& a
return (aCell1.nType == aCell2.nType);
}
-sal_Bool ScXMLExport::IsEditCell(const com::sun::star::table::CellAddress& aAddress) const
+sal_Bool ScXMLExport::IsEditCell(const com::sun::star::table::CellAddress& aAddress, ScMyCell* pMyCell) const
{
ScAddress aCoreAddress(static_cast<SCCOL>(aAddress.Column),
static_cast<SCROW>(aAddress.Row),
static_cast<SCTAB>(aAddress.Sheet));
ScBaseCell* pBaseCell = GetDocument() ? GetDocument()->GetCell(aCoreAddress) : NULL;
+ if (pMyCell)
+ pMyCell->pBaseCell = pBaseCell;
+
if (pBaseCell)
return (pBaseCell->GetCellType() == CELLTYPE_EDIT);
return sal_False;
@@ -2867,12 +2909,36 @@ sal_Bool ScXMLExport::IsEditCell(ScMyCell& rCell) const
return rCell.bIsEditCell;
else
{
- rCell.bIsEditCell = IsEditCell(rCell.aCellAddress);
+ rCell.bIsEditCell = IsEditCell(rCell.aCellAddress, &rCell);
rCell.bKnowWhetherIsEditCell = sal_True;
return rCell.bIsEditCell;
}
}
+sal_Bool ScXMLExport::IsMultiLineFormulaCell(ScMyCell& rCell) const
+{
+ if (rCell.pBaseCell)
+ {
+ if (rCell.pBaseCell->GetCellType() != CELLTYPE_FORMULA)
+ return false;
+
+ return static_cast<ScFormulaCell*>(rCell.pBaseCell)->IsMultilineResult();
+ }
+
+ ScAddress aAddr(static_cast<SCCOL>(rCell.aCellAddress.Column),
+ static_cast<SCROW>(rCell.aCellAddress.Row),
+ static_cast<SCTAB>(rCell.aCellAddress.Sheet));
+ ScBaseCell* pBaseCell = pDoc ? pDoc->GetCell(aAddr) : NULL;
+ if (!pBaseCell)
+ return false;
+
+ rCell.pBaseCell = pBaseCell;
+ if (rCell.pBaseCell->GetCellType() != CELLTYPE_FORMULA)
+ return false;
+
+ return static_cast<ScFormulaCell*>(rCell.pBaseCell)->IsMultilineResult();
+}
+
//UNUSED2008-05 sal_Bool ScXMLExport::IsAnnotationEqual(const uno::Reference<table::XCell>& /* xCell1 */,
//UNUSED2008-05 const uno::Reference<table::XCell>& /* xCell2 */)
//UNUSED2008-05 {
@@ -2974,7 +3040,7 @@ sal_Bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2)
if (GetCellText(aCell1, aCellPos1) && GetCellText(aCell2, aCellPos2))
{
bIsEqual = (aCell1.sStringValue == aCell2.sStringValue) &&
- (ScCellObj::GetInputString_Impl(pDoc, aCellPos1, TRUE) == ScCellObj::GetInputString_Impl(pDoc, aCellPos2, TRUE));
+ (lcl_GetRawString(pDoc, aCellPos1) == lcl_GetRawString(pDoc, aCellPos2));
}
else
bIsEqual = sal_False;
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 0ed10a5ae476..d38bd7b23970 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -62,6 +62,7 @@ class XMLNumberFormatAttributesExportHelper;
class ScChartListener;
class SfxItemPool;
class ScAddress;
+class ScBaseCell;
typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec;
@@ -187,9 +188,10 @@ class ScXMLExport : public SvXMLExport
void SetRepeatAttribute (const sal_Int32 nEqualCellCount);
sal_Bool IsCellTypeEqual (const ScMyCell& aCell1, const ScMyCell& aCell2) const;
- sal_Bool IsEditCell(const com::sun::star::table::CellAddress& aAddress) const;
+ sal_Bool IsEditCell(const com::sun::star::table::CellAddress& aAddress, ScMyCell* pMyCell = NULL) const;
//UNUSED2008-05 sal_Bool IsEditCell(const com::sun::star::uno::Reference <com::sun::star::table::XCell>& xCell) const;
sal_Bool IsEditCell(ScMyCell& rCell) const;
+ sal_Bool IsMultiLineFormulaCell(ScMyCell& rCell) const;
//UNUSED2008-05 sal_Bool IsAnnotationEqual(const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell1,
//UNUSED2008-05 const com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell2);
sal_Bool IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2);
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index 4eefbbc1a917..7eabdff07b9b 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -114,6 +114,49 @@ void ScXMLExternalRefTabSourceContext::EndElement()
// ============================================================================
+ScXMLExternalRefRowsContext::ScXMLExternalRefRowsContext(
+ ScXMLImport& rImport, USHORT nPrefix, const OUString& rLName,
+ const Reference<XAttributeList>& /* xAttrList */, ScXMLExternalTabData& rRefInfo ) :
+ SvXMLImportContext( rImport, nPrefix, rLName ),
+ mrScImport(rImport),
+ mrExternalRefInfo(rRefInfo)
+{
+}
+
+ScXMLExternalRefRowsContext::~ScXMLExternalRefRowsContext()
+{
+}
+
+SvXMLImportContext* ScXMLExternalRefRowsContext::CreateChildContext(
+ USHORT nPrefix, const OUString& rLocalName, const Reference<XAttributeList>& xAttrList )
+{
+ // #i101319# row elements inside group, rows or header-rows
+ // are treated like row elements directly in the table element
+
+ const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowsElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
+ switch (nToken)
+ {
+ case XML_TOK_TABLE_ROWS_ROW_GROUP:
+ case XML_TOK_TABLE_ROWS_HEADER_ROWS:
+ case XML_TOK_TABLE_ROWS_ROWS:
+ return new ScXMLExternalRefRowsContext(
+ mrScImport, nPrefix, rLocalName, xAttrList, mrExternalRefInfo);
+ case XML_TOK_TABLE_ROWS_ROW:
+ return new ScXMLExternalRefRowContext(
+ mrScImport, nPrefix, rLocalName, xAttrList, mrExternalRefInfo);
+ default:
+ ;
+ }
+ return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+}
+
+void ScXMLExternalRefRowsContext::EndElement()
+{
+}
+
+// ============================================================================
+
ScXMLExternalRefRowContext::ScXMLExternalRefRowContext(
ScXMLImport& rImport, USHORT nPrefix, const OUString& rLName,
const Reference<XAttributeList>& xAttrList, ScXMLExternalTabData& rRefInfo ) :
@@ -153,7 +196,7 @@ SvXMLImportContext* ScXMLExternalRefRowContext::CreateChildContext(
{
const SvXMLTokenMap& rTokenMap = mrScImport.GetTableRowElemTokenMap();
sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName);
- if (nToken == XML_TOK_TABLE_ROW_CELL)
+ if (nToken == XML_TOK_TABLE_ROW_CELL || nToken == XML_TOK_TABLE_ROW_COVERED_CELL)
return new ScXMLExternalRefCellContext(mrScImport, nPrefix, rLocalName, xAttrList, mrExternalRefInfo);
return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
diff --git a/sc/source/filter/xml/xmlexternaltabi.hxx b/sc/source/filter/xml/xmlexternaltabi.hxx
index 504be153953d..567df13f1643 100644
--- a/sc/source/filter/xml/xmlexternaltabi.hxx
+++ b/sc/source/filter/xml/xmlexternaltabi.hxx
@@ -65,6 +65,30 @@ private:
// ============================================================================
+class ScXMLExternalRefRowsContext : public SvXMLImportContext
+{
+public:
+ ScXMLExternalRefRowsContext( ScXMLImport& rImport, USHORT nPrefix,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ ScXMLExternalTabData& rRefInfo );
+
+ virtual ~ScXMLExternalRefRowsContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+private:
+ ScXMLImport& mrScImport;
+ ScXMLExternalTabData& mrExternalRefInfo;
+};
+
+// ============================================================================
+
class ScXMLExternalRefRowContext : public SvXMLImportContext
{
public:
diff --git a/sc/source/filter/xml/xmlfilti.cxx b/sc/source/filter/xml/xmlfilti.cxx
index 59d53542535a..87bdc748906c 100644
--- a/sc/source/filter/xml/xmlfilti.cxx
+++ b/sc/source/filter/xml/xmlfilti.cxx
@@ -335,48 +335,60 @@ SvXMLImportContext *ScXMLConditionContext::CreateChildContext( USHORT nPrefix,
return new SvXMLImportContext( GetImport(), nPrefix, rLName );
}
-void ScXMLConditionContext::getOperatorXML(const rtl::OUString sTempOperator, sheet::FilterOperator& aFilterOperator, sal_Bool& bUseRegularExpressions) const
+void ScXMLConditionContext::getOperatorXML(const rtl::OUString sTempOperator, sal_Int32& aFilterOperator, sal_Bool& bUseRegularExpressions) const
{
bUseRegularExpressions = sal_False;
if (IsXMLToken(sTempOperator, XML_MATCH))
{
bUseRegularExpressions = sal_True;
- aFilterOperator = sheet::FilterOperator_EQUAL;
+ aFilterOperator = sheet::FilterOperator2::EQUAL;
}
else if (IsXMLToken(sTempOperator, XML_NOMATCH))
{
bUseRegularExpressions = sal_True;
- aFilterOperator = sheet::FilterOperator_NOT_EQUAL;
+ aFilterOperator = sheet::FilterOperator2::NOT_EQUAL;
}
else if (sTempOperator.compareToAscii("=") == 0)
- aFilterOperator = sheet::FilterOperator_EQUAL;
+ aFilterOperator = sheet::FilterOperator2::EQUAL;
else if (sTempOperator.compareToAscii("!=") == 0)
- aFilterOperator = sheet::FilterOperator_NOT_EQUAL;
+ aFilterOperator = sheet::FilterOperator2::NOT_EQUAL;
else if (IsXMLToken(sTempOperator, XML_BOTTOM_PERCENT))
- aFilterOperator = sheet::FilterOperator_BOTTOM_PERCENT;
+ aFilterOperator = sheet::FilterOperator2::BOTTOM_PERCENT;
else if (IsXMLToken(sTempOperator, XML_BOTTOM_VALUES))
- aFilterOperator = sheet::FilterOperator_BOTTOM_VALUES;
+ aFilterOperator = sheet::FilterOperator2::BOTTOM_VALUES;
else if (IsXMLToken(sTempOperator, XML_EMPTY))
- aFilterOperator = sheet::FilterOperator_EMPTY;
+ aFilterOperator = sheet::FilterOperator2::EMPTY;
else if (sTempOperator.compareToAscii(">") == 0)
- aFilterOperator = sheet::FilterOperator_GREATER;
+ aFilterOperator = sheet::FilterOperator2::GREATER;
else if (sTempOperator.compareToAscii(">=") == 0)
- aFilterOperator = sheet::FilterOperator_GREATER_EQUAL;
+ aFilterOperator = sheet::FilterOperator2::GREATER_EQUAL;
else if (sTempOperator.compareToAscii("<") == 0)
- aFilterOperator = sheet::FilterOperator_LESS;
+ aFilterOperator = sheet::FilterOperator2::LESS;
else if (sTempOperator.compareToAscii("<=") == 0)
- aFilterOperator = sheet::FilterOperator_LESS_EQUAL;
+ aFilterOperator = sheet::FilterOperator2::LESS_EQUAL;
else if (IsXMLToken(sTempOperator, XML_NOEMPTY))
- aFilterOperator = sheet::FilterOperator_NOT_EMPTY;
+ aFilterOperator = sheet::FilterOperator2::NOT_EMPTY;
else if (IsXMLToken(sTempOperator, XML_TOP_PERCENT))
- aFilterOperator = sheet::FilterOperator_TOP_PERCENT;
+ aFilterOperator = sheet::FilterOperator2::TOP_PERCENT;
else if (IsXMLToken(sTempOperator, XML_TOP_VALUES))
- aFilterOperator = sheet::FilterOperator_TOP_VALUES;
+ aFilterOperator = sheet::FilterOperator2::TOP_VALUES;
+ else if (IsXMLToken(sTempOperator, XML_CONTAINS))
+ aFilterOperator = sheet::FilterOperator2::CONTAINS;
+ else if (IsXMLToken(sTempOperator, XML_DOES_NOT_CONTAIN))
+ aFilterOperator = sheet::FilterOperator2::DOES_NOT_CONTAIN;
+ else if (IsXMLToken(sTempOperator, XML_BEGINS_WITH))
+ aFilterOperator = sheet::FilterOperator2::BEGINS_WITH;
+ else if (IsXMLToken(sTempOperator, XML_DOES_NOT_BEGIN_WITH))
+ aFilterOperator = sheet::FilterOperator2::DOES_NOT_BEGIN_WITH;
+ else if (IsXMLToken(sTempOperator, XML_ENDS_WITH))
+ aFilterOperator = sheet::FilterOperator2::ENDS_WITH;
+ else if (IsXMLToken(sTempOperator, XML_DOES_NOT_END_WITH))
+ aFilterOperator = sheet::FilterOperator2::DOES_NOT_END_WITH;
}
void ScXMLConditionContext::EndElement()
{
- sheet::TableFilterField aFilterField;
+ sheet::TableFilterField2 aFilterField;
if (pFilterContext->GetConnection())
aFilterField.Connection = sheet::FilterConnection_OR;
else
diff --git a/sc/source/filter/xml/xmlfilti.hxx b/sc/source/filter/xml/xmlfilti.hxx
index f0021e9dda1b..b2b45175c138 100644
--- a/sc/source/filter/xml/xmlfilti.hxx
+++ b/sc/source/filter/xml/xmlfilti.hxx
@@ -36,7 +36,8 @@
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/sheet/FilterOperator.hpp>
-#include <com/sun/star/sheet/TableFilterField.hpp>
+#include <com/sun/star/sheet/FilterOperator2.hpp>
+#include <com/sun/star/sheet/TableFilterField2.hpp>
#include <tools/stack.hxx>
#include "xmldrani.hxx"
@@ -48,7 +49,7 @@ class ScXMLFilterContext : public SvXMLImportContext
{
ScXMLDatabaseRangeContext* pDatabaseRangeContext;
- com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField> aFilterFields;
+ com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField2> aFilterFields;
com::sun::star::table::CellAddress aOutputPosition;
com::sun::star::table::CellRangeAddress aConditionSourceRangeAddress;
sal_Int16 nUserListIndex;
@@ -89,7 +90,7 @@ public:
aConnectionOrStack.Push(pTemp);}
void CloseConnection() { sal_Bool* pTemp = static_cast <sal_Bool*> (aConnectionOrStack.Pop()); bConnectionOr = *pTemp; bNextConnectionOr = *pTemp; delete pTemp;}
sal_Bool GetConnection() { sal_Bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; }
- void AddFilterField (const com::sun::star::sheet::TableFilterField aFilterField) { aFilterFields.realloc(aFilterFields.getLength() + 1);
+ void AddFilterField(const com::sun::star::sheet::TableFilterField2 aFilterField) { aFilterFields.realloc(aFilterFields.getLength() + 1);
aFilterFields[aFilterFields.getLength() - 1] = aFilterField; }
};
@@ -171,7 +172,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList>& xAttrList );
- void getOperatorXML(const rtl::OUString sTempOperator, com::sun::star::sheet::FilterOperator& aFilterOperator, sal_Bool& bUseRegularExpressions) const;
+ void getOperatorXML(const rtl::OUString sTempOperator, sal_Int32& aFilterOperator, sal_Bool& bUseRegularExpressions) const;
virtual void EndElement();
};
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 873e95168088..200e33743020 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -74,6 +74,7 @@
#include "unonames.hxx"
#include "rangeutl.hxx"
#include "postit.hxx"
+#include "formulaparserpool.hxx"
#include <comphelper/extract.hxx>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -2850,36 +2851,99 @@ void ScXMLImport::ProgressBarIncrement(sal_Bool bEditCell, sal_Int32 nInc)
}
}
-// static
-bool ScXMLImport::IsAcceptedFormulaNamespace( const sal_uInt16 nFormulaPrefix,
- const rtl::OUString & rValue, formula::FormulaGrammar::Grammar& rGrammar,
- const formula::FormulaGrammar::Grammar eStorageGrammar )
+sal_Int32 ScXMLImport::GetVisibleSheet()
{
- switch (nFormulaPrefix)
+ // Get the visible sheet number from model's view data (after settings were loaded),
+ // or 0 (default: first sheet) if no settings available.
+
+ uno::Reference<document::XViewDataSupplier> xSupp(GetModel(), uno::UNO_QUERY);
+ if (xSupp.is())
{
- case XML_NAMESPACE_OF:
- rGrammar = formula::FormulaGrammar::GRAM_ODFF;
- return true;
- case XML_NAMESPACE_OOOC:
- rGrammar = formula::FormulaGrammar::GRAM_PODF;
- return true;
+ uno::Reference<container::XIndexAccess> xIndex = xSupp->getViewData();
+ if ( xIndex.is() && xIndex->getCount() > 0 )
+ {
+ uno::Any aAny( xIndex->getByIndex(0) );
+ uno::Sequence<beans::PropertyValue> aViewSettings; // settings for (first) view
+ if ( aAny >>= aViewSettings )
+ {
+ sal_Int32 nCount = aViewSettings.getLength();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ if ( aViewSettings[i].Name.compareToAscii(SC_ACTIVETABLE) == 0 )
+ {
+ rtl::OUString sValue;
+ if(aViewSettings[i].Value >>= sValue)
+ {
+ String sTabName(sValue);
+ SCTAB nTab = 0;
+ if (pDoc->GetTable(sTabName, nTab))
+ return nTab;
+ }
+ }
+ }
+ }
+ }
}
- // An invalid namespace can occur from a colon in the formula text if no
- // namespace tag was added. First character in string has to be '=' in that
- // case.
- bool bNoNamespace = (nFormulaPrefix == XML_NAMESPACE_NONE ||
- (nFormulaPrefix == XML_NAMESPACE_UNKNOWN && rValue.toChar() == '='));
-
- if (bNoNamespace && eStorageGrammar == formula::FormulaGrammar::GRAM_PODF)
- // There may be documents in the wild that stored no namespace in ODF 1.x
- rGrammar = formula::FormulaGrammar::GRAM_PODF;
- else if (bNoNamespace)
- // The default for ODF 1.2 and later without namespace is 'of:' ODFF
- rGrammar = formula::FormulaGrammar::GRAM_ODFF;
- else
- // Whatever ...
- rGrammar = eStorageGrammar;
+ return 0;
+}
- return false;
+void ScXMLImport::ExtractFormulaNamespaceGrammar(
+ OUString& rFormula, OUString& rFormulaNmsp, FormulaGrammar::Grammar& reGrammar,
+ const OUString& rAttrValue, bool bRestrictToExternalNmsp ) const
+{
+ // parse the attribute value, extract namespace ID, literal namespace, and formula string
+ rFormulaNmsp = OUString();
+ sal_uInt16 nNsId = GetNamespaceMap()._GetKeyByAttrName( rAttrValue, 0, &rFormula, &rFormulaNmsp, sal_False );
+
+ // check if we have an ODF formula namespace
+ if( !bRestrictToExternalNmsp ) switch( nNsId )
+ {
+ case XML_NAMESPACE_OOOC:
+ rFormulaNmsp = OUString(); // remove namespace string for built-in grammar
+ reGrammar = FormulaGrammar::GRAM_PODF;
+ return;
+ case XML_NAMESPACE_OF:
+ rFormulaNmsp = OUString(); // remove namespace string for built-in grammar
+ reGrammar = FormulaGrammar::GRAM_ODFF;
+ return;
+ }
+
+ /* Find default grammar for formulas without namespace. There may be
+ documents in the wild that stored no namespace in ODF 1.0/1.1. Use
+ GRAM_PODF then (old style ODF 1.0/1.1 formulas). The default for ODF
+ 1.2 and later without namespace is GRAM_ODFF (OpenFormula). */
+ FormulaGrammar::Grammar eDefaultGrammar =
+ (GetDocument()->GetStorageGrammar() == FormulaGrammar::GRAM_PODF) ?
+ FormulaGrammar::GRAM_PODF : FormulaGrammar::GRAM_ODFF;
+
+ /* Check if we have no namespace at all. The value XML_NAMESPACE_NONE
+ indicates that there is no colon. If the first character of the
+ attribute value is the equality sign, the value XML_NAMESPACE_UNKNOWN
+ indicates that there is a colon somewhere in the formula string. */
+ if( (nNsId == XML_NAMESPACE_NONE) || ((nNsId == XML_NAMESPACE_UNKNOWN) && (rAttrValue.toChar() == '=')) )
+ {
+ rFormula = rAttrValue; // return entire string as formula
+ reGrammar = eDefaultGrammar;
+ return;
+ }
+
+ /* Check if a namespace URL could be resolved from the attribute value.
+ Use that namespace only, if the Calc document knows an associated
+ external formula parser. This prevents that the range operator in
+ conjunction with defined names is confused as namespaces prefix, e.g.
+ in the expression 'table:A1' where 'table' is a named reference. */
+ if( ((nNsId & XML_NAMESPACE_UNKNOWN_FLAG) != 0) && (rFormulaNmsp.getLength() > 0) &&
+ GetDocument()->GetFormulaParserPool().hasFormulaParser( rFormulaNmsp ) )
+ {
+ reGrammar = FormulaGrammar::GRAM_EXTERNAL;
+ return;
+ }
+
+ /* All attempts failed (e.g. no namespace and no leading equality sign, or
+ an invalid namespace prefix), continue with the entire attribute value. */
+ rFormula = rAttrValue;
+ rFormulaNmsp = OUString(); // remove any namespace string
+ reGrammar = eDefaultGrammar;
}
+
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 052ef20c6022..f96d34c40ca5 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -598,6 +598,7 @@ struct ScMyNamedExpression
{
rtl::OUString sName;
rtl::OUString sContent;
+ rtl::OUString sContentNmsp;
rtl::OUString sBaseCellAddress;
rtl::OUString sRangeType;
formula::FormulaGrammar::Grammar eGrammar;
@@ -624,11 +625,14 @@ struct ScMyImportValidation
rtl::OUString sErrorMessage;
rtl::OUString sFormula1;
rtl::OUString sFormula2;
+ rtl::OUString sFormulaNmsp1;
+ rtl::OUString sFormulaNmsp2;
rtl::OUString sBaseCellAddress; // #b4974740# string is used directly
com::sun::star::sheet::ValidationAlertStyle aAlertStyle;
com::sun::star::sheet::ValidationType aValidationType;
com::sun::star::sheet::ConditionOperator aOperator;
- formula::FormulaGrammar::Grammar eGrammar;
+ formula::FormulaGrammar::Grammar eGrammar1;
+ formula::FormulaGrammar::Grammar eGrammar2;
sal_Int16 nShowList;
sal_Bool bShowErrorMessage;
sal_Bool bShowImputMessage;
@@ -983,46 +987,43 @@ public:
void SetLabelRanges();
void AddDefaultNote( const com::sun::star::table::CellAddress& aCell );
-
- /** If namespace prefix is an accepted formula namespace.
-
- For an accepted namespace (return <TRUE/>), the formula text is the
- part without the namespace tag (aFormula of the _GetKeyByAttrName()
- example below).
-
- For an invalid namespace (not defined in the file,
- XML_NAMESPACE_UNKNOWN; may also be the result of no namespace with
- colon in the formula text, in that case text has to start with
- character '=') or no namespace tag (XML_NAMESPACE_NONE) the full text
- (rValue) should be used (return <FALSE/>).
-
- @param nFormulaPrefix
- The result of a _GetKeyByAttrName( rValue, aFormula, sal_False)
- call.
-
- @param rValue
- The attribute's string (formula text) including the namespace, if
- any.
-
- @param rGrammar
- Return value set toformula::FormulaGrammar::GRAM_ODFF orformula::FormulaGrammar::GRAM_PODF or
- eStorageGrammar, according to the namespace or absence thereof
- encountered.
-
- @param eStorageGrammar
- Default storage grammar of the document,formula::FormulaGrammar::GRAM_ODFF for
- ODF 1.2 and later documents,formula::FormulaGrammar::GRAM_PODF for ODF 1.x
- documents.
-
- @return
- <TRUE/> if an accepted namespace (XML_NAMESPACE_OF or
- XML_NAMESPACE_OOOC), else <FALSE/>.
+ sal_Int32 GetVisibleSheet();
+ /** Extracts the formula string, the formula grammar namespace URL, and a
+ grammar enum value from the passed formula attribute value.
+
+ @param rFormula
+ (out-parameter) Returns the plain formula string with the leading
+ equality sign if existing.
+
+ @param rFormulaNmsp
+ (out-parameter) Returns the URL of the formula grammar namespace if
+ the attribute value contains the prefix of an unknown namespace.
+
+ @param reGrammar
+ (out-parameter) Returns the exact formula grammar if the formula
+ is in a supported ODF format (e.g. FormulaGrammar::GRAM_PODF for
+ ODF 1.0/1.1 formulas, or FormulaGrammar::GRAM_ODFF for ODF 1.2
+ formulas a.k.a. OpenFormula). Returns the default storage grammar,
+ if the attribute value does not contain a namespace prefix. Returns
+ the special value FormulaGrammar::GRAM_EXTERNAL, if an unknown
+ namespace could be extracted from the formula which will be
+ contained in the parameter rFormulaNmsp then.
+
+ @param rAttrValue
+ The value of the processed formula attribute.
+
+ @param bRestrictToExternalNmsp
+ If set to TRUE, only namespaces of external formula grammars will
+ be recognized. Internal namespace prefixes (e.g. 'oooc:' or 'of:'
+ will be considered to be part of the formula, e.g. an expression
+ with range operator.
*/
-
- static bool IsAcceptedFormulaNamespace( const sal_uInt16 nFormulaPrefix,
- const rtl::OUString & rValue, formula::FormulaGrammar::Grammar& rGrammar,
- const formula::FormulaGrammar::Grammar eStorageGrammar );
-
+ void ExtractFormulaNamespaceGrammar(
+ ::rtl::OUString& rFormula,
+ ::rtl::OUString& rFormulaNmsp,
+ ::formula::FormulaGrammar::Grammar& reGrammar,
+ const ::rtl::OUString& rAttrValue,
+ bool bRestrictToExternalNmsp = false ) const;
};
#endif
diff --git a/sc/source/filter/xml/xmlnexpi.cxx b/sc/source/filter/xml/xmlnexpi.cxx
index 3f822d5274c6..9a2a49f0b021 100644
--- a/sc/source/filter/xml/xmlnexpi.cxx
+++ b/sc/source/filter/xml/xmlnexpi.cxx
@@ -196,8 +196,6 @@ ScXMLNamedExpressionContext::ScXMLNamedExpressionContext( ScXMLImport& rImport,
SvXMLImportContext( rImport, nPrfx, rLName )
{
ScMyNamedExpression* pNamedExpression(new ScMyNamedExpression);
- const formula::FormulaGrammar::Grammar eStorageGrammar = pNamedExpression->eGrammar =
- GetScImport().GetDocument()->GetStorageGrammar();
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetNamedExpressionAttrTokenMap());
for( sal_Int16 i=0; i < nAttrCount; ++i )
@@ -217,16 +215,9 @@ ScXMLNamedExpressionContext::ScXMLNamedExpressionContext( ScXMLImport& rImport,
break;
case XML_TOK_NAMED_EXPRESSION_ATTR_EXPRESSION :
{
- rtl::OUString sFormula;
- sal_uInt16 nFormulaPrefix = GetImport().GetNamespaceMap().
- _GetKeyByAttrName( sValue, &sFormula, sal_False );
-
- if (ScXMLImport::IsAcceptedFormulaNamespace( nFormulaPrefix,
- sValue, pNamedExpression->eGrammar,
- eStorageGrammar))
- pNamedExpression->sContent = sFormula;
- else
- pNamedExpression->sContent = sValue;
+ GetScImport().ExtractFormulaNamespaceGrammar(
+ pNamedExpression->sContent, pNamedExpression->sContentNmsp,
+ pNamedExpression->eGrammar, sValue );
}
break;
case XML_TOK_NAMED_EXPRESSION_ATTR_BASE_CELL_ADDRESS :
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index ac6cef7e54ec..79ba79f0e689 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -73,6 +73,7 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace xmloff::token;
//using namespace ::com::sun::star::text;
+using namespace ::formula;
ScXMLCellImportPropertyMapper::ScXMLCellImportPropertyMapper(
const UniReference< XMLPropertySetMapper >& rMapper,
@@ -248,8 +249,14 @@ void ScXMLRowImportPropertyMapper::finished(::std::vector< XMLPropertyState >& r
if (::cppu::any2bool(pOptimalHeight->maValue))
{
if (pHeight)
+ {
+ // set the stored height, but keep "optimal" flag:
+ // pass the height value as OptimalHeight property (only allowed while loading!)
+ pOptimalHeight->maValue = pHeight->maValue;
pHeight->mnIndex = -1;
- pOptimalHeight->mnIndex = -1;
+ }
+ else
+ pOptimalHeight->mnIndex = -1;
}
}
else if (pHeight)
@@ -279,10 +286,7 @@ public:
ScXMLMapContext::ScXMLMapContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName, const uno::Reference< xml::sax::XAttributeList > & xAttrList )
- : SvXMLImportContext( rImport, nPrfx, rLName ),
- sApplyStyle(),
- sCondition(),
- sBaseCell()
+ : SvXMLImportContext( rImport, nPrfx, rLName )
{
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
for( sal_Int16 i=0; i < nAttrCount; ++i )
@@ -309,200 +313,118 @@ ScXMLMapContext::~ScXMLMapContext()
{
}
-void XMLTableStyleContext::SetOperator(com::sun::star::uno::Sequence<beans::PropertyValue>& aProps,
- const com::sun::star::sheet::ConditionOperator aOp) const
-{
- sal_Int32 nLength(aProps.getLength());
- aProps.realloc(nLength + 1);
- aProps[nLength].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_OPERATOR));
- aProps[nLength].Value <<= aOp;
-}
+namespace {
-void XMLTableStyleContext::SetBaseCellAddress(com::sun::star::uno::Sequence<beans::PropertyValue>& aProps,
- const rtl::OUString& sBaseCell) const
+template< typename Type >
+inline void lclAppendProperty( uno::Sequence< beans::PropertyValue >& rProps, const OUString& rPropName, const Type& rValue )
{
- sal_Int32 nLength(aProps.getLength());
- aProps.realloc(nLength + 1);
-
- // #b4974740# source position must be set as string, because it may
- // refer to a sheet that hasn't been loaded yet.
-
- aProps[nLength].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SOURCESTR));
- aProps[nLength].Value <<= sBaseCell;
+ sal_Int32 nLength = rProps.getLength();
+ rProps.realloc( nLength + 1 );
+ rProps[ nLength ].Name = rPropName;
+ rProps[ nLength ].Value <<= rValue;
}
-void XMLTableStyleContext::SetStyle(com::sun::star::uno::Sequence<beans::PropertyValue>& aProps,
- const rtl::OUString& sApplyStyle) const
+} // namespace
+
+void XMLTableStyleContext::SetOperator( uno::Sequence< beans::PropertyValue >& rProps, sheet::ConditionOperator eOp ) const
{
- sal_Int32 nLength(aProps.getLength());
- aProps.realloc(nLength + 1);
- aProps[nLength].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_STYLENAME));
- aProps[nLength].Value <<= sApplyStyle;
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_OPERATOR ) ), eOp );
}
-void XMLTableStyleContext::SetFormula1(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const rtl::OUString& sFormula, bool bPreParse) const
+void XMLTableStyleContext::SetBaseCellAddress( uno::Sequence< beans::PropertyValue >& rProps, const OUString& rBaseCell ) const
{
- sal_Int32 nLength(aProps.getLength());
- aProps.realloc(nLength + 1);
- aProps[nLength].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_FORMULA1));
- if (bPreParse)
- {
- rtl::OUString sRealFormula(sFormula);
- ScXMLConverter::ParseFormula(sRealFormula);
- aProps[nLength].Value <<= sRealFormula;
- }
- else
- aProps[nLength].Value <<= sFormula;
+ /* #b4974740# Source position must be set as string, because it may refer
+ to a sheet that hasn't been loaded yet. */
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SOURCESTR ) ), rBaseCell );
}
-void XMLTableStyleContext::SetFormula2(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const rtl::OUString& sFormula) const
+void XMLTableStyleContext::SetStyle( uno::Sequence<beans::PropertyValue>& rProps, const OUString& rApplyStyle ) const
{
- sal_Int32 nLength(aProps.getLength());
- aProps.realloc(nLength + 1);
- aProps[nLength].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_FORMULA2));
- rtl::OUString sRealFormula(sFormula);
- ScXMLConverter::ParseFormula(sRealFormula);
- aProps[nLength].Value <<= sRealFormula;
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_STYLENAME ) ), rApplyStyle );
}
-void XMLTableStyleContext::SetFormulas(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const rtl::OUString& sFormulas) const
+void XMLTableStyleContext::SetFormula( uno::Sequence< beans::PropertyValue >& rProps,
+ sal_Int32 nFormulaIdx, const OUString& rFormula, const OUString& rFormulaNmsp,
+ FormulaGrammar::Grammar eGrammar, bool bHasNmsp ) const
{
- sal_Int32 i(0);
- sal_Bool bString(sal_False);
- sal_Int32 nBrakes(0);
- while ((sFormulas[i] != ',' || nBrakes > 0 || bString) && i < sFormulas.getLength())
+ OUString aFormula, aFormulaNmsp;
+ FormulaGrammar::Grammar eNewGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
+ if( bHasNmsp )
{
- if (sFormulas[i] == '(')
- ++nBrakes;
- if (sFormulas[i] == ')')
- --nBrakes;
- if (sFormulas[i] == '"')
- bString = !bString;
- ++i;
+ // the entire attribute contains a namespace: internal namespace not allowed
+ aFormula = rFormula;
+ aFormulaNmsp = rFormulaNmsp;
+ eNewGrammar = eGrammar;
}
- if (sFormulas[i] == ',')
+ else
{
- rtl::OUString sFormula1(sFormulas.copy(0, i));
- rtl::OUString sFormula2(sFormulas.copy(i + 1));
- SetFormula1(aProps, sFormula1);
- SetFormula2(aProps, sFormula2);
+ // the attribute does not contain a namespace: try to find a namespace of an external grammar
+ GetScImport().ExtractFormulaNamespaceGrammar( aFormula, aFormulaNmsp, eNewGrammar, rFormula, true );
+ if( eNewGrammar != FormulaGrammar::GRAM_EXTERNAL )
+ eNewGrammar = eGrammar;
}
-}
-void XMLTableStyleContext::SetGrammar(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const formula::FormulaGrammar::Grammar eGrammar) const
-{
- sal_Int32 nLength(aProps.getLength());
- aProps.realloc(nLength + 1);
- aProps[nLength].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_GRAMMAR));
- aProps[nLength].Value <<= static_cast<sal_Int32>(eGrammar);
+ // add formula, formula namespace, and grammar with appropriate property names
+ sal_Int32 nGrammar = static_cast< sal_Int32 >( eNewGrammar );
+ switch( nFormulaIdx )
+ {
+ case 1:
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULA1 ) ), aFormula );
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULANMSP1 ) ), aFormulaNmsp );
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_GRAMMAR1 ) ), nGrammar );
+ break;
+ case 2:
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULA2 ) ), aFormula );
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULANMSP2 ) ), aFormulaNmsp );
+ lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_GRAMMAR2 ) ), nGrammar );
+ break;
+ default:
+ OSL_ENSURE( false, "XMLTableStyleContext::SetFormula - invalid formula index" );
+ }
}
void XMLTableStyleContext::GetConditionalFormat(uno::Any& aAny,
const rtl::OUString& sTempCondition,
const rtl::OUString& sApplyStyle, const rtl::OUString& sBaseCell) const
{
- rtl::OUString sCondition(sTempCondition);
- if (sCondition.getLength() && sApplyStyle.getLength())
+ if (sTempCondition.getLength() && sApplyStyle.getLength())
{
uno::Reference<sheet::XSheetConditionalEntries> xConditionalEntries(aAny, uno::UNO_QUERY);
if (xConditionalEntries.is())
{
- const formula::FormulaGrammar::Grammar eStorageGrammar = GetScImport().GetDocument()->GetStorageGrammar();
- formula::FormulaGrammar::Grammar eGrammar = eStorageGrammar;
- // ToDo: erase all blanks in the condition, but not in formulas or strings
- rtl::OUString scell_content(RTL_CONSTASCII_USTRINGPARAM("cell_content"));
- rtl::OUString scell_content_is_between(RTL_CONSTASCII_USTRINGPARAM("cell_content_is_between"));
- rtl::OUString scell_content_is_not_between(RTL_CONSTASCII_USTRINGPARAM("cell_content_is_not_between"));
- rtl::OUString sis_true_formula(RTL_CONSTASCII_USTRINGPARAM("is_true_formula"));
uno::Sequence<beans::PropertyValue> aProps;
if (sBaseCell.getLength())
SetBaseCellAddress(aProps, sBaseCell);
SetStyle(aProps, sApplyStyle);
- sal_Int32 i = 0;
- while (sCondition[i] != '(' && i < sCondition.getLength())
- ++i;
- if (sCondition[i] == '(')
+
+ // extract leading namespace from condition string
+ OUString aCondition, aConditionNmsp;
+ FormulaGrammar::Grammar eGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
+ GetScImport().ExtractFormulaNamespaceGrammar( aCondition, aConditionNmsp, eGrammar, sTempCondition );
+ bool bHasNmsp = aCondition.getLength() < sTempCondition.getLength();
+
+ // parse a condition from the attribute string
+ ScXMLConditionParseResult aParseResult;
+ ScXMLConditionHelper::parseCondition( aParseResult, aCondition, 0 );
+
+ /* Check the result. A valid value in aParseResult.meToken implies
+ that the other members of aParseResult are filled with valid
+ data for that token. */
+ switch( aParseResult.meToken )
{
- sCondition = sCondition.copy(i + 1);
- if (i == scell_content.getLength())
- {
- sCondition = sCondition.copy(1);
- switch (sCondition[0])
- {
- case '<' :
- {
- if (sCondition[1] == '=')
- {
- SetOperator(aProps, sheet::ConditionOperator_LESS_EQUAL);
- sCondition = sCondition.copy(2);
- }
- else
- {
- SetOperator(aProps, sheet::ConditionOperator_LESS);
- sCondition = sCondition.copy(1);
- }
- }
- break;
- case '>' :
- {
- if (sCondition[1] == '=')
- {
- SetOperator(aProps, sheet::ConditionOperator_GREATER_EQUAL);
- sCondition = sCondition.copy(2);
- }
- else
- {
- SetOperator(aProps, sheet::ConditionOperator_GREATER);
- sCondition = sCondition.copy(1);
- }
- }
- break;
- case '=' :
- {
- SetOperator(aProps, sheet::ConditionOperator_EQUAL);
- sCondition = sCondition.copy(1);
- }
- break;
- case '!' :
- {
- SetOperator(aProps, sheet::ConditionOperator_NOT_EQUAL);
- sCondition = sCondition.copy(1);
- }
- break;
- }
- SetFormula1(aProps, sCondition);
- }
- else if (i == scell_content_is_between.getLength())
- {
- SetOperator(aProps, sheet::ConditionOperator_BETWEEN);
- sCondition = sCondition.copy(0, sCondition.getLength() - 1);
- SetFormulas(aProps, sCondition);
- }
- else if (i == scell_content_is_not_between.getLength())
- {
- SetOperator(aProps, sheet::ConditionOperator_NOT_BETWEEN);
- sCondition = sCondition.copy(0, sCondition.getLength() - 1);
- SetFormulas(aProps, sCondition);
- }
- else if (i == sis_true_formula.getLength())
- {
- SetOperator(aProps, sheet::ConditionOperator_FORMULA);
- sCondition = sCondition.copy(0, sCondition.getLength() - 1);
- rtl::OUString sFormula;
- sal_uInt16 nFormulaPrefix = GetImport().GetNamespaceMap().
- _GetKeyByAttrName( sCondition, &sFormula, sal_False );
- if (ScXMLImport::IsAcceptedFormulaNamespace( nFormulaPrefix,
- sCondition, eGrammar, eStorageGrammar))
- sCondition = sFormula;
- SetFormula1(aProps, sCondition, false);
- }
+ case XML_COND_CELLCONTENT: // condition is 'cell-content()<operator><expression>'
+ case XML_COND_ISTRUEFORMULA: // condition is 'is-true-formula(<expression>)'
+ case XML_COND_ISBETWEEN: // condition is 'cell-content-is-between(<expression1>,<expression2>)'
+ case XML_COND_ISNOTBETWEEN: // condition is 'cell-content-is-not-between(<expression1>,<expression2>)'
+ SetOperator( aProps, aParseResult.meOperator );
+ SetFormula( aProps, 1, aParseResult.maOperand1, aConditionNmsp, eGrammar, bHasNmsp );
+ SetFormula( aProps, 2, aParseResult.maOperand2, aConditionNmsp, eGrammar, bHasNmsp );
+ break;
+
+ default:; // unacceptable or unknown condition
}
- SetGrammar( aProps, eGrammar);
- xConditionalEntries->addNew(aProps);
+
+ xConditionalEntries->addNew( aProps );
aAny <<= xConditionalEntries;
}
}
diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx
index 4d80f5710ac9..272ec0151134 100644
--- a/sc/source/filter/xml/xmlstyli.hxx
+++ b/sc/source/filter/xml/xmlstyli.hxx
@@ -107,20 +107,22 @@ class XMLTableStyleContext : public XMLPropStyleContext
const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
- void SetOperator(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const com::sun::star::sheet::ConditionOperator aOp) const;
- void SetBaseCellAddress(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const rtl::OUString& sBaseCell) const;
- void SetStyle(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const rtl::OUString& sApplyStyle) const;
- void SetFormula1(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const rtl::OUString& sFormula, bool bPreParse = true) const;
- void SetFormula2(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const rtl::OUString& sFormula) const;
- void SetFormulas(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const rtl::OUString& sFormulas) const;
- void SetGrammar(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
- const formula::FormulaGrammar::Grammar eGrammar) const;
+ void SetOperator(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps,
+ ::com::sun::star::sheet::ConditionOperator eOp ) const;
+
+ void SetBaseCellAddress(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps,
+ const ::rtl::OUString& rBaseCell ) const;
+
+ void SetStyle(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps,
+ const ::rtl::OUString& rApplyStyle ) const;
+
+ void SetFormula(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps,
+ sal_Int32 nFormulaIdx, const ::rtl::OUString& rFormula,
+ const ::rtl::OUString& rFormulaNmsp, ::formula::FormulaGrammar::Grammar eGrammar, bool bHasNmsp ) const;
void GetConditionalFormat(
::com::sun::star::uno::Any& aAny, const rtl::OUString& sCondition,
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index 03437449ec61..231839b9f946 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -38,10 +38,13 @@
#include "xmlstyli.hxx"
#include "xmlimprt.hxx"
#include "document.hxx"
+#include "markdata.hxx"
#include "XMLConverter.hxx"
#include "docuno.hxx"
#include "cellsuno.hxx"
#include "XMLStylesImportHelper.hxx"
+#include "tabprotection.hxx"
+#include <svx/svdpage.hxx>
#include <xmloff/xmltkmap.hxx>
#include <xmloff/nmspmap.hxx>
@@ -58,6 +61,10 @@
#include <com/sun/star/util/XProtectable.hpp>
#include <com/sun/star/sheet/XArrayFormulaRange.hpp>
+#include <memory>
+
+using ::std::auto_ptr;
+
//------------------------------------------------------------------
using namespace com::sun::star;
@@ -576,7 +583,35 @@ void ScMyTables::UpdateRowHeights()
{
rImport.LockSolarMutex();
// update automatic row heights
- ScModelObj::getImplementation(rImport.GetModel())->UpdateAllRowHeights();
+
+ // For sheets with any kind of shapes (including notes),
+ // update row heights immediately (before setting the positions).
+ // For sheets without shapes, set "pending" flag
+ // and update row heights when a sheet is shown.
+ // The current sheet (from view settings) is always updated immediately.
+
+ ScDocument* pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
+ if (pDoc)
+ {
+ SCTAB nCount = pDoc->GetTableCount();
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+
+ SCTAB nVisible = static_cast<SCTAB>( rImport.GetVisibleSheet() );
+
+ ScMarkData aUpdateSheets;
+ for (SCTAB nTab=0; nTab<nCount; ++nTab)
+ {
+ const SdrPage* pPage = pDrawLayer ? pDrawLayer->GetPage(nTab) : NULL;
+ if ( nTab == nVisible || ( pPage && pPage->GetObjCount() != 0 ) )
+ aUpdateSheets.SelectTable( nTab, TRUE );
+ else
+ pDoc->SetPendingRowHeights( nTab, TRUE );
+ }
+
+ if (aUpdateSheets.GetSelectCount())
+ ScModelObj::getImplementation(rImport.GetModel())->UpdateAllRowHeights(&aUpdateSheets);
+ }
+
rImport.UnlockSolarMutex();
}
}
@@ -606,7 +641,7 @@ void ScMyTables::DeleteTable()
ScMyMatrixRangeList::iterator aEndItr = aMatrixRangeList.end();
while(aItr != aEndItr)
{
- SetMatrix(aItr->aRange, aItr->sFormula, aItr->eGrammar);
+ SetMatrix(aItr->aRange, aItr->sFormula, aItr->sFormulaNmsp, aItr->eGrammar);
++aItr;
}
aMatrixRangeList.clear();
@@ -616,13 +651,10 @@ void ScMyTables::DeleteTable()
{
uno::Sequence<sal_Int8> aPass;
SvXMLUnitConverter::decodeBase64(aPass, sPassword);
- rImport.GetDocument()->SetTabProtection(static_cast<SCTAB>(nCurrentSheet), bProtection, aPass);
- /*uno::Reference <util::XProtectable> xProtectable(xCurrentSheet, uno::UNO_QUERY);
- if (xProtectable.is())
- {
- rtl::OUString sKey;
- xProtectable->protect(sKey);
- }*/
+ auto_ptr<ScTableProtection> pProtect(new ScTableProtection);
+ pProtect->setProtected(bProtection);
+ pProtect->setPasswordHash(aPass, PASSHASH_OOO);
+ rImport.GetDocument()->SetTabProtection(static_cast<SCTAB>(nCurrentSheet), pProtect.get());
}
rImport.UnlockSolarMutex();
@@ -723,7 +755,9 @@ void ScMyTables::AddShape(uno::Reference <drawing::XShape>& rShape,
aResizeShapes.AddShape(rShape, pRangeList, rStartAddress, rEndAddress, nEndX, nEndY);
}
-void ScMyTables::AddMatrixRange(sal_Int32 nStartColumn, sal_Int32 nStartRow, sal_Int32 nEndColumn, sal_Int32 nEndRow, const rtl::OUString& rFormula, const formula::FormulaGrammar::Grammar eGrammar)
+void ScMyTables::AddMatrixRange(
+ sal_Int32 nStartColumn, sal_Int32 nStartRow, sal_Int32 nEndColumn, sal_Int32 nEndRow,
+ const rtl::OUString& rFormula, const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar)
{
DBG_ASSERT(nEndRow >= nStartRow, "wrong row order");
DBG_ASSERT(nEndColumn >= nStartColumn, "wrong column order");
@@ -733,7 +767,7 @@ void ScMyTables::AddMatrixRange(sal_Int32 nStartColumn, sal_Int32 nStartRow, sal
aRange.EndColumn = nEndColumn;
aRange.EndRow = nEndRow;
aRange.Sheet = sal::static_int_cast<sal_Int16>(nCurrentSheet);
- ScMatrixRange aMRange(aRange, rFormula, eGrammar);
+ ScMatrixRange aMRange(aRange, rFormula, rFormulaNmsp, eGrammar);
aMatrixRangeList.push_back(aMRange);
}
@@ -754,7 +788,7 @@ sal_Bool ScMyTables::IsPartOfMatrix(sal_Int32 nColumn, sal_Int32 nRow)
}
else if ((nRow > aItr->aRange.EndRow) && (nColumn > aItr->aRange.EndColumn))
{
- SetMatrix(aItr->aRange, aItr->sFormula, aItr->eGrammar);
+ SetMatrix(aItr->aRange, aItr->sFormula, aItr->sFormulaNmsp, aItr->eGrammar);
aItr = aMatrixRangeList.erase(aItr);
}
else if (nColumn < aItr->aRange.StartColumn)
@@ -771,7 +805,8 @@ sal_Bool ScMyTables::IsPartOfMatrix(sal_Int32 nColumn, sal_Int32 nRow)
return bResult;
}
-void ScMyTables::SetMatrix(const table::CellRangeAddress& rRange, const rtl::OUString& rFormula, const formula::FormulaGrammar::Grammar eGrammar)
+void ScMyTables::SetMatrix(const table::CellRangeAddress& rRange, const rtl::OUString& rFormula,
+ const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar)
{
uno::Reference <table::XCellRange> xMatrixCellRange(
GetCurrentXCellRange()->getCellRangeByPosition(rRange.StartColumn, rRange.StartRow,
@@ -785,7 +820,7 @@ void ScMyTables::SetMatrix(const table::CellRangeAddress& rRange, const rtl::OUS
static_cast<ScCellRangeObj*>(ScCellRangesBase::getImplementation(
xMatrixCellRange));
if (pCellRangeObj)
- pCellRangeObj->SetArrayFormulaWithGrammar( rFormula, eGrammar);
+ pCellRangeObj->SetArrayFormulaWithGrammar( rFormula, rFormulaNmsp, eGrammar);
}
}
}
diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx
index 84a07ff90449..c5a16e2c3ef4 100644
--- a/sc/source/filter/xml/xmlsubti.hxx
+++ b/sc/source/filter/xml/xmlsubti.hxx
@@ -97,10 +97,12 @@ public:
struct ScMatrixRange
{
rtl::OUString sFormula;
+ rtl::OUString sFormulaNmsp;
formula::FormulaGrammar::Grammar eGrammar;
com::sun::star::table::CellRangeAddress aRange;
- ScMatrixRange(const com::sun::star::table::CellRangeAddress& rRange, const rtl::OUString& rFormula, const formula::FormulaGrammar::Grammar eGrammarP) :
+ ScMatrixRange(const com::sun::star::table::CellRangeAddress& rRange, const rtl::OUString& rFormula, const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammarP) :
sFormula(rFormula),
+ sFormulaNmsp(rFormulaNmsp),
eGrammar(eGrammarP),
aRange(rRange)
{
@@ -181,11 +183,13 @@ public:
sal_Int32 nEndColumn,
sal_Int32 nEndRow,
const rtl::OUString& rFormula,
+ const rtl::OUString& rFormulaNmsp,
const formula::FormulaGrammar::Grammar );
sal_Bool IsPartOfMatrix(sal_Int32 nColumn, sal_Int32 nRow);
void SetMatrix( const com::sun::star::table::CellRangeAddress& rRange,
const rtl::OUString& rFormula,
+ const rtl::OUString& rFormulaNmsp,
const formula::FormulaGrammar::Grammar );
};
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index 451c9b17118d..cc95e01be821 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -235,6 +235,12 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( USHORT nPrefix,
// external cache data.
switch (nToken)
{
+ case XML_TOK_TABLE_ROW_GROUP:
+ case XML_TOK_TABLE_HEADER_ROWS:
+ case XML_TOK_TABLE_ROWS:
+ // #i101319# don't discard rows in groups or header (repeat range)
+ return new ScXMLExternalRefRowsContext(
+ GetScImport(), nPrefix, rLName, xAttrList, *pExternalRefInfo);
case XML_TOK_TABLE_ROW:
return new ScXMLExternalRefRowContext(
GetScImport(), nPrefix, rLName, xAttrList, *pExternalRefInfo);
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 616071be52d4..3ed9b4062a9d 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -563,31 +563,6 @@ uno::Reference< XAccessible > ScChildrenShapes::GetAt(const awt::Point& rPoint)
--i;
}
-/* Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
- if (pWindow)
- {
- Point aPnt( rPoint.X, rPoint.Y );
- aPnt = pWindow->PixelToLogic( aPnt );
- SdrPage* pDrawPage = GetDrawPage();
- if (pDrawPage)
- {
- SdrObject * pObj = GetDrawPage()->CheckHit(aPnt, 1, NULL, false);
- if (pObj)
- {
- uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
- SortedShapes::iterator aItr;;
- if (FindShape(xShape, aItr))
- {
- if ((*aItr) && (*aItr)->pAccShape)
- xAccessible = (*aItr)->pAccShape;
- else
- xAccessible = Get(aItr - maZOrderedShapes.begin());
- }
- else
- DBG_ERRORFILE("a shape is not in the list");
- }
- }
- }*/
}
return xAccessible;
}
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 2f05b7c5d960..46987c88636f 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -113,14 +113,22 @@ extern USHORT nEditAdjust; //! Member an ViewData
//==================================================================
+static sal_Unicode lcl_getSheetSeparator(ScDocument* pDoc)
+{
+ ScCompiler aComp(pDoc, ScAddress());
+ aComp.SetGrammar(pDoc->GetGrammar());
+ return aComp.GetNativeAddressSymbol(ScCompiler::Convention::SHEET_SEPARATOR);
+}
+
void ScInputHandler::InitRangeFinder( const String& rFormula )
{
DeleteRangeFinder();
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+ ScDocument* pDoc = pDocSh->GetDocument();
+ const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDoc);
if ( !pActiveViewSh || !SC_MOD()->GetInputOptions().GetRangeFinder() )
return;
- ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
// String aDelimiters = pEngine->GetWordDelimiters();
String aDelimiters = ScEditUtil::ModifyDelimiters(
@@ -129,7 +137,7 @@ void ScInputHandler::InitRangeFinder( const String& rFormula )
xub_StrLen nColon = aDelimiters.Search(':');
if ( nColon != STRING_NOTFOUND )
aDelimiters.Erase( nColon, 1 ); // Delimiter ohne Doppelpunkt
- xub_StrLen nDot = aDelimiters.Search('.');
+ xub_StrLen nDot = aDelimiters.Search(cSheetSep);
if ( nDot != STRING_NOTFOUND )
aDelimiters.Erase( nDot, 1 ); // Delimiter ohne Punkt
@@ -437,7 +445,7 @@ ScInputHandler::ScInputHandler()
bProtected( FALSE ),
bCellHasPercentFormat( FALSE ),
nValidation( 0 ),
- nAttrAdjust( SVX_HOR_JUSTIFY_STANDARD ),
+ eAttrAdjust( SVX_HOR_JUSTIFY_STANDARD ),
aScaleX( 1,1 ),
aScaleY( 1,1 ),
pRefViewSh( NULL ),
@@ -702,6 +710,9 @@ void ScInputHandler::ShowTipCursor()
HideTip();
HideTipBelow();
EditView* pActiveView = pTopView ? pTopView : pTableView;
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+ const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
+ const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
if ( bFormulaMode && pActiveView && pFormulaDataPara && pEngine->GetParagraphCount() == 1 )
{
@@ -730,7 +741,7 @@ void ScInputHandler::ShowTipCursor()
nLeftParentPos = lcl_MatchParenthesis( aSelText, aSelText.Len()-1 );
if( nLeftParentPos != STRING_NOTFOUND )
{
- sal_Unicode c = aSelText.GetChar( nLeftParentPos-1 );
+ sal_Unicode c = ( nLeftParentPos > 0 ) ? aSelText.GetChar( nLeftParentPos-1 ) : 0;
if( !((c >= 'A' && c<= 'Z') || (c>= 'a' && c<= 'z' )) )
continue;
nNextFStart = aHelper.GetFunctionStart( aSelText, nLeftParentPos, TRUE);
@@ -764,8 +775,8 @@ void ScInputHandler::ShowTipCursor()
}
if( bFlag )
{
- nCountSemicolon = aNew.GetTokenCount(';')-1;
- nCountDot = aNew.GetTokenCount('.')-1;
+ nCountSemicolon = aNew.GetTokenCount(cSep)-1;
+ nCountDot = aNew.GetTokenCount(cSheetSep)-1;
if( !nCountSemicolon )
{
@@ -787,7 +798,7 @@ void ScInputHandler::ShowTipCursor()
{
nStartPosition = i+1;
}
- else if( cNext == ';' )
+ else if( cNext == cSep )
{
nCount ++;
nEndPosition = i;
@@ -808,7 +819,7 @@ void ScInputHandler::ShowTipCursor()
{
nStartPosition = i+1;
}
- else if( cNext == ';' )
+ else if( cNext == cSep )
{
nCount ++;
nEndPosition = i;
@@ -818,7 +829,7 @@ void ScInputHandler::ShowTipCursor()
}
nStartPosition = nEndPosition+1;
}
- else if( cNext == '.' )
+ else if( cNext == cSheetSep )
{
continue;
}
@@ -919,6 +930,9 @@ void ScInputHandler::ShowTipBelow( const String& rText )
void ScInputHandler::UseFormulaData()
{
EditView* pActiveView = pTopView ? pTopView : pTableView;
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+ const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
+ const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
// Formeln duerfen nur 1 Absatz haben
if ( pActiveView && pFormulaData && pEngine->GetParagraphCount() == 1 )
@@ -969,7 +983,8 @@ void ScInputHandler::UseFormulaData()
if( nLeftParentPos == STRING_NOTFOUND )
break;
- sal_Unicode c = aFormula.GetChar( nLeftParentPos-1 );
+ // #160063# nLeftParentPos can be 0 if a parenthesis is inserted before the formula
+ sal_Unicode c = ( nLeftParentPos > 0 ) ? aFormula.GetChar( nLeftParentPos-1 ) : 0;
if( !((c >= 'A' && c<= 'Z') || (c>= 'a' && c<= 'z') ) )
continue;
nNextFStart = aHelper.GetFunctionStart( aFormula, nLeftParentPos, TRUE);
@@ -1003,8 +1018,8 @@ void ScInputHandler::UseFormulaData()
}
if( bFlag )
{
- nCountSemicolon = aNew.GetTokenCount(';')-1;
- nCountDot = aNew.GetTokenCount('.')-1;
+ nCountSemicolon = aNew.GetTokenCount(cSep)-1;
+ nCountDot = aNew.GetTokenCount(cSheetSep)-1;
if( !nCountSemicolon )
{
@@ -1026,7 +1041,7 @@ void ScInputHandler::UseFormulaData()
{
nStartPosition = i+1;
}
- else if( cNext == ';' )
+ else if( cNext == cSep )
{
nCount ++;
nEndPosition = i;
@@ -1047,7 +1062,7 @@ void ScInputHandler::UseFormulaData()
{
nStartPosition = i+1;
}
- else if( cNext == ';' )
+ else if( cNext == cSep )
{
nCount ++;
nEndPosition = i;
@@ -1057,7 +1072,7 @@ void ScInputHandler::UseFormulaData()
}
nStartPosition = nEndPosition+1;
}
- else if( cNext == '.' )
+ else if( cNext == cSheetSep )
{
continue;
}
@@ -1706,7 +1721,7 @@ void ScInputHandler::ForgetLastPattern()
void ScInputHandler::UpdateAdjust( sal_Unicode cTyped )
{
SvxAdjust eSvxAdjust;
- switch (nAttrAdjust)
+ switch (eAttrAdjust)
{
case SVX_HOR_JUSTIFY_STANDARD:
{
@@ -1895,13 +1910,13 @@ BOOL ScInputHandler::StartTable( sal_Unicode cTyped, BOOL bFromCommand )
// Ausrichtung
- nAttrAdjust = ((const SvxHorJustifyItem&)pPattern->
+ eAttrAdjust = (SvxCellHorJustify)((const SvxHorJustifyItem&)pPattern->
GetItem(ATTR_HOR_JUSTIFY)).GetValue();
- if ( nAttrAdjust == SVX_HOR_JUSTIFY_REPEAT &&
+ if ( eAttrAdjust == SVX_HOR_JUSTIFY_REPEAT &&
static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() )
{
// #i31843# "repeat" with "line breaks" is treated as default alignment
- nAttrAdjust = SVX_HOR_JUSTIFY_STANDARD;
+ eAttrAdjust = SVX_HOR_JUSTIFY_STANDARD;
}
}
@@ -2740,6 +2755,7 @@ BOOL ScInputHandler::IsModalMode( SfxObjectShell* pDocSh )
void ScInputHandler::AddRefEntry()
{
+ const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
UpdateActiveView();
if (!pTableView && !pTopView)
return; // z.B. FillMode
@@ -2748,9 +2764,9 @@ void ScInputHandler::AddRefEntry()
RemoveSelection();
if (pTableView)
- pTableView->InsertText( ';', FALSE );
+ pTableView->InsertText( cSep, FALSE );
if (pTopView)
- pTopView->InsertText( ';', FALSE );
+ pTopView->InsertText( cSep, FALSE );
DataChanged();
}
@@ -3464,6 +3480,12 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
bInOwnChange = FALSE;
}
+void ScInputHandler::UpdateCellAdjust( SvxCellHorJustify eJust )
+{
+ eAttrAdjust = eJust;
+ UpdateAdjust( 0 );
+}
+
void ScInputHandler::ResetDelayTimer()
{
if(pDelayTimer!=NULL)
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 8fd3c1f8ac0b..5a3fd605b08f 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1699,7 +1699,7 @@ void ScPosWnd::DoEnter()
ScRangeName aNewRanges( *pNames );
ScAddress aCursor( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() );
String aContent;
- aSelection.Format( aContent, SCR_ABS_3D, pDoc );
+ aSelection.Format( aContent, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
ScRangeData* pNew = new ScRangeData( pDoc, aText, aContent, aCursor );
if ( aNewRanges.Insert(pNew) )
{
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 9e8d280403a9..94a2cdfc3324 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -313,6 +313,8 @@ sal_Bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor )
BOOL bIncludeFiltered = pDoc->IsCutMode() || bUsedForLink;
ScImportExport aObj( pDoc, aBlock );
+ if ( bUsedForLink )
+ aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, ' ', false ) );
aObj.SetFormulas( pDoc->GetViewOptions().GetOption( VOPT_FORMULAS ) );
aObj.SetIncludeFiltered( bIncludeFiltered );
@@ -656,7 +658,7 @@ void ScTransferObj::InitDocShell()
// page format (grid etc) and page size (maximum size for ole object)
- Size aPaperSize = SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 ); // Twips
+ Size aPaperSize = SvxPaperInfo::GetPaperSize( PAPER_A4 ); // Twips
ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
String aStyleName = pDoc->GetPageStyle( aBlock.aStart.Tab() );
SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SFX_STYLE_FAMILY_PAGE );
@@ -817,7 +819,10 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
{
String aStr;
pFCell->GetString(aStr);
- pNew = new ScStringCell( aStr );
+ if ( pFCell->IsMultilineResult() )
+ pNew = new ScEditCell( aStr, pDestDoc );
+ else
+ pNew = new ScStringCell( aStr );
}
pDestDoc->PutCell( nCol,nRow,nDestTab, pNew );
diff --git a/sc/source/ui/attrdlg/attrdlg.cxx b/sc/source/ui/attrdlg/attrdlg.cxx
index 9e2e1278e7a1..9fd600409211 100644
--- a/sc/source/ui/attrdlg/attrdlg.cxx
+++ b/sc/source/ui/attrdlg/attrdlg.cxx
@@ -56,6 +56,11 @@
#include <svx/flagsdef.hxx> //CHINA001
#include <svx/flstitem.hxx> //CHINA001
#include <sfx2/app.hxx> //CHINA001
+
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <layout/layout-pre.hxx>
+#endif
+
//==================================================================
ScAttrDlg::ScAttrDlg( SfxViewFrame* pFrameP,
@@ -72,7 +77,12 @@ ScAttrDlg::ScAttrDlg( SfxViewFrame* pFrameP,
DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");//CHINA001
+#if LAYOUT_SFX_TABDIALOG_BROKEN
AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 ); //CHINA001 AddTabPage( TP_NUMBER, SvxNumberFormatTabPage::Create, 0 );
+#else
+ String number = rtl::OUString::createFromAscii ("Numbers");
+ AddTabPage( TP_NUMBER, number, pFact->GetTabPageCreatorFunc (RID_SVXPAGE_NUMBERFORMAT), 0, FALSE, TAB_APPEND);
+#endif
DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");//CHINA001
AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 ); //CHINA001 AddTabPage( TP_FONT, SvxCharNamePage::Create, 0 );
DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");//CHINA001
diff --git a/sc/source/ui/attrdlg/condfrmt.cxx b/sc/source/ui/attrdlg/condfrmt.cxx
index 21cb4e069b93..704546d76bf6 100644
--- a/sc/source/ui/attrdlg/condfrmt.cxx
+++ b/sc/source/ui/attrdlg/condfrmt.cxx
@@ -33,6 +33,7 @@
#include <sfx2/dispatch.hxx>
+#include <svtools/stritem.hxx>
#include "tabvwsh.hxx"
#include "reffact.hxx"
@@ -72,6 +73,7 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aRbCond12 ( this, ScResId( RB_COND1_2 ), &aEdtCond12,this ),
aFtCond1Template ( this, ScResId( FT_COND1_TEMPLATE ) ),
aLbCond1Template ( this, ScResId( LB_COND1_TEMPLATE ) ),
+ aBtnNew1 ( this, ScResId( BTN_COND1_NEW ) ),
aFlSep1 ( this, ScResId( FL_SEP1 ) ),
aCbxCond2 ( this, ScResId( CBX_COND2 ) ),
@@ -84,6 +86,7 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aRbCond22 ( this, ScResId( RB_COND2_2 ), &aEdtCond22,this ),
aFtCond2Template ( this, ScResId( FT_COND2_TEMPLATE ) ),
aLbCond2Template ( this, ScResId( LB_COND2_TEMPLATE ) ),
+ aBtnNew2 ( this, ScResId( BTN_COND2_NEW ) ),
aFlSep2 ( this, ScResId( FL_SEP2 ) ),
aCbxCond3 ( this, ScResId( CBX_COND3 ) ),
@@ -96,6 +99,7 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aRbCond32 ( this, ScResId( RB_COND3_2 ), &aEdtCond32,this ),
aFtCond3Template ( this, ScResId( FT_COND3_TEMPLATE ) ),
aLbCond3Template ( this, ScResId( LB_COND3_TEMPLATE ) ),
+ aBtnNew3 ( this, ScResId( BTN_COND3_NEW ) ),
aBtnOk ( this, ScResId( BTN_OK ) ),
aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
@@ -127,7 +131,12 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aBtnOk.SetClickHdl ( LINK( this, ScConditionalFormatDlg, BtnHdl ) );
//? aBtnCancel.SetClickHdl( LINK( this, ScConditionalFormatDlg, BtnHdl ) );
- Link aLink = LINK( this, ScConditionalFormatDlg, GetFocusHdl );
+ Link aLink = LINK( this, ScConditionalFormatDlg, NewBtnHdl );
+ aBtnNew1.SetClickHdl( aLink );
+ aBtnNew2.SetClickHdl( aLink );
+ aBtnNew3.SetClickHdl( aLink );
+
+ aLink = LINK( this, ScConditionalFormatDlg, GetFocusHdl );
aEdtCond11.SetGetFocusHdl( aLink );
aEdtCond12.SetGetFocusHdl( aLink );
aEdtCond21.SetGetFocusHdl( aLink );
@@ -478,6 +487,7 @@ IMPL_LINK( ScConditionalFormatDlg, ClickCond1Hdl, void *, EMPTYARG )
aRbCond12.Enable( bChecked );
aFtCond1Template.Enable( bChecked );
aLbCond1Template.Enable( bChecked );
+ aBtnNew1.Enable( bChecked );
return( 0L );
}
@@ -558,6 +568,7 @@ IMPL_LINK( ScConditionalFormatDlg, ClickCond2Hdl, void *, EMPTYARG )
aRbCond22.Enable( bChecked );
aFtCond2Template.Enable( bChecked );
aLbCond2Template.Enable( bChecked );
+ aBtnNew2.Enable( bChecked );
return( 0L );
}
@@ -638,6 +649,7 @@ IMPL_LINK( ScConditionalFormatDlg, ClickCond3Hdl, void *, EMPTYARG )
aRbCond32.Enable( bChecked );
aFtCond3Template.Enable( bChecked );
aLbCond3Template.Enable( bChecked );
+ aBtnNew3.Enable( bChecked );
return( 0L );
}
@@ -762,3 +774,59 @@ IMPL_LINK( ScConditionalFormatDlg, BtnHdl, PushButton*, pBtn )
}
+//----------------------------------------------------------------------------
+
+IMPL_LINK( ScConditionalFormatDlg, NewBtnHdl, PushButton*, pBtn )
+{
+ SfxUInt16Item aFamilyItem( SID_STYLE_FAMILY, SFX_STYLE_FAMILY_PARA );
+ SfxStringItem aRefItem( SID_STYLE_REFERENCE, ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
+
+ // unlock the dispatcher so SID_STYLE_NEW can be executed
+ // (SetDispatcherLock would affect all Calc documents)
+ SfxDispatcher* pDisp = GetBindings().GetDispatcher();
+ BOOL bLocked = pDisp->IsLocked();
+ if (bLocked)
+ pDisp->Lock(sal_False);
+
+ // Execute the "new style" slot, complete with undo and all necessary updates.
+ // The return value (SfxUInt16Item) is ignored, look for new styles instead.
+ pDisp->Execute( SID_STYLE_NEW, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD | SFX_CALLMODE_MODAL,
+ &aFamilyItem,
+ &aRefItem,
+ 0L );
+
+ if (bLocked)
+ pDisp->Lock(sal_True);
+
+ // Find the new style and add it into the style list boxes
+ String aNewStyle;
+ SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA );
+ for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() )
+ {
+ String aName = pStyle->GetName();
+ if ( aLbCond1Template.GetEntryPos(aName) == LISTBOX_ENTRY_NOTFOUND ) // all lists contain the same entries
+ {
+ aLbCond1Template.InsertEntry( aName );
+ aLbCond2Template.InsertEntry( aName );
+ aLbCond3Template.InsertEntry( aName );
+ // if there are several new styles (from API or a different view),
+ // assume the last one is the result of the dialog
+ aNewStyle = aName;
+ }
+ }
+
+ // select the new style in the list box for which the button was pressed
+ if ( aNewStyle.Len() )
+ {
+ ListBox* pListBox = &aLbCond1Template;
+ if ( pBtn == &aBtnNew2 )
+ pListBox = &aLbCond2Template;
+ else if ( pBtn == &aBtnNew3 )
+ pListBox = &aLbCond3Template;
+
+ pListBox->SelectEntry( aNewStyle );
+ }
+
+ return 0;
+}
+
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 86901418d37c..60b101d482c0 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -31,6 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
+#if ! ENABLE_LAYOUT_EXPERIMENTAL
+#undef ENABLE_LAYOUT
+#endif
+
#undef SC_DLLIMPLEMENTATION
#include "scdlgfact.hxx"
@@ -79,6 +83,7 @@
// ause
#include "editutil.hxx"
+#include <sfx2/layout.hxx>
IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl); //add for ScColOrRowDlg
IMPL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl);//CHINA001 add for ScImportAsciiDlg
@@ -112,6 +117,40 @@ IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); //add for ScStringInputDlg
IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); //add for ScImportOptionsDlg
IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
+// AbstractTabDialog_Impl begin
+void AbstractTabDialog_Impl::SetCurPageId( USHORT nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+
+const SfxItemSet* AbstractTabDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+//add by CHINA001
+const USHORT* AbstractTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+//add by CHINA001
+void AbstractTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+//From class Window.
+void AbstractTabDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractTabDialog_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+
+#if ENABLE_LAYOUT
+namespace layout
+{
+IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
// AbstractTabDialog_Impl begin
void AbstractTabDialog_Impl::SetCurPageId( USHORT nId )
@@ -142,6 +181,8 @@ String AbstractTabDialog_Impl::GetText() const
{
return pDlg->GetText();
}
+}
+#endif /* ENABLE_LAYOUT */
//add for AbstractTabDialog_Impl end
// AbstractScImportAsciiDlg_Impl begin
@@ -673,6 +714,24 @@ VclAbstractDialog * ScAbstractDialogFactory_Impl::CreateScColOrRowDlg(Window*
}
//add for ScColOrRowDlg end
+//add for ScSortWarningDlg begin
+VclAbstractDialog * ScAbstractDialogFactory_Impl::CreateScSortWarningDlg( Window* pParent, const String& rExtendText,
+ const String& rCurrentText, int nId )
+{
+ Dialog * pDlg=NULL;
+ switch ( nId )
+ {
+ case RID_SCDLG_SORT_WARNING:
+ pDlg = new ScSortWarningDlg( pParent, rExtendText, rCurrentText );
+ break;
+ default:
+ break;
+ }
+ if( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+//add for ScSortWarningDlg end
//add for ScDataPilotDatabaseDlg begin
@@ -1227,6 +1286,10 @@ AbstractScImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScImportOptions
}
//add for ScImportOptionsDlg end
+#if ENABLE_LAYOUT && !LAYOUT_SFX_TABDIALOG_BROKEN
+#define SfxTabDialog layout::SfxTabDialog
+#define AbstractTabDialog_Impl layout::AbstractTabDialog_Impl
+#endif /* ENABLE_LAYOUT */
//add for ScAttrDlg begin
SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScAttrDlg( SfxViewFrame* pFrame,
Window* pParent,
@@ -1249,6 +1312,8 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScAttrDlg( SfxViewFra
}
//add for ScAttrDlg end
+#undef SfxTabDialog
+#undef AbstractTabDialog_Impl
//add for ScHFEditDlg begin
SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScHFEditDlg( SfxViewFrame* pFrame,
@@ -1378,6 +1443,10 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScValidationDlg( Wind
}
//add for ScValidationDlg end
+#if ENABLE_LAYOUT && !LAYOUT_SFX_TABDIALOG_BROKEN
+#define SfxTabDialog layout::SfxTabDialog
+#define AbstractTabDialog_Impl layout::AbstractTabDialog_Impl
+#endif /* ENABLE_LAYOUT */
//add for ScSortDlg begin
SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg( Window* pParent,
const SfxItemSet* pArgSet,int nId )
@@ -1396,6 +1465,9 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg( Window*
return new AbstractTabDialog_Impl( pDlg );
return 0;
}
+#undef SfxTabDialog
+#undef AbstractTabDialog_Impl
+
//add for ScSortDlg end
//------------------ Factories for TabPages--------------------
CreateTabPage ScAbstractDialogFactory_Impl::GetTabPageCreatorFunc( USHORT nId )
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index fbfcd81636b8..40f6d3bee976 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -63,6 +63,7 @@ class ScShowTabDlg;
class ScStringInputDlg;
class ScImportOptionsDlg;
class SfxTabDialog;
+class ScSortWarningDlg;
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
DialogClass* pDlg; \
@@ -354,6 +355,23 @@ class AbstractTabDialog_Impl : public SfxAbstractTabDialog
virtual void SetText( const XubString& rStr ); //add by CHINA001
virtual String GetText() const; //add by CHINA001
};
+#if ENABLE_LAYOUT
+namespace layout
+{
+//add for ScAttrDlg , ScHFEditDlg, ScStyleDlg, ScSubTotalDlg, ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
+class AbstractTabDialog_Impl : public SfxAbstractTabDialog
+{
+ DECL_ABSTDLG_BASE( AbstractTabDialog_Impl,SfxTabDialog )
+ virtual void SetCurPageId( USHORT nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const USHORT* GetInputRanges( const SfxItemPool& pItem ); //add by CHINA001
+ virtual void SetInputSet( const SfxItemSet* pInSet ); //add by CHINA001
+ //From class Window.
+ virtual void SetText( const XubString& rStr ); //add by CHINA001
+ virtual String GetText() const; //add by CHINA001
+};
+} // end namespace layout
+#endif /* ENABLE_LAYOUT */
//------------------------------------------------------------------------
//AbstractDialogFactory_Impl implementations
class ScAbstractDialogFactory_Impl : public ScAbstractDialogFactory
@@ -381,6 +399,9 @@ public:
const String& rStrLabel,
int nId,
BOOL bColDefault = TRUE );
+
+ virtual VclAbstractDialog * CreateScSortWarningDlg( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId );
+
virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ); //add for ScDataPilotDatabaseDlg
virtual AbstractScDataPilotSourceTypeDlg * CreateScDataPilotSourceTypeDlg ( Window* pParent, BOOL bEnableExternal, int nId ) ; //add for ScDataPilotSourceTypeDlg
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index 8f3402f51861..e20542bfedf6 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -629,7 +629,7 @@ void ScDPFieldWindow::DelField( size_t nDelIndex )
void ScDPFieldWindow::ClearFields()
{
- if( eType == TYPE_SELECT )
+ if( eType == TYPE_SELECT || eType == TYPE_PAGE || eType == TYPE_COL || eType == TYPE_ROW || eType == TYPE_DATA)
{
com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible;
if (!xTempAcc.is() && pAccessible)
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 0464a70684b9..a7a80165566f 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -75,21 +75,33 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
: ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_FILTER ),
//
aFlCriteria ( this, ScResId( FL_CRITERIA ) ),
+ aLbConnect1 ( this, ScResId( LB_OP1 ) ),
aLbField1 ( this, ScResId( LB_FIELD1 ) ),
aLbCond1 ( this, ScResId( LB_COND1 ) ),
aEdVal1 ( this, ScResId( ED_VAL1 ) ),
- aLbConnect1 ( this, ScResId( LB_OP1 ) ),
+ aLbConnect2 ( this, ScResId( LB_OP2 ) ),
aLbField2 ( this, ScResId( LB_FIELD2 ) ),
aLbCond2 ( this, ScResId( LB_COND2 ) ),
aEdVal2 ( this, ScResId( ED_VAL2 ) ),
- aLbConnect2 ( this, ScResId( LB_OP2 ) ),
+ aLbConnect3 ( this, ScResId( LB_OP3 ) ),
aLbField3 ( this, ScResId( LB_FIELD3 ) ),
aLbCond3 ( this, ScResId( LB_COND3 ) ),
aEdVal3 ( this, ScResId( ED_VAL3 ) ),
+ aLbConnect4 ( this, ScResId( LB_OP4 ) ),
+ aLbField4 ( this, ScResId( LB_FIELD4 ) ),
+ aLbCond4 ( this, ScResId( LB_COND4 ) ),
+ aEdVal4 ( this, ScResId( ED_VAL4 ) ),
aFtConnect ( this, ScResId( FT_OP ) ),
aFtField ( this, ScResId( FT_FIELD ) ),
aFtCond ( this, ScResId( FT_COND ) ),
aFtVal ( this, ScResId( FT_VAL ) ),
+ aFlSeparator ( this, ScResId( FL_SEPARATOR ) ),
+ aScrollBar ( this, ScResId( LB_SCROLL ) ),
+ aFlOptions ( this, ScResId( FL_OPTIONS ) ),
+ aBtnMore ( this, ScResId( BTN_MORE ) ),
+ aBtnHelp ( this, ScResId( BTN_HELP ) ),
+ aBtnOk ( this, ScResId( BTN_OK ) ),
+ aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
_INIT_COMMON_FILTER_RSCOBJS
aStrEmpty ( ScResId( SCSTR_EMPTY ) ),
aStrNotEmpty ( ScResId( SCSTR_NOTEMPTY ) ),
@@ -110,7 +122,12 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
{
for (USHORT i=0; i<=MAXCOL; i++)
pEntryLists[i] = NULL;
-
+ for (SCSIZE i=0;i<MAXQUERY;i++)
+ {
+ bRefreshExceptQuery[i]=FALSE;
+ }
+ aBtnMore.SetMoreText( String(ScResId( SCSTR_MOREBTN_MOREOPTIONS )) );
+ aBtnMore.SetLessText( String(ScResId( SCSTR_MOREBTN_FEWEROPTIONS )) );
Init( rArgSet );
FreeResource();
@@ -153,8 +170,16 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
aLbField1.SetSelectHdl ( LINK( this, ScFilterDlg, LbSelectHdl ) );
aLbField2.SetSelectHdl ( LINK( this, ScFilterDlg, LbSelectHdl ) );
aLbField3.SetSelectHdl ( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbField4.SetSelectHdl ( LINK( this, ScFilterDlg, LbSelectHdl ) );
aLbConnect1.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
aLbConnect2.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbConnect3.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbConnect4.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+
+ aLbCond1.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbCond2.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbCond3.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
+ aLbCond4.SetSelectHdl( LINK( this, ScFilterDlg, LbSelectHdl ) );
pViewData = rQueryItem.GetViewData();
pDoc = pViewData ? pViewData->GetDocument() : NULL;
@@ -164,12 +189,19 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
aFieldLbArr [0] = &aLbField1;
aFieldLbArr [1] = &aLbField2;
aFieldLbArr [2] = &aLbField3;
+ aFieldLbArr [3] = &aLbField4;
aValueEdArr [0] = &aEdVal1;
aValueEdArr [1] = &aEdVal2;
aValueEdArr [2] = &aEdVal3;
+ aValueEdArr [3] = &aEdVal4;
aCondLbArr [0] = &aLbCond1;
aCondLbArr [1] = &aLbCond2;
aCondLbArr [2] = &aLbCond3;
+ aCondLbArr [3] = &aLbCond4;
+ aConnLbArr [0] = &aLbConnect1;
+ aConnLbArr [1] = &aLbConnect2;
+ aConnLbArr [2] = &aLbConnect3;
+ aConnLbArr [3] = &aLbConnect4;
// Optionen initialisieren lassen:
@@ -197,7 +229,7 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
FillFieldLists();
- for ( SCSIZE i=0; i<3; i++ )
+ for ( SCSIZE i=0; i<4; i++ )
{
String aValStr;
USHORT nCondPos = 0;
@@ -208,7 +240,6 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
{
nCondPos = (USHORT)rEntry.eOp;
nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
-
if ( rEntry.nVal == SC_EMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING )
{
aValStr = aStrEmpty;
@@ -223,8 +254,14 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
aValStr = *rEntry.pStr;
}
else if ( i == 0 )
+ {
nFieldSelPos = GetFieldSelPos( pViewData->GetCurX() );
+ rEntry.nField = nFieldSelPos ? (theQueryData.nCol1 +
+ static_cast<SCCOL>(nFieldSelPos) - 1) : static_cast<SCCOL>(0);
+ rEntry.bDoQuery=TRUE;
+ bRefreshExceptQuery[i]=TRUE;
+ }
aFieldLbArr[i]->SelectEntryPos( nFieldSelPos );
aCondLbArr [i]->SelectEntryPos( nCondPos );
aValueEdArr[i]->SetText( aValStr );
@@ -232,26 +269,36 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
UpdateValueList( static_cast<USHORT>(i+1) );
}
+ aScrollBar.SetEndScrollHdl( LINK( this, ScFilterDlg, ScrollHdl ) );
+ aScrollBar.SetScrollHdl( LINK( this, ScFilterDlg, ScrollHdl ) );
+
+ aScrollBar.SetRange( Range( 0, 4 ) );
+ aScrollBar.SetLineSize( 1 );
+ aLbConnect1.Hide();
// Disable/Enable Logik:
(aLbField1.GetSelectEntryPos() != 0)
&& (aLbField2.GetSelectEntryPos() != 0)
- ? aLbConnect1.SelectEntryPos( (USHORT)theQueryData.GetEntry(1).eConnect )
- : aLbConnect1.SetNoSelection();
+ ? aLbConnect2.SelectEntryPos( (USHORT)theQueryData.GetEntry(1).eConnect )
+ : aLbConnect2.SetNoSelection();
(aLbField2.GetSelectEntryPos() != 0)
&& (aLbField3.GetSelectEntryPos() != 0)
- ? aLbConnect2.SelectEntryPos( (USHORT)theQueryData.GetEntry(2).eConnect )
- : aLbConnect2.SetNoSelection();
+ ? aLbConnect3.SelectEntryPos( (USHORT)theQueryData.GetEntry(2).eConnect )
+ : aLbConnect3.SetNoSelection();
+ (aLbField3.GetSelectEntryPos() != 0)
+ && (aLbField4.GetSelectEntryPos() != 0)
+ ? aLbConnect4.SelectEntryPos( (USHORT)theQueryData.GetEntry(3).eConnect )
+ : aLbConnect4.SetNoSelection();
if ( aLbField1.GetSelectEntryPos() == 0 )
{
- aLbConnect1.Disable();
+ aLbConnect2.Disable();
aLbField2.Disable();
aLbCond2.Disable();
aEdVal2.Disable();
}
- else if ( aLbConnect1.GetSelectEntryCount() == 0 )
+ else if ( aLbConnect2.GetSelectEntryCount() == 0 )
{
aLbField2.Disable();
aLbCond2.Disable();
@@ -260,17 +307,30 @@ void __EXPORT ScFilterDlg::Init( const SfxItemSet& rArgSet )
if ( aLbField2.GetSelectEntryPos() == 0 )
{
- aLbConnect2.Disable();
+ aLbConnect3.Disable();
aLbField3.Disable();
aLbCond3.Disable();
aEdVal3.Disable();
}
- else if ( aLbConnect2.GetSelectEntryCount() == 0 )
+ else if ( aLbConnect3.GetSelectEntryCount() == 0 )
{
aLbField3.Disable();
aLbCond3.Disable();
aEdVal3.Disable();
}
+ if ( aLbField3.GetSelectEntryPos() == 0 )
+ {
+ aLbConnect4.Disable();
+ aLbField4.Disable();
+ aLbCond4.Disable();
+ aEdVal4.Disable();
+ }
+ else if ( aLbConnect4.GetSelectEntryCount() == 0 )
+ {
+ aLbField4.Disable();
+ aLbCond4.Disable();
+ aEdVal4.Disable();
+ }
if(pDoc!=NULL &&
pDoc->GetChangeTrack()!=NULL) aBtnCopyResult.Disable();
@@ -332,9 +392,11 @@ void ScFilterDlg::FillFieldLists()
aLbField1.Clear();
aLbField2.Clear();
aLbField3.Clear();
+ aLbField4.Clear();
aLbField1.InsertEntry( aStrNone, 0 );
aLbField2.InsertEntry( aStrNone, 0 );
aLbField3.InsertEntry( aStrNone, 0 );
+ aLbField4.InsertEntry( aStrNone, 0 );
if ( pDoc )
{
@@ -358,6 +420,7 @@ void ScFilterDlg::FillFieldLists()
aLbField1.InsertEntry( aFieldName, i );
aLbField2.InsertEntry( aFieldName, i );
aLbField3.InsertEntry( aFieldName, i );
+ aLbField4.InsertEntry( aFieldName, i );
i++;
}
nFieldCount = i;
@@ -369,7 +432,7 @@ void ScFilterDlg::FillFieldLists()
void ScFilterDlg::UpdateValueList( USHORT nList )
{
- if ( pDoc && nList>0 && nList<=3 )
+ if ( pDoc && nList>0 && nList<=4 )
{
ComboBox* pValList = aValueEdArr[nList-1];
USHORT nFieldSelPos = aFieldLbArr[nList-1]->GetSelectEntryPos();
@@ -442,7 +505,7 @@ void ScFilterDlg::UpdateHdrInValueList( USHORT nList )
{
//! GetText / SetText ??
- if ( pDoc && nList>0 && nList<=3 )
+ if ( pDoc && nList>0 && nList<=4 )
{
USHORT nFieldSelPos = aFieldLbArr[nList-1]->GetSelectEntryPos();
if ( nFieldSelPos )
@@ -492,7 +555,7 @@ void ScFilterDlg::UpdateHdrInValueList( USHORT nList )
void ScFilterDlg::ClearValueList( USHORT nList )
{
- if ( nList>0 && nList<=3 )
+ if ( nList>0 && nList<=4 )
{
ComboBox* pValList = aValueEdArr[nList-1];
pValList->Clear();
@@ -519,10 +582,7 @@ ScQueryItem* ScFilterDlg::GetOutputItem()
{
ScAddress theCopyPos;
ScQueryParam theParam( theQueryData );
- USHORT nConnect1 = aLbConnect1.GetSelectEntryPos();
- USHORT nConnect2 = aLbConnect2.GetSelectEntryPos();
BOOL bCopyPosOk = FALSE;
- SCSIZE i;
if ( aBtnCopyResult.IsChecked() )
{
@@ -536,57 +596,6 @@ ScQueryItem* ScFilterDlg::GetOutputItem()
bCopyPosOk = ( SCA_VALID == (nResult & SCA_VALID) );
}
- for ( i = 0; i < 3; i++ )
- {
- USHORT nField = aFieldLbArr[i]->GetSelectEntryPos();
- ScQueryOp eOp = (ScQueryOp)aCondLbArr[i]->GetSelectEntryPos();
-
- BOOL bDoThis = (aFieldLbArr[i]->GetSelectEntryPos() != 0);
- theParam.GetEntry(i).bDoQuery = bDoThis;
-
- if ( bDoThis )
- {
- ScQueryEntry& rEntry = theParam.GetEntry(i);
-
- String aStrVal( aValueEdArr[i]->GetText() );
-
- /*
- * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer"
- * als Konstanten in nVal in Verbindung mit dem Schalter
- * bQueryByString auf FALSE.
- */
- if ( aStrVal == aStrEmpty )
- {
- rEntry.pStr->Erase();
- rEntry.nVal = SC_EMPTYFIELDS;
- rEntry.bQueryByString = FALSE;
- }
- else if ( aStrVal == aStrNotEmpty )
- {
- rEntry.pStr->Erase();
- rEntry.nVal = SC_NONEMPTYFIELDS;
- rEntry.bQueryByString = FALSE;
- }
- else
- {
- *rEntry.pStr = aStrVal;
- rEntry.nVal = 0;
- rEntry.bQueryByString = TRUE;
- }
-
- rEntry.nField = nField ? (theQueryData.nCol1 +
- static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
- rEntry.eOp = eOp;
- }
- }
-
- theParam.GetEntry(1).eConnect = (nConnect1 != LISTBOX_ENTRY_NOTFOUND)
- ? (ScQueryConnect)nConnect1
- : SC_AND;
- theParam.GetEntry(2).eConnect = (nConnect2 != LISTBOX_ENTRY_NOTFOUND)
- ? (ScQueryConnect)nConnect2
- : SC_AND;
-
if ( aBtnCopyResult.IsChecked() && bCopyPosOk )
{
theParam.bInplace = FALSE;
@@ -611,10 +620,6 @@ ScQueryItem* ScFilterDlg::GetOutputItem()
// nur die drei eingestellten - alles andere zuruecksetzen
- SCSIZE nEC = theParam.GetEntryCount();
- for (i=3; i<nEC; i++) // alles ueber 3
- theParam.GetEntry(i).bDoQuery = FALSE; // zuruecksetzen
-
DELETEZ( pOutItem );
pOutItem = new ScQueryItem( nWhichQuery, &theParam );
@@ -713,86 +718,231 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
* Behandlung der Enable/Disable-Logik,
* abhaengig davon, welche ListBox angefasst wurde:
*/
+ USHORT nOffset = GetSliderPos();
if ( pLb == &aLbConnect1 )
{
- if ( !aLbField2.IsEnabled() )
- {
- aLbField2.Enable();
- aLbCond2.Enable();
- aEdVal2.Enable();
- }
+ aLbField1.Enable();
+ aLbCond1.Enable();
+ aEdVal1.Enable();
+
+ USHORT nConnect1 = aLbConnect1.GetSelectEntryPos();
+ USHORT nQE = nOffset;
+ theQueryData.GetEntry(nQE).eConnect =(ScQueryConnect)nConnect1;
+ bRefreshExceptQuery[nQE]=TRUE;
}
+
else if ( pLb == &aLbConnect2 )
{
- if ( !aLbField3.IsEnabled() )
- {
- aLbField3.Enable();
- aLbCond3.Enable();
- aEdVal3.Enable();
- }
+ aLbField2.Enable();
+ aLbCond2.Enable();
+ aEdVal2.Enable();
+
+ USHORT nConnect2 = aLbConnect2.GetSelectEntryPos();
+ USHORT nQE = 1+nOffset;
+ theQueryData.GetEntry(nQE).eConnect =(ScQueryConnect)nConnect2;
+ bRefreshExceptQuery[nQE]=TRUE;
+ }
+ else if ( pLb == &aLbConnect3 )
+ {
+ aLbField3.Enable();
+ aLbCond3.Enable();
+ aEdVal3.Enable();
+
+ USHORT nConnect3 = aLbConnect3.GetSelectEntryPos();
+ USHORT nQE = 2+nOffset;
+ theQueryData.GetEntry(nQE).eConnect = (ScQueryConnect)nConnect3;
+ bRefreshExceptQuery[nQE]=TRUE;
+
+ }
+ else if ( pLb == &aLbConnect4 )
+ {
+ aLbField4.Enable();
+ aLbCond4.Enable();
+ aEdVal4.Enable();
+
+ USHORT nConnect4 = aLbConnect4.GetSelectEntryPos();
+ USHORT nQE = 3+nOffset;
+ theQueryData.GetEntry(nQE).eConnect = (ScQueryConnect)nConnect4;
+ bRefreshExceptQuery[nQE]=TRUE;
+
}
else if ( pLb == &aLbField1 )
{
if ( aLbField1.GetSelectEntryPos() == 0 )
{
- aLbConnect1.SetNoSelection();
aLbConnect2.SetNoSelection();
+ aLbConnect3.SetNoSelection();
+ aLbConnect4.SetNoSelection();
aLbField2.SelectEntryPos( 0 );
aLbField3.SelectEntryPos( 0 );
+ aLbField4.SelectEntryPos( 0 );
aLbCond2.SelectEntryPos( 0 );
aLbCond3.SelectEntryPos( 0 );
+ aLbCond4.SelectEntryPos( 0 );
ClearValueList( 1 );
ClearValueList( 2 );
ClearValueList( 3 );
+ ClearValueList( 4 );
- aLbConnect1.Disable();
aLbConnect2.Disable();
+ aLbConnect3.Disable();
+ aLbConnect4.Disable();
aLbField2.Disable();
aLbField3.Disable();
+ aLbField4.Disable();
aLbCond2.Disable();
aLbCond3.Disable();
+ aLbCond4.Disable();
aEdVal2.Disable();
aEdVal3.Disable();
+ aEdVal4.Disable();
+ for (USHORT i= nOffset; i< MAXQUERY; i++)
+ {
+ theQueryData.GetEntry(i).bDoQuery = FALSE;
+ bRefreshExceptQuery[i]=FALSE;
+ theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
+ }
+ bRefreshExceptQuery[nOffset] =TRUE;
}
else
{
UpdateValueList( 1 );
- if ( !aLbConnect1.IsEnabled() )
+ if ( !aLbConnect2.IsEnabled() )
{
- aLbConnect1.Enable();
+ aLbConnect2.Enable();
}
+ theQueryData.GetEntry(nOffset).bDoQuery = TRUE;
+ USHORT nField = pLb->GetSelectEntryPos();
+ theQueryData.GetEntry(nOffset).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
}
}
else if ( pLb == &aLbField2 )
{
if ( aLbField2.GetSelectEntryPos() == 0 )
{
- aLbConnect2.SetNoSelection();
+ aLbConnect3.SetNoSelection();
+ aLbConnect4.SetNoSelection();
aLbField3.SelectEntryPos( 0 );
+ aLbField4.SelectEntryPos( 0 );
aLbCond3.SelectEntryPos( 0 );
+ aLbCond4.SelectEntryPos( 0 );
ClearValueList( 2 );
ClearValueList( 3 );
+ ClearValueList( 4 );
- aLbConnect2.Disable();
+ aLbConnect3.Disable();
+ aLbConnect4.Disable();
aLbField3.Disable();
+ aLbField4.Disable();
aLbCond3.Disable();
+ aLbCond4.Disable();
aEdVal3.Disable();
+ aEdVal4.Disable();
+
+ USHORT nTemp=nOffset+1;
+ for (USHORT i= nTemp; i< MAXQUERY; i++)
+ {
+ theQueryData.GetEntry(i).bDoQuery = FALSE;
+ bRefreshExceptQuery[i]=FALSE;
+ theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
+ }
+ bRefreshExceptQuery[nTemp]=TRUE;
}
else
{
UpdateValueList( 2 );
- if ( !aLbConnect2.IsEnabled() )
+ if ( !aLbConnect3.IsEnabled() )
{
- aLbConnect2.Enable();
+ aLbConnect3.Enable();
}
+ USHORT nField = pLb->GetSelectEntryPos();
+ USHORT nQ=1+nOffset;
+ theQueryData.GetEntry(nQ).bDoQuery = TRUE;
+ theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
}
}
else if ( pLb == &aLbField3 )
{
- ( aLbField3.GetSelectEntryPos() == 0 )
- ? ClearValueList( 3 )
- : UpdateValueList( 3 );
+ if ( aLbField3.GetSelectEntryPos() == 0 )
+ {
+ aLbConnect4.SetNoSelection();
+ aLbField4.SelectEntryPos( 0 );
+ aLbCond4.SelectEntryPos( 0 );
+ ClearValueList( 3 );
+ ClearValueList( 4 );
+
+ aLbConnect4.Disable();
+ aLbField4.Disable();
+ aLbCond4.Disable();
+ aEdVal4.Disable();
+
+ USHORT nTemp=nOffset+2;
+ for (USHORT i= nTemp; i< MAXQUERY; i++)
+ {
+ theQueryData.GetEntry(i).bDoQuery = FALSE;
+ bRefreshExceptQuery[i]=FALSE;
+ theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
+ }
+ bRefreshExceptQuery[nTemp]=TRUE;
+ }
+ else
+ {
+ UpdateValueList( 3 );
+ if ( !aLbConnect4.IsEnabled() )
+ {
+ aLbConnect4.Enable();
+ }
+
+ USHORT nField = pLb->GetSelectEntryPos();
+ USHORT nQ=2+nOffset;
+ theQueryData.GetEntry(nQ).bDoQuery = TRUE;
+ theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
+
+ }
+ }
+ else if ( pLb == &aLbField4 )
+ {
+ if ( aLbField4.GetSelectEntryPos() == 0 )
+ {
+ ClearValueList( 4 );
+ USHORT nTemp=nOffset+3;
+ for (USHORT i= nTemp; i< MAXQUERY; i++)
+ {
+ theQueryData.GetEntry(i).bDoQuery = FALSE;
+ bRefreshExceptQuery[i]=FALSE;
+ theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
+ }
+ bRefreshExceptQuery[nTemp]=TRUE;
+ }
+ else
+ {
+ UpdateValueList( 4 );
+ USHORT nField = pLb->GetSelectEntryPos();
+ USHORT nQ=3+nOffset;
+ theQueryData.GetEntry(nQ).bDoQuery = TRUE;
+ theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
+ }
+
+ }
+ else if ( pLb == &aLbCond1)
+ {
+ theQueryData.GetEntry(nOffset).eOp=(ScQueryOp)pLb->GetSelectEntryPos();
+ }
+ else if ( pLb == &aLbCond2)
+ {
+ USHORT nQ=1+nOffset;
+ theQueryData.GetEntry(nQ).eOp=(ScQueryOp)pLb->GetSelectEntryPos();
+ }
+ else if ( pLb == &aLbCond3)
+ {
+ USHORT nQ=2+nOffset;
+ theQueryData.GetEntry(nQ).eOp=(ScQueryOp)pLb->GetSelectEntryPos();
+ }
+ else
+ {
+ USHORT nQ=3+nOffset;
+ theQueryData.GetEntry(nQ).eOp=(ScQueryOp)pLb->GetSelectEntryPos();
}
return 0;
@@ -814,14 +964,17 @@ IMPL_LINK( ScFilterDlg, CheckBoxHdl, CheckBox*, pBox )
USHORT nCurSel1 = aLbField1.GetSelectEntryPos();
USHORT nCurSel2 = aLbField2.GetSelectEntryPos();
USHORT nCurSel3 = aLbField3.GetSelectEntryPos();
+ USHORT nCurSel4 = aLbField4.GetSelectEntryPos();
FillFieldLists();
aLbField1.SelectEntryPos( nCurSel1 );
aLbField2.SelectEntryPos( nCurSel2 );
aLbField3.SelectEntryPos( nCurSel3 );
+ aLbField4.SelectEntryPos( nCurSel4 );
UpdateHdrInValueList( 1 );
UpdateHdrInValueList( 2 );
UpdateHdrInValueList( 3 );
+ UpdateHdrInValueList( 4 );
}
if ( pBox == &aBtnCase ) // Wertlisten komplett
@@ -832,6 +985,7 @@ IMPL_LINK( ScFilterDlg, CheckBoxHdl, CheckBox*, pBox )
UpdateValueList( 1 ); // aktueller Text wird gemerkt
UpdateValueList( 2 );
UpdateValueList( 3 );
+ UpdateValueList( 4 );
}
return 0;
@@ -842,27 +996,190 @@ IMPL_LINK( ScFilterDlg, CheckBoxHdl, CheckBox*, pBox )
IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd )
{
+ USHORT nOffset = GetSliderPos();
+ USHORT i=0;
+ USHORT nQE =i + nOffset;
if ( pEd )
{
- String aStrVal = pEd->GetText();
- ListBox* pLb = &aLbCond1;
-
- if ( pEd == &aEdVal2 ) pLb = &aLbCond2;
- else if ( pEd == &aEdVal3 ) pLb = &aLbCond3;
-
- // wenn einer der Sonderwerte leer/nicht-leer
- // gewaehlt wird, so macht nur der =-Operator Sinn:
+ String aStrVal = pEd->GetText();
+ ListBox* pLbCond = &aLbCond1;
+ ListBox* pLbField = &aLbField1;
+ if ( pEd == &aEdVal2 )
+ {
+ pLbCond = &aLbCond2;
+ pLbField = &aLbField2;
+ i=1;
+ nQE=i+nOffset;
+ }
+ if ( pEd == &aEdVal3 )
+ {
+ pLbCond = &aLbCond3;
+ pLbField = &aLbField3;
+ i=2;
+ nQE=i+nOffset;
+ }
+ if ( pEd == &aEdVal4 )
+ {
+ pLbCond = &aLbCond4;
+ pLbField = &aLbField4;
+ i=3;
+ nQE=i+nOffset;
+ }
if ( aStrEmpty == aStrVal || aStrNotEmpty == aStrVal )
{
- pLb->SelectEntry( '=' );
- pLb->Disable();
+ pLbCond->SelectEntry( '=' );
+ pLbCond->Disable();
}
else
- pLb->Enable();
+ pLbCond->Enable();
+
+ ScQueryEntry& rEntry = theQueryData.GetEntry( nQE );
+ BOOL bDoThis = (pLbField->GetSelectEntryPos() != 0);
+ rEntry.bDoQuery = bDoThis;
+
+ if ( rEntry.bDoQuery || bRefreshExceptQuery[nQE] )
+ {
+ if ( aStrVal == aStrEmpty )
+ {
+ rEntry.pStr->Erase();
+ rEntry.nVal = SC_EMPTYFIELDS;
+ rEntry.bQueryByString = FALSE;
+ }
+ else if ( aStrVal == aStrNotEmpty )
+ {
+ rEntry.pStr->Erase();
+ rEntry.nVal = SC_NONEMPTYFIELDS;
+ rEntry.bQueryByString = FALSE;
+ }
+ else
+ {
+ *rEntry.pStr = aStrVal;
+ rEntry.nVal = 0;
+ rEntry.bQueryByString = TRUE;
+ }
+
+ USHORT nField = pLbField->GetSelectEntryPos();
+ rEntry.nField = nField ? (theQueryData.nCol1 +
+ static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
+
+ ScQueryOp eOp = (ScQueryOp)pLbCond->GetSelectEntryPos();
+ rEntry.eOp = eOp;
+
+ }
}
+ return 0;
+}
+//----------------------------------------------------------------------------
+IMPL_LINK( ScFilterDlg, ScrollHdl, ScrollBar*, EMPTYARG )
+{
+ SliderMoved();
return 0;
}
+void ScFilterDlg::SliderMoved()
+{
+ USHORT nOffset = GetSliderPos();
+ RefreshEditRow( nOffset);
+}
+USHORT ScFilterDlg::GetSliderPos()
+{
+ return (USHORT) aScrollBar.GetThumbPos();
+}
+void ScFilterDlg::RefreshEditRow( USHORT nOffset )
+{
+ if (nOffset==0)
+ aConnLbArr[0]->Hide();
+ else
+ aConnLbArr[0]->Show();
+
+ for ( USHORT i=0; i<4; i++ )
+ {
+ String aValStr;
+ USHORT nCondPos = 0;
+ USHORT nFieldSelPos = 0;
+ USHORT nQE = i+nOffset;
+
+ ScQueryEntry& rEntry = theQueryData.GetEntry( nQE);
+ if ( rEntry.bDoQuery || bRefreshExceptQuery[nQE] )
+ {
+ nCondPos = (USHORT)rEntry.eOp;
+ if(rEntry.bDoQuery)
+ nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
+
+ if ( rEntry.nVal == SC_EMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING )
+ {
+ aValStr = aStrEmpty;
+ aCondLbArr[i]->Disable();
+ }
+ else if ( rEntry.nVal == SC_NONEMPTYFIELDS && !rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING )
+ {
+ aValStr = aStrNotEmpty;
+ aCondLbArr[i]->Disable();
+ }
+ else
+ {
+ aValStr = *rEntry.pStr;
+ aCondLbArr[i]->Enable();
+ }
+ aFieldLbArr[i]->Enable();
+ aValueEdArr[i]->Enable();
+ if (nOffset==0)
+ {
+ if (i<3)
+ {
+ if(rEntry.bDoQuery)
+ aConnLbArr[i+1]->Enable();
+ else
+ aConnLbArr[i+1]->Disable();
+ USHORT nQENext = nQE+1;
+ if(theQueryData.GetEntry(nQENext).bDoQuery || bRefreshExceptQuery[nQENext])
+ aConnLbArr[i+1]->SelectEntryPos( (USHORT) theQueryData.GetEntry(nQENext).eConnect );
+ else
+ aConnLbArr[i+1]->SetNoSelection();
+ }
+ }
+ else
+ {
+ if(theQueryData.GetEntry( nQE-1).bDoQuery)
+ aConnLbArr[i]->Enable();
+ else
+ aConnLbArr[i]->Disable();
+
+ if(rEntry.bDoQuery || bRefreshExceptQuery[nQE])
+ aConnLbArr[i]->SelectEntryPos( (USHORT) rEntry.eConnect );
+ else
+ aConnLbArr[i]->SetNoSelection();
+ }
+
+ }
+ else
+ {
+ if (nOffset==0)
+ {
+ if(i<3)
+ {
+ aConnLbArr[i+1]->SetNoSelection();
+ aConnLbArr[i+1]->Disable();
+ }
+ }
+ else
+ {
+ if(theQueryData.GetEntry( nQE-1).bDoQuery)
+ aConnLbArr[i]->Enable();
+ else
+ aConnLbArr[i]->Disable();
+ aConnLbArr[i]->SetNoSelection();
+ }
+ aFieldLbArr[i]->Disable();
+ aCondLbArr[i]->Disable();
+ aValueEdArr[i]->Disable();
+ }
+ aFieldLbArr[i]->SelectEntryPos( nFieldSelPos );
+ aCondLbArr [i]->SelectEntryPos( nCondPos );
+ aValueEdArr[i]->SetText( aValStr );
+ UpdateValueList( static_cast<USHORT>(i+1) );
+ }
+}
diff --git a/sc/source/ui/dbgui/pivot.hrc b/sc/source/ui/dbgui/pivot.hrc
index dea4f3d16dd6..b7aefcfd996a 100644
--- a/sc/source/ui/dbgui/pivot.hrc
+++ b/sc/source/ui/dbgui/pivot.hrc
@@ -66,6 +66,10 @@
#define BTN_FILTER 29
#define BTN_DRILLDOWN 30
+#define FT_INAREA 40
+#define RB_INAREA 41
+#define ED_INAREA 42
+
#define PIVOTSTR_SUM 1
#define PIVOTSTR_COUNT 2
#define PIVOTSTR_AVG 3
diff --git a/sc/source/ui/dbgui/pivot.src b/sc/source/ui/dbgui/pivot.src
index 0449c1d2db59..a4694e756edb 100644
--- a/sc/source/ui/dbgui/pivot.src
+++ b/sc/source/ui/dbgui/pivot.src
@@ -158,7 +158,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
MapUnit = MAP_APPFONT ;
- Delta = 73 ;
+ Delta = 90 ;
};
Window WND_FIELD
{
@@ -178,17 +178,42 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
Text [ en-US ] = "Result" ;
Hide = TRUE ;
};
- FixedText FT_OUTAREA
+
+ FixedText FT_INAREA
{
Pos = MAP_APPFONT ( 12 , 203 ) ;
Size = MAP_APPFONT ( 59 , 8 ) ;
Hide = TRUE ;
+ Text [ en-US ] = "Selection from" ;
+ };
+ Edit ED_INAREA
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 73 , 201 ) ;
+ Size = MAP_APPFONT ( 100 , 12 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ ImageButton RB_INAREA
+ {
+ Pos = MAP_APPFONT ( 177 , 200 ) ;
+ Size = MAP_APPFONT ( 13 , 15 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ QuickHelpText [ en-US ] = "Shrink" ;
+ };
+
+ FixedText FT_OUTAREA
+ {
+ Pos = MAP_APPFONT ( 12 , 221 ) ;
+ Size = MAP_APPFONT ( 59 , 8 ) ;
+ Hide = TRUE ;
Text [ en-US ] = "Results to" ;
};
ListBox LB_OUTAREA
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 73 , 201 ) ;
+ Pos = MAP_APPFONT ( 73 , 219 ) ;
Size = MAP_APPFONT ( 75 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
@@ -197,14 +222,14 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
Edit ED_OUTAREA
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 152 , 201 ) ;
+ Pos = MAP_APPFONT ( 152 , 219 ) ;
Size = MAP_APPFONT ( 100 , 12 ) ;
TabStop = TRUE ;
Hide = TRUE ;
};
ImageButton RB_OUTAREA
{
- Pos = MAP_APPFONT ( 256 , 200 ) ;
+ Pos = MAP_APPFONT ( 256 , 218 ) ;
Size = MAP_APPFONT ( 13 , 15 ) ;
TabStop = TRUE ;
Hide = TRUE ;
@@ -212,7 +237,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
};
CheckBox BTN_IGNEMPTYROWS
{
- Pos = MAP_APPFONT ( 12 , 219 ) ;
+ Pos = MAP_APPFONT ( 12 , 237 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
TabStop = TRUE ;
Hide = TRUE ;
@@ -220,7 +245,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
};
CheckBox BTN_DETECTCAT
{
- Pos = MAP_APPFONT ( 142 , 219 ) ;
+ Pos = MAP_APPFONT ( 142 , 237 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
TabStop = TRUE ;
Hide = TRUE ;
@@ -228,7 +253,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
};
CheckBox BTN_TOTALCOL
{
- Pos = MAP_APPFONT ( 12 , 233 ) ;
+ Pos = MAP_APPFONT ( 12 , 251 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
TabStop = TRUE ;
Hide = TRUE ;
@@ -236,7 +261,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
};
CheckBox BTN_TOTALROW
{
- Pos = MAP_APPFONT ( 142 , 233 ) ;
+ Pos = MAP_APPFONT ( 142 , 251 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
TabStop = TRUE ;
Hide = TRUE ;
@@ -244,7 +269,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
};
CheckBox BTN_FILTER
{
- Pos = MAP_APPFONT ( 12 , 247 ) ;
+ Pos = MAP_APPFONT ( 12 , 265 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
TabStop = TRUE ;
Hide = TRUE ;
@@ -252,7 +277,7 @@ ModelessDialog RID_SCDLG_PIVOT_LAYOUT
};
CheckBox BTN_DRILLDOWN
{
- Pos = MAP_APPFONT ( 142 , 247 ) ;
+ Pos = MAP_APPFONT ( 142 , 265 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
TabStop = TRUE ;
Hide = TRUE ;
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 7573b6841220..7b03e067a865 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -36,6 +36,7 @@
//----------------------------------------------------------------------------
#include "pvlaydlg.hxx"
+#include "dbdocfun.hxx"
#include <sfx2/dispatch.hxx>
#include <vcl/msgbox.hxx>
@@ -56,6 +57,7 @@
#include "pivot.hrc"
#include "dpobject.hxx"
#include "dpsave.hxx"
+#include "dpshttab.hxx"
#include "scmod.hxx"
#include "sc.hrc" //CHINA001
@@ -120,6 +122,11 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar
aFtInfo ( this, ScResId( FT_INFO ) ),
aFlAreas ( this, ScResId( FL_OUTPUT ) ),
+
+ aFtInArea ( this, ScResId( FT_INAREA) ),
+ aEdInPos ( this, ScResId( ED_INAREA) ),
+ aRbInPos ( this, ScResId( RB_INAREA ), &aEdInPos, this ),
+
aLbOutPos ( this, ScResId( LB_OUTAREA ) ),
aFtOutArea ( this, ScResId( FT_OUTAREA ) ),
aEdOutPos ( this, this, ScResId( ED_OUTAREA ) ),
@@ -143,6 +150,8 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar
bIsDrag ( FALSE ),
+ pEditActive ( NULL ),
+
eLastActiveType ( TYPE_SELECT ),
nOffset ( 0 ),
//
@@ -204,6 +213,10 @@ void __EXPORT ScDPLayoutDlg::Init()
for ( USHORT i = 0; i < FUNC_COUNT; ++i )
aFuncNameArr.push_back( String( ScResId( i + 1 ) ) );
+ aBtnMore.AddWindow( &aFlAreas );
+ aBtnMore.AddWindow( &aFtInArea );
+ aBtnMore.AddWindow( &aEdInPos );
+ aBtnMore.AddWindow( &aRbInPos );
aBtnMore.AddWindow( &aFtOutArea );
aBtnMore.AddWindow( &aLbOutPos );
aBtnMore.AddWindow( &aEdOutPos );
@@ -214,7 +227,6 @@ void __EXPORT ScDPLayoutDlg::Init()
aBtnMore.AddWindow( &aBtnTotalRow );
aBtnMore.AddWindow( &aBtnFilter );
aBtnMore.AddWindow( &aBtnDrillDown );
- aBtnMore.AddWindow( &aFlAreas );
aBtnMore.SetClickHdl( LINK( this, ScDPLayoutDlg, MoreClickHdl ) );
{
@@ -232,31 +244,35 @@ void __EXPORT ScDPLayoutDlg::Init()
aRowArr.resize( MAX_FIELDS );
aDataArr.resize( MAX_FIELDS );
- InitWndSelect( thePivotData.ppLabelArr, static_cast<long>(thePivotData.nLabels) );
- InitWnd( thePivotData.aPageArr, static_cast<long>(thePivotData.nPageCount), TYPE_PAGE );
- InitWnd( thePivotData.aColArr, static_cast<long>(thePivotData.nColCount), TYPE_COL );
- InitWnd( thePivotData.aRowArr, static_cast<long>(thePivotData.nRowCount), TYPE_ROW );
- InitWnd( thePivotData.aDataArr, static_cast<long>(thePivotData.nDataCount), TYPE_DATA );
-
- aSlider.SetPageSize( PAGE_SIZE );
- aSlider.SetVisibleSize( PAGE_SIZE );
- aSlider.SetLineSize( LINE_SIZE );
- aSlider.SetRange( Range( 0, static_cast<long>(((thePivotData.nLabels+LINE_SIZE-1)/LINE_SIZE)*LINE_SIZE) ) );
-
- if ( thePivotData.nLabels > PAGE_SIZE )
+ ScRange inRange;
+ String inString;
+ if (xDlgDPObject->GetSheetDesc())
{
- aSlider.SetEndScrollHdl( LINK( this, ScDPLayoutDlg, ScrollHdl ) );
- aSlider.Show();
+ aEdInPos.Enable();
+ aRbInPos.Enable();
+ aOldRange = xDlgDPObject->GetSheetDesc()->aSourceRange;
+ aOldRange.Format( inString, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
+ aEdInPos.SetText(inString);
}
else
- aSlider.Hide();
+ {
+ /* Data is not reachable, so could be a remote database */
+ aEdInPos.Disable();
+ aRbInPos.Disable();
+ }
- // Ein-/Ausgabebereiche: ----------------------------------------------
+ InitFields();
aLbOutPos .SetSelectHdl( LINK( this, ScDPLayoutDlg, SelAreaHdl ) );
aEdOutPos .SetModifyHdl( LINK( this, ScDPLayoutDlg, EdModifyHdl ) );
+ aEdInPos .SetModifyHdl( LINK( this, ScDPLayoutDlg, EdInModifyHdl ) );
aBtnOk .SetClickHdl ( LINK( this, ScDPLayoutDlg, OkHdl ) );
aBtnCancel.SetClickHdl ( LINK( this, ScDPLayoutDlg, CancelHdl ) );
+ Link aLink = LINK( this, ScDPLayoutDlg, GetFocusHdl );
+ if ( aEdInPos.IsEnabled() )
+ // Once disabled it will never get enabled, so no need to handle focus.
+ aEdInPos.SetGetFocusHdl( aLink );
+ aEdOutPos.SetGetFocusHdl( aLink );
if ( pViewData && pDoc )
{
@@ -475,6 +491,27 @@ void ScDPLayoutDlg::InitFocus()
aWndSelect.GrabFocus();
}
+void ScDPLayoutDlg::InitFields()
+{
+ InitWndSelect( thePivotData.ppLabelArr, static_cast<long>(thePivotData.nLabels) );
+ InitWnd( thePivotData.aPageArr, static_cast<long>(thePivotData.nPageCount), TYPE_PAGE );
+ InitWnd( thePivotData.aColArr, static_cast<long>(thePivotData.nColCount), TYPE_COL );
+ InitWnd( thePivotData.aRowArr, static_cast<long>(thePivotData.nRowCount), TYPE_ROW );
+ InitWnd( thePivotData.aDataArr, static_cast<long>(thePivotData.nDataCount), TYPE_DATA );
+
+ aSlider.SetPageSize( PAGE_SIZE );
+ aSlider.SetVisibleSize( PAGE_SIZE );
+ aSlider.SetLineSize( LINE_SIZE );
+ aSlider.SetRange( Range( 0, static_cast<long>(((thePivotData.nLabels+LINE_SIZE-1)/LINE_SIZE)*LINE_SIZE) ) );
+
+ if ( thePivotData.nLabels > PAGE_SIZE )
+ {
+ aSlider.SetEndScrollHdl( LINK( this, ScDPLayoutDlg, ScrollHdl ) );
+ aSlider.Show();
+ }
+ else
+ aSlider.Hide();
+}
//----------------------------------------------------------------------------
@@ -1309,22 +1346,75 @@ BOOL ScDPLayoutDlg::GetPivotArrays( PivotField* pPageArr,
return bFit;
}
+void ScDPLayoutDlg::UpdateSrcRange()
+{
+ String theCurPosStr = aEdInPos.GetText();
+ USHORT nResult = ScRange().Parse(theCurPosStr, pDoc, pDoc->GetAddressConvention());
+
+ if ( SCA_VALID != (nResult & SCA_VALID) )
+ // invalid source range.
+ return;
+
+ ScRefAddress start, end;
+ ConvertDoubleRef(pDoc, theCurPosStr, 1, start, end, pDoc->GetAddressConvention());
+ ScRange aNewRange(start.GetAddress(), end.GetAddress());
+ ScSheetSourceDesc inSheet = *xDlgDPObject->GetSheetDesc();
+
+ if (inSheet.aSourceRange == aNewRange)
+ // new range is identical to the current range. Nothing to do.
+ return;
+
+ ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
+ inSheet.aSourceRange = aNewRange;
+ xDlgDPObject->SetSheetDesc(inSheet);
+ xDlgDPObject->FillOldParam( thePivotData, FALSE );
+ xDlgDPObject->FillLabelData(thePivotData);
+
+ pTabViewShell->SetDialogDPObject(xDlgDPObject.get());
+ aLabelDataArr.clear();
+ aWndSelect.ClearFields();
+ aWndData.ClearFields();
+ aWndRow.ClearFields();
+ aWndCol.ClearFields();
+ aWndPage.ClearFields();
+
+ for (size_t i = 0; i < MAX_LABELS; ++i)
+ aSelectArr[i].reset();
+
+ for (size_t i = 0; i < MAX_FIELDS; ++i)
+ {
+ aRowArr[i].reset();
+ aColArr[i].reset();
+ aDataArr[i].reset();
+ }
+
+ for (size_t i = 0; i < MAX_PAGEFIELDS; ++i)
+ aPageArr[i].reset();
+
+ InitFields();
+}
//----------------------------------------------------------------------------
void ScDPLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
{
- if ( bRefInputMode )
+ if ( !bRefInputMode || !pEditActive )
+ return;
+
+ if ( rRef.aStart != rRef.aEnd )
+ RefInputStart( pEditActive );
+
+ if ( pEditActive == &aEdInPos )
+ {
+ String aRefStr;
+ rRef.Format( aRefStr, SCR_ABS_3D, pDocP, pDocP->GetAddressConvention() );
+ pEditActive->SetRefString( aRefStr );
+ }
+ else if ( pEditActive == &aEdOutPos )
{
- if ( rRef.aStart != rRef.aEnd )
- RefInputStart( &aEdOutPos );
-/*
- ScAddress aAdr( nStartCol, nStartRow, nStartTab );
- aAdr.PutInOrder( ScAddress( nEndCol, nEndRow, nEndTab ) );
-*/
String aRefStr;
rRef.aStart.Format( aRefStr, STD_FORMAT, pDocP, pDocP->GetAddressConvention() );
- aEdOutPos.SetRefString( aRefStr );
+ pEditActive->SetRefString( aRefStr );
}
}
@@ -1335,7 +1425,12 @@ void ScDPLayoutDlg::SetActive()
{
if ( bRefInputMode )
{
- aEdOutPos.GrabFocus();
+ if ( pEditActive )
+ pEditActive->GrabFocus();
+
+ if ( pEditActive == &aEdInPos )
+ EdInModifyHdl( NULL );
+ else if ( pEditActive == &aEdOutPos )
EdModifyHdl( NULL );
}
else
@@ -1374,7 +1469,7 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
String aOutPosStr( aEdOutPos.GetText() );
ScAddress aAdrDest;
BOOL bToNewTable = (aLbOutPos.GetSelectEntryPos() == 1);
- USHORT nResult = !bToNewTable ? aAdrDest.Parse( aOutPosStr, pDoc ) : 0;
+ USHORT nResult = !bToNewTable ? aAdrDest.Parse( aOutPosStr, pDoc, pDoc->GetAddressConvention() ) : 0;
if ( bToNewTable
|| ( (aOutPosStr.Len() > 0) && (SCA_VALID == (nResult & SCA_VALID)) ) )
@@ -1507,12 +1602,11 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG )
//----------------------------------------------------------------------------
-IMPL_LINK_INLINE_START( ScDPLayoutDlg, CancelHdl, CancelButton *, EMPTYARG )
+IMPL_LINK( ScDPLayoutDlg, CancelHdl, CancelButton *, EMPTYARG )
{
Close();
return 0;
}
-IMPL_LINK_INLINE_END( ScDPLayoutDlg, CancelHdl, CancelButton *, EMPTYARG )
//----------------------------------------------------------------------------
@@ -1524,9 +1618,18 @@ IMPL_LINK( ScDPLayoutDlg, MoreClickHdl, MoreButton *, EMPTYARG )
bRefInputMode = TRUE;
//@BugID 54702 Enablen/Disablen nur noch in Basisklasse
//SFX_APPWINDOW->Enable();
+ if ( aEdInPos.IsEnabled() )
+ {
+ aEdInPos.Enable();
+ aEdInPos.GrabFocus();
+ aEdInPos.Enable();
+ }
+ else
+ {
aEdOutPos.Enable();
aEdOutPos.GrabFocus();
- aRbOutPos.Enable();
+ aEdOutPos.Enable();
+ }
}
else
{
@@ -1543,7 +1646,7 @@ IMPL_LINK( ScDPLayoutDlg, MoreClickHdl, MoreButton *, EMPTYARG )
IMPL_LINK( ScDPLayoutDlg, EdModifyHdl, Edit *, EMPTYARG )
{
String theCurPosStr = aEdOutPos.GetText();
- USHORT nResult = ScAddress().Parse( theCurPosStr, pDoc );
+ USHORT nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() );
if ( SCA_VALID == (nResult & SCA_VALID) )
{
@@ -1567,6 +1670,13 @@ IMPL_LINK( ScDPLayoutDlg, EdModifyHdl, Edit *, EMPTYARG )
}
+IMPL_LINK( ScDPLayoutDlg, EdInModifyHdl, Edit *, EMPTYARG )
+{
+ UpdateSrcRange();
+ return 0;
+}
+
+
//----------------------------------------------------------------------------
IMPL_LINK( ScDPLayoutDlg, SelAreaHdl, ListBox *, EMPTYARG )
@@ -1620,4 +1730,16 @@ IMPL_LINK( ScDPLayoutDlg, ScrollHdl, ScrollBar *, EMPTYARG )
return 0;
}
+//----------------------------------------------------------------------------
+
+IMPL_LINK( ScDPLayoutDlg, GetFocusHdl, Control*, pCtrl )
+{
+ pEditActive = NULL;
+ if ( pCtrl == &aEdInPos )
+ pEditActive = &aEdInPos;
+ else if ( pCtrl == &aEdOutPos )
+ pEditActive = &aEdOutPos;
+
+ return 0;
+}
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index b0d82e7bf14e..86f344c11c55 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -78,7 +78,12 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi
aEdFilterArea ( this, this, ScResId( ED_CRITERIA_AREA ) ),
aRbFilterArea ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea, this ),
//
+ aFlOptions ( this, ScResId( FL_OPTIONS ) ),
_INIT_COMMON_FILTER_RSCOBJS
+ aBtnOk ( this, ScResId( BTN_OK ) ),
+ aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, ScResId( BTN_HELP ) ),
+ aBtnMore ( this, ScResId( BTN_MORE ) ),
//
pOptionsMgr ( NULL ),
nWhichQuery ( rArgSet.GetPool()->GetWhich( SID_QUERY ) ),
diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
index 26c3811864c5..7d1462f62f27 100644
--- a/sc/source/ui/dbgui/sortdlg.cxx
+++ b/sc/source/ui/dbgui/sortdlg.cxx
@@ -34,14 +34,15 @@
#undef SC_DLLIMPLEMENTATION
-
+#include <vcl/msgbox.hxx>
#include "tpsort.hxx"
#include "sortdlg.hxx"
#include "scresid.hxx"
#include "sortdlg.hrc"
-
-//==================================================================
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <layout/layout-pre.hxx>
+#endif
ScSortDlg::ScSortDlg( Window* pParent,
const SfxItemSet* pArgSet ) :
@@ -52,8 +53,15 @@ ScSortDlg::ScSortDlg( Window* pParent,
bIsByRows ( FALSE )
{
+#if LAYOUT_SFX_TABDIALOG_BROKEN
AddTabPage( TP_FIELDS, ScTabPageSortFields::Create, 0 );
AddTabPage( TP_OPTIONS, ScTabPageSortOptions::Create, 0 );
+#else
+ String fields = rtl::OUString::createFromAscii ("fields");
+ AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, FALSE, TAB_APPEND);
+ String options = rtl::OUString::createFromAscii ("options");
+ AddTabPage( TP_OPTIONS, options, ScTabPageSortOptions::Create, 0, FALSE, TAB_APPEND);
+#endif
FreeResource();
}
@@ -61,3 +69,42 @@ __EXPORT ScSortDlg::~ScSortDlg()
{
}
+//==================================================================
+ScSortWarningDlg::ScSortWarningDlg( Window* pParent,
+ const String& rExtendText,
+ const String& rCurrentText ):
+ ModalDialog ( pParent, ScResId( RID_SCDLG_SORT_WARNING ) ),
+ aFtText ( this, ScResId( FT_TEXT ) ),
+ aFtTip ( this, ScResId( FT_TIP ) ),
+ aBtnExtSort ( this, ScResId( BTN_EXTSORT ) ),
+ aBtnCurSort ( this, ScResId( BTN_CURSORT ) ),
+ aBtnCancel ( this, ScResId( BTN_CANCEL ) )
+{
+ String sTextName = aFtText.GetText();
+ sTextName.SearchAndReplaceAscii("%1", rExtendText);
+ sTextName.SearchAndReplaceAscii("%2", rCurrentText);
+ aFtText.SetText( sTextName );
+
+ aBtnExtSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+ aBtnCurSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+
+ FreeResource();
+}
+
+ScSortWarningDlg::~ScSortWarningDlg()
+{
+}
+
+IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn )
+{
+ if ( pBtn == &aBtnExtSort )
+ {
+ EndDialog( BTN_EXTEND_RANGE );
+ }
+ else if( pBtn == &aBtnCurSort )
+ {
+ EndDialog( BTN_CURRENT_SELECTION );
+ }
+ return 0;
+}
+//========================================================================//
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index a5b42fc9f364..1e6c2b3f8fa7 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -544,6 +544,18 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
// Sortieroptionen-Tabpage:
//========================================================================
+#if ENABLE_LAYOUT_EXPERIMENTAL
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef ScResId
+#define ScResId(x) #x
+#undef SfxTabPage
+#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "sort-options.xml", id, &args )
+#endif /* ENABLE_LAYOUT */
+
+#endif /* ENABLE_LAYOUT_EXPERIMENTAL */
+
ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent,
const SfxItemSet& rArgSet )
@@ -569,6 +581,11 @@ ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent,
aFtAreaLabel ( this, ScResId( FT_AREA_LABEL ) ),
// aFtArea ( this, ScResId( FT_AREA ) ),
//
+#if ENABLE_LAYOUT_EXPERIMENTAL
+#undef this
+#undef ScResId
+#define ScResId(x) this, #x
+#endif /* ENABLE_LAYOUT_EXPERIMENTAL */
aStrRowLabel ( ScResId( STR_ROW_LABEL ) ),
aStrColLabel ( ScResId( STR_COL_LABEL ) ),
aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ),
@@ -579,7 +596,7 @@ ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent,
rArgSet.Get( nWhichSort )).GetSortData() ),
pViewData ( NULL ),
pDoc ( NULL ),
- pDlg ( (ScSortDlg*)(GetParent()->GetParent()) ),
+ pDlg ( (ScSortDlg*)(GetParent() ? GetParent()->GetParent() : 0 ) ),
pColRes ( NULL ),
pColWrap ( NULL )
{
@@ -708,6 +725,9 @@ USHORT* __EXPORT ScTabPageSortOptions::GetRanges()
// -----------------------------------------------------------------------
+#if ENABLE_LAYOUT_EXPERIMENTAL
+#undef SfxTabPage
+#endif /* ENABLE_LAYOUT_EXPERIMENTAL */
SfxTabPage* __EXPORT ScTabPageSortOptions::Create(
Window* pParent,
const SfxItemSet& rArgSet )
@@ -884,9 +904,11 @@ int __EXPORT ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP )
if ( !bPosInputOk )
{
+#if !ENABLE_LAYOUT_EXPERIMENTAL
ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ),
ScGlobal::GetRscString( STR_INVALID_TABREF )
).Execute();
+#endif /* ENABLE_LAYOUT_EXPERIMENTAL */
aEdOutPos.GrabFocus();
aEdOutPos.SetSelection( Selection( 0, SELECTION_MAX ) );
theOutPos.Set(0,0,0);
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 1e85f3c01f3e..33caccaed815 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -58,6 +58,7 @@
#include "editable.hxx"
#include "attrib.hxx"
#include "drwlayer.hxx"
+#include "dpshttab.hxx"
// -----------------------------------------------------------------
@@ -1299,6 +1300,22 @@ BOOL ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
BOOL bOverflow = FALSE;
ScRange aNewOut = pDestObj->GetNewOutputRange( bOverflow );
+
+ //! test for overlap with other data pilot tables
+ if( pOldObj )
+ {
+ const ScSheetSourceDesc* pSheetDesc = pOldObj->GetSheetDesc();
+ if( pSheetDesc && pSheetDesc->aSourceRange.Intersects( aNewOut ) )
+ {
+ ScRange aOldRange = pOldObj->GetOutRange();
+ SCsROW nDiff = aOldRange.aStart.Row()-aNewOut.aStart.Row();
+ aNewOut.aStart.SetRow( aOldRange.aStart.Row() );
+ aNewOut.aEnd.SetRow( aNewOut.aEnd.Row()+nDiff );
+ if( !ValidRow( aNewOut.aStart.Row() ) || !ValidRow( aNewOut.aEnd.Row() ) )
+ bOverflow = TRUE;
+ }
+ }
+
if ( bOverflow )
{
// like with STR_PROTECTIONERR, use undo to reverse everything
@@ -1354,9 +1371,7 @@ BOOL ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
pDoc->CopyToDocument( aNewOut, IDF_ALL, FALSE, pNewUndoDoc );
}
- //! test for overlap with other data pilot tables
-
- pDestObj->Output();
+ pDestObj->Output( aNewOut.aStart );
rDocShell.PostPaintGridAll(); //! only necessary parts
bDone = TRUE;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 5a3d6bd2703b..ebb080a89cfa 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -59,6 +59,7 @@
#include "arealink.hxx"
#include "attrib.hxx"
+#include "dociter.hxx"
#include "autoform.hxx"
#include "cell.hxx"
#include "detdata.hxx"
@@ -92,15 +93,25 @@
#include "editable.hxx"
#include "compiler.hxx"
#include "scui_def.hxx" //CHINA001
+#include "tabprotection.hxx"
+
+#include <memory>
+
using namespace com::sun::star;
+using ::com::sun::star::uno::Sequence;
// STATIC DATA -----------------------------------------------------------
//========================================================================
-IMPL_LINK( ScDocFunc, NotifyDrawUndo, SfxUndoAction*, pUndoAction )
+IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction )
{
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( pUndoAction, &rDocShell ) );
+ // #i101118# if drawing layer collects the undo actions, add it there
+ ScDrawLayer* pDrawLayer = rDocShell.GetDocument()->GetDrawLayer();
+ if( pDrawLayer && pDrawLayer->IsRecording() )
+ pDrawLayer->AddCalcUndo( pUndoAction );
+ else
+ rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( pUndoAction, &rDocShell ) );
rDocShell.SetDrawModified();
return 0;
}
@@ -949,16 +960,18 @@ BOOL ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
}
-ScTokenArray* lcl_ScDocFunc_CreateTokenArrayXML( const String& rText )
+ScTokenArray* lcl_ScDocFunc_CreateTokenArrayXML( const String& rText, const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScTokenArray* pCode = new ScTokenArray;
pCode->AddString( rText );
+ if( (eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) && (rFormulaNmsp.Len() > 0) )
+ pCode->AddString( rFormulaNmsp );
return pCode;
}
ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
- const String& rText, const formula::FormulaGrammar::Grammar eGrammar )
+ const String& rText, const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScDocument* pDoc = rDocShell.GetDocument();
ScBaseCell* pNewCell = NULL;
@@ -968,7 +981,7 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
ScTokenArray* pCode;
if ( pDoc->IsImportingXML() )
{ // temporary formula string as string tokens
- pCode = lcl_ScDocFunc_CreateTokenArrayXML( rText );
+ pCode = lcl_ScDocFunc_CreateTokenArrayXML( rText, rFormulaNmsp, eGrammar );
pDoc->IncXMLImportedFormulaCount( rText.Len() );
}
else
@@ -1005,8 +1018,8 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
BOOL ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText,
- BOOL bInterpret, BOOL bEnglish, BOOL bApi,
- const formula::FormulaGrammar::Grammar eGrammar )
+ BOOL bInterpret, BOOL bEnglish, BOOL bApi,
+ const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
// SetCellText ruft PutCell oder SetNormalString
@@ -1019,12 +1032,15 @@ BOOL ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText,
// code moved to own method InterpretEnglishString because it is also used in
// ScCellRangeObj::setFormulaArray
- pNewCell = InterpretEnglishString( rPos, rText, eGrammar );
+ pNewCell = InterpretEnglishString( rPos, rText, rFormulaNmsp, eGrammar );
}
// sonst Null behalten -> SetString mit lokalen Formeln/Zahlformat
}
else if ( rText.Len() )
+ {
+ OSL_ENSURE( rFormulaNmsp.Len() == 0, "ScDocFunc::SetCellText - formula namespace, but do not interpret?" );
pNewCell = ScBaseCell::CreateTextCell( rText, pDoc ); // immer Text
+ }
if (pNewCell)
return PutCell( rPos, pNewCell, bApi );
@@ -1041,7 +1057,7 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
if( !pNote || (bShow == pNote->IsCaptionShown()) ) return false;
// move the caption to internal or hidden layer and create undo action
- pNote->ShowCaption( bShow );
+ pNote->ShowCaption( rPos, bShow );
if( rDoc.IsUndoEnabled() )
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideNote( rDocShell, rPos, bShow ) );
@@ -1069,7 +1085,7 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bA
aNewText.ConvertLineEnd(); //! ist das noetig ???
if( ScPostIt* pNote = (aNewText.Len() > 0) ? pDoc->GetOrCreateNote( rPos ) : pDoc->GetNote( rPos ) )
- pNote->SetText( aNewText );
+ pNote->SetText( rPos, aNewText );
//! Undo !!!
@@ -1093,23 +1109,26 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
SfxUndoManager* pUndoMgr = (pDrawLayer && rDoc.IsUndoEnabled()) ? rDocShell.GetUndoManager() : 0;
- // collect drawing undo actions for deleting/inserting caption obejcts
- if( pUndoMgr )
- pDrawLayer->BeginCalcUndo();
-
- // delete old note
ScNoteData aOldData;
- if( ScPostIt* pOldNote = rDoc.ReleaseNote( rPos ) )
+ ScPostIt* pOldNote = rDoc.ReleaseNote( rPos );
+ if( pOldNote )
{
+ // ensure existing caption object before draw undo tracking starts
+ pOldNote->GetOrCreateCaption( rPos );
// rescue note data for undo
aOldData = pOldNote->GetNoteData();
- // delete the note (creates drawing undo action for the caption object)
- delete pOldNote;
}
+ // collect drawing undo actions for deleting/inserting caption obejcts
+ if( pUndoMgr )
+ pDrawLayer->BeginCalcUndo();
+
+ // delete the note (creates drawing undo action for the caption object)
+ delete pOldNote;
+
// create new note (creates drawing undo action for the new caption object)
ScNoteData aNewData;
- if( ScPostIt* pNewNote = ScNoteUtil::CreateNoteFromString( rDoc, rPos, rNoteText, false ) )
+ if( ScPostIt* pNewNote = ScNoteUtil::CreateNoteFromString( rDoc, rPos, rNoteText, false, true ) )
{
if( pAuthor ) pNewNote->SetAuthor( *pAuthor );
if( pDate ) pNewNote->SetDate( *pDate );
@@ -1302,6 +1321,15 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
BOOL bSuccess;
SCTAB i;
+ ScTabViewShell* pViewSh = rDocShell.GetBestViewShell(); //preserve current cursor position
+ SCCOL nCursorCol = 0;
+ SCROW nCursorRow = 0;
+ if( pViewSh )
+ {
+ nCursorCol = pViewSh->GetViewData()->GetCurX();
+ nCursorRow = pViewSh->GetViewData()->GetCurY();
+ }
+
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
@@ -1325,6 +1353,14 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
}
+ ScMarkData aFullMark( aMark ); // including scenario sheets
+ for( i=0; i<nTabCount; i++ )
+ if( aMark.GetTableSelect( i ) )
+ {
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ aFullMark.SelectTable( j, TRUE );
+ }
+
SCTAB nSelCount = aMark.GetSelectCount();
// zugehoerige Szenarien auch anpassen
@@ -1335,22 +1371,33 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nMergeTestEndX = nEndCol;
SCROW nMergeTestEndY = nEndRow;
- if (eCmd==INS_INSROWS)
+ ScRange aExtendMergeRange( rRange );
+
+ if( rRange.aStart == rRange.aEnd && pDoc->HasAttrib(rRange, HASATTR_MERGED) )
+ {
+ pDoc->ExtendMerge( aExtendMergeRange );
+ pDoc->ExtendOverlapped( aExtendMergeRange );
+ nMergeTestEndX = aExtendMergeRange.aEnd.Col();
+ nMergeTestEndY = aExtendMergeRange.aEnd.Row();
+ nPaintEndX = nMergeTestEndX;
+ nPaintEndY = nMergeTestEndY;
+ }
+
+ if ( eCmd == INS_INSROWS )
{
nMergeTestStartX = 0;
nMergeTestEndX = MAXCOL;
}
- if (eCmd==INS_INSCOLS)
+ if ( eCmd == INS_INSCOLS )
{
nMergeTestStartY = 0;
nMergeTestEndY = MAXROW;
}
- if (eCmd==INS_CELLSDOWN)
+ if ( eCmd == INS_CELLSDOWN )
nMergeTestEndY = MAXROW;
- if (eCmd==INS_CELLSRIGHT)
+ if ( eCmd == INS_CELLSRIGHT )
nMergeTestEndX = MAXCOL;
- BOOL bCanDo = TRUE;
BOOL bNeedRefresh = FALSE;
SCCOL nEditTestEndX = (eCmd==INS_INSCOLS) ? MAXCOL : nMergeTestEndX;
@@ -1363,12 +1410,35 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
return FALSE;
}
+ WaitObject aWait( rDocShell.GetActiveDialogParent() ); // wichtig wegen TrackFormulas bei UpdateReference
+
+ ScDocument* pRefUndoDoc = NULL;
+ ScRefUndoData* pUndoData = NULL;
+ if ( bRecord )
+ {
+ pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, FALSE, FALSE );
+
+ // pRefUndoDoc is filled in InsertCol / InsertRow
+
+ pUndoData = new ScRefUndoData( pDoc );
+
+ pDoc->BeginDrawUndo();
+ }
+
+ // #i8302 : we unmerge overwhelming ranges, before insertion all the actions are put in the same ListAction
+ // the patch comes from mloiseleur and maoyg
+ BOOL bInsertMerge = FALSE;
+ std::vector<ScRange> qIncreaseRange;
+ String aUndo = ScGlobal::GetRscString( STR_UNDO_INSERTCELLS );
+ if (bRecord)
+ rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo );
+
for( i=0; i<nTabCount; i++ )
{
if( aMark.GetTableSelect(i) )
{
- if (pDoc->HasAttrib( nMergeTestStartX,nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i,
- HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ if( pDoc->HasAttrib( nMergeTestStartX, nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
if (eCmd==INS_CELLSRIGHT)
bNeedRefresh = TRUE;
@@ -1380,114 +1450,136 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
- if ( nMergeStartX != nMergeTestStartX || nMergeStartY != nMergeTestStartY ||
- nMergeEndX != nMergeTestEndX || nMergeEndY != nMergeTestEndY )
- bCanDo = FALSE;
-
- //! ? nur Start testen ?
- if (!bCanDo)
- if ( eCmd==INS_INSCOLS || eCmd==INS_INSROWS )
- if ( nMergeStartX == nMergeTestStartX && nMergeStartY == nMergeTestStartY )
- {
- bCanDo = TRUE;
- }
- }
+ if(( eCmd == INS_CELLSDOWN && ( nMergeStartX != nMergeTestStartX || nMergeEndX != nMergeTestEndX )) ||
+ (eCmd == INS_CELLSRIGHT && ( nMergeStartY != nMergeTestStartY || nMergeEndY != nMergeTestEndY )) )
+ {
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
+ rDocShell.GetUndoManager()->LeaveListAction();
+ return FALSE;
+ }
- if (!bCanDo)
- {
- //! auf Verschieben (Drag&Drop) zurueckfuehren !!!
- // "Kann nicht in zusammengefasste Bereiche einfuegen"
- if (!bApi)
- rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
- return FALSE;
- }
- }
- }
+ SCCOL nTestCol = -1;
+ SCROW nTestRow1 = -1;
+ SCROW nTestRow2 = -1;
- //
- // ausfuehren
- //
+ ScDocAttrIterator aTestIter( pDoc, i, nMergeTestStartX, nMergeTestStartY, nMergeTestEndX, nMergeTestEndY );
+ ScRange aExtendRange( nMergeTestStartX, nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i );
+ const ScPatternAttr* pPattern = NULL;
+ const ScMergeAttr* pMergeFlag = NULL;
+ const ScMergeFlagAttr* pMergeFlagAttr = NULL;
+ while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != NULL )
+ {
+ pMergeFlag = (const ScMergeAttr*) &pPattern->GetItem(ATTR_MERGE);
+ pMergeFlagAttr = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG);
+ INT16 nNewFlags = pMergeFlagAttr->GetValue() & ( SC_MF_HOR | SC_MF_VER );
+ if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
+ {
+ ScRange aRange( nTestCol, nTestRow1, i );
+ pDoc->ExtendOverlapped(aRange);
+ pDoc->ExtendMerge(aRange, TRUE, TRUE);
- WaitObject aWait( rDocShell.GetActiveDialogParent() ); // wichtig wegen TrackFormulas bei UpdateReference
+ if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
+ {
+ for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ )
+ {
+ ScRange aTestRange( nTestCol, nTestRow, i );
+ pDoc->ExtendOverlapped( aTestRange );
+ pDoc->ExtendMerge( aTestRange, TRUE, TRUE);
+ ScRange aMergeRange( aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
+ if( !aExtendRange.In( aMergeRange ) )
+ {
+ qIncreaseRange.push_back( aTestRange );
+ bInsertMerge = TRUE;
+ }
+ }
+ }
+ else
+ {
+ ScRange aMergeRange( aRange.aStart.Col(),aRange.aStart.Row(), i );
+ if( !aExtendRange.In( aMergeRange ) )
+ {
+ qIncreaseRange.push_back( aRange );
+ }
+ bInsertMerge = TRUE;
+ }
+ }
+ }
- ScDocument* pRefUndoDoc = NULL;
- ScRefUndoData* pUndoData = NULL;
- if ( bRecord )
- {
- pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, FALSE, FALSE );
+ if( bInsertMerge )
+ {
+ if( eCmd == INS_INSROWS || eCmd == INS_CELLSDOWN )
+ {
+ nStartRow = aExtendMergeRange.aStart.Row();
+ nEndRow = aExtendMergeRange.aEnd.Row();
- // pRefUndoDoc is filled in InsertCol / InsertRow
+ if( eCmd == INS_CELLSDOWN )
+ nEndCol = nMergeTestEndX;
+ else
+ {
+ nStartCol = 0;
+ nEndCol = MAXCOL;
+ }
+ }
+ else if( eCmd == INS_CELLSRIGHT || eCmd == INS_INSCOLS )
+ {
- pUndoData = new ScRefUndoData( pDoc );
+ nStartCol = aExtendMergeRange.aStart.Col();
+ nEndCol = aExtendMergeRange.aEnd.Col();
+ if( eCmd == INS_CELLSRIGHT )
+ {
+ nEndRow = nMergeTestEndY;
+ }
+ else
+ {
+ nStartRow = 0;
+ nEndRow = MAXROW;
+ }
+ }
- pDoc->BeginDrawUndo();
+ if( !qIncreaseRange.empty() )
+ {
+ for( ::std::vector<ScRange>::const_iterator iIter( qIncreaseRange.begin()); iIter != qIncreaseRange.end(); iIter++ )
+ {
+ ScRange aRange( *iIter );
+ if( pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ {
+ UnmergeCells( aRange, TRUE, TRUE );
+ }
+ }
+ }
+ }
+ else
+ {
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
+ rDocShell.GetUndoManager()->LeaveListAction();
+ return FALSE;
+ }
+ }
+ }
}
switch (eCmd)
{
case INS_CELLSDOWN:
- bSuccess = TRUE;
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- bSuccess &= pDoc->InsertRow( nStartCol, i, nEndCol, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
- }
- }
+ bSuccess = pDoc->InsertRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
nPaintEndY = MAXROW;
break;
case INS_INSROWS:
- bSuccess = TRUE;
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- bSuccess &= pDoc->InsertRow( 0, i, MAXCOL, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
- }
- }
+ bSuccess = pDoc->InsertRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
nPaintStartX = 0;
nPaintEndX = MAXCOL;
nPaintEndY = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case INS_CELLSRIGHT:
- bSuccess = TRUE;
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- bSuccess &= pDoc->InsertCol( nStartRow, i, nEndRow, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
- }
- }
+ bSuccess = pDoc->InsertCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
nPaintEndX = MAXCOL;
break;
case INS_INSCOLS:
- bSuccess = TRUE;
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- bSuccess &= pDoc->InsertCol( 0, i, MAXROW, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
- }
- }
+ bSuccess = pDoc->InsertCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
nPaintStartY = 0;
nPaintEndY = MAXROW;
nPaintEndX = MAXCOL;
@@ -1504,6 +1596,7 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB* pTabs = NULL;
SCTAB* pScenarios = NULL;
SCTAB nUndoPos = 0;
+
if ( bRecord )
{
pTabs = new SCTAB[nSelCount];
@@ -1513,7 +1606,6 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
{
if( aMark.GetTableSelect( i ) )
{
-
SCTAB nCount = 0;
for( SCTAB j=i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
nCount ++;
@@ -1523,11 +1615,45 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
nUndoPos ++;
}
}
+
+ if( !bInsertMerge )
+ {
+ rDocShell.GetUndoManager()->LeaveListAction();
+ }
+
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoInsertCells(
&rDocShell, ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ),
nUndoPos, pTabs, pScenarios, eCmd, pRefUndoDoc, pUndoData, bPartOfPaste ) );
}
+ // #i8302 : we remerge growing ranges, with the new part inserted
+
+ while( !qIncreaseRange.empty() )
+ {
+ ScRange aRange = qIncreaseRange.back();
+ if( !pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ {
+ switch (eCmd)
+ {
+ case INS_CELLSDOWN:
+ case INS_INSROWS:
+ aRange.aEnd.IncRow(static_cast<SCsCOL>(nEndRow-nStartRow+1));
+ break;
+ case INS_CELLSRIGHT:
+ case INS_INSCOLS:
+ aRange.aEnd.IncCol(static_cast<SCsCOL>(nEndCol-nStartCol+1));
+ break;
+ default:
+ break;
+ }
+ MergeCells(aRange, FALSE, TRUE, TRUE);
+ }
+ qIncreaseRange.pop_back();
+ }
+
+ if( bInsertMerge )
+ rDocShell.GetUndoManager()->LeaveListAction();
+
for( i=0; i<nTabCount; i++ )
{
if( aMark.GetTableSelect( i ) )
@@ -1560,15 +1686,39 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDocShell.PostPaint( nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i+nScenarioCount, nPaintFlags, nExtFlags );
}
}
- aModificator.SetDocumentModified();
+ //aModificator.SetDocumentModified();
}
else
{
+ if( bInsertMerge )
+ {
+ while( !qIncreaseRange.empty() )
+ {
+ ScRange aRange = qIncreaseRange.back();
+ MergeCells(aRange, FALSE, TRUE, TRUE);
+ qIncreaseRange.pop_back();
+ }
+
+ if( pViewSh )
+ {
+ pViewSh->MarkRange( rRange, FALSE );
+ pViewSh->SetCursor( nCursorCol, nCursorRow );
+ }
+ }
+
+ rDocShell.GetUndoManager()->LeaveListAction();
+ SfxUndoManager* pMgr = rDocShell.GetUndoManager();
+ pMgr->RemoveLastUndoAction();
+
delete pRefUndoDoc;
delete pUndoData;
if (!bApi)
rDocShell.ErrorMessage(STR_INSERT_FULL); // Spalte/Zeile voll
}
+
+ aModificator.SetDocumentModified();
+
+ SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
return bSuccess;
}
@@ -1622,6 +1772,14 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
}
+ ScMarkData aFullMark( aMark ); // including scenario sheets
+ for( i=0; i<nTabCount; i++ )
+ if( aMark.GetTableSelect( i ) )
+ {
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ aFullMark.SelectTable( j, TRUE );
+ }
+
SCTAB nSelCount = aMark.GetSelectCount();
SCCOL nUndoStartX = nStartCol;
@@ -1629,6 +1787,18 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nUndoEndX = nEndCol;
SCROW nUndoEndY = nEndRow;
+ ScRange aExtendMergeRange( rRange );
+
+ if( rRange.aStart == rRange.aEnd && pDoc->HasAttrib(rRange, HASATTR_MERGED) )
+ {
+ pDoc->ExtendMerge( aExtendMergeRange );
+ pDoc->ExtendOverlapped( aExtendMergeRange );
+ nUndoEndX = aExtendMergeRange.aEnd.Col();
+ nUndoEndY = aExtendMergeRange.aEnd.Row();
+ nPaintEndX = nUndoEndX;
+ nPaintEndY = nUndoEndY;
+ }
+
if (eCmd==DEL_DELROWS)
{
nUndoStartX = 0;
@@ -1639,7 +1809,6 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nUndoStartY = 0;
nUndoEndY = MAXROW;
}
-
// Test Zellschutz
SCCOL nEditTestEndX = nUndoEndX;
@@ -1660,19 +1829,24 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nMergeTestEndX = (eCmd==DEL_CELLSLEFT) ? MAXCOL : nUndoEndX;
SCROW nMergeTestEndY = (eCmd==DEL_CELLSUP) ? MAXROW : nUndoEndY;
- BOOL bCanDo = TRUE;
+ SCCOL nExtendStartCol = nUndoStartX;
+ SCROW nExtendStartRow = nUndoStartY;
BOOL bNeedRefresh = FALSE;
+ //Issue 8302 want to be able to insert into the middle of merged cells
+ //the patch comes from maoyg
+ ::std::vector<ScRange> qDecreaseRange;
+ BOOL bDeletingMerge = FALSE;
+ String aUndo = ScGlobal::GetRscString( STR_UNDO_DELETECELLS );
+ if (bRecord)
+ rDocShell.GetUndoManager()->EnterListAction( aUndo, aUndo );
+
for( i=0; i<nTabCount; i++ )
{
if( aMark.GetTableSelect(i) )
{
- if (pDoc->HasAttrib( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i,
- HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ if ( pDoc->HasAttrib( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i, HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
- if ( eCmd==DEL_CELLSLEFT || eCmd==DEL_CELLSUP )
- bNeedRefresh = TRUE;
-
SCCOL nMergeStartX = nUndoStartX;
SCROW nMergeStartY = nUndoStartY;
SCCOL nMergeEndX = nMergeTestEndX;
@@ -1680,28 +1854,119 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
- if ( nMergeStartX != nUndoStartX || nMergeStartY != nUndoStartY ||
- nMergeEndX != nMergeTestEndX || nMergeEndY != nMergeTestEndY )
- bCanDo = FALSE;
+ if( ( eCmd == DEL_CELLSUP && ( nMergeStartX != nUndoStartX || nMergeEndX != nMergeTestEndX))||
+ ( eCmd == DEL_CELLSLEFT && ( nMergeStartY != nUndoStartY || nMergeEndY != nMergeTestEndY)))
+ {
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_DELETECELLS_0);
+ rDocShell.GetUndoManager()->LeaveListAction();
+ return FALSE;
+ }
+
+ nExtendStartCol = nMergeStartX;
+ nExtendStartRow = nMergeStartY;
+ SCCOL nTestCol = -1;
+ SCROW nTestRow1 = -1;
+ SCROW nTestRow2 = -1;
+
+ ScDocAttrIterator aTestIter( pDoc, i, nUndoStartX, nUndoStartY, nMergeTestEndX, nMergeTestEndY );
+ ScRange aExtendRange( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i );
+ const ScPatternAttr* pPattern = NULL;
+ const ScMergeAttr* pMergeFlag = NULL;
+ const ScMergeFlagAttr* pMergeFlagAttr = NULL;
+ while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != NULL )
+ {
+ pMergeFlag = (const ScMergeAttr*) &pPattern->GetItem( ATTR_MERGE );
+ pMergeFlagAttr = (const ScMergeFlagAttr*) &pPattern->GetItem( ATTR_MERGE_FLAG );
+ INT16 nNewFlags = pMergeFlagAttr->GetValue() & ( SC_MF_HOR | SC_MF_VER );
+ if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
+ {
+ ScRange aRange( nTestCol, nTestRow1, i );
+ pDoc->ExtendOverlapped( aRange );
+ pDoc->ExtendMerge( aRange, TRUE, TRUE );
+
+ if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
+ {
+ for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ )
+ {
+ ScRange aTestRange( nTestCol, nTestRow, i );
+ pDoc->ExtendOverlapped( aTestRange );
+ pDoc->ExtendMerge( aTestRange, TRUE, TRUE);
+ ScRange aMergeRange( aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
+ if( !aExtendRange.In( aMergeRange ) )
+ {
+ qDecreaseRange.push_back( aTestRange );
+ bDeletingMerge = TRUE;
+ }
+ }
+ }
+ else
+ {
+ ScRange aMergeRange( aRange.aStart.Col(),aRange.aStart.Row(), i );
+ if( !aExtendRange.In( aMergeRange ) )
+ {
+ qDecreaseRange.push_back( aRange );
+ }
+ bDeletingMerge = TRUE;
+ }
+ }
+ }
- // ganze Zeilen/Spalten: Testen, ob Merge komplett geloescht werden kann
+ if( bDeletingMerge )
+ {
- if (!bCanDo)
- if ( eCmd==DEL_DELCOLS || eCmd==DEL_DELROWS )
- if ( nMergeStartX == nUndoStartX && nMergeStartY == nUndoStartY )
+ if( eCmd == DEL_DELROWS || eCmd == DEL_CELLSUP )
+ {
+ nStartRow = aExtendMergeRange.aStart.Row();
+ nEndRow = aExtendMergeRange.aEnd.Row();
+ bNeedRefresh = TRUE;
+
+ if( eCmd == DEL_CELLSUP )
+ {
+ nEndCol = aExtendMergeRange.aEnd.Col();
+ }
+ else
{
- bCanDo = TRUE;
+ nStartCol = 0;
+ nEndCol = MAXCOL;
+ }
+ }
+ else if( eCmd == DEL_CELLSLEFT || eCmd == DEL_DELCOLS )
+ {
+
+ nStartCol = aExtendMergeRange.aStart.Col();
+ nEndCol = aExtendMergeRange.aEnd.Col();
+ if( eCmd == DEL_CELLSLEFT )
+ {
+ nEndRow = aExtendMergeRange.aEnd.Row();
bNeedRefresh = TRUE;
}
- }
+ else
+ {
+ nStartRow = 0;
+ nEndRow = MAXROW;
+ }
+ }
- if (!bCanDo)
- {
- //! auf Verschieben (Drag&Drop) zurueckfuehren !!!
- // "Kann nicht aus zusammengefassten Bereichen loeschen"
- if (!bApi)
- rDocShell.ErrorMessage(STR_MSSG_DELETECELLS_0);
- return FALSE;
+ if( !qDecreaseRange.empty() )
+ {
+ for( ::std::vector<ScRange>::const_iterator iIter( qDecreaseRange.begin()); iIter != qDecreaseRange.end(); iIter++ )
+ {
+ ScRange aRange( *iIter );
+ if( pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ {
+ UnmergeCells( aRange, TRUE, TRUE );
+ }
+ }
+ }
+ }
+ else
+ {
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_DELETECELLS_0);
+ rDocShell.GetUndoManager()->LeaveListAction();
+ return FALSE;
+ }
}
}
}
@@ -1755,66 +2020,22 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
switch (eCmd)
{
case DEL_CELLSUP:
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
-
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- pDoc->DeleteRow( nStartCol, i, nEndCol, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
- }
- }
+ pDoc->DeleteRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, NULL, &aFullMark );
nPaintEndY = MAXROW;
break;
case DEL_DELROWS:
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
-
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- pDoc->DeleteRow( 0, i, MAXCOL, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline );
- }
- }
+ pDoc->DeleteRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
nPaintStartX = 0;
nPaintEndX = MAXCOL;
nPaintEndY = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case DEL_CELLSLEFT:
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
-
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- pDoc->DeleteCol( nStartRow, i, nEndRow, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
- }
- }
+ pDoc->DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, NULL, &aFullMark );
nPaintEndX = MAXCOL;
break;
case DEL_DELCOLS:
- for( i=0; i<nTabCount; i++ )
- {
- if( aMark.GetTableSelect( i ) )
- {
- SCTAB nScenarioCount = 0;
-
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
- nScenarioCount ++;
-
- pDoc->DeleteCol( 0, i, MAXROW, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline );
- }
- }
+ pDoc->DeleteCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
nPaintStartY = 0;
nPaintEndY = MAXROW;
nPaintEndX = MAXCOL;
@@ -1829,8 +2050,9 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord )
{
- for ( i=nStartTab; i<=nTabCount; i++)
- pRefUndoDoc->DeleteAreaTab(nUndoStartX,nUndoStartY,nUndoEndX,nUndoEndY, i, IDF_ALL);
+ for( i=0; i<nTabCount; i++ )
+ if( aFullMark.GetTableSelect( i ) )
+ pRefUndoDoc->DeleteAreaTab(nUndoStartX,nUndoStartY,nUndoEndX,nUndoEndY, i, IDF_ALL);
// alle Tabellen anlegen, damit Formeln kopiert werden koennen:
pUndoDoc->AddUndoTab( 0, nTabCount-1, FALSE, FALSE );
@@ -1856,12 +2078,70 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nUndoPos ++;
}
}
+
+ if( !bDeletingMerge )
+ {
+ rDocShell.GetUndoManager()->LeaveListAction();
+ }
+
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDeleteCells(
&rDocShell, ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ),nUndoPos, pTabs, pScenarios,
eCmd, pUndoDoc, pUndoData ) );
}
- if (bNeedRefresh)
+ // #i8302 want to be able to insert into the middle of merged cells
+ // the patch comes from maoyg
+
+ while( !qDecreaseRange.empty() )
+ {
+ ScRange aRange = qDecreaseRange.back();
+
+ long nDecreaseRowCount = 0;
+ long nDecreaseColCount = 0;
+ if( eCmd == DEL_CELLSUP || eCmd == DEL_DELROWS )
+ {
+ if( nStartRow >= aRange.aStart.Row() && nStartRow <= aRange.aEnd.Row() && nEndRow>= aRange.aStart.Row() && nEndRow <= aRange.aEnd.Row() )
+ nDecreaseRowCount = nEndRow-nStartRow+1;
+ else if( nStartRow >= aRange.aStart.Row() && nStartRow <= aRange.aEnd.Row() && nEndRow >= aRange.aStart.Row() && nEndRow >= aRange.aEnd.Row() )
+ nDecreaseRowCount = aRange.aEnd.Row()-nStartRow+1;
+ else if( nStartRow >= aRange.aStart.Row() && nStartRow >= aRange.aEnd.Row() && nEndRow>= aRange.aStart.Row() && nEndRow <= aRange.aEnd.Row() )
+ nDecreaseRowCount = aRange.aEnd.Row()-nEndRow+1;
+ }
+ else if( eCmd == DEL_CELLSLEFT || eCmd == DEL_DELCOLS )
+ {
+ if( nStartCol >= aRange.aStart.Col() && nStartCol <= aRange.aEnd.Col() && nEndCol>= aRange.aStart.Col() && nEndCol <= aRange.aEnd.Col() )
+ nDecreaseColCount = nEndCol-nStartCol+1;
+ else if( nStartCol >= aRange.aStart.Col() && nStartCol <= aRange.aEnd.Col() && nEndCol >= aRange.aStart.Col() && nEndCol >= aRange.aEnd.Col() )
+ nDecreaseColCount = aRange.aEnd.Col()-nStartCol+1;
+ else if( nStartCol >= aRange.aStart.Col() && nStartCol >= aRange.aEnd.Col() && nEndCol>= aRange.aStart.Col() && nEndCol <= aRange.aEnd.Col() )
+ nDecreaseColCount = aRange.aEnd.Col()-nEndCol+1;
+ }
+
+ switch (eCmd)
+ {
+ case DEL_CELLSUP:
+ case DEL_DELROWS:
+ aRange.aEnd.SetRow(static_cast<SCsCOL>( aRange.aEnd.Row()-nDecreaseRowCount));
+ break;
+ case DEL_CELLSLEFT:
+ case DEL_DELCOLS:
+ aRange.aEnd.SetCol(static_cast<SCsCOL>( aRange.aEnd.Col()-nDecreaseColCount));
+ break;
+ default:
+ break;
+ }
+
+ if( !pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ {
+ MergeCells( aRange, FALSE, TRUE, TRUE );
+ }
+ qDecreaseRange.pop_back();
+ }
+
+ if( bDeletingMerge )
+ rDocShell.GetUndoManager()->LeaveListAction();
+
+ if ( bNeedRefresh )
{
// #i51445# old merge flag attributes must be deleted also for single cells,
// not only for whole columns/rows
@@ -1873,7 +2153,7 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScPatternAttr aPattern( pDoc->GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- pDoc->ApplyPatternArea( nUndoStartX, nUndoStartY, nMergeTestEndX, nMergeTestEndY, aMark, aPattern );
+ pDoc->ApplyPatternArea( nExtendStartCol, nExtendStartRow, nMergeTestEndX, nMergeTestEndY, aMark, aPattern );
for( i=0; i<nTabCount; i++ )
{
@@ -1884,7 +2164,7 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
nScenarioCount ++;
- ScRange aMergedRange( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i+nScenarioCount );
+ ScRange aMergedRange( nExtendStartCol, nExtendStartRow, i, nMergeTestEndX, nMergeTestEndY, i+nScenarioCount );
pDoc->ExtendMerge( aMergedRange, TRUE );
}
}
@@ -2160,9 +2440,13 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
/* Paste cell notes and drawing objects after adjusting formula references
and row heights. There are no cell notes or drawing objects, if the
- clipdoc does not contain a drawing layer. */
+ clipdoc does not contain a drawing layer.
+ #i102056# Passing IDF_NOTE only would overwrite cell contents with
+ empty note cells, therefore the special modifier IDF_ADDNOTES is passed
+ here too which changes the behaviour of ScColumn::CopyFromClip() to not
+ touch existing cells. */
if ( pClipDoc->GetDrawLayer() )
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_NOTE | IDF_OBJECTS,
+ pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_NOTE | IDF_ADDNOTES | IDF_OBJECTS,
pRefUndoDoc, pClipDoc, TRUE, FALSE, bIncludeFiltered );
if (bRecord)
@@ -2861,103 +3145,156 @@ BOOL ScDocFunc::RemovePageBreak( BOOL bColumn, const ScAddress& rPos,
//------------------------------------------------------------------------
-BOOL lcl_ValidPassword( ScDocument* pDoc, SCTAB nTab,
- const String& rPassword,
- uno::Sequence<sal_Int8>* pReturnOld = NULL )
+void ScDocFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
{
- uno::Sequence<sal_Int8> aOldPassword;
- if ( nTab == TABLEID_DOC )
- {
- if (pDoc->IsDocProtected())
- aOldPassword = pDoc->GetDocPassword();
- }
- else
+ ScDocument* pDoc = rDocShell.GetDocument();
+
+ pDoc->SetTabProtection(nTab, &rProtect);
+ if (pDoc->IsUndoEnabled())
{
- if (pDoc->IsTabProtected(nTab))
- aOldPassword = pDoc->GetTabPassword(nTab);
- }
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
+ if (pProtect)
+ {
+ ::std::auto_ptr<ScTableProtection> p(new ScTableProtection(*pProtect));
+ p->setProtected(true); // just in case ...
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoTabProtect(&rDocShell, nTab, p) );
- if (pReturnOld)
- *pReturnOld = aOldPassword;
+ // ownership of auto_ptr now transferred to ScUndoTabProtect.
+ }
+ }
- return ((aOldPassword.getLength() == 0) || SvPasswordHelper::CompareHashPassword(aOldPassword, rPassword));
+ rDocShell.PostPaintGridAll();
+ ScDocShellModificator aModificator(rDocShell);
+ aModificator.SetDocumentModified();
}
-BOOL ScDocFunc::Protect( SCTAB nTab, const String& rPassword, BOOL bApi )
+BOOL ScDocFunc::Protect( SCTAB nTab, const String& rPassword, BOOL /*bApi*/ )
{
- ScDocShellModificator aModificator( rDocShell );
-
ScDocument* pDoc = rDocShell.GetDocument();
- BOOL bUndo(pDoc->IsUndoEnabled());
- BOOL bOk = lcl_ValidPassword( pDoc, nTab, rPassword);
- if ( bOk )
- {
- uno::Sequence<sal_Int8> aPass;
- if (rPassword.Len())
- SvPasswordHelper::GetHashPassword(aPass, rPassword);
-
- if (bUndo)
+ if (nTab == TABLEID_DOC)
+ {
+ // document protection
+ ScDocProtection aProtection;
+ aProtection.setProtected(true);
+ aProtection.setPassword(rPassword);
+ pDoc->SetDocProtection(&aProtection);
+ if (pDoc->IsUndoEnabled())
{
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoProtect( &rDocShell, nTab, TRUE, aPass ) );
+ ScDocProtection* pProtect = pDoc->GetDocProtection();
+ DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScDocProtection pointer is NULL!");
+ if (pProtect)
+ {
+ ::std::auto_ptr<ScDocProtection> p(new ScDocProtection(*pProtect));
+ p->setProtected(true); // just in case ...
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoDocProtect(&rDocShell, p) );
+ // ownership of auto_ptr is transferred to ScUndoDocProtect.
+ }
}
-
- if ( nTab == TABLEID_DOC )
- pDoc->SetDocProtection( TRUE, aPass );
- else
- pDoc->SetTabProtection( nTab, TRUE, aPass );
-
- rDocShell.PostPaintGridAll();
- aModificator.SetDocumentModified();
}
- else if (!bApi)
+ else
{
- // different password was set before
-
-//! rDocShell.ErrorMessage(...);
+ // sheet protection
- InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
- aBox.Execute();
+ ScTableProtection aProtection;
+ aProtection.setProtected(true);
+ aProtection.setPassword(rPassword);
+ pDoc->SetTabProtection(nTab, &aProtection);
+ if (pDoc->IsUndoEnabled())
+ {
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
+ if (pProtect)
+ {
+ ::std::auto_ptr<ScTableProtection> p(new ScTableProtection(*pProtect));
+ p->setProtected(true); // just in case ...
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoTabProtect(&rDocShell, nTab, p) );
+ // ownership of auto_ptr now transferred to ScUndoTabProtect.
+ }
+ }
}
- return bOk;
+ rDocShell.PostPaintGridAll();
+ ScDocShellModificator aModificator( rDocShell );
+ aModificator.SetDocumentModified();
+
+ return true;
}
BOOL ScDocFunc::Unprotect( SCTAB nTab, const String& rPassword, BOOL bApi )
{
- ScDocShellModificator aModificator( rDocShell );
-
ScDocument* pDoc = rDocShell.GetDocument();
- BOOL bUndo(pDoc->IsUndoEnabled());
- uno::Sequence<sal_Int8> aOldPassword;
- uno::Sequence<sal_Int8> aPass;
- BOOL bOk = lcl_ValidPassword( pDoc, nTab, rPassword, &aOldPassword );
- if ( bOk )
- {
- uno::Sequence<sal_Int8> aEmptyPass;
- if ( nTab == TABLEID_DOC )
- pDoc->SetDocProtection( FALSE, aEmptyPass );
- else
- pDoc->SetTabProtection( nTab, FALSE, aEmptyPass );
- if (bUndo)
+ if (nTab == TABLEID_DOC)
+ {
+ // document protection
+
+ ScDocProtection* pDocProtect = pDoc->GetDocProtection();
+ if (!pDocProtect || !pDocProtect->isProtected())
+ // already unprotected (should not happen)!
+ return true;
+
+ // save the protection state before unprotect (for undo).
+ ::std::auto_ptr<ScDocProtection> pProtectCopy(new ScDocProtection(*pDocProtect));
+
+ if (!pDocProtect->verifyPassword(rPassword))
{
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoProtect( &rDocShell, nTab, FALSE, aOldPassword ) );
+ if (!bApi)
+ {
+ InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
+ aBox.Execute();
+ }
+ return false;
}
- rDocShell.PostPaintGridAll();
- aModificator.SetDocumentModified();
+ pDoc->SetDocProtection(NULL);
+ if (pDoc->IsUndoEnabled())
+ {
+ pProtectCopy->setProtected(false);
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoDocProtect(&rDocShell, pProtectCopy) );
+ // ownership of auto_ptr now transferred to ScUndoDocProtect.
+ }
}
- else if (!bApi)
+ else
{
-//! rDocShell.ErrorMessage(...);
+ // sheet protection
- InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
- aBox.Execute();
+ ScTableProtection* pTabProtect = pDoc->GetTabProtection(nTab);
+ if (!pTabProtect || !pTabProtect->isProtected())
+ // already unprotected (should not happen)!
+ return true;
+
+ // save the protection state before unprotect (for undo).
+ ::std::auto_ptr<ScTableProtection> pProtectCopy(new ScTableProtection(*pTabProtect));
+ if (!pTabProtect->verifyPassword(rPassword))
+ {
+ if (!bApi)
+ {
+ InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
+ aBox.Execute();
+ }
+ return false;
+ }
+
+ pDoc->SetTabProtection(nTab, NULL);
+ if (pDoc->IsUndoEnabled())
+ {
+ pProtectCopy->setProtected(false);
+ rDocShell.GetUndoManager()->AddUndoAction(
+ new ScUndoTabProtect(&rDocShell, nTab, pProtectCopy) );
+ // ownership of auto_ptr now transferred to ScUndoTabProtect.
+ }
}
- return bOk;
+ rDocShell.PostPaintGridAll();
+ ScDocShellModificator aModificator( rDocShell );
+ aModificator.SetDocumentModified();
+
+ return true;
}
//------------------------------------------------------------------------
@@ -3184,9 +3521,8 @@ BOOL ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
//------------------------------------------------------------------------
BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
- const ScTokenArray* pTokenArray,
- const String& rString, BOOL bApi, BOOL bEnglish,
- const formula::FormulaGrammar::Grammar eGrammar )
+ const ScTokenArray* pTokenArray, const String& rString, BOOL bApi, BOOL bEnglish,
+ const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScDocShellModificator aModificator( rDocShell );
@@ -3233,7 +3569,7 @@ BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
}
else if ( pDoc->IsImportingXML() )
{
- ScTokenArray* pCode = lcl_ScDocFunc_CreateTokenArrayXML( rString );
+ ScTokenArray* pCode = lcl_ScDocFunc_CreateTokenArrayXML( rString, rFormulaNmsp, eGrammar );
pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_STRING, pCode, eGrammar);
delete pCode;
@@ -4163,11 +4499,11 @@ BOOL ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd
if ( DeleteContents( aMark, IDF_CONTENTS, TRUE, bApi ) )
{
// GRAM_PODF_A1 for API compatibility.
- bRet = EnterMatrix( aNewRange, &aMark, NULL, aFormula, bApi, FALSE,formula::FormulaGrammar::GRAM_PODF_A1 );
+ bRet = EnterMatrix( aNewRange, &aMark, NULL, aFormula, bApi, FALSE, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
if (!bRet)
{
// versuchen, alten Zustand wiederherzustellen
- EnterMatrix( rOldRange, &aMark, NULL, aFormula, bApi, FALSE,formula::FormulaGrammar::GRAM_PODF_A1 );
+ EnterMatrix( rOldRange, &aMark, NULL, aFormula, bApi, FALSE, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
}
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 4545406ac3c9..c62c2dc41fdf 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -79,11 +79,6 @@
#include <sot/formats.hxx>
#define SOT_FORMATSTR_ID_STARCALC_30 SOT_FORMATSTR_ID_STARCALC
-//REMOVE #ifndef SO2_DECL_SVSTORAGESTREAM_DEFINED
-//REMOVE #define SO2_DECL_SVSTORAGESTREAM_DEFINED
-//REMOVE SO2_DECL_REF(SotStorageStream)
-//REMOVE #endif
-
// INCLUDE ---------------------------------------------------------------
#include "cell.hxx"
@@ -97,7 +92,6 @@
#include "scresid.hxx"
#include "sc.hrc"
#include "globstr.hrc"
-//CHINA001 #include "tpstat.hxx"
#include "scerrors.hxx"
#include "brdcst.hxx"
#include "stlpool.hxx"
@@ -126,6 +120,7 @@
#include "cfgids.hxx"
#include "warnpassword.hxx"
#include "optsolver.hxx"
+#include "tabprotection.hxx"
#include "docsh.hxx"
#include "docshimp.hxx"
@@ -283,6 +278,7 @@ void ScDocShell::BeforeXMLLoading()
pModificator = new ScDocShellModificator( *this );
aDocument.SetImportingXML( TRUE );
+ aDocument.EnableExecuteLink( false ); // #i101304# to be safe, prevent nested loading from external references
aDocument.EnableUndo( FALSE );
// prevent unnecessary broadcasts and "half way listeners"
aDocument.SetInsertingFromOtherDoc( TRUE );
@@ -363,6 +359,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
aDocument.SetInsertingFromOtherDoc( FALSE );
aDocument.SetImportingXML( FALSE );
+ aDocument.EnableExecuteLink( true );
aDocument.EnableUndo( TRUE );
bIsEmpty = FALSE;
@@ -404,7 +401,7 @@ BOOL ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::R
bRet = aImport.Import(sal_True, nError);
if ( nError )
- pLoadMedium->SetError( nError );
+ pLoadMedium->SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
aDocument.SetXMLFromWrapper( FALSE );
AfterXMLLoading(bRet);
@@ -465,10 +462,10 @@ BOOL __EXPORT ScDocShell::Load( SfxMedium& rMedium )
}
if (!bRet && !rMedium.GetError())
- rMedium.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ rMedium.SetError( SVSTREAM_FILEFORMAT_ERROR, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if (rMedium.GetError())
- SetError( rMedium.GetError() );
+ SetError( rMedium.GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
InitItems();
CalcOutputFactor();
@@ -749,7 +746,7 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
if ( !bSuccess )
- SetError( ERRCODE_IO_ABORT ); // this error code will produce no error message, but will break the further saving process
+ SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // this error code will produce no error message, but will break the further saving process
}
}
break;
@@ -851,7 +848,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else
bRet = TRUE;
@@ -882,7 +879,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
@@ -921,13 +918,13 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError == SCWARN_IMPORT_RANGE_OVERFLOW)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
bRet = TRUE;
}
else if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else
bRet = TRUE;
@@ -987,12 +984,12 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else if ( bOverflow )
{
if (!GetError())
- SetError(SCWARN_IMPORT_RANGE_OVERFLOW);
+ SetError(SCWARN_IMPORT_RANGE_OVERFLOW, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
bSetColWidths = TRUE;
bSetSimpleTextColWidths = TRUE;
@@ -1022,7 +1019,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
bRet = ( eError == SCWARN_IMPORT_RANGE_OVERFLOW );
}
else
@@ -1066,7 +1063,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
@@ -1076,6 +1073,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
bSetColWidths = TRUE;
bSetSimpleTextColWidths = TRUE;
+ bSetRowHeights = TRUE;
}
else if (aFltName.EqualsAscii(pFilterSylk))
{
@@ -1100,9 +1098,10 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
if ( eError != eERR_OK && !GetError() )
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
bSetColWidths = TRUE;
bSetSimpleTextColWidths = TRUE;
+ bSetRowHeights = TRUE;
}
else if (aFltName.EqualsAscii(pFilterQPro6))
{
@@ -1112,7 +1111,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError( eError );
+ SetError( eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
}
@@ -1138,7 +1137,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
@@ -1157,7 +1156,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
if ( eError != eERR_OK && !GetError() )
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else if (aFltName.EqualsAscii(pFilterHtml) || aFltName.EqualsAscii(pFilterHtmlWebQ))
{
@@ -1177,7 +1176,7 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (eError != eERR_OK)
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
bRet = TRUE;
@@ -1194,12 +1193,12 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
if ( eError != eERR_OK && !GetError() )
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else
{
if (!GetError())
- SetError(SCERR_IMPORT_NI);
+ SetError(SCERR_IMPORT_NI, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
if (!bCalc3)
@@ -1323,6 +1322,16 @@ BOOL __EXPORT ScDocShell::SaveAs( SfxMedium& rMedium )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::SaveAs" );
+#if ENABLE_SHEET_PROTECTION
+ ScTabViewShell* pViewShell = GetBestViewShell();
+ if (pViewShell && ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_OOO))
+ {
+ if (!pViewShell->ExecuteRetypePassDlg(PASSHASH_OOO))
+ // password re-type cancelled. Don't save the document.
+ return false;
+ }
+#endif
+
ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
PrepareSaveGuard aPrepareGuard( *this);
@@ -1788,7 +1797,6 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
rStream.SetNumberFormatInt( nOldNumberFormatInt );
}
-
BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertTo" );
@@ -1842,15 +1850,39 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
- /* #115980 #If the imported document contained an encrypted password -
- determine if we should save without it. */
- ScExtDocSettings& rDocSett = pExtDocOpt->GetDocSettings();
- if( rDocSett.mbEncrypted )
+#if ENABLE_SHEET_PROTECTION
+ bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_XL);
+ if (bNeedRetypePassDlg && !pViewShell->ExecuteRetypePassDlg(PASSHASH_XL))
+ {
+ SetError( ERRCODE_ABORT );
+ return false;
+ }
+#else
+
+ do
{
+ SfxItemSet* pSet = rMed.GetItemSet();
+ if (!pSet)
+ break;
+
+ const SfxPoolItem* pItem = NULL;
+ if (SFX_ITEM_SET != pSet->GetItemState(SID_PASSWORD, sal_True, &pItem))
+ // password is not set.
+ break;
+
+ /* #115980 #If the imported document contained an encrypted password -
+ determine if we should save without it. */
bDoSave = ScWarnPassword::WarningOnPassword( rMed );
- // #i42858# warn only on time
- rDocSett.mbEncrypted = false;
+
+ if (bDoSave)
+ {
+ // #i42858# warn only one time
+ pSet->ClearItem(SID_PASSWORD);
+ }
}
+ while (false);
+
+#endif
}
if( bDoSave )
@@ -1863,7 +1895,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
FltError eError = ScFormatFilter::Get().ScExportExcel5( rMed, &aDocument, eFormat, RTL_TEXTENCODING_MS_1252 );
if( eError && !GetError() )
- SetError( eError );
+ SetError( eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
// don't return false for warnings
bRet = ((eError & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK) || (eError == eERR_OK);
@@ -1871,7 +1903,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
else
{
// export aborted, i.e. "Save without password" warning
- SetError( ERRCODE_ABORT );
+ SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
else if (aFltName.EqualsAscii(pFilterAscii))
@@ -1904,7 +1936,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
if (aDocument.GetTableCount() > 1)
if (!rMed.GetError())
- rMed.SetError(SCWARN_EXPORT_ASCII);
+ rMed.SetError(SCWARN_EXPORT_ASCII, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
}
else if (aFltName.EqualsAscii(pFilterDBase))
@@ -1937,11 +1969,11 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
if ( eError != eERR_OK && (eError & ERRCODE_WARNING_MASK) )
{
//! if ( !rMed.GetError() )
-//! rMed.SetError( eError );
+//! rMed.SetError( eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
eError = eERR_OK;
}
//! else if ( aDocument.GetTableCount() > 1 && !rMed.GetError() )
-//! rMed.SetError( SCWARN_EXPORT_ASCII );
+//! rMed.SetError( SCWARN_EXPORT_ASCII, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
INetURLObject aTmpFile( rMed.GetPhysicalName(), INET_PROT_FILE );
if ( bHasMemo )
@@ -1949,7 +1981,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
if ( eError != eERR_OK )
{
if (!GetError())
- SetError(eError);
+ SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if ( bHasMemo && IsDocument( aTmpFile ) )
KillFile( aTmpFile );
}
@@ -1970,7 +2002,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
{
KillFile( aTmpFile );
if ( !GetError() )
- SetError( SCERR_EXPORT_DATA );
+ SetError( SCERR_EXPORT_DATA, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
}
@@ -2004,7 +2036,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
if (aDocument.GetTableCount() > 1)
if (!rMed.GetError())
- rMed.SetError(SCWARN_EXPORT_ASCII);
+ rMed.SetError(SCWARN_EXPORT_ASCII, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
}
else if (aFltName.EqualsAscii(pFilterSylk))
@@ -2037,13 +2069,13 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
SetError( *new StringErrorInfo(
SCWARN_EXPORT_NONCONVERTIBLE_CHARS,
aImExport.GetNonConvertibleChars(),
- ERRCODE_BUTTON_OK | ERRCODE_MSG_INFO ) );
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_INFO ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
else
{
if (GetError())
- SetError(SCERR_IMPORT_NI);
+ SetError(SCERR_IMPORT_NI, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
return bRet;
}
@@ -2165,7 +2197,6 @@ BOOL ScDocShell::HasAutomaticTableName( const String& rFilter ) // static
aDdeTextFmt(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TEXT"))), \
nPrtToScreenFactor( 1.0 ), \
pImpl ( new DocShell_Impl ), \
- pUndoManager ( NULL ), \
bHeaderOn ( TRUE ), \
bFooterOn ( TRUE ), \
bNoInformLost ( TRUE ), \
@@ -2265,7 +2296,8 @@ __EXPORT ScDocShell::~ScDocShell()
pSfxApp->RemoveDdeTopic( this );
delete pDocFunc;
- delete pUndoManager;
+ delete aDocument.mpUndoManager;
+ aDocument.mpUndoManager = 0;
delete pImpl;
delete pPaintLockData;
@@ -2286,9 +2318,7 @@ __EXPORT ScDocShell::~ScDocShell()
SfxUndoManager* __EXPORT ScDocShell::GetUndoManager()
{
- if (!pUndoManager)
- pUndoManager = new SfxUndoManager;
- return pUndoManager;
+ return aDocument.GetUndoManager();
}
void ScDocShell::SetModified( BOOL bModified )
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 6e4940f96fd3..fcbfb648ae14 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1051,8 +1051,8 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
aValue.Erase( 0, 1 );
aValue.Erase( aValue.Len()-1, 1 );
GetDocFunc().EnterMatrix( aSourceRange,
- NULL, NULL, aValue, FALSE, FALSE,
- formula::FormulaGrammar::GRAM_DEFAULT );
+ NULL, NULL, aValue, FALSE, FALSE,
+ EMPTY_STRING, formula::FormulaGrammar::GRAM_DEFAULT );
}
break;
case MM_REFERENCE : // do nothing
@@ -1292,7 +1292,7 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
ScChangeAction* pAction = pThisTrack->GetLast();
while ( pAction && pAction->GetActionNumber() >= nStartShared )
{
- pThisTrack->Reject( pAction );
+ pThisTrack->Reject( pAction, true );
pAction = pAction->GetPrev();
}
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 3da74feae40e..d4df2863eec5 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -126,6 +126,7 @@ using namespace ::com::sun::star;
#include "externalrefmgr.hxx"
#include "sharedocdlg.hxx"
+#include "conditio.hxx"
//------------------------------------------------------------------
@@ -1266,6 +1267,8 @@ void ScDocShell::DoRecalc( BOOL bApi )
if ( pSh )
pSh->UpdateCharts(TRUE);
+ aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+
// #47939# Wenn es Charts gibt, dann alles painten, damit nicht
// PostDataChanged und die Charts nacheinander kommen und Teile
// doppelt gepainted werden.
@@ -1291,6 +1294,12 @@ void ScDocShell::DoHardRecalc( BOOL /* bApi */ )
GetDocFunc().DetectiveRefresh(); // erzeugt eigenes Undo
if ( pSh )
pSh->UpdateCharts(TRUE);
+
+ // CalcAll doesn't broadcast value changes, so SC_HINT_CALCALL is broadcasted globally
+ // in addition to SFX_HINT_DATACHANGED.
+ aDocument.BroadcastUno( SfxSimpleHint( SC_HINT_CALCALL ) );
+ aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+
PostPaintGridAll();
}
@@ -1368,6 +1377,23 @@ void ScDocShell::NotifyStyle( const SfxStyleSheetHint& rHint )
}
}
}
+ else if ( pStyle->GetFamily() == SFX_STYLE_FAMILY_PARA )
+ {
+ if ( nId == SFX_STYLESHEET_MODIFIED)
+ {
+ String aNewName = pStyle->GetName();
+ String aOldName = aNewName;
+ BOOL bExtended = rHint.ISA(SfxStyleSheetHintExtended);
+ if (bExtended)
+ aOldName = ((SfxStyleSheetHintExtended&)rHint).GetOldName();
+ if ( aNewName != aOldName )
+ {
+ ScConditionalFormatList* pList = aDocument.GetCondFormList();
+ if (pList)
+ pList->RenameCellStyle( aOldName,aNewName );
+ }
+ }
+ }
// alles andere geht ueber Slots...
}
@@ -1816,6 +1842,10 @@ void lcl_GetPrintData( ScDocShell* pDocShell /*in*/,
rOptions = SC_MOD()->GetPrintOptions();
}
+ // update all pending row heights with a single progress bar,
+ // instead of a separate progress for each sheet from ScPrintFunc
+ pDocShell->UpdatePendingRowHeights( MAXTAB, true );
+
// get number of total pages
rnTotalPages = 0;
SCTAB nTabCount = pDocument->GetTableCount();
@@ -2406,10 +2436,12 @@ long __EXPORT ScDocShell::DdeGetData( const String& rItem,
if( aDdeTextFmt.EqualsAscii( "CSV" ) ||
aDdeTextFmt.EqualsAscii( "FCSV" ) )
aObj.SetSeparator( ',' );
+ aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, 0, false ) );
return aObj.ExportData( rMimeType, rValue ) ? 1 : 0;
}
ScImportExport aObj( &aDocument, rItem );
+ aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, 0, false ) );
if( aObj.IsRef() )
return aObj.ExportData( rMimeType, rValue ) ? 1 : 0;
return 0;
@@ -2473,10 +2505,14 @@ long __EXPORT ScDocShell::DdeSetData( const String& rItem,
pData->GetSymbol( aPos ); // continue with the name's contents
}
}
+
+ // Address in DDE function must be always parsed as CONV_OOO so that it
+ // would always work regardless of current address convension. We do this
+ // because the address item in a DDE entry is *not* normalized when saved
+ // into ODF.
ScRange aRange;
- formula::FormulaGrammar::AddressConvention eConv = aDocument.GetAddressConvention();
- BOOL bValid = ( ( aRange.Parse( aPos, &aDocument, eConv ) & SCA_VALID ) ||
- ( aRange.aStart.Parse( aPos, &aDocument, eConv ) & SCA_VALID ) );
+ bool bValid = ( (aRange.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO ) & SCA_VALID) ||
+ (aRange.aStart.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO) & SCA_VALID) );
ScServerObject* pObj = NULL; // NULL = error
if ( bValid )
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index d3b6bb55dcdd..281f03ff3622 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -393,13 +393,51 @@ BOOL ScDocShell::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab )
return bChange;
}
-void ScDocShell::UpdateAllRowHeights()
+void ScDocShell::UpdateAllRowHeights( const ScMarkData* pTabMark )
{
// update automatic row heights
ScSizeDeviceProvider aProv(this);
Fraction aZoom(1,1);
- aDocument.UpdateAllRowHeights( aProv.GetDevice(), aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom );
+ aDocument.UpdateAllRowHeights( aProv.GetDevice(), aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, pTabMark );
+}
+
+void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
+{
+ BOOL bIsUndoEnabled = aDocument.IsUndoEnabled();
+ aDocument.EnableUndo( FALSE );
+ if ( bBefore ) // check all sheets up to nUpdateTab
+ {
+ SCTAB nTabCount = aDocument.GetTableCount();
+ if ( nUpdateTab >= nTabCount )
+ nUpdateTab = nTabCount-1; // nUpdateTab is inclusive
+
+ ScMarkData aUpdateSheets;
+ SCTAB nTab;
+ for (nTab=0; nTab<=nUpdateTab; ++nTab)
+ if ( aDocument.IsPendingRowHeights( nTab ) )
+ aUpdateSheets.SelectTable( nTab, TRUE );
+
+ if (aUpdateSheets.GetSelectCount())
+ UpdateAllRowHeights(&aUpdateSheets); // update with a single progress bar
+
+ for (nTab=0; nTab<=nUpdateTab; ++nTab)
+ if ( aUpdateSheets.GetTableSelect( nTab ) )
+ {
+ aDocument.UpdatePageBreaks( nTab );
+ aDocument.SetPendingRowHeights( nTab, FALSE );
+ }
+ }
+ else // only nUpdateTab
+ {
+ if ( aDocument.IsPendingRowHeights( nUpdateTab ) )
+ {
+ AdjustRowHeight( 0, MAXROW, nUpdateTab );
+ aDocument.UpdatePageBreaks( nUpdateTab );
+ aDocument.SetPendingRowHeights( nUpdateTab, FALSE );
+ }
+ }
+ aDocument.EnableUndo( bIsUndoEnabled );
}
#if OLD_PIVOT_IMPLEMENTATION
@@ -827,7 +865,7 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
++nAdjSource; // new position of source table after CopyTab
if ( aDocument.IsTabProtected( nAdjSource ) )
- aDocument.SetTabProtection( nDestTab, TRUE, aDocument.GetTabPassword( nAdjSource ) );
+ aDocument.CopyTabProtection(nAdjSource, nDestTab);
if (bRecord)
{
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index d78aa6fe3d84..9cc0b274028e 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -143,7 +143,8 @@ private:
// ============================================================================
ScExternalRefCache::Table::Table()
- : mbReferenced( true) // Prevent accidental data loss due to lack of knowledge.
+ : meReferenced( REFERENCED_MARKED )
+ // Prevent accidental data loss due to lack of knowledge.
{
}
@@ -151,14 +152,25 @@ ScExternalRefCache::Table::~Table()
{
}
+void ScExternalRefCache::Table::setReferencedFlag( ScExternalRefCache::Table::ReferencedFlag eFlag )
+{
+ meReferenced = eFlag;
+}
+
void ScExternalRefCache::Table::setReferenced( bool bReferenced )
{
- mbReferenced = bReferenced;
+ if (meReferenced != REFERENCED_PERMANENT)
+ meReferenced = (bReferenced ? REFERENCED_MARKED : UNREFERENCED);
+}
+
+ScExternalRefCache::Table::ReferencedFlag ScExternalRefCache::Table::getReferencedFlag() const
+{
+ return meReferenced;
}
bool ScExternalRefCache::Table::isReferenced() const
{
- return mbReferenced;
+ return meReferenced != UNREFERENCED;
}
void ScExternalRefCache::Table::setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex)
@@ -328,7 +340,7 @@ const String* ScExternalRefCache::getRealRangeName(sal_uInt16 nFileId, const Str
ScExternalRefCache::TokenRef ScExternalRefCache::getCellData(
sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow,
- bool bEmptyCellOnNull, sal_uInt32* pnFmtIndex)
+ bool bEmptyCellOnNull, bool bWriteEmpty, sal_uInt32* pnFmtIndex)
{
DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
if (itrDoc == maDocs.end())
@@ -355,12 +367,16 @@ ScExternalRefCache::TokenRef ScExternalRefCache::getCellData(
TokenRef pToken = pTableData->getCell(nCol, nRow, pnFmtIndex);
if (!pToken && bEmptyCellOnNull)
+ {
pToken.reset(new ScEmptyCellToken(false, false));
+ if (bWriteEmpty)
+ pTableData->setCell(nCol, nRow, pToken);
+ }
return pToken;
}
ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
- sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, bool bEmptyCellOnNull)
+ sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, bool bEmptyCellOnNull, bool bWriteEmpty)
{
DocDataType::iterator itrDoc = maDocs.find(nFileId);
if (itrDoc == maDocs.end())
@@ -413,7 +429,11 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
if (!pToken)
{
if (bEmptyCellOnNull)
+ {
pToken.reset(new ScEmptyCellToken(false, false));
+ if (bWriteEmpty)
+ pTab->setCell(nCol, nRow, pToken);
+ }
else
return TokenArrayRef();
}
@@ -729,21 +749,57 @@ bool ScExternalRefCache::setCacheDocReferenced( sal_uInt16 nFileId )
return areAllCacheTablesReferenced();
}
-bool ScExternalRefCache::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName )
+bool ScExternalRefCache::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets, bool bPermanent )
{
- size_t nIndex = 0;
- TableTypeRef pTab = getCacheTable( nFileId, rTabName, false, &nIndex);
- if (pTab.get())
+ DocItem* pDoc = getDocItem(nFileId);
+ if (pDoc)
{
- if (!pTab->isReferenced())
+ size_t nIndex = 0;
+ String aTabNameUpper = ScGlobal::pCharClass->upper( rTabName);
+ if (lcl_getTableDataIndex( pDoc->maTableNameIndex, aTabNameUpper, nIndex))
{
- pTab->setReferenced( true);
- addCacheTableToReferenced( nFileId, nIndex);
+ size_t nStop = ::std::min( nIndex + nSheets, pDoc->maTables.size());
+ for (size_t i = nIndex; i < nStop; ++i)
+ {
+ TableTypeRef pTab = pDoc->maTables[i];
+ if (pTab.get())
+ {
+ Table::ReferencedFlag eNewFlag = (bPermanent ?
+ Table::REFERENCED_PERMANENT :
+ Table::REFERENCED_MARKED);
+ Table::ReferencedFlag eOldFlag = pTab->getReferencedFlag();
+ if (eOldFlag != Table::REFERENCED_PERMANENT && eNewFlag != eOldFlag)
+ {
+ pTab->setReferencedFlag( eNewFlag);
+ addCacheTableToReferenced( nFileId, i);
+ }
+ }
+ }
}
}
return areAllCacheTablesReferenced();
}
+void ScExternalRefCache::setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets )
+{
+ DocItem* pDoc = getDocItem(nFileId);
+ if (pDoc)
+ {
+ size_t nIndex = 0;
+ String aTabNameUpper = ScGlobal::pCharClass->upper( rTabName);
+ if (lcl_getTableDataIndex( pDoc->maTableNameIndex, aTabNameUpper, nIndex))
+ {
+ size_t nStop = ::std::min( nIndex + nSheets, pDoc->maTables.size());
+ for (size_t i = nIndex; i < nStop; ++i)
+ {
+ TableTypeRef pTab = pDoc->maTables[i];
+ if (pTab.get())
+ pTab->setReferencedFlag( Table::REFERENCED_PERMANENT);
+ }
+ }
+ }
+}
+
void ScExternalRefCache::setAllCacheTableReferencedStati( bool bReferenced )
{
if (bReferenced)
@@ -783,9 +839,17 @@ void ScExternalRefCache::setAllCacheTableReferencedStati( bool bReferenced )
TableTypeRef & xTab = rDocItem.maTables[i];
if (xTab.get())
{
- xTab->setReferenced( false);
- rDocReferenced.maTables[i] = false;
- rDocReferenced.mbAllTablesReferenced = false;
+ if (xTab->getReferencedFlag() == Table::REFERENCED_PERMANENT)
+ addCacheTableToReferenced( nFileId, i);
+ else
+ {
+ xTab->setReferencedFlag( Table::UNREFERENCED);
+ rDocReferenced.maTables[i] = false;
+ rDocReferenced.mbAllTablesReferenced = false;
+ // An addCacheTableToReferenced() actually may have
+ // resulted in mbAllReferenced been set. Clear it.
+ maReferenced.mbAllReferenced = false;
+ }
}
}
}
@@ -1309,8 +1373,9 @@ void ScExternalRefManager::RefCells::moveTable(SCTAB nOldTab, SCTAB nNewTab, boo
xNewTab->mnIndex = nNewTab;
maTables.insert(itrNew, xNewTab);
list<TabItemRef>::iterator itr = itrNew, itrEnd = maTables.end();
- for (++itr; itr != itrEnd; ++itr)
- (*itr)->mnIndex += 1;
+ if (itr != itrEnd) // #i99807# check that itr is not at end already
+ for (++itr; itr != itrEnd; ++itr)
+ (*itr)->mnIndex += 1;
}
else
{
@@ -1472,9 +1537,19 @@ bool ScExternalRefManager::setCacheDocReferenced( sal_uInt16 nFileId )
return maRefCache.setCacheDocReferenced( nFileId);
}
-bool ScExternalRefManager::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName )
+bool ScExternalRefManager::setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets )
{
- return maRefCache.setCacheTableReferenced( nFileId, rTabName);
+ return maRefCache.setCacheTableReferenced( nFileId, rTabName, nSheets, false);
+}
+
+void ScExternalRefManager::setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets )
+{
+ if (isInReferenceMarking())
+ // Do all maintenance work.
+ maRefCache.setCacheTableReferenced( nFileId, rTabName, nSheets, true);
+ else
+ // Set only the permanent flag.
+ maRefCache.setCacheTableReferencedPermanently( nFileId, rTabName, nSheets);
}
void ScExternalRefManager::setAllCacheTableReferencedStati( bool bReferenced )
@@ -1504,10 +1579,18 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
if (pFmt)
pFmt->mbIsSet = false;
+ bool bLoading = mpDoc->IsImportingXML();
+
// Check if the given table name and the cell position is cached.
+ // #i101304# When loading a file, the saved cache (hidden sheet)
+ // is assumed to contain all data for the loaded formulas.
+ // No cache entries are created from empty cells in the saved sheet,
+ // so they have to be created here (bWriteEmpty parameter).
+ // Otherwise, later interpretation of the loaded formulas would
+ // load the source document even if the user didn't want to update.
sal_uInt32 nFmtIndex = 0;
ScExternalRefCache::TokenRef pToken = maRefCache.getCellData(
- nFileId, rTabName, rCell.Col(), rCell.Row(), false, &nFmtIndex);
+ nFileId, rTabName, rCell.Col(), rCell.Row(), bLoading, bLoading, &nFmtIndex);
if (pToken)
{
if (pFmt)
@@ -1531,7 +1614,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
// once again, but this time treat a non-cached cell as an empty cell
// as long as the table itself is cached.
pToken = maRefCache.getCellData(
- nFileId, rTabName, rCell.Col(), rCell.Row(), true, &nFmtIndex);
+ nFileId, rTabName, rCell.Col(), rCell.Row(), true, false, &nFmtIndex);
return pToken;
}
@@ -1580,8 +1663,11 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(sal_u
maybeLinkExternalFile(nFileId);
+ bool bLoading = mpDoc->IsImportingXML();
+
// Check if the given table name and the cell position is cached.
- ScExternalRefCache::TokenArrayRef p = maRefCache.getCellRangeData(nFileId, rTabName, rRange, false);
+ // #i101304# When loading, put empty cells into cache, see getSingleRefToken.
+ ScExternalRefCache::TokenArrayRef p = maRefCache.getCellRangeData(nFileId, rTabName, rRange, bLoading, bLoading);
if (p.get())
return p;
@@ -1591,7 +1677,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokens(sal_u
// Source document is not reachable. Try to get data from the cache
// once again, but this time treat non-cached cells as empty cells as
// long as the table itself is cached.
- return maRefCache.getCellRangeData(nFileId, rTabName, rRange, true);
+ return maRefCache.getCellRangeData(nFileId, rTabName, rRange, true, false);
}
SCTAB nTab1;
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index ee1d3f676167..67186f84a84a 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -93,6 +93,21 @@ class StarBASIC;
//========================================================================
+namespace
+{
+ const String SYLK_LF = String::CreateFromAscii("\x1b :");
+ const String DOUBLE_SEMICOLON = String::CreateFromAscii(";;");
+ const String DOUBLE_DOUBLEQUOTE = String::CreateFromAscii("\"\"");
+}
+
+enum SylkVersion
+{
+ SYLK_SCALC3, // Wrote wrongly quoted strings and unescaped semicolons.
+ SYLK_OOO32, // Correct strings, plus multiline content.
+ SYLK_OWN, // Place our new versions, if any, before this value.
+ SYLK_OTHER // Assume that aliens wrote correct strings.
+};
+
// Gesamtdokument ohne Undo
@@ -102,7 +117,7 @@ ScImportExport::ScImportExport( ScDocument* p )
nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ),
bFormulas( FALSE ), bIncludeFiltered( TRUE ),
bAll( TRUE ), bSingle( TRUE ), bUndo( FALSE ),
- bOverflow( FALSE ), mbApi( true )
+ bOverflow( FALSE ), mbApi( true ), mExportTextOptions()
{
pUndoDoc = NULL;
pExtOptions = NULL;
@@ -117,7 +132,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScAddress& rPt )
nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ),
bFormulas( FALSE ), bIncludeFiltered( TRUE ),
bAll( FALSE ), bSingle( TRUE ), bUndo( BOOL( pDocSh != NULL ) ),
- bOverflow( FALSE ), mbApi( true )
+ bOverflow( FALSE ), mbApi( true ), mExportTextOptions()
{
pUndoDoc = NULL;
pExtOptions = NULL;
@@ -133,7 +148,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScRange& r )
nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ),
bFormulas( FALSE ), bIncludeFiltered( TRUE ),
bAll( FALSE ), bSingle( FALSE ), bUndo( BOOL( pDocSh != NULL ) ),
- bOverflow( FALSE ), mbApi( true )
+ bOverflow( FALSE ), mbApi( true ), mExportTextOptions()
{
pUndoDoc = NULL;
pExtOptions = NULL;
@@ -150,7 +165,7 @@ ScImportExport::ScImportExport( ScDocument* p, const String& rPos )
nSizeLimit( 0 ), cSep( '\t' ), cStr( '"' ),
bFormulas( FALSE ), bIncludeFiltered( TRUE ),
bAll( FALSE ), bSingle( TRUE ), bUndo( BOOL( pDocSh != NULL ) ),
- bOverflow( FALSE ), mbApi( true )
+ bOverflow( FALSE ), mbApi( true ), mExportTextOptions()
{
pUndoDoc = NULL;
pExtOptions = NULL;
@@ -575,6 +590,7 @@ void ScImportExport::WriteUnicodeOrByteString( SvStream& rStrm, const String& rS
}
+// This function could be replaced by endlub()
// static
void ScImportExport::WriteUnicodeOrByteEndl( SvStream& rStrm )
{
@@ -605,7 +621,7 @@ enum DoubledQuoteMode
DQM_SEPARATE // end one string and begin next
};
-const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString,
+static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString,
sal_Unicode cStr, DoubledQuoteMode eMode )
{
p++; //! jump over opening quote
@@ -653,8 +669,126 @@ const sal_Unicode* lcl_ScanString( const sal_Unicode* p, String& rString,
return p;
}
+void lcl_UnescapeSylk( String & rString, SylkVersion eVersion )
+{
+ // Older versions didn't escape the semicolon.
+ // Older versions quoted the string and doubled embedded quotes, but not
+ // the semicolons, which was plain wrong.
+ if (eVersion >= SYLK_OOO32)
+ rString.SearchAndReplaceAll( DOUBLE_SEMICOLON, ';' );
+ else
+ rString.SearchAndReplaceAll( DOUBLE_DOUBLEQUOTE, '"' );
+
+ rString.SearchAndReplaceAll( SYLK_LF, _LF );
+}
+
+static const sal_Unicode* lcl_ScanSylkString( const sal_Unicode* p,
+ String& rString, SylkVersion eVersion )
+{
+ const sal_Unicode* pStartQuote = p;
+ const sal_Unicode* pEndQuote = 0;
+ while( *(++p) )
+ {
+ if( *p == '"' )
+ {
+ pEndQuote = p;
+ if (eVersion >= SYLK_OOO32)
+ {
+ if (*(p+1) == ';')
+ {
+ if (*(p+2) == ';')
+ {
+ p += 2; // escaped ';'
+ pEndQuote = 0;
+ }
+ else
+ break; // end field
+ }
+ }
+ else
+ {
+ if (*(p+1) == '"')
+ {
+ ++p; // escaped '"'
+ pEndQuote = 0;
+ }
+ else if (*(p+1) == ';')
+ break; // end field
+ }
+ }
+ }
+ if (!pEndQuote)
+ pEndQuote = p; // Take all data as string.
+ rString.Append( pStartQuote + 1, sal::static_int_cast<xub_StrLen>( pEndQuote - pStartQuote - 1 ) );
+ lcl_UnescapeSylk( rString, eVersion);
+ return p;
+}
+
+static const sal_Unicode* lcl_ScanSylkFormula( const sal_Unicode* p,
+ String& rString, SylkVersion eVersion )
+{
+ const sal_Unicode* pStart = p;
+ if (eVersion >= SYLK_OOO32)
+ {
+ while (*p)
+ {
+ if (*p == ';')
+ {
+ if (*(p+1) == ';')
+ ++p; // escaped ';'
+ else
+ break; // end field
+ }
+ ++p;
+ }
+ rString.Append( pStart, sal::static_int_cast<xub_StrLen>( p - pStart));
+ lcl_UnescapeSylk( rString, eVersion);
+ }
+ else
+ {
+ // Nasty. If in old versions the formula contained a semicolon, it was
+ // quoted and embedded quotes were doubled, but semicolons were not. If
+ // there was no semicolon, it could still contain quotes and doubled
+ // embedded quotes if it was something like ="a""b", which was saved as
+ // E"a""b" as is and has to be preserved, even if older versions
+ // couldn't even load it correctly. However, theoretically another
+ // field might follow and thus the line contain a semicolon again, such
+ // as ...;E"a""b";...
+ bool bQuoted = false;
+ if (*p == '"')
+ {
+ // May be a quoted expression or just a string constant expression
+ // with quotes.
+ while (*(++p))
+ {
+ if (*p == '"')
+ {
+ if (*(p+1) == '"')
+ ++p; // escaped '"'
+ else
+ break; // closing '"', had no ';' yet
+ }
+ else if (*p == ';')
+ {
+ bQuoted = true; // ';' within quoted expression
+ break;
+ }
+ }
+ p = pStart;
+ }
+ if (bQuoted)
+ p = lcl_ScanSylkString( p, rString, eVersion);
+ else
+ {
+ while (*p && *p != ';')
+ ++p;
+ rString.Append( pStart, sal::static_int_cast<xub_StrLen>( p - pStart));
+ }
+ }
+ return p;
+}
-void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cStr )
+static void lcl_DoubleEscapeChar( String& rString, sal_Unicode cStr )
{
xub_StrLen n = 0;
while( ( n = rString.Search( cStr, n ) ) != STRING_NOTFOUND )
@@ -662,9 +796,18 @@ void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cStr )
rString.Insert( cStr, n );
n += 2;
}
+}
- rString.Insert( cStr, 0 );
- rString.Append( cStr );
+static void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cQuote, sal_Unicode cEsc )
+{
+ if (cEsc)
+ lcl_DoubleEscapeChar( rString, cEsc );
+
+ if (cQuote)
+ {
+ rString.Insert( cQuote, 0 );
+ rString.Append( cQuote );
+ }
ScImportExport::WriteUnicodeOrByteString( rStrm, rString );
}
@@ -1279,6 +1422,7 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
SCCOL nEndCol = aRange.aEnd.Col();
SCROW nEndRow = aRange.aEnd.Row();
String aCell;
+ bool bConvertLF = (GetSystemLineEnd() != LINEEND_LF);
for (nRow = nStartRow; nRow <= nEndRow; nRow++)
{
@@ -1296,15 +1440,28 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
{
pDoc->GetFormula( nCol, nRow, aRange.aStart.Tab(), aCell, TRUE );
if( aCell.Search( cSep ) != STRING_NOTFOUND )
- lcl_WriteString( rStrm, aCell, cStr );
+ lcl_WriteString( rStrm, aCell, cStr, cStr );
else
lcl_WriteSimpleString( rStrm, aCell );
}
else
{
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell );
- if( aCell.Search( cSep ) != STRING_NOTFOUND )
- lcl_WriteString( rStrm, aCell, cStr );
+
+ bool bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND );
+ if( bMultiLineText )
+ {
+ if( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSpace )
+ aCell.SearchAndReplaceAll( _LF, ' ' );
+ else if ( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSystem && bConvertLF )
+ aCell.ConvertLineEnd();
+ }
+
+ if( mExportTextOptions.mcSeparatorConvertTo && cSep )
+ aCell.SearchAndReplaceAll( cSep, mExportTextOptions.mcSeparatorConvertTo );
+
+ if( mExportTextOptions.mbAddQuotes && ( aCell.Search( cSep ) != STRING_NOTFOUND ) )
+ lcl_WriteString( rStrm, aCell, cStr, cStr );
else
lcl_WriteSimpleString( rStrm, aCell );
}
@@ -1322,8 +1479,21 @@ BOOL ScImportExport::Doc2Text( SvStream& rStrm )
default:
{
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCell );
- if( aCell.Search( cSep ) != STRING_NOTFOUND )
- lcl_WriteString( rStrm, aCell, cStr );
+
+ bool bMultiLineText = ( aCell.Search( _LF ) != STRING_NOTFOUND );
+ if( bMultiLineText )
+ {
+ if( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSpace )
+ aCell.SearchAndReplaceAll( _LF, ' ' );
+ else if ( mExportTextOptions.meNewlineConversion == ScExportTextOptions::ToSystem && bConvertLF )
+ aCell.ConvertLineEnd();
+ }
+
+ if( mExportTextOptions.mcSeparatorConvertTo && cSep )
+ aCell.SearchAndReplaceAll( cSep, mExportTextOptions.mcSeparatorConvertTo );
+
+ if( mExportTextOptions.mbAddQuotes && ( aCell.Search( cSep ) != STRING_NOTFOUND ) )
+ lcl_WriteString( rStrm, aCell, cStr, cStr );
else
lcl_WriteSimpleString( rStrm, aCell );
}
@@ -1348,6 +1518,7 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
{
BOOL bOk = TRUE;
BOOL bMyDoc = FALSE;
+ SylkVersion eVersion = SYLK_OTHER;
// US-English separators for StringToDouble
sal_Unicode cDecSep = '.';
@@ -1424,8 +1595,8 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
if( *p == '"' )
{
bText = TRUE;
- aText = '\''; // force string cell
- p = lcl_ScanString( p, aText, '"', DQM_ESCAPE );
+ aText.Erase();
+ p = lcl_ScanSylkString( p, aText, eVersion);
}
else
bText = FALSE;
@@ -1435,7 +1606,11 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
if ( !(*q == ';' && *(q+1) == 'I') )
{ // don't ignore value
if( bText )
- pDoc->SetString( nCol, nRow, aRange.aStart.Tab(), aText );
+ {
+ pDoc->PutCell( nCol, nRow, aRange.aStart.Tab(),
+ ScBaseCell::CreateTextCell( aText, pDoc),
+ (BOOL) TRUE);
+ }
else
{
double fVal = rtl_math_uStringToDouble( p,
@@ -1466,15 +1641,7 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
if( !bMyDoc || !bData )
break;
aText = '=';
- if( *p == '"' )
- p = lcl_ScanString( p, aText, '"', DQM_ESCAPE );
- else
- {
- const sal_Unicode* q = p;
- while( *p && *p != ';' )
- p++;
- aText.Append( q, sal::static_int_cast<xub_StrLen>( p-q ) );
- }
+ p = lcl_ScanSylkFormula( p, aText, eVersion);
ScAddress aPos( nCol, nRow, aRange.aStart.Tab() );
/* FIXME: do we want GRAM_ODFF_A1 instead? At the
* end it probably should be GRAM_ODFF_R1C1, since
@@ -1584,7 +1751,11 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
else if( cTag == 'I' && *p == 'D' )
{
aLine.Erase( 0, 4 );
- bMyDoc = aLine.EqualsAscii( "SCALC3" );
+ if (aLine.EqualsAscii( "CALCOOO32" ))
+ eVersion = SYLK_OOO32;
+ else if (aLine.EqualsAscii( "SCALC3" ))
+ eVersion = SYLK_SCALC3;
+ bMyDoc = (eVersion <= SYLK_OWN);
}
else if( cTag == 'E' ) // Ende
break;
@@ -1616,7 +1787,7 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
String aCellStr;
String aValStr;
lcl_WriteSimpleString( rStrm,
- String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "ID;PSCALC3" )) );
+ String( RTL_CONSTASCII_USTRINGPARAM( "ID;PCALCOOO32")));
WriteUnicodeOrByteEndl( rStrm );
for (nRow = nStartRow; nRow <= nEndRow; nRow++)
@@ -1661,6 +1832,7 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
case CELLTYPE_EDIT:
hasstring:
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr );
+ aCellStr.SearchAndReplaceAll( _LF, SYLK_LF );
aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" ));
aBufStr += String::CreateFromInt32( c );
@@ -1668,7 +1840,7 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
aBufStr += String::CreateFromInt32( r );
aBufStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ";K" ));
lcl_WriteSimpleString( rStrm, aBufStr );
- lcl_WriteString( rStrm, aCellStr, '"' );
+ lcl_WriteString( rStrm, aCellStr, '"', ';' );
checkformula:
if( bForm )
@@ -1730,12 +1902,7 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
}
lcl_WriteSimpleString( rStrm, aPrefix );
if ( aCellStr.Len() )
- {
- if( aCellStr.Search( ';' ) != STRING_NOTFOUND )
- lcl_WriteString( rStrm, aCellStr, '"' );
- else
- lcl_WriteSimpleString( rStrm, aCellStr );
- }
+ lcl_WriteString( rStrm, aCellStr, 0, ';' );
}
WriteUnicodeOrByteEndl( rStrm );
break;
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index dafb3077bf27..aeb4b6604e67 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -200,10 +200,12 @@ BOOL __EXPORT ScServerObject::GetData(
if( aDdeTextFmt.EqualsAscii( "CSV" ) ||
aDdeTextFmt.EqualsAscii( "FCSV" ) )
aObj.SetSeparator( ',' );
+ aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, ' ', false ) );
return aObj.ExportData( rMimeType, rData ) ? 1 : 0;
}
ScImportExport aObj( pDoc, aRange );
+ aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, ' ', false ) );
if( aObj.IsRef() )
return aObj.ExportData( rMimeType, rData ) ? 1 : 0;
return 0;
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 49f93a403f88..63f958763479 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -71,9 +71,11 @@
#include "userdat.hxx"
#include <sfx2/objsh.hxx>
-#include <sfx2/macropg.hxx>
#include <svtools/macitem.hxx>
+#include <sfx2/evntconf.hxx>
+#include <sfx2/viewsh.hxx>
#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
//------------------------------------------------------------------
@@ -228,7 +230,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
{
SdrPageView* pPV = 0;
SdrObject* pHit = 0;
- if ( pView->PickObj( pWin->PixelToLogic( pViewData->GetMousePosPixel() ), pHit, pPV, SDRSEARCH_DEEP ) )
+ if ( pView->PickObj( pWin->PixelToLogic( pViewData->GetMousePosPixel() ), pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
pObj = pHit;
}
@@ -325,25 +327,31 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, Window* pWin )
aTab.Insert( SFX_EVENT_MOUSECLICK_OBJECT, new SvxMacro( sMacro, String() ) );
aItem.SetMacroTable( aTab );
}
+
// create empty itemset for macro-dlg
- SfxItemSet* pItemSet = new SfxItemSet(SFX_APP()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM );
+ SfxItemSet* pItemSet = new SfxItemSet(SFX_APP()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
pItemSet->Put ( aItem, SID_ATTR_MACROITEM );
- SfxMacroAssignDlg aDlg( pWin, GetObjectShell(), *pItemSet );
- SfxMacroTabPage *pMacroPage = (SfxMacroTabPage*) aDlg.GetTabPage();
- pMacroPage->AddEvent( ScResId(RID_SCSTR_ONCLICK),
- SFX_EVENT_MOUSECLICK_OBJECT);
+ SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
+ aNamesItem.AddEvent( ScResId(RID_SCSTR_ONCLICK), String(), SFX_EVENT_MOUSECLICK_OBJECT );
+ pItemSet->Put( aNamesItem, SID_EVENTCONFIG );
+
+ com::sun::star::uno::Reference < com::sun::star::frame::XFrame > xFrame;
+ if (GetViewShell())
+ xFrame = GetViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface();
- if ( RET_OK == aDlg.Execute() )
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pWin, *pItemSet, xFrame, SID_EVENTCONFIG );
+ if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
{
- const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
+ const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
const SfxPoolItem* pItem;
if( SFX_ITEM_SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, FALSE, &pItem ))
{
rtl::OUString sMacro;
SvxMacro* pMacro = ((SvxMacroItem*)pItem)->GetMacroTable().Get( SFX_EVENT_MOUSECLICK_OBJECT );
if ( pMacro )
- sMacro = pMacro->GetMacName();
+ sMacro = pMacro->GetMacName();
if ( pObj->IsGroupObject() )
{
@@ -361,6 +369,7 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, Window* pWin )
}
}
+ delete pMacroDlg;
delete pItemSet;
}
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index dd7e1a114ef2..8c175f0cd3a9 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -221,7 +221,32 @@ void __EXPORT ScDrawTextObjectBar::Execute( SfxRequest &rReq )
String aString;
SvxFontItem aNewItem( EE_CHAR_FONTINFO );
- if (ScViewUtil::ExecuteCharMap( rItem, aNewItem, aString ))
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if( pArgs )
+ pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem);
+
+ if ( pItem )
+ {
+ aString = ((const SfxStringItem*)pItem)->GetValue();
+ const SfxPoolItem* pFtItem = NULL;
+ pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem);
+ const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
+ if ( pFontItem )
+ {
+ String aFontName(pFontItem->GetValue());
+ Font aFont(aFontName, Size(1,1)); // Size nur wg. CTOR
+ aNewItem = SvxFontItem( aFont.GetFamily(), aFont.GetName(),
+ aFont.GetStyleName(), aFont.GetPitch(),
+ aFont.GetCharSet(), ATTR_FONT );
+ }
+ else
+ aNewItem = rItem;
+ }
+ else
+ ScViewUtil::ExecuteCharMap( rItem, *pViewData->GetViewShell()->GetViewFrame(), aNewItem, aString );
+
+ if ( aString.Len() )
{
SfxItemSet aSet( pOutliner->GetEmptyItemSet() );
aSet.Put( aNewItem );
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index 2dccd6edbfe0..fadb8270b6a6 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -795,12 +795,12 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
SdrPageView* pPV;
ScMacroInfo* pInfo = 0;
- if ( pView->PickObj(aPnt, pObj, pPV, SDRSEARCH_ALSOONMASTER) )
+ if ( pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
{
if ( pObj->IsGroupObject() )
{
SdrObject* pHit = 0;
- if ( pView->PickObj(aMDPos, pHit, pPV, SDRSEARCH_DEEP ) )
+ if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
pObj = pHit;
}
pInfo = ScDrawLayer::GetMacroInfo( pObj );
@@ -825,7 +825,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
// kann mit ALT unterdrueckt werden
pWindow->SetPointer( Pointer( POINTER_REFHAND ) ); // Text-URL / ImageMap
}
- else if ( !bAlt && pView->PickObj(aPnt, pObj, pPV, SDRSEARCH_PICKMACRO) )
+ else if ( !bAlt && pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
{
// kann mit ALT unterdrueckt werden
SdrObjMacroHitRec aHitRec; //! muss da noch irgendwas gesetzt werden ????
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 5dff4041bd22..93abbd48c9e7 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -167,8 +167,10 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
if ( aRangeListRef->Count() )
{
pScDoc->LimitChartIfAll( aRangeListRef ); // limit whole columns/rows to used area
+
+ // update string from modified ranges. The ranges must be in the current formula syntax.
String aTmpStr;
- aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() ); // update string from changed ranges
+ aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );
aRangeString = aTmpStr;
ScChartPositioner aChartPositioner( pScDoc, aRangeListRef );
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index c26d3fdcb5fc..23aefe17c71b 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -42,6 +42,7 @@
#include "detfunc.hxx"
#include "document.hxx"
#include <vcl/svapp.hxx>
+#include <svx/sdrhittesthelper.hxx>
/*************************************************************************
|*
@@ -333,8 +334,10 @@ BOOL FuPoor::IsDetectiveHit( const Point& rLogicPos )
{
USHORT nHitLog = (USHORT) pWindow->PixelToLogic(
Size(pView->GetHitTolerancePixel(),0)).Width();
- if ( pObject->IsHit( rLogicPos, nHitLog ) )
+ if(SdrObjectPrimitiveHit(*pObject, rLogicPos, nHitLog, *pPV, 0, false))
+ {
bFound = TRUE;
+ }
}
pObject = aIter.Next();
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 02fc2e38b0f6..79c466f9f2c3 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -171,7 +171,7 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
else
{
BOOL bAlt = rMEvt.IsMod2();
- if ( !bAlt && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_PICKMACRO) )
+ if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
{
pView->BegMacroObj(aMDPos, pObj, pPV, pWindow);
bReturn = TRUE;
@@ -179,7 +179,7 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
else
{
String sURL, sTarget;
- if ( !bAlt && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER))
+ if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER))
{
// Support for imported Excel docs
// Excel is of course not consistent and allows
@@ -200,7 +200,7 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
if ( pObj->IsGroupObject() )
{
SdrObject* pHit = NULL;
- if ( pView->PickObj(aMDPos, pHit, pPV, SDRSEARCH_DEEP ) )
+ if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
pObj = pHit;
}
diff --git a/sc/source/ui/drawfunc/fusel2.cxx b/sc/source/ui/drawfunc/fusel2.cxx
index aa518ee42a81..7c096fd51d71 100644
--- a/sc/source/ui/drawfunc/fusel2.cxx
+++ b/sc/source/ui/drawfunc/fusel2.cxx
@@ -53,6 +53,7 @@
#include "drwlayer.hxx"
#include "docsh.hxx"
#include "drawview.hxx"
+#include <svx/sdrhittesthelper.hxx>
// -----------------------------------------------------------------------
@@ -79,7 +80,7 @@ BOOL FuSelection::TestDetective( SdrPageView* pPV, const Point& rPos )
{
USHORT nHitLog = (USHORT) pWindow->PixelToLogic(
Size(pView->GetHitTolerancePixel(),0)).Width();
- if ( pObject->IsHit( rPos, nHitLog ) )
+ if (SdrObjectPrimitiveHit(*pObject, rPos, nHitLog, *pPV, 0, false))
{
ScViewData* pViewData = pViewShell->GetViewData();
ScSplitPos ePos = pViewShell->FindWindow( pWindow );
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 302d1c825a2a..ebcb2ad30802 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -193,7 +193,7 @@ BOOL __EXPORT FuText::MouseButtonDown(const MouseEvent& rMEvt)
{
if (pHdl == NULL &&
// pView->TakeTextEditObject(aMDPos, pObj, pPV) )
- pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_PICKTEXTEDIT) )
+ pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKTEXTEDIT) )
{
SdrOutliner* pO = MakeOutliner();
lcl_UpdateHyphenator( *pO, pObj );
@@ -250,7 +250,7 @@ BOOL __EXPORT FuText::MouseButtonDown(const MouseEvent& rMEvt)
BOOL bMacro = FALSE;
// if (bMacro && pView->TakeMacroObject(aMDPos,pObj,pPV))
- if (bMacro && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_PICKMACRO) )
+ if (bMacro && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
{
pView->BegMacroObj(aMDPos,pObj,pPV,pWindow);
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index 3fc99568e173..701a53aecfcc 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -130,7 +130,7 @@ void FuText::StopEditMode(BOOL /*bTextDirection*/)
if( pNote )
{
// hide the caption object if it is in hidden state
- pNote->HideCaptionTemp();
+ pNote->ShowCaptionTemp( aNotePos, false );
// update author and date
pNote->AutoStamp();
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 4544c1ca0792..8d631a9f0609 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -126,7 +126,6 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
m_xParser.set(ScServiceProvider::MakeInstance(SC_SERVICE_FORMULAPARS,(ScDocShell*)pDoc->GetDocumentShell()),uno::UNO_QUERY);
uno::Reference< beans::XPropertySet> xSet(m_xParser,uno::UNO_QUERY);
xSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_COMPILEFAP)),uno::makeAny(sal_True));
- xSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_REFERENCEPOS)),uno::makeAny(table::CellAddress(aCursorPos.Tab(),aCursorPos.Col(),aCursorPos.Row())));
m_xOpCodeMapper.set(ScServiceProvider::MakeInstance(SC_SERVICE_OPCODEMAPPER,(ScDocShell*)pDoc->GetDocumentShell()),uno::UNO_QUERY);
@@ -657,6 +656,12 @@ uno::Reference< sheet::XFormulaOpCodeMapper> ScFormulaDlg::getFormulaOpCodeMappe
{
return m_xOpCodeMapper;
}
+
+table::CellAddress ScFormulaDlg::getReferencePosition() const
+{
+ return table::CellAddress(aCursorPos.Tab(),aCursorPos.Col(),aCursorPos.Row());
+}
+
::std::auto_ptr<formula::FormulaTokenArray> ScFormulaDlg::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
{
::std::auto_ptr<formula::FormulaTokenArray> pArray(new ScTokenArray());
diff --git a/sc/source/ui/inc/AccessibleContextBase.hxx b/sc/source/ui/inc/AccessibleContextBase.hxx
index 9460ade94421..8d312a0d13d9 100644
--- a/sc/source/ui/inc/AccessibleContextBase.hxx
+++ b/sc/source/ui/inc/AccessibleContextBase.hxx
@@ -53,7 +53,7 @@
#include <svtools/lstner.hxx>
#include <cppuhelper/compbase5.hxx>
#include <cppuhelper/implbase1.hxx>
-#include <unotools/servicehelper.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/broadcasthelper.hxx>
class Rectangle;
diff --git a/sc/source/ui/inc/attrdlg.hxx b/sc/source/ui/inc/attrdlg.hxx
index 45af08f59b07..fe881f988813 100644
--- a/sc/source/ui/inc/attrdlg.hxx
+++ b/sc/source/ui/inc/attrdlg.hxx
@@ -37,6 +37,15 @@ class Window;
class SfxViewFrame;
class SfxItemSet;
+#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
+#define LAYOUT_SFX_TABDIALOG_BROKEN 1
+#endif /* !LAYOUT_SFX_TABDIALOG_BROKEN */
+
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <sfx2/layout.hxx>
+#include <layout/layout-pre.hxx>
+#endif
+
//==================================================================
class ScAttrDlg : public SfxTabDialog
@@ -54,6 +63,9 @@ private:
DECL_LINK( OkHandler, void* ); // fuer DoppelClick-Beenden in TabPages
};
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <layout/layout-post.hxx>
+#endif
#endif // SC_ATTRDLG_HXX
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index 0bcb2fd20eb9..8e09b7350bb1 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -69,9 +69,6 @@ private:
DECL_LINK( ClipboardChanged, TransferableDataHelper* );
DECL_LINK( DialogClosed, AbstractScLinkedAreaDlg* );
- bool IsFullScreen() const;
- void SetFullScreen( bool bSet );
-
public:
TYPEINFO();
diff --git a/sc/source/ui/inc/condfrmt.hrc b/sc/source/ui/inc/condfrmt.hrc
index dcc1870a3e35..943e41219e7b 100644
--- a/sc/source/ui/inc/condfrmt.hrc
+++ b/sc/source/ui/inc/condfrmt.hrc
@@ -70,3 +70,7 @@
#define BTN_CANCEL 32
#define BTN_HELP 33
+#define BTN_COND1_NEW 34
+#define BTN_COND2_NEW 35
+#define BTN_COND3_NEW 36
+
diff --git a/sc/source/ui/inc/condfrmt.hxx b/sc/source/ui/inc/condfrmt.hxx
index 4e74bc6cb5db..db36fef2066a 100644
--- a/sc/source/ui/inc/condfrmt.hxx
+++ b/sc/source/ui/inc/condfrmt.hxx
@@ -71,6 +71,7 @@ private:
formula::RefButton aRbCond12;
FixedText aFtCond1Template;
ListBox aLbCond1Template;
+ PushButton aBtnNew1;
FixedLine aFlSep1;
CheckBox aCbxCond2;
@@ -83,6 +84,7 @@ private:
formula::RefButton aRbCond22;
FixedText aFtCond2Template;
ListBox aLbCond2Template;
+ PushButton aBtnNew2;
FixedLine aFlSep2;
CheckBox aCbxCond3;
@@ -95,6 +97,7 @@ private:
formula::RefButton aRbCond32;
FixedText aFtCond3Template;
ListBox aLbCond3Template;
+ PushButton aBtnNew3;
OKButton aBtnOk;
CancelButton aBtnCancel;
@@ -146,6 +149,7 @@ private:
DECL_LINK( GetFocusHdl, Control* );
DECL_LINK( LoseFocusHdl, Control* );
DECL_LINK( BtnHdl, PushButton* );
+ DECL_LINK( NewBtnHdl, PushButton* );
#endif // _CONDFRMT_CXX
};
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index 101caae8d999..21e295a58fa4 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -33,11 +33,10 @@
#include <tools/link.hxx>
#include "global.hxx"
-#include "postit.hxx"
#include "formula/grammar.hxx"
class ScEditEngineDefaulter;
-class SfxUndoAction;
+class SdrUndoAction;
class ScAddress;
class ScDocShell;
class ScMarkData;
@@ -47,7 +46,7 @@ class ScRangeName;
class ScBaseCell;
class ScTokenArray;
struct ScTabOpParam;
-
+class ScTableProtection;
// ---------------------------------------------------------------------------
@@ -67,7 +66,7 @@ public:
ScDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {}
~ScDocFunc() {}
- DECL_LINK( NotifyDrawUndo, SfxUndoAction* );
+ DECL_LINK( NotifyDrawUndo, SdrUndoAction* );
BOOL DetectiveAddPred(const ScAddress& rPos);
BOOL DetectiveDelPred(const ScAddress& rPos);
@@ -90,11 +89,12 @@ public:
BOOL bInterpret, BOOL bApi );
BOOL SetCellText( const ScAddress& rPos, const String& rText,
BOOL bInterpret, BOOL bEnglish, BOOL bApi,
+ const String& rFormulaNmsp,
const formula::FormulaGrammar::Grammar eGrammar );
// creates a new cell for use with PutCell
ScBaseCell* InterpretEnglishString( const ScAddress& rPos, const String& rText,
- const formula::FormulaGrammar::Grammar eGrammar );
+ const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar );
bool ShowNote( const ScAddress& rPos, bool bShow = true );
inline bool HideNote( const ScAddress& rPos ) { return ShowNote( rPos, false ); }
@@ -135,6 +135,8 @@ public:
BOOL RemovePageBreak( BOOL bColumn, const ScAddress& rPos,
BOOL bRecord, BOOL bSetModified, BOOL bApi );
+ void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
+
BOOL Protect( SCTAB nTab, const String& rPassword, BOOL bApi );
BOOL Unprotect( SCTAB nTab, const String& rPassword, BOOL bApi );
@@ -146,6 +148,7 @@ public:
BOOL EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
const ScTokenArray* pTokenArray,
const String& rString, BOOL bApi, BOOL bEnglish,
+ const String& rFormulaNmsp,
const formula::FormulaGrammar::Grammar );
BOOL TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index f8bfc53ddf44..b8b8d10f0c6e 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -103,7 +103,6 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
double nPrtToScreenFactor;
//! FontList* pFontList;
DocShell_Impl* pImpl;
- SfxUndoManager* pUndoManager;
ScDocFunc* pDocFunc;
//SfxObjectCreateMode eShellMode;
@@ -291,7 +290,8 @@ public:
BOOL IsEditable() const;
BOOL AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab );
- void UpdateAllRowHeights();
+ void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL );
+ void UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore = false );
#if OLD_PIVOT_IMPLEMENTATION
void PivotUpdate( ScPivot* pOldPivot, ScPivot* pNewPivot,
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index 6bc29b67e441..7e9ed68706ef 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -59,7 +59,6 @@ class TypedScStrCollection;
// Gemeinsame Resource-Objekte:
#define _COMMON_FILTER_RSCOBJS \
- FixedLine aFlOptions; \
CheckBox aBtnCase; \
CheckBox aBtnRegExp; \
CheckBox aBtnHeader; \
@@ -71,17 +70,12 @@ class TypedScStrCollection;
CheckBox aBtnDestPers; \
FixedText aFtDbAreaLabel; \
FixedInfo aFtDbArea; \
- OKButton aBtnOk; \
- CancelButton aBtnCancel; \
- HelpButton aBtnHelp; \
- MoreButton aBtnMore; \
const String aStrUndefined; \
const String aStrNoName; \
const String aStrNone;
#define _INIT_COMMON_FILTER_RSCOBJS \
- aFlOptions ( this, ScResId( FL_OPTIONS ) ), \
aBtnCase ( this, ScResId( BTN_CASE ) ), \
aBtnRegExp ( this, ScResId( BTN_REGEXP ) ), \
aBtnHeader ( this, ScResId( BTN_HEADER ) ), \
@@ -93,10 +87,6 @@ class TypedScStrCollection;
aBtnDestPers ( this, ScResId( BTN_DEST_PERS ) ), \
aFtDbAreaLabel ( this, ScResId( FT_DBAREA_LABEL ) ), \
aFtDbArea ( this, ScResId( FT_DBAREA ) ), \
- aBtnOk ( this, ScResId( BTN_OK ) ), \
- aBtnCancel ( this, ScResId( BTN_CANCEL ) ), \
- aBtnHelp ( this, ScResId( BTN_HELP ) ), \
- aBtnMore ( this, ScResId( BTN_MORE ) ), \
aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ), \
aStrNoName ( ScGlobal::GetRscString(STR_DB_NONAME) ), \
aStrNone ( ScResId( SCSTR_NONE ) ),
@@ -116,28 +106,46 @@ public:
virtual void SetActive();
virtual BOOL Close();
+ void SliderMoved();
+ USHORT GetSliderPos();
+ void RefreshEditRow( USHORT nOffset );
private:
FixedLine aFlCriteria;
//----------------------------
+ ListBox aLbConnect1;
ListBox aLbField1;
ListBox aLbCond1;
ComboBox aEdVal1;
//----------------------------
- ListBox aLbConnect1;
+ ListBox aLbConnect2;
ListBox aLbField2;
ListBox aLbCond2;
ComboBox aEdVal2;
//----------------------------
- ListBox aLbConnect2;
+ ListBox aLbConnect3;
ListBox aLbField3;
ListBox aLbCond3;
ComboBox aEdVal3;
//----------------------------
+ ListBox aLbConnect4;
+ ListBox aLbField4;
+ ListBox aLbCond4;
+ ComboBox aEdVal4;
+ //----------------------------
FixedText aFtConnect;
FixedText aFtField;
FixedText aFtCond;
FixedText aFtVal;
+ FixedLine aFlSeparator;
+
+ ScrollBar aScrollBar;
+
+ FixedLine aFlOptions;
+ MoreButton aBtnMore;
+ HelpButton aBtnHelp;
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
_COMMON_FILTER_RSCOBJS
@@ -155,9 +163,11 @@ private:
ScDocument* pDoc;
SCTAB nSrcTab;
- ComboBox* aValueEdArr[3];
- ListBox* aFieldLbArr[3];
- ListBox* aCondLbArr[3];
+ ComboBox* aValueEdArr[4];
+ ListBox* aFieldLbArr[4];
+ ListBox* aCondLbArr[4];
+ ListBox* aConnLbArr[4];
+ BOOL bRefreshExceptQuery[MAXQUERY];
USHORT nFieldCount;
BOOL bRefInputMode;
@@ -184,6 +194,7 @@ private:
DECL_LINK( CheckBoxHdl, CheckBox* );
DECL_LINK( EndDlgHdl, Button* );
DECL_LINK( MoreClickHdl, MoreButton* );
+ DECL_LINK( ScrollHdl, ScrollBar* );
// Hack: RefInput-Kontrolle
DECL_LINK( TimeOutHdl, Timer* );
@@ -212,8 +223,15 @@ private:
formula::RefEdit aEdFilterArea;
formula::RefButton aRbFilterArea;
+ FixedLine aFlOptions;
+
_COMMON_FILTER_RSCOBJS
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+ MoreButton aBtnMore;
+
ScFilterOptionsMgr* pOptionsMgr;
const USHORT nWhichQuery;
@@ -238,6 +256,7 @@ private:
DECL_LINK( FilterAreaSelHdl, ListBox* );
DECL_LINK( FilterAreaModHdl, formula::RefEdit* );
DECL_LINK( EndDlgHdl, Button* );
+ DECL_LINK( ScrollHdl, ScrollBar* );
// Hack: RefInput-Kontrolle
DECL_LINK( TimeOutHdl, Timer* );
diff --git a/sc/source/ui/inc/filter.hrc b/sc/source/ui/inc/filter.hrc
index 0948171a1e00..65e965b6bea3 100644
--- a/sc/source/ui/inc/filter.hrc
+++ b/sc/source/ui/inc/filter.hrc
@@ -68,6 +68,13 @@
#define ED_VAL2 33
#define ED_VAL3 34
#define FL_CRITERIA 35
+#define FL_SEPARATOR 36
+#define LB_OP3 37
+#define LB_FIELD4 38
+#define LB_COND4 39
+#define ED_VAL4 40
+#define LB_SCROLL 41
+#define LB_OP4 42
// Spezialfilter
diff --git a/sc/source/ui/inc/formula.hxx b/sc/source/ui/inc/formula.hxx
index a40a6092fe26..b25811eb9220 100644
--- a/sc/source/ui/inc/formula.hxx
+++ b/sc/source/ui/inc/formula.hxx
@@ -105,6 +105,7 @@ public:
virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const;
+ virtual ::com::sun::star::table::CellAddress getReferencePosition() const;
virtual BOOL Close();
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 9b31289d13d0..844d88055578 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -116,18 +116,19 @@ namespace sdr
public:
typedef ::std::vector< basegfx::B2DRange > RangeVector;
+ protected:
+ basegfx::B2DPolyPolygon impGetOverlayPolyPolygon() const;
+
private:
ScOverlayType mePaintType;
RangeVector maRectangles;
- virtual void drawGeometry(OutputDevice& rOutputDevice);
- virtual void createBaseRange(OutputDevice& rOutputDevice);
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
public:
OverlayObjectCell( ScOverlayType eType, const Color& rColor, const RangeVector& rRects);
virtual ~OverlayObjectCell();
-
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
};
} // end of namespace overlay
diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx
index 3c20903ddbb2..fb4dcaa83958 100644
--- a/sc/source/ui/inc/impex.hxx
+++ b/sc/source/ui/inc/impex.hxx
@@ -42,6 +42,17 @@ class SvStream;
class SfxMedium;
class ScAsciiOptions;
+struct ScExportTextOptions
+{
+ enum NewlineConversion { ToSystem, ToSpace, None };
+ ScExportTextOptions( NewlineConversion eNewlineConversion = ToSystem, sal_Unicode cSeparatorConvertTo = 0, bool bAddQuotes = false ) :
+ meNewlineConversion( eNewlineConversion ), mcSeparatorConvertTo( cSeparatorConvertTo ), mbAddQuotes( bAddQuotes ) {}
+
+ NewlineConversion meNewlineConversion;
+ sal_Unicode mcSeparatorConvertTo; // Convert separator to this character
+ bool mbAddQuotes;
+};
+
class ScImportExport
{
ScDocShell* pDocSh;
@@ -60,6 +71,7 @@ class ScImportExport
BOOL bUndo; // Mit Undo?
BOOL bOverflow; // zuviele Zeilen/Spalten
bool mbApi;
+ ScExportTextOptions mExportTextOptions;
ScAsciiOptions* pExtOptions; // erweiterte Optionen
@@ -138,6 +150,8 @@ public:
bool IsApi() const { return mbApi; }
void SetApi( bool bApi ) { mbApi = bApi; }
+ const ScExportTextOptions& GetExportTextOptions() { return mExportTextOptions; }
+ void SetExportTextOptions( const ScExportTextOptions& options ) { mExportTextOptions = options; }
};
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 4c1c8bd06eb8..2ed7b6d7c807 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -35,6 +35,7 @@
#include "address.hxx"
#include <tools/fract.hxx>
#include <tools/gen.hxx>
+#include <svx/svxenum.hxx>
class ScDocument;
class ScTabView;
@@ -101,7 +102,7 @@ private:
BOOL bProtected;
BOOL bCellHasPercentFormat;
ULONG nValidation;
- USHORT nAttrAdjust; // enum SvxCellHorJustify
+ SvxCellHorJustify eAttrAdjust;
Fraction aScaleX; // fuer Ref-MapMode
Fraction aScaleY;
@@ -189,6 +190,7 @@ public:
void NotifyChange( const ScInputHdlState* pState, BOOL bForce = FALSE,
ScTabViewShell* pSourceSh = NULL,
BOOL bStopEditing = TRUE);
+ void UpdateCellAdjust( SvxCellHorJustify eJust );
void ResetDelayTimer(); //BugId 54702
diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx
index a8edb19538e0..419a3beb2cfc 100644
--- a/sc/source/ui/inc/instbdlg.hxx
+++ b/sc/source/ui/inc/instbdlg.hxx
@@ -56,6 +56,9 @@
#include <vcl/field.hxx>
#include "expftext.hxx"
+#include <layout/layout.hxx>
+#include <layout/layout-pre.hxx>
+
class ScViewData;
class ScDocument;
class ScDocShell;
@@ -130,5 +133,7 @@ private:
#endif
};
+#include <layout/layout-post.hxx>
+
#endif // SC_INSTBDLG_HXX
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 2ea9c060bc4d..b48fa7fdffa2 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -38,6 +38,9 @@
#include <vcl/lstbox.hxx>
#include <vcl/fixed.hxx>
+#include <layout/layout.hxx>
+#include <layout/layout-pre.hxx>
+
//------------------------------------------------------------------------
class ScMoveTableDlg : public ModalDialog
@@ -72,6 +75,7 @@ private:
DECL_LINK( SelHdl, ListBox * );
};
+#include <layout/layout-post.hxx>
#endif // SC_MVTABDLG_HXX
diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 6a8e43fb2e7c..fd607975ff47 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -92,7 +92,7 @@ public:
Size aUserSize;
MapMode aUserMapMode;
- Paper ePaper;
+ Paper ePaper;
Orientation eOrientation;
USHORT nPaperBin;
};
diff --git a/sc/source/ui/inc/protectiondlg.hrc b/sc/source/ui/inc/protectiondlg.hrc
new file mode 100644
index 000000000000..79285d3ce125
--- /dev/null
+++ b/sc/source/ui/inc/protectiondlg.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.hrc,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sc.hrc>
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
+
+#define BTN_PROTECT 4
+#define FT_PASSWORD1 5
+#define ED_PASSWORD1 6
+#define FT_PASSWORD2 7
+#define ED_PASSWORD2 8
+#define FL_OPTIONS 9
+#define FT_OPTIONS 10
+#define CLB_OPTIONS 11
+
+#define ST_SELECT_LOCKED_CELLS 50
+#define ST_SELECT_UNLOCKED_CELLS 51
diff --git a/sc/source/ui/inc/protectiondlg.hxx b/sc/source/ui/inc/protectiondlg.hxx
new file mode 100644
index 000000000000..36330498c941
--- /dev/null
+++ b/sc/source/ui/inc/protectiondlg.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.hxx,v $
+ * $Revision: 1.1.2.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_UI_PROTECTION_DLG_HXX
+#define SC_UI_PROTECTION_DLG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <svx/checklbx.hxx>
+
+class Window;
+class ScTableProtection;
+
+class ScTableProtectionDlg : public ModalDialog
+{
+public:
+ explicit ScTableProtectionDlg(Window* pParent);
+ virtual ~ScTableProtectionDlg();
+
+ virtual short Execute();
+
+ void SetDialogData(const ScTableProtection& rData);
+
+ void WriteData(ScTableProtection& rData) const;
+
+private:
+ ScTableProtectionDlg(); // disabled
+
+ void Init();
+
+ void EnableOptionalWidgets(bool bEnable = true);
+
+ CheckBox maBtnProtect;
+
+ FixedText maPassword1Text;
+ Edit maPassword1Edit;
+ FixedText maPassword2Text;
+ Edit maPassword2Edit;
+
+ FixedLine maOptionsLine;
+ FixedText maOptionsText;
+ SvxCheckListBox maOptionsListBox;
+
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+
+ String maSelectLockedCells;
+ String maSelectUnlockedCells;
+
+ DECL_LINK( OKHdl, OKButton* );
+ DECL_LINK( CheckBoxHdl, CheckBox* );
+ DECL_LINK( PasswordModifyHdl, Edit* );
+};
+
+#endif
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
index b0fd8a02c946..b7a71aebc1fe 100644
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ b/sc/source/ui/inc/pvlaydlg.hxx
@@ -48,6 +48,7 @@
#include "pivot.hxx"
#include "anyrefdg.hxx"
#include "fieldwnd.hxx"
+#include "formula/funcutl.hxx"
/*==========================================================================*\
@@ -129,10 +130,18 @@ private:
FixedInfo aFtInfo;
FixedLine aFlAreas;
+
+ // DP source selection
+ FixedText aFtInArea;
+ ::formula::RefEdit aEdInPos;
+ ::formula::RefButton aRbInPos;
+
+ // DP output location
ListBox aLbOutPos;
FixedText aFtOutArea;
- formula::RefEdit aEdOutPos;
- formula::RefButton aRbOutPos;
+ formula::RefEdit aEdOutPos;
+ formula::RefButton aRbOutPos;
+
CheckBox aBtnIgnEmptyRows;
CheckBox aBtnDetectCat;
CheckBox aBtnTotalCol;
@@ -155,6 +164,8 @@ private:
size_t nDnDFromIndex;
BOOL bIsDrag;
+ ::formula::RefEdit* pEditActive;
+
Rectangle aRectPage;
Rectangle aRectRow;
Rectangle aRectCol;
@@ -173,6 +184,7 @@ private:
ScDPFuncDataVec aDataArr;
ScDPObjectPtr xDlgDPObject;
+ ScRange aOldRange;
ScPivotParam thePivotData;
ScViewData* pViewData;
ScDocument* pDoc;
@@ -184,6 +196,7 @@ private:
void InitWndSelect ( LabelData** ppLabelArr, long nLabels );
void InitWnd ( PivotField* pArr, long nCount, ScDPFieldType eType );
void InitFocus ();
+ void InitFields ();
void CalcWndSizes ();
Point DlgPos2WndPos ( const Point& rPt, Window& rWnd );
ScDPLabelData* GetLabelData ( SCsCOL nCol, size_t* pPos = NULL );
@@ -207,14 +220,19 @@ private:
USHORT& rColCount,
USHORT& rRowCount,
USHORT& rDataCount );
+
+ void UpdateSrcRange();
+
// Handler
DECL_LINK( ClickHdl, PushButton * );
DECL_LINK( ScrollHdl, ScrollBar * );
DECL_LINK( SelAreaHdl, ListBox * );
DECL_LINK( MoreClickHdl, MoreButton * );
DECL_LINK( EdModifyHdl, Edit * );
+ DECL_LINK( EdInModifyHdl, Edit * );
DECL_LINK( OkHdl, OKButton * );
DECL_LINK( CancelHdl, CancelButton * );
+ DECL_LINK( GetFocusHdl, Control* );
};
diff --git a/sc/source/ui/inc/retypepassdlg.hrc b/sc/source/ui/inc/retypepassdlg.hrc
new file mode 100644
index 000000000000..fe0f7e8a760a
--- /dev/null
+++ b/sc/source/ui/inc/retypepassdlg.hrc
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: retypepassdlg.hrc,v $
+ * $Revision: 1.1.2.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <sc.hrc>
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
+
+#define FT_DESC 10
+#define FL_DOCUMENT 11
+#define FT_DOCSTATUS 12
+#define BTN_RETYPE_DOC 13
+
+#define FL_SHEET 112
+
+#define FT_SHEETNAME1 113
+#define FT_SHEETSTATUS1 114
+#define BTN_RETYPE_SHEET1 115
+
+#define FT_SHEETNAME2 116
+#define FT_SHEETSTATUS2 117
+#define BTN_RETYPE_SHEET2 118
+
+#define FT_SHEETNAME3 119
+#define FT_SHEETSTATUS3 120
+#define BTN_RETYPE_SHEET3 121
+
+#define FT_SHEETNAME4 122
+#define FT_SHEETSTATUS4 123
+#define BTN_RETYPE_SHEET4 124
+
+#define SB_SCROLL 190
+
+#define STR_NOT_PROTECTED 200
+#define STR_NOT_PASS_PROTECTED 201
+#define STR_HASH_BAD 202
+#define STR_HASH_GOOD 203
+#define STR_HASH_REGENERATED 204
+
+#define FT_PASSWORD1 301
+#define ED_PASSWORD1 302
+#define FT_PASSWORD2 303
+#define ED_PASSWORD2 304
+#define BTN_MATCH_OLD_PASSWORD 305
+#define BTN_RETYPE_PASSWORD 306
+#define BTN_REMOVE_PASSWORD 307
diff --git a/sc/source/ui/inc/retypepassdlg.hxx b/sc/source/ui/inc/retypepassdlg.hxx
new file mode 100644
index 000000000000..657773d112f7
--- /dev/null
+++ b/sc/source/ui/inc/retypepassdlg.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: retypepassdlg.hxx,v $
+ * $Revision: 1.1.2.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SC_UI_RETYPEPASS_DLG_HXX
+#define SC_UI_RETYPEPASS_DLG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/scrbar.hxx>
+#include <svx/checklbx.hxx>
+#include <svtools/stdctrl.hxx>
+
+#include "tabprotection.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+class Window;
+class ScDocProtection;
+class ScTableProtection;
+class ScDocument;
+
+class ScRetypePassDlg : public ModalDialog
+{
+public:
+ typedef ::boost::shared_ptr<ScDocProtection> DocProtectionPtr;
+ typedef ::boost::shared_ptr<ScTableProtection> TabProtectionPtr;
+
+ explicit ScRetypePassDlg(Window* pParent);
+ virtual ~ScRetypePassDlg();
+
+ virtual short Execute();
+
+ void SetDataFromDocument(const ScDocument& rDoc);
+ void SetDesiredHash(ScPasswordHash eHash);
+
+ /** Write the new set of password data to the document instance to
+ overwrite the current ones. */
+ void WriteNewDataToDocument(ScDocument& rDoc) const;
+
+private:
+ ScRetypePassDlg(); // disabled
+
+ void Init();
+ void PopulateDialog();
+ void SetDocData();
+ void SetTableData(size_t nRowPos, SCTAB nTab);
+ void ResetTableRows();
+
+ /** Check the status of all hash values to see if it's okay to enable
+ the OK button. */
+ void CheckHashStatus();
+
+private:
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+
+ FixedInfo maTextDescription;
+
+ FixedLine maLineDocument;
+ FixedText maTextDocStatus;
+ PushButton maBtnRetypeDoc;
+
+ FixedLine maLineSheet;
+ FixedText maTextSheetName1;
+ FixedText maTextSheetStatus1;
+ PushButton maBtnRetypeSheet1;
+
+ FixedText maTextSheetName2;
+ FixedText maTextSheetStatus2;
+ PushButton maBtnRetypeSheet2;
+
+ FixedText maTextSheetName3;
+ FixedText maTextSheetStatus3;
+ PushButton maBtnRetypeSheet3;
+
+ FixedText maTextSheetName4;
+ FixedText maTextSheetStatus4;
+ PushButton maBtnRetypeSheet4;
+
+ ScrollBar maScrollBar;
+
+ String maTextNotProtected;
+ String maTextNotPassProtected;
+ String maTextHashBad;
+ String maTextHashGood;
+ String maTextHashRegen;
+
+ DECL_LINK( OKHdl, OKButton* );
+ DECL_LINK( RetypeBtnHdl, PushButton* );
+ DECL_LINK( ScrollHdl, ScrollBar* );
+
+ struct TableItem
+ {
+ String maName;
+ TabProtectionPtr mpProtect;
+ };
+ ::std::vector<TableItem> maTableItems;
+
+ DocProtectionPtr mpDocItem;
+ size_t mnCurScrollPos;
+ ScPasswordHash meDesiredHash;
+};
+
+// ============================================================================
+
+class ScRetypePassInputDlg : public ModalDialog
+{
+public:
+ explicit ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected);
+ virtual ~ScRetypePassInputDlg();
+
+ virtual short Execute();
+
+ bool IsRemovePassword() const;
+ String GetNewPassword() const;
+
+private:
+ ScRetypePassInputDlg(); // disabled
+
+ void Init();
+ void CheckPasswordInput();
+
+private:
+ OKButton maBtnOk;
+ CancelButton maBtnCancel;
+ HelpButton maBtnHelp;
+
+ RadioButton maBtnRetypePassword;
+
+ FixedText maPassword1Text;
+ Edit maPassword1Edit;
+ FixedText maPassword2Text;
+ Edit maPassword2Edit;
+
+ CheckBox maBtnMatchOldPass;
+
+ RadioButton maBtnRemovePassword;
+
+ DECL_LINK( OKHdl, OKButton* );
+ DECL_LINK( RadioBtnHdl, RadioButton* );
+ DECL_LINK( CheckBoxHdl, CheckBox* );
+ DECL_LINK( PasswordModifyHdl, Edit* );
+
+ ScPassHashProtectable* mpProtected;
+};
+
+#endif
diff --git a/sc/source/ui/inc/scui_def.hxx b/sc/source/ui/inc/scui_def.hxx
index 231c983db69a..e2a11bb3204c 100644
--- a/sc/source/ui/inc/scui_def.hxx
+++ b/sc/source/ui/inc/scui_def.hxx
@@ -53,6 +53,8 @@
#define BTN_PASTE_NAME 100 // from namepast.hxx
#define BTN_PASTE_LIST 101 // from namepast.hxx
+#define BTN_EXTEND_RANGE 150
+#define BTN_CURRENT_SELECTION 151
#define SCRET_REMOVE 0x42 //from subtdlg.hxx
#endif
diff --git a/sc/source/ui/inc/sortdlg.hrc b/sc/source/ui/inc/sortdlg.hrc
index 902606429596..8f2f641e7574 100644
--- a/sc/source/ui/inc/sortdlg.hrc
+++ b/sc/source/ui/inc/sortdlg.hrc
@@ -32,6 +32,7 @@
#include "sc.hrc" // -> RID_SCDLG_SORT
// -> RID_SCPAGE_SORT_FIELDS
// -> RID_SCPAGE_SORT_OPTIONS
+ // -> RID_SCDLG_SORT_WARNING
// -> SCSTR_NONAME
// -> SCSTR_UNDEFINED
// -> SCSTR_FIELD
@@ -40,6 +41,7 @@
#define RID_SCDLG_SORT 256
#define RID_SCPAGE_SORT_FIELDS 257
#define RID_SCPAGE_SORT_OPTIONS 258
+#define RID_SCDLG_SORT_WARNING
*/
#define TP_FIELDS 1
@@ -80,6 +82,12 @@
#define FT_ALGORITHM 18
#define LB_ALGORITHM 19
+//#define RID_SCDLG_SORT_WARNING
+#define FT_TEXT 1
+#define FT_TIP 2
+#define BTN_EXTSORT 3
+#define BTN_CURSORT 4
+#define BTN_CANCEL 5
diff --git a/sc/source/ui/inc/sortdlg.hxx b/sc/source/ui/inc/sortdlg.hxx
index c5cf9c28d0cc..d1ffb8aac0ed 100644
--- a/sc/source/ui/inc/sortdlg.hxx
+++ b/sc/source/ui/inc/sortdlg.hxx
@@ -32,11 +32,19 @@
#define SC_SORTDLG_HXX
#include <sfx2/tabdlg.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include "scui_def.hxx" //CHINA001
-#ifndef _SFX_HXX
-#endif
+#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
+#define LAYOUT_SFX_TABDIALOG_BROKEN 1
+#endif /* !LAYOUT_SFX_TABDIALOG_BROKEN */
-//==================================================================
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <sfx2/layout.hxx>
+#include <layout/layout-pre.hxx>
+#endif
class ScSortDlg : public SfxTabDialog
{
@@ -61,7 +69,22 @@ inline void ScSortDlg::SetByRows ( BOOL bByRows ) { bIsByRows = bByRows; }
inline BOOL ScSortDlg::GetHeaders() const { return bIsHeaders; }
inline BOOL ScSortDlg::GetByRows () const { return bIsByRows; }
+class ScSortWarningDlg : public ModalDialog
+{
+public:
+ ScSortWarningDlg( Window* pParent, const String& rExtendText,const String& rCurrentText );
+ ~ScSortWarningDlg();
+ DECL_LINK( BtnHdl, PushButton* );
+private:
+ FixedText aFtText;
+ FixedText aFtTip;
+ PushButton aBtnExtSort;
+ PushButton aBtnCurSort;
+ CancelButton aBtnCancel;
+};
-#endif // SC_SORTDLG_HXX
-
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <layout/layout-post.hxx>
+#endif
+#endif // SC_SORTDLG_HXX
diff --git a/sc/source/ui/inc/strindlg.hxx b/sc/source/ui/inc/strindlg.hxx
index bb82123ab20d..3c812cc7b5c2 100644
--- a/sc/source/ui/inc/strindlg.hxx
+++ b/sc/source/ui/inc/strindlg.hxx
@@ -37,6 +37,9 @@
#include <vcl/imagebtn.hxx>
#include <vcl/edit.hxx>
+#include <layout/layout.hxx>
+#include <layout/layout-pre.hxx>
+
//------------------------------------------------------------------------
class ScStringInputDlg : public ModalDialog
@@ -59,6 +62,7 @@ private:
HelpButton aBtnHelp;
};
+#include <layout/layout-post.hxx>
#endif // SC_STRINDLG_HXX
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index d6b7583808d8..d7b5e2a8260b 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -472,6 +472,7 @@ public:
void SelectAll( BOOL bContinue = FALSE );
void SelectAllTables();
+ void DeselectAllTables();
void MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
BOOL bCols = FALSE, BOOL bRows = FALSE, BOOL bCellSelection = FALSE );
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index bc70ea9a7428..10224536bf0b 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -33,11 +33,13 @@
#include <sfx2/viewsh.hxx>
#include <sfx2/viewfac.hxx>
+#include <svx/svxenum.hxx>
#include "scdllapi.h"
#include "dbfunc.hxx" // -> tabview
#include "target.hxx"
#include "rangelst.hxx" // ScRangeListRef
#include "shellids.hxx"
+#include "tabprotection.hxx" // for ScPasswordHash
class FmFormShell;
class SbxObject;
@@ -257,6 +259,7 @@ public:
ScInputHandler* GetInputHandler() const;
void UpdateInputHandler( BOOL bForce = FALSE, BOOL bStopEditing = TRUE );
+ void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
BOOL TabKeyInput(const KeyEvent& rKEvt);
BOOL SfxKeyInput(const KeyEvent& rKEvt);
@@ -428,6 +431,8 @@ public:
void BroadcastAccessibility( const SfxHint &rHint );
BOOL HasAccessibilityObjects();
+ bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
+
using ScTabView::ShowCursor;
};
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index a3cbffb4c39e..dfa8c9cb8cf3 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -132,6 +132,13 @@ class ScRangeData;
class CollatorRessource;
class CollatorWrapper;
+#if ENABLE_LAYOUT_EXPERIMENTAL
+#include <sfx2/layout.hxx>
+#include <layout/layout-pre.hxx>
+#else /* !ENABLE_LAYOUT_EXPERIMENTAL */
+#define LocalizedString String
+#endif /* !ENABLE_LAYOUT_EXPERIMENTAL */
+
class ScTabPageSortOptions : public SfxTabPage
{
public:
@@ -139,6 +146,8 @@ public:
const SfxItemSet& rArgSet );
~ScTabPageSortOptions();
+#undef SfxTabPage
+#define SfxTabPage ::SfxTabPage
static SfxTabPage* Create ( Window* pParent,
const SfxItemSet& rArgSet );
static USHORT* GetRanges ();
@@ -177,9 +186,9 @@ private:
FixedText aFtAreaLabel;
// FixedInfo aFtArea;
- String aStrRowLabel;
- String aStrColLabel;
- String aStrUndefined;
+ LocalizedString aStrRowLabel;
+ LocalizedString aStrColLabel;
+ LocalizedString aStrUndefined;
String aStrNoName;
String aStrAreaLabel;
@@ -208,7 +217,9 @@ private:
#endif
};
-
+#if ENABLE_LAYOUT_EXPERIMENTAL
+#include <layout/layout-post.hxx>
+#endif /* ENABLE_LAYOUT_EXPERIMENTAL */
#endif // SC_TPSORT_HXX
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index d357461d0f5e..281f44f4fe82 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -36,6 +36,7 @@
#include "spellparam.hxx"
class ScDocShell;
+class ScBaseCell;
class ScDocument;
class ScOutlineTable;
class ScRangeName;
@@ -592,6 +593,35 @@ private:
void SetChangeTrack();
};
+class ScUndoRefConversion: public ScSimpleUndo
+{
+public:
+ TYPEINFO();
+ ScUndoRefConversion( ScDocShell* pNewDocShell,
+ const ScRange& aMarkRange, const ScMarkData& rMark,
+ ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc, BOOL bNewMulti, USHORT nNewFlag);
+ virtual ~ScUndoRefConversion();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual void Repeat(SfxRepeatTarget& rTarget);
+ virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
+
+ virtual String GetComment() const;
+
+private:
+ ScMarkData aMarkData;
+ ScDocument* pUndoDoc;
+ ScDocument* pRedoDoc;
+ ScRange aRange;
+ BOOL bMulti;
+ USHORT nFlags;
+ ULONG nStartChangeAction;
+ ULONG nEndChangeAction;
+
+ void DoChange( ScDocument* pRefDoc);
+ void SetChangeTrack();
+};
class ScUndoListNames: public ScBlockUndo
{
diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx
index ff76ebd16702..1eadf24041db 100644
--- a/sc/source/ui/inc/undotab.hxx
+++ b/sc/source/ui/inc/undotab.hxx
@@ -52,11 +52,15 @@
#include <com/sun/star/uno/Sequence.hxx>
+#include <memory>
+
class ScDocShell;
class ScDocument;
class SdrUndoAction;
class ScPrintRangeSaver;
class SdrObject;
+class ScDocProtection;
+class ScTableProtection;
//----------------------------------------------------------------------------
@@ -335,14 +339,15 @@ private:
void DoChange( BOOL bShow ) const;
};
+// ============================================================================
-class ScUndoProtect : public ScSimpleUndo
+/** This class implements undo & redo of document protect & unprotect
+ operations. */
+class ScUndoDocProtect : public ScSimpleUndo
{
public:
- TYPEINFO();
- ScUndoProtect( ScDocShell* pShell, SCTAB nNewTab,
- BOOL bNewProtect, const com::sun::star::uno::Sequence<sal_Int8>& rNewPassword );
- virtual ~ScUndoProtect();
+ ScUndoDocProtect(ScDocShell* pShell, ::std::auto_ptr<ScDocProtection> pProtectSettings);
+ virtual ~ScUndoDocProtect();
virtual void Undo();
virtual void Redo();
@@ -352,11 +357,34 @@ public:
virtual String GetComment() const;
private:
- SCTAB nTab;
- BOOL bProtect;
- com::sun::star::uno::Sequence<sal_Int8> aPassword;
+ ::std::auto_ptr<ScDocProtection> mpProtectSettings;
+
+ void DoProtect(bool bProtect);
+};
+
+// ============================================================================
+
+/** This class implements undo & redo of both protect and unprotect of
+ sheet. */
+class ScUndoTabProtect : public ScSimpleUndo
+{
+public:
+ ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab,
+ ::std::auto_ptr<ScTableProtection> pProtectSettings);
+ virtual ~ScUndoTabProtect();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual void Repeat(SfxRepeatTarget& rTarget);
+ virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
+
+ virtual String GetComment() const;
+
+private:
+ SCTAB mnTab;
+ ::std::auto_ptr<ScTableProtection> mpProtectSettings;
- void DoProtect( BOOL bDo );
+ void DoProtect(bool bProtect);
};
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 0759d1fe2893..228c4b4c1489 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -69,6 +69,7 @@ class Exchange;
class ScRangeList;
class SvxHyperlinkItem;
class ScTransferObj;
+class ScTableProtection;
namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
@@ -199,6 +200,8 @@ public:
void ChangeIndent( BOOL bIncrement );
+ void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
+
void Protect( SCTAB nTab, const String& rPassword );
BOOL Unprotect( SCTAB nTab, const String& rPassword );
@@ -300,6 +303,7 @@ public:
void SetNoteText( const ScAddress& rPos, const String& rNoteText );
void ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate );
+ void DoRefConversion( BOOL bRecord = TRUE );
//UNUSED2008-05 void DoSpellingChecker( BOOL bRecord = TRUE );
void DoHangulHanjaConversion( BOOL bRecord = TRUE );
diff --git a/sc/source/ui/inc/viewutil.hxx b/sc/source/ui/inc/viewutil.hxx
index 77d82c258aca..bfc24e36b464 100644
--- a/sc/source/ui/inc/viewutil.hxx
+++ b/sc/source/ui/inc/viewutil.hxx
@@ -38,6 +38,8 @@ class String;
class SfxItemSet;
class SfxBindings;
class SvxFontItem;
+class SfxViewShell;
+class SfxViewFrame;
class ScChangeAction;
class ScChangeViewSettings;
@@ -54,6 +56,7 @@ class ScViewUtil // static Methoden
{
public:
static BOOL ExecuteCharMap( const SvxFontItem& rOldFont,
+ SfxViewFrame& rFrame,
SvxFontItem& rNewFont,
String& rString );
@@ -75,6 +78,11 @@ public:
static void UnmarkFiltered( ScMarkData& rMark, ScDocument* pDoc );
static void HideDisabledSlot( SfxItemSet& rSet, SfxBindings& rBindings, USHORT nSlotId );
+
+ /** Returns true, if the passed view shell is in full screen mode. */
+ static bool IsFullScreen( SfxViewShell& rViewShell );
+ /** Enters or leaves full screen mode at the passed view shell. */
+ static void SetFullScreen( SfxViewShell& rViewShell, bool bSet );
};
// ---------------------------------------------------------------------------
diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx
index 621e066976c4..72ebb9f08cbb 100644
--- a/sc/source/ui/miscdlgs/instbdlg.cxx
+++ b/sc/source/ui/miscdlgs/instbdlg.cxx
@@ -55,6 +55,17 @@
#define SC_INSTBDLG_CXX
#include "instbdlg.hxx"
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef ScResId
+#define ScResId(x) #x
+#undef ModalDialog
+#define ModalDialog( parent, id ) Dialog( parent, "insert-sheet.xml", id )
+#undef ErrorBox
+#define ErrorBox( this, bits, message ) ErrorBox (LAYOUT_THIS_WINDOW (this), bits, message)
+#endif /* ENABLE_LAYOUT */
+
//==================================================================
ScInsertTableDlg::ScInsertTableDlg( Window* pParent, ScViewData& rData, SCTAB nTabCount, bool bFromFile )
@@ -86,6 +97,10 @@ ScInsertTableDlg::ScInsertTableDlg( Window* pParent, ScViewData& rData, SCTAB nT
nSelTabIndex ( 0 ),
nTableCount (nTabCount)
{
+#if ENABLE_LAYOUT
+ SetHelpId (SID_INSERT_TABLE);
+ aFtPath.SetText (EMPTY_STRING);
+#endif /* ENABLE_LAYOUT */
Init_Impl( bFromFile );
FreeResource();
}
@@ -152,11 +167,16 @@ void ScInsertTableDlg::Init_Impl( bool bFromFile )
//------------------------------------------------------------------------
+#if ENABLE_LAYOUT
+#undef ModalDialog
+#define ModalDialog Dialog
+#endif /* ENABLE_LAYOUT */
+
short __EXPORT ScInsertTableDlg::Execute()
{
// set Parent of DocumentInserter and Doc-Manager
Window* pOldDefParent = Application::GetDefDialogParent();
- Application::SetDefDialogParent( this );
+ Application::SetDefDialogParent( LAYOUT_THIS_WINDOW (this) );
if ( aBtnFromFile.IsChecked() )
aBrowseTimer.Start();
diff --git a/sc/source/ui/miscdlgs/makefile.mk b/sc/source/ui/miscdlgs/makefile.mk
index 988b288da625..66e1f33618e2 100644
--- a/sc/source/ui/miscdlgs/makefile.mk
+++ b/sc/source/ui/miscdlgs/makefile.mk
@@ -78,7 +78,9 @@ SLOFILES = \
$(SLO)$/warnbox.obj \
$(SLO)$/scuiautofmt.obj \
$(SLO)$/conflictsdlg.obj \
- $(SLO)$/sharedocdlg.obj
+ $(SLO)$/sharedocdlg.obj \
+ $(SLO)$/protectiondlg.obj \
+ $(SLO)$/retypepassdlg.obj
EXCEPTIONSFILES = \
$(SLO)$/acredlin.obj \
@@ -87,7 +89,9 @@ EXCEPTIONSFILES = \
$(SLO)$/optsolver.obj \
$(SLO)$/solveroptions.obj \
$(SLO)$/crnrdlg.obj \
- $(SLO)$/solverutil.obj
+ $(SLO)$/solverutil.obj \
+ $(SLO)$/protectiondlg.obj \
+ $(SLO)$/retypepassdlg.obj
SRS1NAME=$(TARGET)
SRC1FILES = \
@@ -96,7 +100,9 @@ SRC1FILES = \
highred.src \
linkarea.src \
conflictsdlg.src \
- sharedocdlg.src
+ sharedocdlg.src \
+ protectiondlg.src \
+ retypepassdlg.src
LIB1TARGET = $(SLB)$/$(TARGET).lib
@@ -116,7 +122,9 @@ LIB1OBJFILES = \
$(SLO)$/redcom.obj \
$(SLO)$/warnbox.obj \
$(SLO)$/conflictsdlg.obj \
- $(SLO)$/sharedocdlg.obj
+ $(SLO)$/sharedocdlg.obj \
+ $(SLO)$/protectiondlg.obj \
+ $(SLO)$/retypepassdlg.obj
# --- Tagets -------------------------------------------------------
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 2a560d2ba0a8..822ff23d9994 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -47,6 +47,15 @@
#include "scresid.hxx"
#include "globstr.hrc"
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef ScResId
+#define ScResId(x) #x
+#undef ModalDialog
+#define ModalDialog( parent, id ) Dialog( parent, "move-copy-sheet.xml", id )
+#endif /* ENABLE_LAYOUT */
+
//==================================================================
ScMoveTableDlg::ScMoveTableDlg( Window* pParent )
@@ -66,6 +75,10 @@ ScMoveTableDlg::ScMoveTableDlg( Window* pParent )
nTable ( 0 ),
bCopyTable ( FALSE )
{
+#if ENABLE_LAYOUT
+#undef ScResId
+ SetHelpId (FID_TAB_MOVE);
+#endif /* ENABLE_LAYOUT */
Init();
FreeResource();
}
diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx
new file mode 100644
index 000000000000..a5116ef61d66
--- /dev/null
+++ b/sc/source/ui/miscdlgs/protectiondlg.cxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.cxx,v $
+ * $Revision: 1.1.2.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "protectiondlg.hxx"
+#include "protectiondlg.hrc"
+#include "scresid.hxx"
+#include "tabprotection.hxx"
+
+#include <vcl/msgbox.hxx>
+
+
+// The order must match that of the list box.
+static const ScTableProtection::Option aOptions[] = {
+ ScTableProtection::SELECT_LOCKED_CELLS,
+ ScTableProtection::SELECT_UNLOCKED_CELLS,
+};
+static const USHORT nOptionCount = sizeof(aOptions)/sizeof(aOptions[0]);
+
+
+ScTableProtectionDlg::ScTableProtectionDlg(Window* pParent) :
+ ModalDialog(pParent, ScResId(RID_SCDLG_TABPROTECTION)),
+
+ maBtnProtect (this, ScResId(BTN_PROTECT)),
+ maPassword1Text (this, ScResId(FT_PASSWORD1)),
+ maPassword1Edit (this, ScResId(ED_PASSWORD1)),
+ maPassword2Text (this, ScResId(FT_PASSWORD2)),
+ maPassword2Edit (this, ScResId(ED_PASSWORD2)),
+ maOptionsLine (this, ScResId(FL_OPTIONS)),
+ maOptionsText (this, ScResId(FT_OPTIONS)),
+ maOptionsListBox(this, ScResId(CLB_OPTIONS)),
+
+ maBtnOk (this, ScResId(BTN_OK)),
+ maBtnCancel (this, ScResId(BTN_CANCEL)),
+ maBtnHelp (this, ScResId(BTN_HELP)),
+
+ maSelectLockedCells(ScResId(ST_SELECT_LOCKED_CELLS)),
+ maSelectUnlockedCells(ScResId(ST_SELECT_UNLOCKED_CELLS))
+{
+ Init();
+ FreeResource();
+}
+
+ScTableProtectionDlg::~ScTableProtectionDlg()
+{
+}
+
+short ScTableProtectionDlg::Execute()
+{
+ return ModalDialog::Execute();
+}
+
+void ScTableProtectionDlg::SetDialogData(const ScTableProtection& rData)
+{
+ for (USHORT i = 0; i < nOptionCount; ++i)
+ maOptionsListBox.CheckEntryPos(i, rData.isOptionEnabled(aOptions[i]));
+}
+
+void ScTableProtectionDlg::WriteData(ScTableProtection& rData) const
+{
+ rData.setProtected(maBtnProtect.IsChecked());
+
+ // We assume that the two password texts match.
+ rData.setPassword(maPassword1Edit.GetText());
+
+ for (USHORT i = 0; i < nOptionCount; ++i)
+ rData.setOption(aOptions[i], maOptionsListBox.IsChecked(i));
+}
+
+void ScTableProtectionDlg::Init()
+{
+ Link aLink = LINK( this, ScTableProtectionDlg, CheckBoxHdl );
+ maBtnProtect.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScTableProtectionDlg, OKHdl );
+ maBtnOk.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScTableProtectionDlg, PasswordModifyHdl );
+ maPassword1Edit.SetModifyHdl(aLink);
+ maPassword2Edit.SetModifyHdl(aLink);
+
+ maOptionsListBox.SetUpdateMode(false);
+ maOptionsListBox.Clear();
+
+ maOptionsListBox.InsertEntry(maSelectLockedCells);
+ maOptionsListBox.InsertEntry(maSelectUnlockedCells);
+
+ maOptionsListBox.CheckEntryPos(0, true);
+ maOptionsListBox.CheckEntryPos(1, true);
+
+ maOptionsListBox.SetUpdateMode(true);
+
+ // Set the default state of the dialog.
+ maBtnProtect.Check(true);
+ maPassword1Edit.GrabFocus();
+}
+
+void ScTableProtectionDlg::EnableOptionalWidgets(bool bEnable)
+{
+ maPassword1Text.Enable(bEnable);
+ maPassword1Edit.Enable(bEnable);
+ maPassword2Text.Enable(bEnable);
+ maPassword2Edit.Enable(bEnable);
+ maOptionsLine.Enable(bEnable);
+ maOptionsText.Enable(bEnable);
+
+ maOptionsListBox.Enable(bEnable);
+ maOptionsListBox.Invalidate();
+}
+
+IMPL_LINK( ScTableProtectionDlg, CheckBoxHdl, CheckBox*, pBtn )
+{
+ if (pBtn == &maBtnProtect)
+ {
+ bool bChecked = maBtnProtect.IsChecked();
+ EnableOptionalWidgets(bChecked);
+ maBtnOk.Enable(bChecked);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( ScTableProtectionDlg, OKHdl, OKButton*, EMPTYARG )
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+IMPL_LINK( ScTableProtectionDlg, PasswordModifyHdl, Edit*, EMPTYARG )
+{
+ String aPass1 = maPassword1Edit.GetText();
+ String aPass2 = maPassword2Edit.GetText();
+ maBtnOk.Enable(aPass1.Equals(aPass2));
+ return 0;
+}
diff --git a/sc/source/ui/miscdlgs/protectiondlg.src b/sc/source/ui/miscdlgs/protectiondlg.src
new file mode 100644
index 000000000000..4919f93ca6f4
--- /dev/null
+++ b/sc/source/ui/miscdlgs/protectiondlg.src
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.src,v $
+ * $Revision: 1.1.2.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "protectiondlg.hrc"
+
+ModalDialog RID_SCDLG_TABPROTECTION
+{
+ Text [ en-US ] = "Protect Sheet" ;
+ Size = MAP_APPFONT ( 220 , 135 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 164 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 164 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 164 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+
+ CheckBox BTN_PROTECT
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 150 , 10 );
+
+ Text [ en-US ] = "P~rotect this sheet and the contents of locked cells" ;
+ };
+
+ FixedText FT_PASSWORD1
+ {
+ Pos = MAP_APPFONT ( 11, 23 );
+ Size = MAP_APPFONT ( 42, 10 );
+
+ Text [ en-US ] = "~Password" ;
+ };
+
+ Edit ED_PASSWORD1
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT ( 56, 22 );
+ Size = MAP_APPFONT ( 75, 12 );
+ };
+
+ FixedText FT_PASSWORD2
+ {
+ Pos = MAP_APPFONT ( 11, 40 );
+ Size = MAP_APPFONT ( 42, 10 );
+
+ Text [ en-US ] = "~Confirm" ;
+ };
+
+ Edit ED_PASSWORD2
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT ( 56, 39 );
+ Size = MAP_APPFONT ( 75, 12 );
+ };
+
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6, 60 );
+ Size = MAP_APPFONT ( 150, 8 );
+
+ Text [ en-US ] = "Options";
+ };
+
+ FixedText FT_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 11, 74 );
+ Size = MAP_APPFONT ( 140, 8 );
+
+ Text [ en-US ] = "Allow all users of this sheet to:";
+ };
+
+ Control CLB_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 11, 85 );
+ Size = MAP_APPFONT ( 140, 40 );
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ String ST_SELECT_LOCKED_CELLS
+ {
+ Text [ en-US ] = "Select locked cells";
+ };
+
+ String ST_SELECT_UNLOCKED_CELLS
+ {
+ Text [ en-US ] = "Select unlocked cells";
+ };
+};
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx
new file mode 100644
index 000000000000..84a008f68f5f
--- /dev/null
+++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx
@@ -0,0 +1,547 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: retypepassdlg.cxx,v $
+ * $Revision: 1.1.2.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "retypepassdlg.hxx"
+#include "retypepassdlg.hrc"
+#include "scresid.hxx"
+#include "document.hxx"
+#include "tabprotection.hxx"
+
+#include <stdio.h>
+
+#include <vcl/msgbox.hxx>
+
+ScRetypePassDlg::ScRetypePassDlg(Window* pParent) :
+ ModalDialog(pParent, ScResId(RID_SCDLG_RETYPEPASS)),
+
+ maBtnOk (this, ScResId(BTN_OK)),
+ maBtnCancel (this, ScResId(BTN_CANCEL)),
+ maBtnHelp (this, ScResId(BTN_HELP)),
+
+ maTextDescription(this, ScResId(FT_DESC)),
+ maLineDocument(this, ScResId(FL_DOCUMENT)),
+ maTextDocStatus(this, ScResId(FT_DOCSTATUS)),
+ maBtnRetypeDoc(this, ScResId(BTN_RETYPE_DOC)),
+
+ maLineSheet(this, ScResId(FL_SHEET)),
+ maTextSheetName1(this, ScResId(FT_SHEETNAME1)),
+ maTextSheetStatus1(this, ScResId(FT_SHEETSTATUS1)),
+ maBtnRetypeSheet1(this, ScResId(BTN_RETYPE_SHEET1)),
+
+ maTextSheetName2(this, ScResId(FT_SHEETNAME2)),
+ maTextSheetStatus2(this, ScResId(FT_SHEETSTATUS2)),
+ maBtnRetypeSheet2(this, ScResId(BTN_RETYPE_SHEET2)),
+
+ maTextSheetName3(this, ScResId(FT_SHEETNAME3)),
+ maTextSheetStatus3(this, ScResId(FT_SHEETSTATUS3)),
+ maBtnRetypeSheet3(this, ScResId(BTN_RETYPE_SHEET3)),
+
+ maTextSheetName4(this, ScResId(FT_SHEETNAME4)),
+ maTextSheetStatus4(this, ScResId(FT_SHEETSTATUS4)),
+ maBtnRetypeSheet4(this, ScResId(BTN_RETYPE_SHEET4)),
+
+ maScrollBar (this, ScResId(SB_SCROLL)),
+
+ maTextNotProtected(ScResId(STR_NOT_PROTECTED)),
+ maTextNotPassProtected(ScResId(STR_NOT_PASS_PROTECTED)),
+ maTextHashBad(ScResId(STR_HASH_BAD)),
+ maTextHashGood(ScResId(STR_HASH_GOOD)),
+ maTextHashRegen(ScResId(STR_HASH_REGENERATED)),
+
+ mpDocItem(static_cast<ScDocProtection*>(NULL)),
+ mnCurScrollPos(0),
+ meDesiredHash(PASSHASH_OOO)
+{
+ Init();
+}
+
+ScRetypePassDlg::~ScRetypePassDlg()
+{
+}
+
+short ScRetypePassDlg::Execute()
+{
+ PopulateDialog();
+ CheckHashStatus();
+ return ModalDialog::Execute();
+}
+
+void ScRetypePassDlg::SetDataFromDocument(const ScDocument& rDoc)
+{
+ const ScDocProtection* pDocProtect = rDoc.GetDocProtection();
+ if (pDocProtect && pDocProtect->isProtected())
+ mpDocItem.reset(new ScDocProtection(*pDocProtect));
+
+ SCTAB nTabCount = rDoc.GetTableCount();
+ maTableItems.reserve(nTabCount);
+ for (SCTAB i = 0; i < nTabCount; ++i)
+ {
+ TableItem aTabItem;
+ rDoc.GetName(i, aTabItem.maName);
+
+ const ScTableProtection* pTabProtect = rDoc.GetTabProtection(i);
+ if (pTabProtect && pTabProtect->isProtected())
+ aTabItem.mpProtect.reset(new ScTableProtection(*pTabProtect));
+
+ maTableItems.push_back(aTabItem);
+ }
+}
+
+void ScRetypePassDlg::SetDesiredHash(ScPasswordHash eHash)
+{
+ meDesiredHash = eHash;
+}
+
+void ScRetypePassDlg::WriteNewDataToDocument(ScDocument& rDoc) const
+{
+ if (mpDocItem.get())
+ rDoc.SetDocProtection(mpDocItem.get());
+
+ size_t nTabCount = static_cast<size_t>(rDoc.GetTableCount());
+ size_t n = maTableItems.size();
+ for (size_t i = 0; i < n; ++i)
+ {
+ if (i >= nTabCount)
+ break;
+
+ ScTableProtection* pTabProtect = maTableItems[i].mpProtect.get();
+ if (pTabProtect)
+ rDoc.SetTabProtection(static_cast<SCTAB>(i), pTabProtect);
+ }
+}
+
+void ScRetypePassDlg::Init()
+{
+ Link aLink = LINK( this, ScRetypePassDlg, OKHdl );
+ maBtnOk.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScRetypePassDlg, RetypeBtnHdl );
+ maBtnRetypeDoc.SetClickHdl(aLink);
+ maBtnRetypeSheet1.SetClickHdl(aLink);
+ maBtnRetypeSheet2.SetClickHdl(aLink);
+ maBtnRetypeSheet3.SetClickHdl(aLink);
+ maBtnRetypeSheet4.SetClickHdl(aLink);
+
+ maTextDocStatus.SetText(maTextNotProtected);
+ maTextSheetStatus1.SetText(maTextNotProtected);
+ maTextSheetStatus2.SetText(maTextNotProtected);
+ maTextSheetStatus3.SetText(maTextNotProtected);
+ maTextSheetStatus4.SetText(maTextNotProtected);
+ maBtnRetypeDoc.Disable();
+
+ // Make all sheet rows invisible.
+
+ maTextSheetName1.Show(false);
+ maTextSheetStatus1.Show(false);
+ maBtnRetypeSheet1.Show(false);
+ maBtnRetypeSheet1.Disable();
+
+ maTextSheetName2.Show(false);
+ maTextSheetStatus2.Show(false);
+ maBtnRetypeSheet2.Show(false);
+ maBtnRetypeSheet2.Disable();
+
+ maTextSheetName3.Show(false);
+ maTextSheetStatus3.Show(false);
+ maBtnRetypeSheet3.Show(false);
+ maBtnRetypeSheet3.Disable();
+
+ maTextSheetName4.Show(false);
+ maTextSheetStatus4.Show(false);
+ maBtnRetypeSheet4.Show(false);
+ maBtnRetypeSheet4.Disable();
+
+ maScrollBar.Show(false);
+
+ maScrollBar.SetEndScrollHdl( LINK( this, ScRetypePassDlg, ScrollHdl ) );
+ maScrollBar.SetScrollHdl( LINK( this, ScRetypePassDlg, ScrollHdl ) );
+
+ maScrollBar.SetPageSize(4);
+ maScrollBar.SetVisibleSize(4);
+ maScrollBar.SetLineSize(1);
+}
+
+void ScRetypePassDlg::PopulateDialog()
+{
+ // Document protection first.
+ SetDocData();
+
+ // Sheet protection next. We're only interested in the first 4 sheets
+ // (or less).
+ size_t n = maTableItems.size();
+ for (size_t i = 0; i < n && i < 4; ++i)
+ SetTableData(i, static_cast< SCTAB >( i ));
+
+ if (n > 4)
+ {
+ maScrollBar.Show(true);
+ maScrollBar.SetRange(Range(0, n));
+ }
+}
+
+void ScRetypePassDlg::SetDocData()
+{
+ bool bBtnEnabled = false;
+ if (mpDocItem.get() && mpDocItem->isProtected())
+ {
+ if (mpDocItem->isPasswordEmpty())
+ maTextDocStatus.SetText(maTextNotPassProtected);
+ else if (mpDocItem->hasPasswordHash(meDesiredHash))
+ maTextDocStatus.SetText(maTextHashGood);
+ else
+ {
+ // incompatible hash
+ maTextDocStatus.SetText(maTextHashBad);
+ bBtnEnabled = true;
+ }
+ }
+ maBtnRetypeDoc.Enable(bBtnEnabled);
+}
+
+void ScRetypePassDlg::SetTableData(size_t nRowPos, SCTAB nTab)
+{
+ if (nRowPos >= 4)
+ return;
+
+ FixedText* pName = NULL;
+ FixedText* pStatus = NULL;
+ PushButton* pBtn = NULL;
+ switch (nRowPos)
+ {
+ case 0:
+ pName = &maTextSheetName1;
+ pStatus = &maTextSheetStatus1;
+ pBtn = &maBtnRetypeSheet1;
+ break;
+ case 1:
+ pName = &maTextSheetName2;
+ pStatus = &maTextSheetStatus2;
+ pBtn = &maBtnRetypeSheet2;
+ break;
+ case 2:
+ pName = &maTextSheetName3;
+ pStatus = &maTextSheetStatus3;
+ pBtn = &maBtnRetypeSheet3;
+ break;
+ case 3:
+ pName = &maTextSheetName4;
+ pStatus = &maTextSheetStatus4;
+ pBtn = &maBtnRetypeSheet4;
+ break;
+ default:
+ return;
+ }
+
+ bool bBtnEnabled = false;
+ pName->SetText(maTableItems[nTab].maName);
+ pName->Show(true);
+ const ScTableProtection* pTabProtect = maTableItems[nTab].mpProtect.get();
+ if (pTabProtect && pTabProtect->isProtected())
+ {
+ if (pTabProtect->isPasswordEmpty())
+ pStatus->SetText(maTextNotPassProtected);
+ else if (pTabProtect->hasPasswordHash(meDesiredHash))
+ pStatus->SetText(maTextHashGood);
+ else
+ {
+ // incompatible hash
+ pStatus->SetText(maTextHashBad);
+ bBtnEnabled = true;
+ }
+ }
+ else
+ pStatus->SetText(maTextNotProtected);
+
+ pStatus->Show(true);
+ pBtn->Show(true);
+ pBtn->Enable(bBtnEnabled);
+}
+
+void ScRetypePassDlg::ResetTableRows()
+{
+ long nScrollPos = maScrollBar.GetThumbPos();
+ mnCurScrollPos = nScrollPos < 0 ? 0 : nScrollPos;
+ size_t nRowCount = maTableItems.size() - nScrollPos;
+ for (size_t i = 0; i < nRowCount; ++i)
+ SetTableData(i, static_cast< SCTAB >( i + nScrollPos ));
+}
+
+bool lcl_IsInGoodStatus(ScPassHashProtectable* pProtected, ScPasswordHash eDesiredHash)
+{
+ if (!pProtected || !pProtected->isProtected())
+ // Not protected.
+ return true;
+
+ if (pProtected->isPasswordEmpty())
+ return true;
+
+ if (pProtected->hasPasswordHash(eDesiredHash))
+ return true;
+
+ return false;
+}
+
+void ScRetypePassDlg::CheckHashStatus()
+{
+ do
+ {
+ if (!lcl_IsInGoodStatus(mpDocItem.get(), meDesiredHash))
+ break;
+
+ bool bStatusGood = true;
+ size_t nTabCount = maTableItems.size();
+ for (size_t i = 0; i < nTabCount && bStatusGood; ++i)
+ {
+ if (!lcl_IsInGoodStatus(maTableItems[i].mpProtect.get(), meDesiredHash))
+ bStatusGood = false;
+ }
+ if (!bStatusGood)
+ break;
+
+ maBtnOk.Enable();
+ return;
+ }
+ while (false);
+
+ maBtnOk.Disable();
+}
+
+IMPL_LINK( ScRetypePassDlg, OKHdl, OKButton*, EMPTYARG )
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassDlg, RetypeBtnHdl, PushButton*, pBtn )
+{
+ ScPassHashProtectable* pProtected = NULL;
+ if (pBtn == &maBtnRetypeDoc)
+ {
+ // document protection.
+ pProtected = mpDocItem.get();
+ }
+ else
+ {
+ // sheet protection.
+ size_t nTabPos = mnCurScrollPos;
+ if (pBtn == &maBtnRetypeSheet2)
+ nTabPos += 1;
+ else if (pBtn == &maBtnRetypeSheet3)
+ nTabPos += 2;
+ else if (pBtn == &maBtnRetypeSheet4)
+ nTabPos += 3;
+ else if (pBtn != &maBtnRetypeSheet1)
+ // This should never happen !
+ return 0;
+
+ if (nTabPos >= maTableItems.size())
+ // Likewise, this should never happen !
+ return 0;
+
+ pProtected = maTableItems[nTabPos].mpProtect.get();
+ }
+
+ if (!pProtected)
+ // What the ... !?
+ return 0;
+
+ ScRetypePassInputDlg aDlg(this, pProtected);
+ if (aDlg.Execute() == RET_OK)
+ {
+ // OK is pressed. Update the protected item.
+ if (aDlg.IsRemovePassword())
+ {
+ // Remove password from this item.
+ pProtected->setPassword(String());
+ }
+ else
+ {
+ // Set a new password.
+ String aNewPass = aDlg.GetNewPassword();
+ pProtected->setPassword(aNewPass);
+ }
+
+ SetDocData();
+ ResetTableRows();
+ CheckHashStatus();
+ }
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassDlg, ScrollHdl, ScrollBar*, EMPTYARG )
+{
+ ResetTableRows();
+ return 0;
+}
+
+// ============================================================================
+
+ScRetypePassInputDlg::ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected) :
+ ModalDialog(pParent, ScResId(RID_SCDLG_RETYPEPASS_INPUT)),
+
+ maBtnOk (this, ScResId(BTN_OK)),
+ maBtnCancel (this, ScResId(BTN_CANCEL)),
+ maBtnHelp (this, ScResId(BTN_HELP)),
+
+ maBtnRetypePassword(this, ScResId(BTN_RETYPE_PASSWORD)),
+
+ maPassword1Text (this, ScResId(FT_PASSWORD1)),
+ maPassword1Edit (this, ScResId(ED_PASSWORD1)),
+ maPassword2Text (this, ScResId(FT_PASSWORD2)),
+ maPassword2Edit (this, ScResId(ED_PASSWORD2)),
+ maBtnMatchOldPass(this, ScResId(BTN_MATCH_OLD_PASSWORD)),
+
+ maBtnRemovePassword(this, ScResId(BTN_REMOVE_PASSWORD)),
+
+ mpProtected(pProtected)
+{
+ Init();
+}
+
+ScRetypePassInputDlg::~ScRetypePassInputDlg()
+{
+}
+
+short ScRetypePassInputDlg::Execute()
+{
+ return ModalDialog::Execute();
+}
+
+bool ScRetypePassInputDlg::IsRemovePassword() const
+{
+ return maBtnRemovePassword.IsChecked();
+}
+
+String ScRetypePassInputDlg::GetNewPassword() const
+{
+ return maPassword1Edit.GetText();
+}
+
+void ScRetypePassInputDlg::Init()
+{
+ Link aLink = LINK( this, ScRetypePassInputDlg, OKHdl );
+ maBtnOk.SetClickHdl(aLink);
+ aLink = LINK( this, ScRetypePassInputDlg, RadioBtnHdl );
+ maBtnRetypePassword.SetClickHdl(aLink);
+ maBtnRemovePassword.SetClickHdl(aLink);
+ aLink = LINK( this, ScRetypePassInputDlg, CheckBoxHdl );
+ maBtnMatchOldPass.SetClickHdl(aLink);
+ aLink = LINK( this, ScRetypePassInputDlg, PasswordModifyHdl );
+ maPassword1Edit.SetModifyHdl(aLink);
+ maPassword2Edit.SetModifyHdl(aLink);
+
+ maBtnOk.Disable();
+ maBtnRetypePassword.Check(true);
+ maBtnMatchOldPass.Check(true);
+ maPassword1Edit.GrabFocus();
+}
+
+void ScRetypePassInputDlg::CheckPasswordInput()
+{
+ String aPass1 = maPassword1Edit.GetText();
+ String aPass2 = maPassword2Edit.GetText();
+
+ if (!aPass1.Len() || !aPass2.Len())
+ {
+ // Empty password is not allowed.
+ maBtnOk.Disable();
+ return;
+ }
+
+ if (!aPass1.Equals(aPass2))
+ {
+ // The two passwords differ.
+ maBtnOk.Disable();
+ return;
+ }
+
+ if (!maBtnMatchOldPass.IsChecked())
+ {
+ maBtnOk.Enable();
+ return;
+ }
+
+ if (!mpProtected)
+ {
+ // This should never happen!
+ maBtnOk.Disable();
+ return;
+ }
+
+ bool bPassGood = mpProtected->verifyPassword(aPass1);
+ maBtnOk.Enable(bPassGood);
+}
+
+IMPL_LINK( ScRetypePassInputDlg, OKHdl, OKButton*, EMPTYARG )
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassInputDlg, RadioBtnHdl, RadioButton*, pBtn )
+{
+ if (pBtn == &maBtnRetypePassword)
+ {
+ maBtnRemovePassword.Check(false);
+ maPassword1Text.Enable();
+ maPassword1Edit.Enable();
+ maPassword2Text.Enable();
+ maPassword2Edit.Enable();
+ maBtnMatchOldPass.Enable();
+ CheckPasswordInput();
+ }
+ else if (pBtn == &maBtnRemovePassword)
+ {
+ maBtnRetypePassword.Check(false);
+ maPassword1Text.Disable();
+ maPassword1Edit.Disable();
+ maPassword2Text.Disable();
+ maPassword2Edit.Disable();
+ maBtnMatchOldPass.Disable();
+ maBtnOk.Enable();
+ }
+
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassInputDlg, CheckBoxHdl, CheckBox*, EMPTYARG )
+{
+ CheckPasswordInput();
+ return 0;
+}
+
+IMPL_LINK( ScRetypePassInputDlg, PasswordModifyHdl, Edit*, EMPTYARG )
+{
+ CheckPasswordInput();
+ return 0;
+}
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.src b/sc/source/ui/miscdlgs/retypepassdlg.src
new file mode 100644
index 000000000000..87d436881f69
--- /dev/null
+++ b/sc/source/ui/miscdlgs/retypepassdlg.src
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: retypepassdlg.src,v $
+ * $Revision: 1.1.2.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "retypepassdlg.hrc"
+
+
+ModalDialog RID_SCDLG_RETYPEPASS
+{
+ Text [ en-US ] = "Re-type Password" ;
+ Size = MAP_APPFONT ( 260 , 165 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 204, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 204, 23 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ };
+
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 204, 43 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ };
+
+ FixedText FT_DESC
+ {
+ Pos = MAP_APPFONT ( 6, 6 ) ;
+ Size = MAP_APPFONT ( 190, 36 );
+
+ WordBreak = TRUE ;
+
+ Text [ en-US ] = "The document you are about to export has one or more protected items with password that cannot be exported. Please re-type your password to be able to export your document." ;
+ };
+
+ FixedLine FL_DOCUMENT
+ {
+ Pos = MAP_APPFONT ( 6, 48 );
+ Size = MAP_APPFONT ( 190, 8 );
+
+ Text [ en-US ] = "Document protection" ;
+ };
+
+ FixedText FT_DOCSTATUS
+ {
+ Pos = MAP_APPFONT ( 10, 62 );
+ Size = MAP_APPFONT ( 140, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_DOC
+ {
+ Pos = MAP_APPFONT ( 158, 59 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ FixedLine FL_SHEET
+ {
+ Pos = MAP_APPFONT ( 6, 83 );
+ Size = MAP_APPFONT ( 190, 8 );
+
+ Text [ en-US ] = "Sheet protection" ;
+ };
+
+ FixedText FT_SHEETNAME1
+ {
+ Pos = MAP_APPFONT ( 10, 97 );
+ Size = MAP_APPFONT ( 68, 8 );
+
+ Text [ en-US ] = "Sheet1 has a really long name" ;
+ };
+
+ FixedText FT_SHEETSTATUS1
+ {
+ Pos = MAP_APPFONT ( 82, 97 );
+ Size = MAP_APPFONT ( 72, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_SHEET1
+ {
+ Pos = MAP_APPFONT ( 158, 94 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ FixedText FT_SHEETNAME2
+ {
+ Pos = MAP_APPFONT ( 10, 113 );
+ Size = MAP_APPFONT ( 68, 8 );
+
+ Text [ en-US ] = "Sheet2" ;
+ };
+
+ FixedText FT_SHEETSTATUS2
+ {
+ Pos = MAP_APPFONT ( 82, 113 );
+ Size = MAP_APPFONT ( 72, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_SHEET2
+ {
+ Pos = MAP_APPFONT ( 158, 110 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ FixedText FT_SHEETNAME3
+ {
+ Pos = MAP_APPFONT ( 10, 129 );
+ Size = MAP_APPFONT ( 68, 8 );
+
+ Text [ en-US ] = "Sheet3" ;
+ };
+
+ FixedText FT_SHEETSTATUS3
+ {
+ Pos = MAP_APPFONT ( 82, 129 );
+ Size = MAP_APPFONT ( 72, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_SHEET3
+ {
+ Pos = MAP_APPFONT ( 158, 126 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ FixedText FT_SHEETNAME4
+ {
+ Pos = MAP_APPFONT ( 10, 145 );
+ Size = MAP_APPFONT ( 68, 8 );
+
+ Text [ en-US ] = "Sheet4" ;
+ };
+
+ FixedText FT_SHEETSTATUS4
+ {
+ Pos = MAP_APPFONT ( 82, 145 );
+ Size = MAP_APPFONT ( 72, 8 );
+
+ Text [ en-US ] = "Status unknown" ;
+ };
+
+ PushButton BTN_RETYPE_SHEET4
+ {
+ Pos = MAP_APPFONT ( 158, 142 );
+ Size = MAP_APPFONT ( 30, 14 );
+
+ Text [ en-US ] = "Re-type" ;
+ };
+
+ ScrollBar SB_SCROLL
+ {
+ Pos = MAP_APPFONT ( 190, 94 ) ;
+ Size = MAP_APPFONT ( 8, 61 ) ;
+ VScroll = TRUE ;
+ };
+
+ String STR_NOT_PROTECTED
+ {
+ Text [ en-US ] = "Not protected" ;
+ };
+
+ String STR_NOT_PASS_PROTECTED
+ {
+ Text [ en-US ] = "Not password-protected" ;
+ };
+
+ String STR_HASH_BAD
+ {
+ Text [ en-US ] = "Hash incompatible" ;
+ };
+
+ String STR_HASH_GOOD
+ {
+ Text [ en-US ] = "Hash compatible" ;
+ };
+
+ String STR_HASH_REGENERATED
+ {
+ Text [ en-US ] = "Hash re-generated" ;
+ };
+};
+
+// ----------------------------------------------------------------------------
+
+ModalDialog RID_SCDLG_RETYPEPASS_INPUT
+{
+ Text [ en-US ] = "Re-type Password" ;
+ Size = MAP_APPFONT ( 230 , 110 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 174, 6 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 174, 23 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ };
+
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 174, 43 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ };
+
+ RadioButton BTN_RETYPE_PASSWORD
+ {
+ Pos = MAP_APPFONT ( 11, 10 );
+ Size = MAP_APPFONT ( 150, 10 );
+
+ Text [ en-US ] = "Re-type password" ;
+ };
+
+ FixedText FT_PASSWORD1
+ {
+ Pos = MAP_APPFONT ( 20, 30 );
+ Size = MAP_APPFONT ( 42, 10 );
+
+ Text [ en-US ] = "~Password" ;
+ };
+
+ Edit ED_PASSWORD1
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT ( 65, 29 );
+ Size = MAP_APPFONT ( 75, 12 );
+ };
+
+ FixedText FT_PASSWORD2
+ {
+ Pos = MAP_APPFONT ( 20, 45 );
+ Size = MAP_APPFONT ( 42, 10 );
+
+ Text [ en-US ] = "~Confirm" ;
+ };
+
+ Edit ED_PASSWORD2
+ {
+ Border = TRUE;
+ PassWord = TRUE;
+ Pos = MAP_APPFONT ( 65, 44 );
+ Size = MAP_APPFONT ( 75, 12 );
+ };
+
+ CheckBox BTN_MATCH_OLD_PASSWORD
+ {
+ Pos = MAP_APPFONT ( 20, 65 );
+ Size = MAP_APPFONT ( 150, 10 );
+
+ Text [ en-US ] = "New password must match the original password." ;
+ };
+
+ RadioButton BTN_REMOVE_PASSWORD
+ {
+ Pos = MAP_APPFONT ( 11, 90 );
+ Size = MAP_APPFONT ( 150, 10 );
+
+ Text [ en-US ] = "Remove password from this protected item." ;
+ };
+};
+
+
diff --git a/sc/source/ui/miscdlgs/strindlg.cxx b/sc/source/ui/miscdlgs/strindlg.cxx
index 65212f7d7313..92630493d32f 100644
--- a/sc/source/ui/miscdlgs/strindlg.cxx
+++ b/sc/source/ui/miscdlgs/strindlg.cxx
@@ -43,6 +43,14 @@
#include "scresid.hxx"
#include "miscdlgs.hrc"
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef ScResId
+#define ScResId(x) #x
+#undef ModalDialog
+#define ModalDialog( parent, id ) Dialog( parent, "string-input.xml", id )
+#endif /* ENABLE_LAYOUT */
//==================================================================
diff --git a/sc/source/ui/src/condfrmt.src b/sc/source/ui/src/condfrmt.src
index 6f20d74b1452..982e2990485c 100644
--- a/sc/source/ui/src/condfrmt.src
+++ b/sc/source/ui/src/condfrmt.src
@@ -128,6 +128,13 @@ ModelessDialog RID_SCDLG_CONDFORMAT
DropDown = TRUE ;
Sort = TRUE ;
};
+ PushButton BTN_COND1_NEW
+ {
+ Pos = MAP_APPFONT ( 124 , 34 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New Style..." ;
+ };
FixedLine FL_SEP1
{
Pos = MAP_APPFONT ( 6 , 51 ) ;
@@ -223,6 +230,13 @@ ModelessDialog RID_SCDLG_CONDFORMAT
DropDown = TRUE ;
Sort = TRUE ;
};
+ PushButton BTN_COND2_NEW
+ {
+ Pos = MAP_APPFONT ( 124 , 88 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ne~w Style..." ;
+ };
FixedLine FL_SEP2
{
Pos = MAP_APPFONT ( 6 , 105 ) ;
@@ -318,6 +332,13 @@ ModelessDialog RID_SCDLG_CONDFORMAT
DropDown = TRUE ;
Sort = TRUE ;
};
+ PushButton BTN_COND3_NEW
+ {
+ Pos = MAP_APPFONT ( 124 , 142 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "New ~Style..." ;
+ };
OKButton BTN_OK
{
Pos = MAP_APPFONT ( 260 , 6 ) ;
diff --git a/sc/source/ui/src/filter.src b/sc/source/ui/src/filter.src
index d655496c5666..2e6a1c330671 100644
--- a/sc/source/ui/src/filter.src
+++ b/sc/source/ui/src/filter.src
@@ -34,7 +34,7 @@ ModelessDialog RID_SCDLG_FILTER
HelpId = SID_FILTER ;
Hide = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 298 , 83 ) ;
+ Size = MAP_APPFONT ( 279 , 121 ) ;
Text [ en-US ] = "Standard Filter" ;
Moveable = TRUE ;
Closeable = FALSE ;
@@ -58,14 +58,14 @@ ModelessDialog RID_SCDLG_FILTER
};
FixedText FT_VAL
{
- Pos = MAP_APPFONT ( 173 , 14 ) ;
+ Pos = MAP_APPFONT ( 201 , 14 ) ;
Size = MAP_APPFONT ( 60 , 8 ) ;
Text [ en-US ] = "Value" ;
};
ListBox LB_OP1
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
Size = MAP_APPFONT ( 40 , 46 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
@@ -78,6 +78,19 @@ ModelessDialog RID_SCDLG_FILTER
ListBox LB_OP2
{
Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 40 , 46 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "AND" ; Default ; > ;
+ < "OR" ; Default ; > ;
+ };
+ };
+ ListBox LB_OP3
+ {
+ Border = TRUE ;
Pos = MAP_APPFONT ( 12 , 57 ) ;
Size = MAP_APPFONT ( 40 , 46 ) ;
TabStop = TRUE ;
@@ -88,6 +101,19 @@ ModelessDialog RID_SCDLG_FILTER
< "OR" ; Default ; > ;
};
};
+ ListBox LB_OP4
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 73 ) ;
+ Size = MAP_APPFONT ( 40 , 46 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "AND" ; Default ; > ;
+ < "OR" ; Default ; > ;
+ };
+ };
ListBox LB_FIELD1
{
Border = TRUE ;
@@ -112,11 +138,19 @@ ModelessDialog RID_SCDLG_FILTER
TabStop = TRUE ;
DropDown = TRUE ;
};
+ ListBox LB_FIELD4
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58 , 73 ) ;
+ Size = MAP_APPFONT ( 60 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
ListBox LB_COND1
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 25 ) ;
- Size = MAP_APPFONT ( 47 , 105 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -131,13 +165,19 @@ ModelessDialog RID_SCDLG_FILTER
< "Smallest" ; Default ; > ;
< "Largest %" ; Default ; > ;
< "Smallest %" ; Default ; > ;
+ < "Contains" ; Default ; > ;
+ < "Does not contain" ; Default ; > ;
+ < "Begins with" ; Default ; > ;
+ < "Does not begin with" ; Default ; > ;
+ < "Ends with" ; Default ; > ;
+ < "Does not end with" ; Default ; > ;
};
};
ListBox LB_COND2
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 41 ) ;
- Size = MAP_APPFONT ( 47 , 105 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -152,13 +192,19 @@ ModelessDialog RID_SCDLG_FILTER
< "Smallest" ; Default ; > ;
< "Largest %" ; Default ; > ;
< "Smallest %" ; Default ; > ;
+ < "Contains" ; Default ; > ;
+ < "Does not contain" ; Default ; > ;
+ < "Begins with" ; Default ; > ;
+ < "Does not begin with" ; Default ; > ;
+ < "Ends with" ; Default ; > ;
+ < "Does not end with" ; Default ; > ;
};
};
ListBox LB_COND3
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 57 ) ;
- Size = MAP_APPFONT ( 47 , 105 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -173,39 +219,87 @@ ModelessDialog RID_SCDLG_FILTER
< "Smallest" ; Default ; > ;
< "Largest %" ; Default ; > ;
< "Smallest %" ; Default ; > ;
+ < "Contains" ; Default ; > ;
+ < "Does not contain" ; Default ; > ;
+ < "Begins with" ; Default ; > ;
+ < "Does not begin with" ; Default ; > ;
+ < "Ends with" ; Default ; > ;
+ < "Does not end with" ; Default ; > ;
+ };
+ };
+ ListBox LB_COND4
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 122 , 73 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ stringlist [ en-US ] =
+ {
+ < "=" ; Default ; > ;
+ < "<" ; Default ; > ;
+ < ">" ; Default ; > ;
+ < "<=" ; Default ; > ;
+ < ">=" ; Default ; > ;
+ < "<>" ; Default ; > ;
+ < "Largest" ; Default ; > ;
+ < "Smallest" ; Default ; > ;
+ < "Largest %" ; Default ; > ;
+ < "Smallest %" ; Default ; > ;
+ < "Contains" ; Default ; > ;
+ < "Does not contain" ; Default ; > ;
+ < "Begins with" ; Default ; > ;
+ < "Does not begin with" ; Default ; > ;
+ < "Ends with" ; Default ; > ;
+ < "Does not end with" ; Default ; > ;
};
};
ComboBox ED_VAL1
{
- Pos = MAP_APPFONT ( 173 , 25 ) ;
+ Pos = MAP_APPFONT ( 201 , 25 ) ;
Size = MAP_APPFONT ( 60 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
ComboBox ED_VAL2
{
- Pos = MAP_APPFONT ( 173 , 41 ) ;
+ Pos = MAP_APPFONT ( 201 , 41 ) ;
Size = MAP_APPFONT ( 60 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
ComboBox ED_VAL3
{
- Pos = MAP_APPFONT ( 173 , 57 ) ;
+ Pos = MAP_APPFONT ( 201 , 57 ) ;
+ Size = MAP_APPFONT ( 60 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ComboBox ED_VAL4
+ {
+ Pos = MAP_APPFONT ( 201 , 73 ) ;
Size = MAP_APPFONT ( 60 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
+ ScrollBar LB_SCROLL
+ {
+ Pos = MAP_APPFONT ( 265, 25 ) ;
+ Size = MAP_APPFONT ( 8 , 60 ) ;
+ TabStop = TRUE ;
+ VScroll = TRUE ;
+ };
+
FixedLine FL_CRITERIA
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 230 , 8 ) ;
+ Size = MAP_APPFONT ( 267 , 8 ) ;
Text [ en-US ] = "Filter criteria";
};
CheckBox BTN_CASE
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 12 , 86 ) ;
+ Pos = MAP_APPFONT ( 12 , 130 ) ;
Size = MAP_APPFONT ( 128 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Case ~sensitive" ;
@@ -213,7 +307,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_REGEXP
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 142 , 86 ) ;
+ Pos = MAP_APPFONT ( 142 , 130 ) ;
Size = MAP_APPFONT ( 94 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Regular ~expression" ;
@@ -221,7 +315,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_HEADER
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 12 , 100 ) ;
+ Pos = MAP_APPFONT ( 12 , 144 ) ;
Size = MAP_APPFONT ( 128 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Range contains ~column labels" ;
@@ -229,7 +323,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_UNIQUE
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 142 , 100 ) ;
+ Pos = MAP_APPFONT ( 142 , 144 ) ;
Size = MAP_APPFONT ( 94 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~No duplication" ;
@@ -237,7 +331,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_COPY_RESULT
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 12 , 114 ) ;
+ Pos = MAP_APPFONT ( 12 , 158 ) ;
Size = MAP_APPFONT ( 128 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Copy ~results to..." ;
@@ -245,7 +339,7 @@ ModelessDialog RID_SCDLG_FILTER
CheckBox BTN_DEST_PERS
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 142 , 114 ) ;
+ Pos = MAP_APPFONT ( 142 , 158 ) ;
Size = MAP_APPFONT ( 94 , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Keep filter criteria" ;
@@ -254,8 +348,8 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Hide = TRUE ;
- Pos = MAP_APPFONT ( 21 , 126 ) ;
- Size = MAP_APPFONT ( 90 , 90 ) ;
+ Pos = MAP_APPFONT ( 21 , 170 ) ;
+ Size = MAP_APPFONT ( 110 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
@@ -263,13 +357,13 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Hide = TRUE ;
- Pos = MAP_APPFONT ( 115 , 126 ) ;
- Size = MAP_APPFONT ( 104 , 12 ) ;
+ Pos = MAP_APPFONT ( 136 , 170 ) ;
+ Size = MAP_APPFONT ( 110 , 12 ) ;
TabStop = TRUE ;
};
ImageButton RB_COPY_AREA
{
- Pos = MAP_APPFONT ( 221 , 125 ) ;
+ Pos = MAP_APPFONT ( 248 , 169 ) ;
Size = MAP_APPFONT ( 13 , 15 ) ;
TabStop = FALSE ;
QuickHelpText [ en-US ] = "Shrink" ;
@@ -277,14 +371,13 @@ ModelessDialog RID_SCDLG_FILTER
FixedLine FL_OPTIONS
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 6 , 75 ) ;
- Size = MAP_APPFONT ( 230 , 8 ) ;
- Text [ en-US ] = "Options" ;
+ Pos = MAP_APPFONT ( 6 , 118 ) ;
+ Size = MAP_APPFONT ( 267 , 8 ) ;
};
FixedText FT_DBAREA
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 66 , 144 ) ;
+ Pos = MAP_APPFONT ( 66 , 188 ) ;
Size = MAP_APPFONT ( 167 , 8 ) ;
Left = TRUE ;
Text [ en-US ] = "dummy" ;
@@ -292,36 +385,41 @@ ModelessDialog RID_SCDLG_FILTER
FixedText FT_DBAREA_LABEL
{
Hide = TRUE ;
- Pos = MAP_APPFONT ( 6 , 144 ) ;
+ Pos = MAP_APPFONT ( 6 , 188 ) ;
Size = MAP_APPFONT ( 58 , 8 ) ;
Text [ en-US ] = "Data range:" ;
};
OKButton BTN_OK
{
- Pos = MAP_APPFONT ( 242 , 6 ) ;
+ Pos = MAP_APPFONT ( 169 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton BTN_CANCEL
{
- Pos = MAP_APPFONT ( 242 , 23 ) ;
+ Pos = MAP_APPFONT ( 223 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
HelpButton BTN_HELP
{
- Pos = MAP_APPFONT ( 242 , 43 ) ;
+ Pos = MAP_APPFONT ( 62 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
MoreButton BTN_MORE
{
- Pos = MAP_APPFONT ( 242 , 63 ) ;
+ Pos = MAP_APPFONT ( 6 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
MapUnit = MAP_APPFONT ;
- Delta = 75 ;
+ Delta = 81 ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 91 ) ;
+ Size = MAP_APPFONT ( 279 , 6 ) ;
};
};
//============================================================================
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 5166340b189e..c5b8cfd1a9e8 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -438,10 +438,6 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "Cell merge not possible if cells already merged!" ;
};
- String STR_MSSG_APPLYPATTLINES_0
- {
- Text [ en-US ] = "Cannot apply borders to multiple selection" ;
- };
String STR_MSSG_INSERTCELLS_0
{
Text [ en-US ] = "Inserting into merged ranges not possible" ;
diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src
index f6e401b1f76d..05d10b9813bd 100644
--- a/sc/source/ui/src/popup.src
+++ b/sc/source/ui/src/popup.src
@@ -183,6 +183,12 @@ Menu RID_POPUP_TAB
};
MenuItem
{
+ Identifier = FID_TAB_DESELECTALL ;
+ HelpId = FID_TAB_DESELECTALL ;
+ Text [ en-US ] = "D~eselect All Sheets" ;
+ };
+ MenuItem
+ {
Identifier = FID_TAB_RTL ;
HelpId = FID_TAB_RTL ;
Text [ en-US ] = "S~heet Right-To-Left" ;
diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src
index 804182e198d5..efe9a0312b02 100644
--- a/sc/source/ui/src/scstring.src
+++ b/sc/source/ui/src/scstring.src
@@ -728,3 +728,13 @@ String RID_SCSTR_ONCLICK
Text [ en-US ] = "Mouse button pressed";
};
+String SCSTR_MOREBTN_MOREOPTIONS
+{
+ Text [ en-US ] = "More ~Options";
+};
+
+String SCSTR_MOREBTN_FEWEROPTIONS
+{
+ Text [ en-US ] = "Fewer ~Options";
+};
+
diff --git a/sc/source/ui/src/sortdlg.src b/sc/source/ui/src/sortdlg.src
index 2fed10c6f220..71aa7b594575 100644
--- a/sc/source/ui/src/sortdlg.src
+++ b/sc/source/ui/src/sortdlg.src
@@ -304,4 +304,48 @@ TabDialog RID_SCDLG_SORT
};
};
+ModalDialog RID_SCDLG_SORT_WARNING
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 91 ) ;
+ Text [ en-US ] = "Sort Range" ;
+ Moveable = TRUE ;
+ Closeable = FALSE ;
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 8 , 3 ) ;
+ Size = MAP_APPFONT ( 170 , 33 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "The cells next to the current selection also contain data. Do you want to extend the sort range to %1, or sort the currently selected range, %2?";
+ };
+ FixedText FT_TIP
+ {
+ Pos = MAP_APPFONT ( 8 , 55 ) ;
+ Size = MAP_APPFONT ( 170 , 33 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Tip: The sort range can be detected automatically. Place the cell cursor inside a list and execute sort. The whole range of neighboring non-empty cells will then be sorted.";
+ };
+ PushButton BTN_EXTSORT
+ {
+ Pos = MAP_APPFONT ( 6 , 39 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "Extend selection";
+ };
+ PushButton BTN_CURSORT
+ {
+ Pos = MAP_APPFONT ( 70 , 39 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Current selection";
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 134 , 39 ) ;
+ Size = MAP_APPFONT ( 40 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 00bc7dd96709..e44f5e7a6478 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -451,7 +451,7 @@ void ScUndoDeleteCells::DoChange( const BOOL bUndo )
for( i=0; i<nCount; i++ )
{
if ( pDoc->HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
- aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED ) )
+ aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
// #i51445# old merge flag attributes must be deleted also for single cells,
// not only for whole columns/rows
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index f12dcda35c8f..ea1e303d6ae3 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -74,6 +74,7 @@ TYPEINIT1(ScUndoAutoFormat, SfxUndoAction);
TYPEINIT1(ScUndoReplace, SfxUndoAction);
TYPEINIT1(ScUndoTabOp, SfxUndoAction);
TYPEINIT1(ScUndoConversion, SfxUndoAction);
+TYPEINIT1(ScUndoRefConversion, SfxUndoAction);
TYPEINIT1(ScUndoRefreshLink, SfxUndoAction);
TYPEINIT1(ScUndoInsertAreaLink, SfxUndoAction);
TYPEINIT1(ScUndoRemoveAreaLink, SfxUndoAction);
@@ -1197,14 +1198,10 @@ void __EXPORT ScUndoReplace::Undo()
}
else if (pSearchItem->GetCellType() == SVX_SEARCHIN_NOTE)
{
- if (ScPostIt* pNote = pDoc->GetNote(aCursorPos))
- {
- pNote->SetText( aUndoStr );
- }
- else
- {
- DBG_ERROR("ScUndoReplace: Hier ist keine Notizzelle");
- }
+ ScPostIt* pNote = pDoc->GetNote( aCursorPos );
+ DBG_ASSERT( pNote, "ScUndoReplace::Undo - cell does not contain a note" );
+ if (pNote)
+ pNote->SetText( aCursorPos, aUndoStr );
if (pViewShell)
pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
SC_FOLLOW_JUMP, FALSE, FALSE );
@@ -1531,6 +1528,98 @@ BOOL ScUndoConversion::CanRepeat(SfxRepeatTarget& rTarget) const
//============================================================================
+// class ScUndoRefConversion
+//
+// cell reference conversion
+
+//----------------------------------------------------------------------------
+
+ScUndoRefConversion::ScUndoRefConversion( ScDocShell* pNewDocShell,
+ const ScRange& aMarkRange, const ScMarkData& rMark,
+ ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc, BOOL bNewMulti, USHORT nNewFlag) :
+ScSimpleUndo( pNewDocShell ),
+aMarkData ( rMark ),
+pUndoDoc ( pNewUndoDoc ),
+pRedoDoc ( pNewRedoDoc ),
+aRange ( aMarkRange ),
+bMulti ( bNewMulti ),
+nFlags ( nNewFlag )
+{
+ SetChangeTrack();
+}
+
+__EXPORT ScUndoRefConversion::~ScUndoRefConversion()
+{
+ delete pUndoDoc;
+ delete pRedoDoc;
+}
+
+String __EXPORT ScUndoRefConversion::GetComment() const
+{
+ return ScGlobal::GetRscString( STR_UNDO_ENTERDATA ); // "Eingabe"
+}
+
+void ScUndoRefConversion::SetChangeTrack()
+{
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ if ( pChangeTrack && (nFlags & IDF_FORMULA) )
+ pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
+ nStartChangeAction, nEndChangeAction );
+ else
+ nStartChangeAction = nEndChangeAction = 0;
+}
+
+void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
+{
+ ScDocument* pDoc = pDocShell->GetDocument();
+
+ ShowTable(aRange);
+
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (pViewShell)
+ pViewShell->SetMarkData( aMarkData );
+
+ ScRange aCopyRange = aRange;
+ SCTAB nTabCount = pDoc->GetTableCount();
+ aCopyRange.aStart.SetTab(0);
+ aCopyRange.aEnd.SetTab(nTabCount-1);
+ pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, pDoc, &aMarkData );
+ pDocShell->PostPaint( aRange, PAINT_GRID);
+ pDocShell->PostDataChanged();
+ if (pViewShell)
+ pViewShell->CellContentChanged();
+}
+void __EXPORT ScUndoRefConversion::Undo()
+{
+ BeginUndo();
+ if (pUndoDoc)
+ DoChange(pUndoDoc);
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ if ( pChangeTrack )
+ pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
+ EndUndo();
+}
+
+void __EXPORT ScUndoRefConversion::Redo()
+{
+ BeginRedo();
+ if (pRedoDoc)
+ DoChange(pRedoDoc);
+ SetChangeTrack();
+ EndRedo();
+}
+
+void __EXPORT ScUndoRefConversion::Repeat(SfxRepeatTarget& rTarget)
+{
+ if (rTarget.ISA(ScTabViewTarget))
+ ((ScTabViewTarget&)rTarget).GetViewShell()->DoRefConversion();
+}
+
+BOOL __EXPORT ScUndoRefConversion::CanRepeat(SfxRepeatTarget& rTarget) const
+{
+ return (rTarget.ISA(ScTabViewTarget));
+}
+//============================================================================
// class ScUndoRefreshLink
//
// Link aktualisieren / aendern
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index d1a59e65fdb0..eb23516cafeb 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -829,6 +829,7 @@ ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rP
mpDrawUndo( pDrawUndo )
{
DBG_ASSERT( maOldData.mpCaption || maNewData.mpCaption, "ScUndoReplaceNote::ScUndoReplaceNote - missing note captions" );
+ DBG_ASSERT( !maOldData.mxInitData.get() && !maNewData.mxInitData.get(), "ScUndoReplaceNote::ScUndoReplaceNote - unexpected unitialized note" );
}
ScUndoReplaceNote::~ScUndoReplaceNote()
@@ -883,7 +884,7 @@ void ScUndoReplaceNote::DoInsertNote( const ScNoteData& rNoteData )
{
ScDocument& rDoc = *pDocShell->GetDocument();
DBG_ASSERT( !rDoc.GetNote( maPos ), "ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
- ScPostIt* pNote = new ScPostIt( rDoc, rNoteData );
+ ScPostIt* pNote = new ScPostIt( rDoc, maPos, rNoteData, false );
rDoc.TakeNote( maPos, pNote );
}
}
@@ -896,7 +897,9 @@ void ScUndoReplaceNote::DoRemoveNote( const ScNoteData& rNoteData )
DBG_ASSERT( rDoc.GetNote( maPos ), "ScUndoReplaceNote::DoRemoveNote - missing cell note" );
if( ScPostIt* pNote = rDoc.ReleaseNote( maPos ) )
{
- // forget caption (already handled in drawing undo)
+ /* Forget pointer to caption object to suppress removing the
+ caption object from the drawing layer while deleting pNote
+ (removing the caption is done by a drawing undo action). */
pNote->ForgetCaption();
delete pNote;
}
@@ -920,7 +923,7 @@ void ScUndoShowHideNote::Undo()
{
BeginUndo();
if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( maPos ) )
- pNote->ShowCaption( !mbShown );
+ pNote->ShowCaption( maPos, !mbShown );
EndUndo();
}
@@ -928,7 +931,7 @@ void ScUndoShowHideNote::Redo()
{
BeginRedo();
if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( maPos ) )
- pNote->ShowCaption( mbShown );
+ pNote->ShowCaption( maPos, mbShown );
EndRedo();
}
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index d3ff10783c27..abd6f815abf9 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -61,6 +61,7 @@
#include "prnsave.hxx"
#include "printfun.hxx"
#include "chgtrack.hxx"
+#include "tabprotection.hxx"
// for ScUndoRenameObject - might me moved to another file later
#include <svx/svditer.hxx>
@@ -72,6 +73,8 @@
extern BOOL bDrawIsInUndo; //! irgendwo als Member !!!
using namespace com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::std::auto_ptr;
// STATIC DATA -----------------------------------------------------------
@@ -85,7 +88,6 @@ TYPEINIT1(ScUndoMakeScenario, SfxUndoAction);
TYPEINIT1(ScUndoImportTab, SfxUndoAction);
TYPEINIT1(ScUndoRemoveLink, SfxUndoAction);
TYPEINIT1(ScUndoShowHideTab, SfxUndoAction);
-TYPEINIT1(ScUndoProtect, SfxUndoAction);
TYPEINIT1(ScUndoPrintRange, SfxUndoAction);
TYPEINIT1(ScUndoScenarioFlags, SfxUndoAction);
TYPEINIT1(ScUndoRenameObject, SfxUndoAction);
@@ -112,12 +114,12 @@ ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell,
SetChangeTrack();
}
-__EXPORT ScUndoInsertTab::~ScUndoInsertTab()
+ScUndoInsertTab::~ScUndoInsertTab()
{
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoInsertTab::GetComment() const
+String ScUndoInsertTab::GetComment() const
{
if (bAppend)
return ScGlobal::GetRscString( STR_UNDO_APPEND_TAB );
@@ -138,7 +140,7 @@ void ScUndoInsertTab::SetChangeTrack()
nEndChangeAction = 0;
}
-void __EXPORT ScUndoInsertTab::Undo()
+void ScUndoInsertTab::Undo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
pViewShell->SetTabNo(nTab);
@@ -159,7 +161,7 @@ void __EXPORT ScUndoInsertTab::Undo()
pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
}
-void __EXPORT ScUndoInsertTab::Redo()
+void ScUndoInsertTab::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -180,14 +182,14 @@ void __EXPORT ScUndoInsertTab::Redo()
SetChangeTrack();
}
-void __EXPORT ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoInsertTab::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoInsertTab::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -211,7 +213,7 @@ ScUndoInsertTables::ScUndoInsertTables( ScDocShell* pNewDocShell,
SetChangeTrack();
}
-__EXPORT ScUndoInsertTables::~ScUndoInsertTables()
+ScUndoInsertTables::~ScUndoInsertTables()
{
String *pStr=NULL;
if(pNameList!=NULL)
@@ -227,7 +229,7 @@ __EXPORT ScUndoInsertTables::~ScUndoInsertTables()
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoInsertTables::GetComment() const
+String ScUndoInsertTables::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
}
@@ -252,7 +254,7 @@ void ScUndoInsertTables::SetChangeTrack()
nStartChangeAction = nEndChangeAction = 0;
}
-void __EXPORT ScUndoInsertTables::Undo()
+void ScUndoInsertTables::Undo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
pViewShell->SetTabNo(nTab);
@@ -282,7 +284,7 @@ void __EXPORT ScUndoInsertTables::Undo()
pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
}
-void __EXPORT ScUndoInsertTables::Redo()
+void ScUndoInsertTables::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -299,14 +301,14 @@ void __EXPORT ScUndoInsertTables::Redo()
SetChangeTrack();
}
-void __EXPORT ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -327,12 +329,12 @@ ScUndoDeleteTab::ScUndoDeleteTab( ScDocShell* pNewDocShell,const SvShorts &aTab,
SetChangeTrack();
}
-__EXPORT ScUndoDeleteTab::~ScUndoDeleteTab()
+ScUndoDeleteTab::~ScUndoDeleteTab()
{
theTabs.Remove(0,theTabs.Count());
}
-String __EXPORT ScUndoDeleteTab::GetComment() const
+String ScUndoDeleteTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_DELETE_TAB );
}
@@ -366,7 +368,7 @@ SCTAB lcl_GetVisibleTabBefore( ScDocument& rDoc, SCTAB nTab )
return nTab;
}
-void __EXPORT ScUndoDeleteTab::Undo()
+void ScUndoDeleteTab::Undo()
{
BeginUndo();
int i=0;
@@ -414,7 +416,7 @@ void __EXPORT ScUndoDeleteTab::Undo()
pDoc->SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
if ( pRefUndoDoc->IsTabProtected( nTab ) )
- pDoc->SetTabProtection( nTab, TRUE, pRefUndoDoc->GetTabPassword( nTab ) );
+ pDoc->SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
// Drawing-Layer passiert beim MoveUndo::EndUndo
// pDoc->TransferDrawPage(pRefUndoDoc, nTab,nTab);
@@ -450,7 +452,7 @@ void __EXPORT ScUndoDeleteTab::Undo()
// EndUndo();
}
-void __EXPORT ScUndoDeleteTab::Redo()
+void ScUndoDeleteTab::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDocShell->GetDocument(), theTabs[0] ) );
@@ -469,7 +471,7 @@ void __EXPORT ScUndoDeleteTab::Redo()
pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
}
-void __EXPORT ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
@@ -478,7 +480,7 @@ void __EXPORT ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
}
}
-BOOL __EXPORT ScUndoDeleteTab::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoDeleteTab::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -500,11 +502,11 @@ ScUndoRenameTab::ScUndoRenameTab( ScDocShell* pNewDocShell,
sNewName = rNewName;
}
-__EXPORT ScUndoRenameTab::~ScUndoRenameTab()
+ScUndoRenameTab::~ScUndoRenameTab()
{
}
-String __EXPORT ScUndoRenameTab::GetComment() const
+String ScUndoRenameTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_RENAME_TAB );
}
@@ -526,22 +528,22 @@ void ScUndoRenameTab::DoChange( SCTAB nTabP, const String& rName ) const
pViewShell->UpdateInputHandler();
}
-void __EXPORT ScUndoRenameTab::Undo()
+void ScUndoRenameTab::Undo()
{
DoChange(nTab, sOldName);
}
-void __EXPORT ScUndoRenameTab::Redo()
+void ScUndoRenameTab::Redo()
{
DoChange(nTab, sNewName);
}
-void __EXPORT ScUndoRenameTab::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoRenameTab::Repeat(SfxRepeatTarget& /* rTarget */)
{
// Repeat macht keinen Sinn
}
-BOOL __EXPORT ScUndoRenameTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoRenameTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -565,13 +567,13 @@ ScUndoMoveTab::ScUndoMoveTab( ScDocShell* pNewDocShell,
theNewTabs.Insert(aNewTab[sal::static_int_cast<USHORT>(i)],theNewTabs.Count());
}
-__EXPORT ScUndoMoveTab::~ScUndoMoveTab()
+ScUndoMoveTab::~ScUndoMoveTab()
{
theNewTabs.Remove(0,theNewTabs.Count());
theOldTabs.Remove(0,theOldTabs.Count());
}
-String __EXPORT ScUndoMoveTab::GetComment() const
+String ScUndoMoveTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_MOVE_TAB );
}
@@ -618,22 +620,22 @@ void ScUndoMoveTab::DoChange( BOOL bUndo ) const
pDocShell->PostDataChanged();
}
-void __EXPORT ScUndoMoveTab::Undo()
+void ScUndoMoveTab::Undo()
{
DoChange( TRUE );
}
-void __EXPORT ScUndoMoveTab::Redo()
+void ScUndoMoveTab::Redo()
{
DoChange( FALSE );
}
-void __EXPORT ScUndoMoveTab::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoMoveTab::Repeat(SfxRepeatTarget& /* rTarget */)
{
// kein Repeat ! ? !
}
-BOOL __EXPORT ScUndoMoveTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoMoveTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -660,12 +662,12 @@ ScUndoCopyTab::ScUndoCopyTab( ScDocShell* pNewDocShell,
theNewTabs.Insert(aNewTab[sal::static_int_cast<USHORT>(i)],theNewTabs.Count());
}
-__EXPORT ScUndoCopyTab::~ScUndoCopyTab()
+ScUndoCopyTab::~ScUndoCopyTab()
{
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoCopyTab::GetComment() const
+String ScUndoCopyTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_COPY_TAB );
}
@@ -684,7 +686,7 @@ void ScUndoCopyTab::DoChange() const
pDocShell->PostDataChanged();
}
-void __EXPORT ScUndoCopyTab::Undo()
+void ScUndoCopyTab::Undo()
{
ScDocument* pDoc = pDocShell->GetDocument();
@@ -717,7 +719,7 @@ void __EXPORT ScUndoCopyTab::Undo()
DoChange();
}
-void __EXPORT ScUndoCopyTab::Redo()
+void ScUndoCopyTab::Redo()
{
ScDocument* pDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -756,7 +758,7 @@ void __EXPORT ScUndoCopyTab::Redo()
}
if ( pDoc->IsTabProtected( nAdjSource ) )
- pDoc->SetTabProtection( nNewTab, TRUE, pDoc->GetTabPassword( nAdjSource ) );
+ pDoc->CopyTabProtection(nAdjSource, nNewTab);
}
RedoSdrUndoAction( pDrawUndo ); // after the sheets are inserted
@@ -767,12 +769,12 @@ void __EXPORT ScUndoCopyTab::Redo()
}
-void __EXPORT ScUndoCopyTab::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoCopyTab::Repeat(SfxRepeatTarget& /* rTarget */)
{
// kein Repeat ! ? !
}
-BOOL __EXPORT ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -801,17 +803,17 @@ ScUndoMakeScenario::ScUndoMakeScenario( ScDocShell* pNewDocShell,
pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
}
-__EXPORT ScUndoMakeScenario::~ScUndoMakeScenario()
+ScUndoMakeScenario::~ScUndoMakeScenario()
{
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoMakeScenario::GetComment() const
+String ScUndoMakeScenario::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_MAKESCENARIO );
}
-void __EXPORT ScUndoMakeScenario::Undo()
+void ScUndoMakeScenario::Undo()
{
ScDocument* pDoc = pDocShell->GetDocument();
@@ -836,7 +838,7 @@ void __EXPORT ScUndoMakeScenario::Undo()
pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
}
-void __EXPORT ScUndoMakeScenario::Redo()
+void ScUndoMakeScenario::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -858,7 +860,7 @@ void __EXPORT ScUndoMakeScenario::Redo()
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
}
-void __EXPORT ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
@@ -866,7 +868,7 @@ void __EXPORT ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
}
}
-BOOL __EXPORT ScUndoMakeScenario::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoMakeScenario::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -889,13 +891,13 @@ ScUndoImportTab::ScUndoImportTab( ScDocShell* pShell,
pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
}
-__EXPORT ScUndoImportTab::~ScUndoImportTab()
+ScUndoImportTab::~ScUndoImportTab()
{
delete pRedoDoc;
DeleteSdrUndoAction( pDrawUndo );
}
-String __EXPORT ScUndoImportTab::GetComment() const
+String ScUndoImportTab::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
}
@@ -922,7 +924,7 @@ void ScUndoImportTab::DoChange() const
PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
}
-void __EXPORT ScUndoImportTab::Undo()
+void ScUndoImportTab::Undo()
{
//! eingefuegte Bereichsnamen etc.
@@ -958,7 +960,7 @@ void __EXPORT ScUndoImportTab::Undo()
}
if ( pDoc->IsTabProtected( nTabPos ) )
- pRedoDoc->SetTabProtection( nTabPos, TRUE, pDoc->GetTabPassword( nTabPos ) );
+ pRedoDoc->SetTabProtection(nTabPos, pDoc->GetTabProtection(nTabPos));
}
}
@@ -973,7 +975,7 @@ void __EXPORT ScUndoImportTab::Undo()
DoChange();
}
-void __EXPORT ScUndoImportTab::Redo()
+void ScUndoImportTab::Redo()
{
if (!pRedoDoc)
{
@@ -1012,7 +1014,7 @@ void __EXPORT ScUndoImportTab::Redo()
}
if ( pRedoDoc->IsTabProtected( nTabPos ) )
- pDoc->SetTabProtection( nTabPos, TRUE, pRedoDoc->GetTabPassword( nTabPos ) );
+ pDoc->SetTabProtection(nTabPos, pRedoDoc->GetTabProtection(nTabPos));
}
RedoSdrUndoAction( pDrawUndo ); // after the sheets are inserted
@@ -1020,14 +1022,14 @@ void __EXPORT ScUndoImportTab::Redo()
DoChange();
}
-void __EXPORT ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
@@ -1075,14 +1077,14 @@ ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const String& rDoc ) :
}
}
-__EXPORT ScUndoRemoveLink::~ScUndoRemoveLink()
+ScUndoRemoveLink::~ScUndoRemoveLink()
{
delete pTabs;
delete pModes;
delete[] pTabNames;
}
-String __EXPORT ScUndoRemoveLink::GetComment() const
+String ScUndoRemoveLink::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_REMOVELINK );
}
@@ -1099,22 +1101,22 @@ void ScUndoRemoveLink::DoChange( BOOL bLink ) const
pDocShell->UpdateLinks();
}
-void __EXPORT ScUndoRemoveLink::Undo()
+void ScUndoRemoveLink::Undo()
{
DoChange( TRUE );
}
-void __EXPORT ScUndoRemoveLink::Redo()
+void ScUndoRemoveLink::Redo()
{
DoChange( FALSE );
}
-void __EXPORT ScUndoRemoveLink::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoRemoveLink::Repeat(SfxRepeatTarget& /* rTarget */)
{
// gippsnich
}
-BOOL __EXPORT ScUndoRemoveLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoRemoveLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -1132,7 +1134,7 @@ ScUndoShowHideTab::ScUndoShowHideTab( ScDocShell* pShell, SCTAB nNewTab, BOOL bN
{
}
-__EXPORT ScUndoShowHideTab::~ScUndoShowHideTab()
+ScUndoShowHideTab::~ScUndoShowHideTab()
{
}
@@ -1149,17 +1151,17 @@ void ScUndoShowHideTab::DoChange( BOOL bShowP ) const
pDocShell->SetDocumentModified();
}
-void __EXPORT ScUndoShowHideTab::Undo()
+void ScUndoShowHideTab::Undo()
{
DoChange(!bShow);
}
-void __EXPORT ScUndoShowHideTab::Redo()
+void ScUndoShowHideTab::Redo()
{
DoChange(bShow);
}
-void __EXPORT ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
@@ -1167,53 +1169,44 @@ void __EXPORT ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
-String __EXPORT ScUndoShowHideTab::GetComment() const
+String ScUndoShowHideTab::GetComment() const
{
USHORT nId = bShow ? STR_UNDO_SHOWTAB : STR_UNDO_HIDETAB;
return ScGlobal::GetRscString( nId );
}
-// -----------------------------------------------------------------------
-//
-// Tabelle/Dokument schuetzen oder Schutz aufheben
-//
+// ============================================================================
-ScUndoProtect::ScUndoProtect( ScDocShell* pShell, SCTAB nNewTab,
- BOOL bNewProtect, const uno::Sequence<sal_Int8>& rNewPassword ) :
- ScSimpleUndo( pShell ),
- nTab( nNewTab ),
- bProtect( bNewProtect ),
- aPassword( rNewPassword )
+ScUndoDocProtect::ScUndoDocProtect(ScDocShell* pShell, auto_ptr<ScDocProtection> pProtectSettings) :
+ ScSimpleUndo(pShell),
+ mpProtectSettings(pProtectSettings)
{
}
-__EXPORT ScUndoProtect::~ScUndoProtect()
+ScUndoDocProtect::~ScUndoDocProtect()
{
}
-void ScUndoProtect::DoProtect( BOOL bDo )
+void ScUndoDocProtect::DoProtect(bool bProtect)
{
ScDocument* pDoc = pDocShell->GetDocument();
- if (bDo)
+ if (bProtect)
{
- if ( nTab == TABLEID_DOC )
- pDoc->SetDocProtection( TRUE, aPassword );
- else
- pDoc->SetTabProtection( nTab, TRUE, aPassword );
+ // set protection.
+ auto_ptr<ScDocProtection> pCopy(new ScDocProtection(*mpProtectSettings));
+ pCopy->setProtected(true);
+ pDoc->SetDocProtection(pCopy.get());
}
else
{
- uno::Sequence<sal_Int8> aEmptyPass;
- if ( nTab == TABLEID_DOC )
- pDoc->SetDocProtection( FALSE, aEmptyPass );
- else
- pDoc->SetTabProtection( nTab, FALSE, aEmptyPass );
+ // remove protection.
+ pDoc->SetDocProtection(NULL);
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1226,37 +1219,103 @@ void ScUndoProtect::DoProtect( BOOL bDo )
pDocShell->PostPaintGridAll();
}
-void __EXPORT ScUndoProtect::Undo()
+void ScUndoDocProtect::Undo()
{
BeginUndo();
- DoProtect( !bProtect );
+ DoProtect(!mpProtectSettings->isProtected());
EndUndo();
}
-void __EXPORT ScUndoProtect::Redo()
+void ScUndoDocProtect::Redo()
{
BeginRedo();
- DoProtect( bProtect );
+ DoProtect(mpProtectSettings->isProtected());
EndRedo();
}
-void __EXPORT ScUndoProtect::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoDocProtect::Repeat(SfxRepeatTarget& /* rTarget */)
{
// gippsnich
}
-BOOL __EXPORT ScUndoProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoDocProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE; // gippsnich
}
-String __EXPORT ScUndoProtect::GetComment() const
+String ScUndoDocProtect::GetComment() const
{
- USHORT nId;
- if ( nTab == TABLEID_DOC )
- nId = bProtect ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
+ USHORT nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
+ return ScGlobal::GetRscString( nId );
+}
+
+// ============================================================================
+
+ScUndoTabProtect::ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab, auto_ptr<ScTableProtection> pProtectSettings) :
+ ScSimpleUndo(pShell),
+ mnTab(nTab),
+ mpProtectSettings(pProtectSettings)
+{
+}
+
+ScUndoTabProtect::~ScUndoTabProtect()
+{
+}
+
+void ScUndoTabProtect::DoProtect(bool bProtect)
+{
+ ScDocument* pDoc = pDocShell->GetDocument();
+
+ if (bProtect)
+ {
+ // set protection.
+ auto_ptr<ScTableProtection> pCopy(new ScTableProtection(*mpProtectSettings));
+ pCopy->setProtected(true);
+ pDoc->SetTabProtection(mnTab, pCopy.get());
+ }
else
- nId = bProtect ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB;
+ {
+ // remove protection.
+ pDoc->SetTabProtection(mnTab, NULL);
+ }
+
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if (pViewShell)
+ {
+ pViewShell->UpdateLayerLocks();
+ pViewShell->UpdateInputHandler(TRUE); // damit sofort wieder eingegeben werden kann
+ }
+
+ pDocShell->PostPaintGridAll();
+}
+
+void ScUndoTabProtect::Undo()
+{
+ BeginUndo();
+ DoProtect(!mpProtectSettings->isProtected());
+ EndUndo();
+}
+
+void ScUndoTabProtect::Redo()
+{
+ BeginRedo();
+ DoProtect(mpProtectSettings->isProtected());
+ EndRedo();
+}
+
+void ScUndoTabProtect::Repeat(SfxRepeatTarget& /* rTarget */)
+{
+ // gippsnich
+}
+
+BOOL ScUndoTabProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+{
+ return FALSE; // gippsnich
+}
+
+String ScUndoTabProtect::GetComment() const
+{
+ USHORT nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB;
return ScGlobal::GetRscString( nId );
}
@@ -1274,7 +1333,7 @@ ScUndoPrintRange::ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
{
}
-__EXPORT ScUndoPrintRange::~ScUndoPrintRange()
+ScUndoPrintRange::~ScUndoPrintRange()
{
delete pOldRanges;
delete pNewRanges;
@@ -1297,31 +1356,31 @@ void ScUndoPrintRange::DoChange(BOOL bUndo)
pDocShell->PostPaint( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), PAINT_GRID );
}
-void __EXPORT ScUndoPrintRange::Undo()
+void ScUndoPrintRange::Undo()
{
BeginUndo();
DoChange( TRUE );
EndUndo();
}
-void __EXPORT ScUndoPrintRange::Redo()
+void ScUndoPrintRange::Redo()
{
BeginRedo();
DoChange( FALSE );
EndRedo();
}
-void __EXPORT ScUndoPrintRange::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoPrintRange::Repeat(SfxRepeatTarget& /* rTarget */)
{
// gippsnich
}
-BOOL __EXPORT ScUndoPrintRange::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoPrintRange::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE; // gippsnich
}
-String __EXPORT ScUndoPrintRange::GetComment() const
+String ScUndoPrintRange::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_PRINTRANGES );
}
@@ -1350,16 +1409,16 @@ ScUndoScenarioFlags::ScUndoScenarioFlags( ScDocShell* pNewDocShell, SCTAB nT,
{
}
-__EXPORT ScUndoScenarioFlags::~ScUndoScenarioFlags()
+ScUndoScenarioFlags::~ScUndoScenarioFlags()
{
}
-String __EXPORT ScUndoScenarioFlags::GetComment() const
+String ScUndoScenarioFlags::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_EDITSCENARIO );
}
-void __EXPORT ScUndoScenarioFlags::Undo()
+void ScUndoScenarioFlags::Undo()
{
ScDocument* pDoc = pDocShell->GetDocument();
@@ -1376,7 +1435,7 @@ void __EXPORT ScUndoScenarioFlags::Undo()
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
}
-void __EXPORT ScUndoScenarioFlags::Redo()
+void ScUndoScenarioFlags::Redo()
{
ScDocument* pDoc = pDocShell->GetDocument();
@@ -1393,12 +1452,12 @@ void __EXPORT ScUndoScenarioFlags::Redo()
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
}
-void __EXPORT ScUndoScenarioFlags::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoScenarioFlags::Repeat(SfxRepeatTarget& /* rTarget */)
{
// Repeat macht keinen Sinn
}
-BOOL __EXPORT ScUndoScenarioFlags::CanRepeat(SfxRepeatTarget& /* rTarget */) const
+BOOL ScUndoScenarioFlags::CanRepeat(SfxRepeatTarget& /* rTarget */) const
{
return FALSE;
}
@@ -1498,7 +1557,7 @@ ScUndoLayoutRTL::ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, BOOL bNewRT
{
}
-__EXPORT ScUndoLayoutRTL::~ScUndoLayoutRTL()
+ScUndoLayoutRTL::~ScUndoLayoutRTL()
{
}
@@ -1518,29 +1577,29 @@ void ScUndoLayoutRTL::DoChange( BOOL bNew )
pDocShell->SetInUndo( FALSE );
}
-void __EXPORT ScUndoLayoutRTL::Undo()
+void ScUndoLayoutRTL::Undo()
{
DoChange(!bRTL);
}
-void __EXPORT ScUndoLayoutRTL::Redo()
+void ScUndoLayoutRTL::Redo()
{
DoChange(bRTL);
}
-void __EXPORT ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
+void ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
Execute( FID_TAB_RTL, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
-BOOL __EXPORT ScUndoLayoutRTL::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoLayoutRTL::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
-String __EXPORT ScUndoLayoutRTL::GetComment() const
+String ScUndoLayoutRTL::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_TAB_RTL );
}
@@ -1560,7 +1619,7 @@ ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell,
meOldGrammar = pDocShell->GetDocument()->GetGrammar();
}
-__EXPORT ScUndoSetGrammar::~ScUndoSetGrammar()
+ScUndoSetGrammar::~ScUndoSetGrammar()
{
}
@@ -1573,17 +1632,17 @@ void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar )
pDocShell->SetInUndo( FALSE );
}
-void __EXPORT ScUndoSetGrammar::Undo()
+void ScUndoSetGrammar::Undo()
{
DoChange( meOldGrammar );
}
-void __EXPORT ScUndoSetGrammar::Redo()
+void ScUndoSetGrammar::Redo()
{
DoChange( meNewGrammar );
}
-void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
+void ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
{
#if 0
// erAck: 2006-09-07T23:00+0200 commented out in CWS scr1c1
@@ -1593,12 +1652,12 @@ void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
#endif
}
-BOOL __EXPORT ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
+BOOL ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
{
return (rTarget.ISA(ScTabViewTarget));
}
-String __EXPORT ScUndoSetGrammar::GetComment() const
+String ScUndoSetGrammar::GetComment() const
{
return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 );
}
diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx
index 996ec359048c..a3b026396942 100644
--- a/sc/source/ui/unoobj/addruno.cxx
+++ b/sc/source/ui/unoobj/addruno.cxx
@@ -115,7 +115,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp
if ( bIsRange )
{
- static SfxItemPropertyMap aPropertyMap[] =
+ static SfxItemPropertyMapEntry aPropertyMap[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
@@ -128,7 +128,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp
}
else
{
- static SfxItemPropertyMap aPropertyMap[] =
+ static SfxItemPropertyMapEntry aPropertyMap[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index 7acaf77729ca..d7f1eb13c1b2 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -85,9 +85,9 @@ using namespace ::com::sun::star;
// AutoFormat-Map nur fuer PropertySetInfo, ohne Which-IDs
-const SfxItemPropertyMap* lcl_GetAutoFormatMap()
+const SfxItemPropertyMapEntry* lcl_GetAutoFormatMap()
{
- static SfxItemPropertyMap aAutoFormatMap_Impl[] =
+ static SfxItemPropertyMapEntry aAutoFormatMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_INCBACK), 0, &::getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_INCBORD), 0, &::getBooleanCppuType(), 0, 0 },
@@ -103,9 +103,9 @@ const SfxItemPropertyMap* lcl_GetAutoFormatMap()
//! Zahlformat (String/Language) ??? (in XNumberFormat nur ReadOnly)
//! table::TableBorder ??!?
-const SfxItemPropertyMap* lcl_GetAutoFieldMap()
+const SfxItemPropertyMapEntry* lcl_GetAutoFieldMap()
{
- static SfxItemPropertyMap aAutoFieldMap_Impl[] =
+ static SfxItemPropertyMapEntry aAutoFieldMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
{MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0 },
@@ -735,21 +735,20 @@ void SAL_CALL ScAutoFormatFieldObj::setPropertyValue(
{
ScUnoGuard aGuard;
ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- String aPropString(aPropertyName);
- const SfxItemPropertyMap* pMap =
- SfxItemPropertyMap::GetByName( lcl_GetAutoFieldMap(), aPropString );
+ const SfxItemPropertySimpleEntry* pEntry =
+ aPropSet.getPropertyMap()->getByName( aPropertyName );
- if ( pMap && pMap->nWID && pFormats && nFormatIndex < pFormats->GetCount() )
+ if ( pEntry && pEntry->nWID && pFormats && nFormatIndex < pFormats->GetCount() )
{
ScAutoFormatData* pData = (*pFormats)[nFormatIndex];
- if ( IsScItemWid( pMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
- if( const SfxPoolItem* pItem = pData->GetItem( nFieldIndex, pMap->nWID ) )
+ if( const SfxPoolItem* pItem = pData->GetItem( nFieldIndex, pEntry->nWID ) )
{
sal_Bool bDone = sal_False;
- switch( pMap->nWID )
+ switch( pEntry->nWID )
{
case ATTR_STACKED:
{
@@ -783,7 +782,7 @@ void SAL_CALL ScAutoFormatFieldObj::setPropertyValue(
break;
default:
SfxPoolItem* pNewItem = pItem->Clone();
- bDone = pNewItem->PutValue( aValue, pMap->nMemberId );
+ bDone = pNewItem->PutValue( aValue, pEntry->nMemberId );
if (bDone)
pData->PutItem( nFieldIndex, *pNewItem );
delete pNewItem;
@@ -796,7 +795,7 @@ void SAL_CALL ScAutoFormatFieldObj::setPropertyValue(
}
else
{
- switch (pMap->nWID)
+ switch (pEntry->nWID)
{
case SC_WID_UNO_TBLBORD:
{
@@ -826,19 +825,18 @@ uno::Any SAL_CALL ScAutoFormatFieldObj::getPropertyValue( const rtl::OUString& a
uno::Any aVal;
ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- String aPropString(aPropertyName);
- const SfxItemPropertyMap* pMap =
- SfxItemPropertyMap::GetByName( lcl_GetAutoFieldMap(), aPropString );
+ const SfxItemPropertySimpleEntry* pEntry =
+ aPropSet.getPropertyMap()->getByName( aPropertyName );
- if ( pMap && pMap->nWID && pFormats && nFormatIndex < pFormats->GetCount() )
+ if ( pEntry && pEntry->nWID && pFormats && nFormatIndex < pFormats->GetCount() )
{
const ScAutoFormatData* pData = (*pFormats)[nFormatIndex];
- if ( IsScItemWid( pMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
- if( const SfxPoolItem* pItem = pData->GetItem( nFieldIndex, pMap->nWID ) )
+ if( const SfxPoolItem* pItem = pData->GetItem( nFieldIndex, pEntry->nWID ) )
{
- switch( pMap->nWID )
+ switch( pEntry->nWID )
{
case ATTR_STACKED:
{
@@ -849,13 +847,13 @@ uno::Any SAL_CALL ScAutoFormatFieldObj::getPropertyValue( const rtl::OUString& a
}
break;
default:
- pItem->QueryValue( aVal, pMap->nMemberId );
+ pItem->QueryValue( aVal, pEntry->nMemberId );
}
}
}
else
{
- switch (pMap->nWID)
+ switch (pEntry->nWID)
{
case SC_WID_UNO_TBLBORD:
{
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index 1c97f7d72078..a8944c427a99 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -148,9 +148,9 @@ extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Settings_crea
// alles ohne Which-ID, Map nur fuer PropertySetInfo
-static const SfxItemPropertyMap* lcl_GetSettingsPropertyMap()
+static const SfxItemPropertyMapEntry* lcl_GetSettingsPropertyMap()
{
- static SfxItemPropertyMap aSettingsPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aSettingsPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_DOAUTOCP), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_ENTERED), 0, &getBooleanCppuType(), 0, 0},
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 9e6eb0cb0c39..cfe51aed6edc 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -155,9 +155,9 @@ public:
// Left/Right/Top/BottomBorder are mapped directly to the core items,
// not collected/applied to the borders of a range -> ATTR_BORDER can be used directly
-const SfxItemPropertyMap* lcl_GetCellsPropertyMap()
+const SfxItemPropertySet* lcl_GetCellsPropertySet()
{
- static SfxItemPropertyMap aCellsPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aCellsPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
@@ -247,15 +247,16 @@ const SfxItemPropertyMap* lcl_GetCellsPropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
{0,0,0,0,0,0}
};
- return aCellsPropertyMap_Impl;
+ static SfxItemPropertySet aCellsPropertySet( aCellsPropertyMap_Impl );
+ return &aCellsPropertySet;
}
// CellRange enthaelt alle Eintraege von Cells, zusaetzlich eigene Eintraege
// mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
-const SfxItemPropertyMap* lcl_GetRangePropertyMap()
+const SfxItemPropertySet* lcl_GetRangePropertySet()
{
- static SfxItemPropertyMap aRangePropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aRangePropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
@@ -347,15 +348,16 @@ const SfxItemPropertyMap* lcl_GetRangePropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
{0,0,0,0,0,0}
};
- return aRangePropertyMap_Impl;
+ static SfxItemPropertySet aRangePropertySet( aRangePropertyMap_Impl );
+ return &aRangePropertySet;
}
// Cell enthaelt alle Eintraege von CellRange, zusaetzlich eigene Eintraege
// mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
-const SfxItemPropertyMap* lcl_GetCellPropertyMap()
+const SfxItemPropertySet* lcl_GetCellPropertySet()
{
- static SfxItemPropertyMap aCellPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aCellPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
@@ -449,15 +451,16 @@ const SfxItemPropertyMap* lcl_GetCellPropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
{0,0,0,0,0,0}
};
- return aCellPropertyMap_Impl;
+ static SfxItemPropertySet aCellPropertySet( aCellPropertyMap_Impl );
+ return &aCellPropertySet;
}
// Column und Row enthalten alle Eintraege von CellRange, zusaetzlich eigene Eintraege
// mit Which-ID 0 (werden nur fuer getPropertySetInfo benoetigt).
-const SfxItemPropertyMap* lcl_GetColumnPropertyMap()
+const SfxItemPropertySet* lcl_GetColumnPropertySet()
{
- static SfxItemPropertyMap aColumnPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aColumnPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
@@ -555,12 +558,13 @@ const SfxItemPropertyMap* lcl_GetColumnPropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
{0,0,0,0,0,0}
};
- return aColumnPropertyMap_Impl;
+ static SfxItemPropertySet aColumnPropertySet( aColumnPropertyMap_Impl );
+ return &aColumnPropertySet;
}
-const SfxItemPropertyMap* lcl_GetRowPropertyMap()
+const SfxItemPropertySet* lcl_GetRowPropertySet()
{
- static SfxItemPropertyMap aRowPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aRowPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
@@ -658,12 +662,13 @@ const SfxItemPropertyMap* lcl_GetRowPropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
{0,0,0,0,0,0}
};
- return aRowPropertyMap_Impl;
+ static SfxItemPropertySet aRowPropertySet( aRowPropertyMap_Impl );
+ return &aRowPropertySet;
}
-const SfxItemPropertyMap* lcl_GetSheetPropertyMap()
+const SfxItemPropertySet* lcl_GetSheetPropertySet()
{
- static SfxItemPropertyMap aSheetPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aSheetPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ABSNAME), SC_WID_UNO_ABSNAME, &getCppuType((rtl::OUString*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
@@ -769,12 +774,13 @@ const SfxItemPropertyMap* lcl_GetSheetPropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
{0,0,0,0,0,0}
};
- return aSheetPropertyMap_Impl;
+ static SfxItemPropertySet aSheetPropertySet( aSheetPropertyMap_Impl );
+ return &aSheetPropertySet;
}
-const SfxItemPropertyMap* lcl_GetEditPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetEditPropertyMap()
{
- static SfxItemPropertyMap aEditPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aEditPropertyMap_Impl[] =
{
SVX_UNOEDIT_CHAR_PROPERTIES,
SVX_UNOEDIT_FONT_PROPERTIES,
@@ -786,6 +792,11 @@ const SfxItemPropertyMap* lcl_GetEditPropertyMap()
};
return aEditPropertyMap_Impl;
}
+const SvxItemPropertySet* lcl_GetEditPropertySet()
+{
+ static SvxItemPropertySet aEditPropertySet( lcl_GetEditPropertyMap() );
+ return &aEditPropertySet;
+}
//------------------------------------------------------------------------
@@ -823,64 +834,6 @@ SV_IMPL_PTRARR( ScNamedEntryArr_Impl, ScNamedEntryPtr );
//------------------------------------------------------------------------
-#ifdef DBG_UTIL
-#define TEST_PROPERTY_MAPS
-#endif
-
-#ifdef TEST_PROPERTY_MAPS
-
-void lcl_TestMap( const SfxItemPropertyMap* pMap )
-{
- while ( pMap->pName )
- {
- const SfxItemPropertyMap* pNext = pMap + 1;
- if ( pNext->pName )
- {
- int nDiff = strcmp( pMap->pName, pNext->pName );
- if ( nDiff >= 0 )
- {
- ByteString aErr("Reihenfolge: ");
- aErr += pMap->pName;
- aErr += '/';
- aErr += pNext->pName;
- DBG_ERROR( aErr.GetBuffer() );
- }
- }
- pMap = pNext;
- }
-}
-
-struct ScPropertyTester
-{
- ScPropertyTester();
-};
-
-//extern const SfxItemPropertyMap* lcl_GetCellStyleMap();
-//extern const SfxItemPropertyMap* lcl_GetPageStyleMap();
-//extern const SfxItemPropertyMap* lcl_GetHeaderStyleMap();
-//extern const SfxItemPropertyMap* lcl_GetFooterStyleMap();
-
-ScPropertyTester::ScPropertyTester()
-{
- lcl_TestMap( lcl_GetCellsPropertyMap() );
- lcl_TestMap( lcl_GetRangePropertyMap() );
- lcl_TestMap( lcl_GetCellPropertyMap() );
- lcl_TestMap( lcl_GetColumnPropertyMap() );
- lcl_TestMap( lcl_GetRowPropertyMap() );
- lcl_TestMap( lcl_GetSheetPropertyMap() );
-
-// lcl_TestMap( lcl_GetCellStyleMap() );
-// lcl_TestMap( lcl_GetPageStyleMap() );
-// lcl_TestMap( lcl_GetHeaderStyleMap() );
-// lcl_TestMap( lcl_GetFooterStyleMap() );
-}
-
-ScPropertyTester aPropertyTester;
-
-#endif
-
-//------------------------------------------------------------------------
-
//! ScLinkListener in anderes File verschieben !!!
ScLinkListener::~ScLinkListener()
@@ -1217,8 +1170,8 @@ BOOL lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
}
BOOL lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
- const uno::Sequence< uno::Sequence<rtl::OUString> >& aData,
- const formula::FormulaGrammar::Grammar eGrammar )
+ const uno::Sequence< uno::Sequence<rtl::OUString> >& aData,
+ const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
// BOOL bApi = TRUE;
@@ -1273,7 +1226,7 @@ BOOL lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
{
String aText(pColArr[nCol]);
ScAddress aPos( nDocCol, nDocRow, nTab );
- ScBaseCell* pNewCell = aFunc.InterpretEnglishString( aPos, aText, eGrammar );
+ ScBaseCell* pNewCell = aFunc.InterpretEnglishString( aPos, aText, rFormulaNmsp, eGrammar );
pDoc->PutCell( aPos, pNewCell );
++nDocCol;
@@ -1372,7 +1325,7 @@ String lcl_GetInputString( ScDocument* pDoc, const ScAddress& rPosition, BOOL bE
// Default-ctor fuer SMART_REFLECTION Krempel
ScCellRangesBase::ScCellRangesBase() :
- aPropSet(lcl_GetCellsPropertyMap()),
+ pPropSet(lcl_GetCellsPropertySet()),
pDocShell( NULL ),
pValueListener( NULL ),
pCurrentFlat( NULL ),
@@ -1390,7 +1343,7 @@ ScCellRangesBase::ScCellRangesBase() :
}
ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
- aPropSet(lcl_GetCellsPropertyMap()),
+ pPropSet(lcl_GetCellsPropertySet()),
pDocShell( pDocSh ),
pValueListener( NULL ),
pCurrentFlat( NULL ),
@@ -1418,7 +1371,7 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
}
ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR) :
- aPropSet(lcl_GetCellsPropertyMap()),
+ pPropSet(lcl_GetCellsPropertySet()),
pDocShell( pDocSh ),
pValueListener( NULL ),
pCurrentFlat( NULL ),
@@ -1619,6 +1572,14 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
bGotDataChangedHint = FALSE;
}
}
+ else if ( nId == SC_HINT_CALCALL )
+ {
+ // broadcast from DoHardRecalc - set bGotDataChangedHint
+ // (SFX_HINT_DATACHANGED follows separately)
+
+ if ( aValueListeners.Count() )
+ bGotDataChangedHint = TRUE;
+ }
}
else if ( rHint.ISA( ScUnoRefUndoHint ) )
{
@@ -1833,27 +1794,20 @@ void SAL_CALL ScCellRangesBase::clearContents( sal_Int32 nContentFlags ) throw(u
const SfxItemPropertyMap* ScCellRangesBase::GetItemPropertyMap()
{
- return lcl_GetCellsPropertyMap();
+ return pPropSet->getPropertyMap();
}
-const SfxItemPropertyMap* lcl_GetPropertyWhich( const SfxItemPropertyMap* pMap, const rtl::OUString& rName,
- USHORT& rItemWhich, sal_Bool bSearch )
+void lcl_GetPropertyWhich( const SfxItemPropertySimpleEntry* pEntry,
+ USHORT& rItemWhich )
{
// Which-ID des betroffenen Items, auch wenn das Item die Property
// nicht alleine behandeln kann
-
-
- const SfxItemPropertyMap* pRetMap;
- if (bSearch)
- pRetMap = SfxItemPropertyMap::GetByName( pMap, rName );
- else
- pRetMap = pMap;
- if ( pRetMap )
+ if ( pEntry )
{
- if ( IsScItemWid( pRetMap->nWID ) )
- rItemWhich = pRetMap->nWID;
+ if ( IsScItemWid( pEntry->nWID ) )
+ rItemWhich = pEntry->nWID;
else
- switch ( pRetMap->nWID )
+ switch ( pEntry->nWID )
{
case SC_WID_UNO_TBLBORD:
rItemWhich = ATTR_BORDER;
@@ -1871,10 +1825,9 @@ const SfxItemPropertyMap* lcl_GetPropertyWhich( const SfxItemPropertyMap* pMap,
}
}
- return pRetMap;
}
-beans::PropertyState ScCellRangesBase::GetOnePropertyState( USHORT nItemWhich, const SfxItemPropertyMap* pMap )
+beans::PropertyState ScCellRangesBase::GetOnePropertyState( USHORT nItemWhich, const SfxItemPropertySimpleEntry* pEntry )
{
beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
if ( nItemWhich ) // item wid (from map or special case)
@@ -1908,11 +1861,11 @@ beans::PropertyState ScCellRangesBase::GetOnePropertyState( USHORT nItemWhich, c
}
}
}
- else if ( pMap )
+ else if ( pEntry )
{
- if ( pMap->nWID == SC_WID_UNO_CHCOLHDR || pMap->nWID == SC_WID_UNO_CHROWHDR || pMap->nWID == SC_WID_UNO_ABSNAME )
+ if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR || pEntry->nWID == SC_WID_UNO_CHROWHDR || pEntry->nWID == SC_WID_UNO_ABSNAME )
eRet = beans::PropertyState_DIRECT_VALUE;
- else if ( pMap->nWID == SC_WID_UNO_CELLSTYL )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
{
// a style is always set, there's no default state
const ScStyleSheet* pStyle = pDocShell->GetDocument()->GetSelectionStyle(*GetMarkData());
@@ -1921,7 +1874,7 @@ beans::PropertyState ScCellRangesBase::GetOnePropertyState( USHORT nItemWhich, c
else
eRet = beans::PropertyState_AMBIGUOUS_VALUE;
}
- else if ( pMap->nWID == SC_WID_UNO_NUMRULES )
+ else if ( pEntry->nWID == SC_WID_UNO_NUMRULES )
eRet = beans::PropertyState_DEFAULT_VALUE; // numbering rules are always default
}
return eRet;
@@ -1934,10 +1887,11 @@ beans::PropertyState SAL_CALL ScCellRangesBase::getPropertyState( const rtl::OUS
if ( aRanges.Count() == 0 )
throw uno::RuntimeException();
- const SfxItemPropertyMap* pMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertyMap* pMap = GetItemPropertyMap(); // from derived class
USHORT nItemWhich = 0;
- pMap = lcl_GetPropertyWhich( pMap, aPropertyName, nItemWhich, sal_True );
- return GetOnePropertyState( nItemWhich, pMap );
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aPropertyName );
+ lcl_GetPropertyWhich( pEntry, nItemWhich );
+ return GetOnePropertyState( nItemWhich, pEntry );
}
uno::Sequence<beans::PropertyState> SAL_CALL ScCellRangesBase::getPropertyStates(
@@ -1946,20 +1900,16 @@ uno::Sequence<beans::PropertyState> SAL_CALL ScCellRangesBase::getPropertyStates
{
ScUnoGuard aGuard;
- const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
beans::PropertyState* pStates = aRet.getArray();
- const SfxItemPropertyMap* pMap = pPropertyMap;
for(INT32 i = 0; i < aPropertyNames.getLength(); i++)
{
USHORT nItemWhich = 0;
- pMap = lcl_GetPropertyWhich(pMap, aPropertyNames[i], nItemWhich, sal_True);
- pStates[i] = GetOnePropertyState(nItemWhich, pMap);
- if (!pMap)
- pMap = pPropertyMap;
- else
- pMap++;
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyNames[i] );
+ lcl_GetPropertyWhich( pEntry, nItemWhich );
+ pStates[i] = GetOnePropertyState(nItemWhich, pEntry);
}
return aRet;
}
@@ -1970,10 +1920,10 @@ void SAL_CALL ScCellRangesBase::setPropertyToDefault( const rtl::OUString& aProp
ScUnoGuard aGuard;
if ( pDocShell )
{
- const SfxItemPropertyMap* pMap = lcl_GetCellsPropertyMap();
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
USHORT nItemWhich = 0;
- pMap = lcl_GetPropertyWhich(pMap, aPropertyName, nItemWhich, sal_True);
-
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyName );
+ lcl_GetPropertyWhich( pEntry, nItemWhich );
if ( nItemWhich ) // item wid (from map or special case)
{
if ( aRanges.Count() ) // leer = nichts zu tun
@@ -1997,13 +1947,13 @@ void SAL_CALL ScCellRangesBase::setPropertyToDefault( const rtl::OUString& aProp
aFunc.ClearItems( *GetMarkData(), aWIDs, TRUE );
}
}
- else if ( pMap )
+ else if ( pEntry )
{
- if ( pMap->nWID == SC_WID_UNO_CHCOLHDR )
+ if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR )
bChartColAsHdr = FALSE;
- else if ( pMap->nWID == SC_WID_UNO_CHROWHDR )
+ else if ( pEntry->nWID == SC_WID_UNO_CHROWHDR )
bChartRowAsHdr = FALSE;
- else if ( pMap->nWID == SC_WID_UNO_CELLSTYL )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
{
ScDocFunc aFunc(*pDocShell);
aFunc.ApplyStyle( *GetMarkData(), ScGlobal::GetRscString(STR_STYLENAME_STANDARD), TRUE, TRUE );
@@ -2024,34 +1974,34 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const rtl::OUString& aPr
if ( pDocShell )
{
ScDocument* pDoc = pDocShell->GetDocument();
- const SfxItemPropertyMap* pMap =
- SfxItemPropertyMap::GetByName( lcl_GetCellsPropertyMap(), aPropertyName );
- if ( pMap )
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyName );
+ if ( pEntry )
{
- if ( IsScItemWid( pMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
const ScPatternAttr* pPattern = pDoc->GetDefPattern();
if ( pPattern )
{
const SfxItemSet& rSet = pPattern->GetItemSet();
- switch ( pMap->nWID ) // fuer Item-Spezial-Behandlungen
+ switch ( pEntry->nWID ) // fuer Item-Spezial-Behandlungen
{
case ATTR_VALUE_FORMAT:
// default has no language set
- aAny <<= (sal_Int32)( ((const SfxUInt32Item&)rSet.Get(pMap->nWID)).GetValue() );
+ aAny <<= (sal_Int32)( ((const SfxUInt32Item&)rSet.Get(pEntry->nWID)).GetValue() );
break;
case ATTR_INDENT:
aAny <<= (sal_Int16)( TwipsToHMM(((const SfxUInt16Item&)
- rSet.Get(pMap->nWID)).GetValue()) );
+ rSet.Get(pEntry->nWID)).GetValue()) );
break;
default:
- aPropSet.getPropertyValue(aPropertyName, rSet, aAny);
+ pPropSet->getPropertyValue(aPropertyName, rSet, aAny);
}
}
}
else
- switch ( pMap->nWID )
+ switch ( pEntry->nWID )
{
case SC_WID_UNO_CHCOLHDR:
case SC_WID_UNO_CHROWHDR:
@@ -2078,8 +2028,8 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const rtl::OUString& aPr
case SC_WID_UNO_CONDLOC:
case SC_WID_UNO_CONDXML:
{
- BOOL bEnglish = ( pMap->nWID != SC_WID_UNO_CONDLOC );
- BOOL bXML = ( pMap->nWID == SC_WID_UNO_CONDXML );
+ BOOL bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
+ BOOL bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
pDoc->GetStorageGrammar() :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
@@ -2092,8 +2042,8 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const rtl::OUString& aPr
case SC_WID_UNO_VALILOC:
case SC_WID_UNO_VALIXML:
{
- BOOL bEnglish = ( pMap->nWID != SC_WID_UNO_VALILOC );
- BOOL bXML = ( pMap->nWID == SC_WID_UNO_VALIXML );
+ BOOL bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
+ BOOL bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
pDoc->GetStorageGrammar() :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
@@ -2121,20 +2071,20 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangesBase::getPropertySe
{
ScUnoGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
+ new SfxItemPropertySetInfo( pPropSet->getPropertyMap() ));
return aRef;
}
-void lcl_SetCellProperty( const SfxItemPropertyMap& rMap, const uno::Any& rValue,
+void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rValue,
ScPatternAttr& rPattern, ScDocument* pDoc,
USHORT& rFirstItemId, USHORT& rSecondItemId )
{
- rFirstItemId = rMap.nWID;
+ rFirstItemId = rEntry.nWID;
rSecondItemId = 0;
SfxItemSet& rSet = rPattern.GetItemSet();
- switch ( rMap.nWID )
+ switch ( rEntry.nWID )
{
case ATTR_VALUE_FORMAT:
{
@@ -2177,7 +2127,7 @@ void lcl_SetCellProperty( const SfxItemPropertyMap& rMap, const uno::Any& rValue
{
sal_Int16 nIntVal = 0;
if ( rValue >>= nIntVal )
- rSet.Put( SfxUInt16Item( rMap.nWID, (USHORT)HMMToTwips(nIntVal) ) );
+ rSet.Put( SfxUInt16Item( rEntry.nWID, (USHORT)HMMToTwips(nIntVal) ) );
else
throw lang::IllegalArgumentException();
}
@@ -2231,8 +2181,7 @@ void lcl_SetCellProperty( const SfxItemPropertyMap& rMap, const uno::Any& rValue
break;
default:
{
- SfxItemPropertySet aPropSet( lcl_GetCellsPropertyMap() );
- aPropSet.setPropertyValue(rMap, rValue, rSet);
+ lcl_GetCellsPropertySet()->setPropertyValue(rEntry, rValue, rSet);
}
}
}
@@ -2248,20 +2197,20 @@ void SAL_CALL ScCellRangesBase::setPropertyValue(
if ( !pDocShell || aRanges.Count() == 0 )
throw uno::RuntimeException();
- const SfxItemPropertyMap* pMap = GetItemPropertyMap(); // from derived class
- pMap = SfxItemPropertyMap::GetByName( pMap, aPropertyName );
- if ( !pMap )
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
- SetOnePropertyValue( pMap, aValue );
+ SetOnePropertyValue( pEntry, aValue );
}
-void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno::Any& aValue )
+void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
- if ( IsScItemWid( pMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
if ( aRanges.Count() ) // leer = nichts zu tun
{
@@ -2280,7 +2229,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertyMap* pMap, cons
rSet.ClearInvalidItems();
USHORT nFirstItem, nSecondItem;
- lcl_SetCellProperty( *pMap, aValue, aPattern, pDoc, nFirstItem, nSecondItem );
+ lcl_SetCellProperty( *pEntry, aValue, aPattern, pDoc, nFirstItem, nSecondItem );
for (USHORT nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++)
if ( nWhich != nFirstItem && nWhich != nSecondItem )
@@ -2290,7 +2239,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertyMap* pMap, cons
}
}
else // implemented here
- switch ( pMap->nWID )
+ switch ( pEntry->nWID )
{
case SC_WID_UNO_CHCOLHDR:
// chart header flags are set for this object, not stored with document
@@ -2334,8 +2283,8 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertyMap* pMap, cons
if (pFormat)
{
ScDocument* pDoc = pDocShell->GetDocument();
- BOOL bEnglish = ( pMap->nWID != SC_WID_UNO_CONDLOC );
- BOOL bXML = ( pMap->nWID == SC_WID_UNO_CONDXML );
+ BOOL bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
+ BOOL bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
formula::FormulaGrammar::GRAM_UNSPECIFIED :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
@@ -2365,8 +2314,8 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertyMap* pMap, cons
if (pValidObj)
{
ScDocument* pDoc = pDocShell->GetDocument();
- BOOL bEnglish = ( pMap->nWID != SC_WID_UNO_VALILOC );
- BOOL bXML = ( pMap->nWID == SC_WID_UNO_VALIXML );
+ BOOL bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
+ BOOL bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
formula::FormulaGrammar::GRAM_UNSPECIFIED :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
@@ -2399,28 +2348,28 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyValue( const rtl::OUString& aProp
if ( !pDocShell || aRanges.Count() == 0 )
throw uno::RuntimeException();
- const SfxItemPropertyMap* pMap = GetItemPropertyMap(); // from derived class
- pMap = SfxItemPropertyMap::GetByName( pMap, aPropertyName );
- if ( !pMap )
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
uno::Any aAny;
- GetOnePropertyValue( pMap, aAny );
+ GetOnePropertyValue( pEntry, aAny );
return aAny;
}
-void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
uno::Any& rAny )
throw(uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
- if ( IsScItemWid( pMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
SfxItemSet* pDataSet = GetCurrentDataSet();
if ( pDataSet )
{
- switch ( pMap->nWID ) // fuer Item-Spezial-Behandlungen
+ switch ( pEntry->nWID ) // fuer Item-Spezial-Behandlungen
{
case ATTR_VALUE_FORMAT:
{
@@ -2437,22 +2386,22 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
break;
case ATTR_INDENT:
rAny <<= (sal_Int16)( TwipsToHMM(((const SfxUInt16Item&)
- pDataSet->Get(pMap->nWID)).GetValue()) );
+ pDataSet->Get(pEntry->nWID)).GetValue()) );
break;
case ATTR_STACKED:
{
sal_Int32 nRot = ((const SfxInt32Item&)pDataSet->Get(ATTR_ROTATE_VALUE)).GetValue();
- BOOL bStacked = ((const SfxBoolItem&)pDataSet->Get(pMap->nWID)).GetValue();
+ BOOL bStacked = ((const SfxBoolItem&)pDataSet->Get(pEntry->nWID)).GetValue();
SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny );
}
break;
default:
- aPropSet.getPropertyValue(*pMap, *pDataSet, rAny);
+ pPropSet->getPropertyValue(*pEntry, *pDataSet, rAny);
}
}
}
else // implemented here
- switch ( pMap->nWID )
+ switch ( pEntry->nWID )
{
case SC_WID_UNO_CHCOLHDR:
ScUnoHelpFunctions::SetBoolInAny( rAny, bChartColAsHdr );
@@ -2499,8 +2448,8 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
if ( pPattern )
{
ScDocument* pDoc = pDocShell->GetDocument();
- BOOL bEnglish = ( pMap->nWID != SC_WID_UNO_CONDLOC );
- BOOL bXML = ( pMap->nWID == SC_WID_UNO_CONDXML );
+ BOOL bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
+ BOOL bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
pDoc->GetStorageGrammar() :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
@@ -2519,8 +2468,8 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
if ( pPattern )
{
ScDocument* pDoc = pDocShell->GetDocument();
- BOOL bEnglish = ( pMap->nWID != SC_WID_UNO_VALILOC );
- BOOL bXML = ( pMap->nWID == SC_WID_UNO_VALIXML );
+ BOOL bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
+ BOOL bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
formula::FormulaGrammar::Grammar eGrammar = (bXML ?
pDoc->GetStorageGrammar() :
formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
@@ -2609,7 +2558,7 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUS
const rtl::OUString* pNames = aPropertyNames.getConstArray();
const uno::Any* pValues = aValues.getConstArray();
- const SfxItemPropertyMap** pMapArray = new const SfxItemPropertyMap*[nCount];
+ const SfxItemPropertySimpleEntry** pEntryArray = new const SfxItemPropertySimpleEntry*[nCount];
sal_Int32 i;
for(i = 0; i < nCount; i++)
@@ -2617,17 +2566,15 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUS
// first loop: find all properties in map, but handle only CellStyle
// (CellStyle must be set before any other cell properties)
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( pPropertyMap, pNames[i] );
- pMapArray[i] = pMap;
- if (pMap)
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( pNames[i] );
+ pEntryArray[i] = pEntry;
+ if (pEntry)
{
- pPropertyMap = pMap + 1; // continue searching at the next entry
-
- if ( pMap->nWID == SC_WID_UNO_CELLSTYL )
+ if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
{
try
{
- SetOnePropertyValue( pMap, pValues[i] );
+ SetOnePropertyValue( pEntry, pValues[i] );
}
catch ( lang::IllegalArgumentException& )
{
@@ -2645,10 +2592,10 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUS
{
// second loop: handle other properties
- const SfxItemPropertyMap* pMap = pMapArray[i];
- if ( pMap )
+ const SfxItemPropertySimpleEntry* pEntry = pEntryArray[i];
+ if ( pEntry )
{
- if ( IsScItemWid( pMap->nWID ) ) // can be handled by SfxItemPropertySet
+ if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
{
if ( !pOldPattern )
{
@@ -2660,7 +2607,7 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUS
// collect items in pNewPattern, apply with one call after the loop
USHORT nFirstItem, nSecondItem;
- lcl_SetCellProperty( *pMap, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
+ lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
// put only affected items into new set
if ( nFirstItem )
@@ -2668,10 +2615,10 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUS
if ( nSecondItem )
pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
}
- else if ( pMap->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
+ else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
{
// call virtual method to set a single property
- SetOnePropertyValue( pMap, pValues[i] );
+ SetOnePropertyValue( pEntry, pValues[i] );
}
}
}
@@ -2684,7 +2631,7 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUS
delete pNewPattern;
delete pOldPattern;
- delete[] pMapArray;
+ delete[] pEntryArray;
}
}
@@ -2694,19 +2641,14 @@ uno::Sequence<uno::Any> SAL_CALL ScCellRangesBase::getPropertyValues(
{
ScUnoGuard aGuard;
- const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
uno::Sequence<uno::Any> aRet(aPropertyNames.getLength());
uno::Any* pProperties = aRet.getArray();
- const SfxItemPropertyMap* pMap = pPropertyMap;
for(INT32 i = 0; i < aPropertyNames.getLength(); i++)
{
- pMap = SfxItemPropertyMap::GetByName( pMap, aPropertyNames[i] );
- GetOnePropertyValue( pMap, pProperties[i] );
- if (!pMap)
- pMap = pPropertyMap;
- else
- pMap++;
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyNames[i] );
+ GetOnePropertyValue( pEntry, pProperties[i] );
}
return aRet;
}
@@ -2762,11 +2704,11 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
uno::Sequence < beans::SetPropertyTolerantFailed > aReturns(nCount);
beans::SetPropertyTolerantFailed* pReturns = aReturns.getArray();
- const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
const rtl::OUString* pNames = aPropertyNames.getConstArray();
const uno::Any* pValues = aValues.getConstArray();
- const SfxItemPropertyMap** pMapArray = new const SfxItemPropertyMap*[nCount];
+ const SfxItemPropertySimpleEntry** pMapArray = new const SfxItemPropertySimpleEntry*[nCount];
sal_Int32 i;
for(i = 0; i < nCount; i++)
@@ -2774,17 +2716,15 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
// first loop: find all properties in map, but handle only CellStyle
// (CellStyle must be set before any other cell properties)
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetTolerantByName( pPropertyMap, pNames[i] );
- pMapArray[i] = pMap;
- if (pMap)
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( pNames[i] );
+ pMapArray[i] = pEntry;
+ if (pEntry)
{
- pPropertyMap = pMap + 1; // continue searching at the next entry
-
- if ( pMap->nWID == SC_WID_UNO_CELLSTYL )
+ if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
{
try
{
- SetOnePropertyValue( pMap, pValues[i] );
+ SetOnePropertyValue( pEntry, pValues[i] );
}
catch ( lang::IllegalArgumentException& )
{
@@ -2803,10 +2743,10 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
{
// second loop: handle other properties
- const SfxItemPropertyMap* pMap = pMapArray[i];
- if ( pMap && ((pMap->nFlags & beans::PropertyAttribute::READONLY) == 0))
+ const SfxItemPropertySimpleEntry* pEntry = pMapArray[i];
+ if ( pEntry && ((pEntry->nFlags & beans::PropertyAttribute::READONLY) == 0))
{
- if ( IsScItemWid( pMap->nWID ) ) // can be handled by SfxItemPropertySet
+ if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
{
if ( !pOldPattern )
{
@@ -2820,7 +2760,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
USHORT nFirstItem, nSecondItem;
try
{
- lcl_SetCellProperty( *pMap, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
+ lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, pDoc, nFirstItem, nSecondItem );
// put only affected items into new set
if ( nFirstItem )
@@ -2834,12 +2774,12 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
}
}
- else if ( pMap->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
+ else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
{
// call virtual method to set a single property
try
{
- SetOnePropertyValue( pMap, pValues[i] );
+ SetOnePropertyValue( pEntry, pValues[i] );
}
catch ( lang::IllegalArgumentException& )
{
@@ -2851,7 +2791,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
else
{
pReturns[nFailed].Name = pNames[i];
- if (pMap)
+ if (pEntry)
pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
else
pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
@@ -2884,27 +2824,22 @@ uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL ScCellRangesBase::get
uno::Sequence < beans::GetPropertyTolerantResult > aReturns(nCount);
beans::GetPropertyTolerantResult* pReturns = aReturns.getArray();
- const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
- const SfxItemPropertyMap* pMap = pPropertyMap;
for(INT32 i = 0; i < nCount; i++)
{
- pPropertyMap = pMap;
- pMap = SfxItemPropertyMap::GetTolerantByName( pMap, aPropertyNames[i] );
- if (!pMap)
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyNames[i] );
+ if (!pEntry)
{
- pMap = pPropertyMap;
pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
}
else
{
USHORT nItemWhich = 0;
- lcl_GetPropertyWhich( pMap, aPropertyNames[i], nItemWhich, sal_False );
- pReturns[i].State = GetOnePropertyState( nItemWhich, pMap );
- GetOnePropertyValue( pMap, pReturns[i].Value );
+ lcl_GetPropertyWhich( pEntry, nItemWhich );
+ pReturns[i].State = GetOnePropertyState( nItemWhich, pEntry );
+ GetOnePropertyValue( pEntry, pReturns[i].Value );
pReturns[i].Result = beans::TolerantPropertySetResultType::SUCCESS;
-
- ++pMap;
}
}
return aReturns;
@@ -2919,32 +2854,28 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL ScCellRangesBas
uno::Sequence < beans::GetDirectPropertyTolerantResult > aReturns(nCount);
beans::GetDirectPropertyTolerantResult* pReturns = aReturns.getArray();
- const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
+ const SfxItemPropertyMap* pPropertyMap = GetItemPropertyMap(); // from derived class
- const SfxItemPropertyMap* pMap = pPropertyMap;
INT32 j = 0;
for(INT32 i = 0; i < nCount; i++)
{
- pPropertyMap = pMap;
- pMap = SfxItemPropertyMap::GetTolerantByName( pMap, aPropertyNames[i] );
- if (!pMap)
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( aPropertyNames[i] );
+ if (!pEntry)
{
- pMap = pPropertyMap;
pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
}
else
{
USHORT nItemWhich = 0;
- lcl_GetPropertyWhich( pMap, aPropertyNames[i], nItemWhich, sal_False );
- pReturns[j].State = GetOnePropertyState( nItemWhich, pMap );
+ lcl_GetPropertyWhich( pEntry, nItemWhich );
+ pReturns[j].State = GetOnePropertyState( nItemWhich, pEntry );
if (pReturns[j].State == beans::PropertyState_DIRECT_VALUE)
{
- GetOnePropertyValue( pMap, pReturns[j].Value );
+ GetOnePropertyValue( pEntry, pReturns[j].Value );
pReturns[j].Result = beans::TolerantPropertySetResultType::SUCCESS;
pReturns[j].Name = aPropertyNames[i];
++j;
}
- ++pMap;
}
}
if (j < nCount)
@@ -4802,7 +4733,7 @@ uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( ScDocument
ScCellRangeObj::ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR) :
ScCellRangesBase( pDocSh, rR ),
- aRangePropSet( lcl_GetRangePropertyMap() ),
+ pRangePropSet( lcl_GetRangePropertySet() ),
aRange( rR )
{
aRange.Justify(); // Anfang / Ende richtig
@@ -5121,15 +5052,14 @@ rtl::OUString SAL_CALL ScCellRangeObj::getArrayFormula() throw(uno::RuntimeExcep
return aFormula;
}
-void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& aFormula,
- const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
+void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& rFormula,
+ const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
{
ScDocShell* pDocSh = GetDocShell();
if (pDocSh)
{
- String aString(aFormula);
ScDocFunc aFunc(*pDocSh);
- if ( aString.Len() )
+ if ( rFormula.getLength() )
{
if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
{
@@ -5137,7 +5067,7 @@ void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& aFormula,
throw uno::RuntimeException();
}
- aFunc.EnterMatrix( aRange, NULL, NULL, aString, TRUE, TRUE, eGrammar );
+ aFunc.EnterMatrix( aRange, NULL, NULL, rFormula, TRUE, TRUE, rFormulaNmsp, eGrammar );
}
else
{
@@ -5155,14 +5085,14 @@ void SAL_CALL ScCellRangeObj::setArrayFormula( const rtl::OUString& aFormula )
{
ScUnoGuard aGuard;
// GRAM_PODF_A1 for API compatibility.
- SetArrayFormula_Impl( aFormula,formula::FormulaGrammar::GRAM_PODF_A1);
+ SetArrayFormula_Impl( aFormula, ::rtl::OUString(), formula::FormulaGrammar::GRAM_PODF_A1);
}
-void ScCellRangeObj::SetArrayFormulaWithGrammar( const rtl::OUString& aFormula,
- const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
+void ScCellRangeObj::SetArrayFormulaWithGrammar( const rtl::OUString& rFormula,
+ const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- SetArrayFormula_Impl( aFormula, eGrammar);
+ SetArrayFormula_Impl( rFormula, rFormulaNmsp, eGrammar);
}
// XArrayFormulaTokens
@@ -5222,7 +5152,7 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula
// Actually GRAM_PODF_A1 is a don't-care here because of the token
// array being set, it fits with other API compatibility grammars
// though.
- aFunc.EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, TRUE, TRUE,formula::FormulaGrammar::GRAM_PODF_A1 );
+ aFunc.EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, TRUE, TRUE, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
else
{
@@ -5338,7 +5268,7 @@ void SAL_CALL ScCellRangeObj::setFormulaArray(
if (pDocSh)
{
// GRAM_PODF_A1 for API compatibility.
- bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray,formula::FormulaGrammar::GRAM_PODF_A1 );
+ bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
if (!bDone)
@@ -5508,7 +5438,7 @@ void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
if ( pDocSh && nSourceCount )
{
ScRange aSourceRange(aRange);
- SCCOLROW nCount = 0; // "Dest-Count"
+ SCsCOLROW nCount = 0; // "Dest-Count"
FillDir eDir = FILL_TO_BOTTOM;
BOOL bError = FALSE;
switch (nFillDirection)
@@ -5536,7 +5466,7 @@ void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
default:
bError = TRUE;
}
- if (nCount > MAXROW) // Ueberlauf
+ if (nCount < 0 || nCount > MAXROW) // overflow
bError = TRUE;
if (!bError)
@@ -5702,7 +5632,15 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe
ScDocShell* pDocSh = GetDocShell();
ScFilterDescriptor aImpl(pDocSh);
- aImpl.setFilterFields( xDescriptor->getFilterFields() );
+ uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY );
+ if ( xDescriptor2.is() )
+ {
+ aImpl.setFilterFields2( xDescriptor2->getFilterFields2() );
+ }
+ else
+ {
+ aImpl.setFilterFields( xDescriptor->getFilterFields() );
+ }
// Rest sind jetzt Properties...
uno::Reference<beans::XPropertySet> xPropSet( xDescriptor, uno::UNO_QUERY );
@@ -6000,26 +5938,26 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangeObj::getPropertySetI
{
ScUnoGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aRangePropSet.getPropertyMap() ));
+ new SfxItemPropertySetInfo( pRangePropSet->getPropertyMap() ));
return aRef;
}
-void ScCellRangeObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno::Any& aValue )
+void ScCellRangeObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
throw(lang::IllegalArgumentException, uno::RuntimeException)
{
// Range has only Position and Size in addition to ScCellRangesBase, both are ReadOnly
// -> nothing to do here
- ScCellRangesBase::SetOnePropertyValue( pMap, aValue );
+ ScCellRangesBase::SetOnePropertyValue( pEntry, aValue );
}
-void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
uno::Any& rAny )
throw(uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
- if ( pMap->nWID == SC_WID_UNO_POS )
+ if ( pEntry->nWID == SC_WID_UNO_POS )
{
ScDocShell* pDocSh = GetDocShell();
if (pDocSh)
@@ -6032,7 +5970,7 @@ void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
rAny <<= aPos;
}
}
- else if ( pMap->nWID == SC_WID_UNO_SIZE )
+ else if ( pEntry->nWID == SC_WID_UNO_SIZE )
{
ScDocShell* pDocSh = GetDocShell();
if (pDocSh)
@@ -6047,14 +5985,14 @@ void ScCellRangeObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
}
}
else
- ScCellRangesBase::GetOnePropertyValue( pMap, rAny );
+ ScCellRangesBase::GetOnePropertyValue( pEntry, rAny );
}
}
const SfxItemPropertyMap* ScCellRangeObj::GetItemPropertyMap()
{
- return lcl_GetRangePropertyMap();
+ return pRangePropSet->getPropertyMap();
}
// XServiceInfo
@@ -6090,20 +6028,19 @@ uno::Sequence<rtl::OUString> SAL_CALL ScCellRangeObj::getSupportedServiceNames()
//------------------------------------------------------------------------
-const SfxItemPropertyMap* ScCellObj::GetEditPropertyMap() // static
+const SvxItemPropertySet* ScCellObj::GetEditPropertySet() // static
{
- return lcl_GetEditPropertyMap();
+ return lcl_GetEditPropertySet();
}
-
const SfxItemPropertyMap* ScCellObj::GetCellPropertyMap()
{
- return lcl_GetCellPropertyMap();
+ return lcl_GetCellPropertySet()->getPropertyMap();
}
ScCellObj::ScCellObj(ScDocShell* pDocSh, const ScAddress& rP) :
ScCellRangeObj( pDocSh, ScRange(rP,rP) ),
pUnoText( NULL ),
- aCellPropSet( lcl_GetCellPropertyMap() ),
+ pCellPropSet( lcl_GetCellPropertySet() ),
aCellPos( rP ),
nActionLockCount( 0 )
{
@@ -6218,11 +6155,6 @@ String ScCellObj::GetInputString_Impl(BOOL bEnglish) const // fuer getFormu
return String();
}
-String ScCellObj::GetInputString_Impl(ScDocument* pDoc, const ScAddress& aPos, BOOL bEnglish) // fuer getFormula / FormulaLocal
-{
- return lcl_GetInputString( pDoc, aPos, bEnglish );
-}
-
String ScCellObj::GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aCellPos)
{
String aVal;
@@ -6273,7 +6205,7 @@ void ScCellObj::SetString_Impl(const String& rString, BOOL bInterpret, BOOL bEng
{
ScDocFunc aFunc(*pDocSh);
// GRAM_PODF_A1 for API compatibility.
- (void)aFunc.SetCellText( aCellPos, rString, bInterpret, bEnglish, TRUE,formula::FormulaGrammar::GRAM_PODF_A1 );
+ (void)aFunc.SetCellText( aCellPos, rString, bInterpret, bEnglish, TRUE, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
}
}
@@ -6321,13 +6253,13 @@ void ScCellObj::SetFormulaResultDouble( double fResult )
}
void ScCellObj::SetFormulaWithGrammar( const ::rtl::OUString& rFormula,
- const formula::FormulaGrammar::Grammar eGrammar )
+ const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
{
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
ScDocFunc aFunc(*pDocSh);
- aFunc.SetCellText( aCellPos, String( rFormula), TRUE, TRUE, TRUE, eGrammar);
+ aFunc.SetCellText( aCellPos, rFormula, TRUE, TRUE, TRUE, rFormulaNmsp, eGrammar);
}
}
@@ -6695,56 +6627,56 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellObj::getPropertySetInfo()
{
ScUnoGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aCellPropSet.getPropertyMap() ));
+ new SfxItemPropertySetInfo( pCellPropSet->getPropertyMap() ));
return aRef;
}
-void ScCellObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno::Any& aValue )
+void ScCellObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
- if ( pMap->nWID == SC_WID_UNO_FORMLOC )
+ if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
{
rtl::OUString aStrVal;
aValue >>= aStrVal;
String aString(aStrVal);
SetString_Impl(aString, TRUE, FALSE); // lokal interpretieren
}
- else if ( pMap->nWID == SC_WID_UNO_FORMRT )
+ else if ( pEntry->nWID == SC_WID_UNO_FORMRT )
{
// Read-Only
//! Exception oder so...
}
else
- ScCellRangeObj::SetOnePropertyValue( pMap, aValue );
+ ScCellRangeObj::SetOnePropertyValue( pEntry, aValue );
}
}
-void ScCellObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+void ScCellObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
uno::Any& rAny )
throw(uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
- if ( pMap->nWID == SC_WID_UNO_FORMLOC )
+ if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
{
// FALSE = lokal
rAny <<= rtl::OUString( GetInputString_Impl(FALSE) );
}
- else if ( pMap->nWID == SC_WID_UNO_FORMRT )
+ else if ( pEntry->nWID == SC_WID_UNO_FORMRT )
{
table::CellContentType eType = GetResultType_Impl();
rAny <<= eType;
}
else
- ScCellRangeObj::GetOnePropertyValue(pMap, rAny);
+ ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
}
const SfxItemPropertyMap* ScCellObj::GetItemPropertyMap()
{
- return lcl_GetCellPropertyMap();
+ return pCellPropSet->getPropertyMap();
}
// XServiceInfo
@@ -6873,7 +6805,7 @@ sal_Int16 SAL_CALL ScCellObj::resetActionLocks() throw(uno::RuntimeException)
ScTableSheetObj::ScTableSheetObj( ScDocShell* pDocSh, SCTAB nTab ) :
ScCellRangeObj( pDocSh, ScRange(0,0,nTab, MAXCOL,MAXROW,nTab) ),
- aSheetPropSet(lcl_GetSheetPropertyMap())
+ pSheetPropSet(lcl_GetSheetPropertySet())
{
}
@@ -8234,19 +8166,19 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableSheetObj::getPropertySet
{
ScUnoGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aSheetPropSet.getPropertyMap() ));
+ new SfxItemPropertySetInfo( pSheetPropSet->getPropertyMap() ));
return aRef;
}
-void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno::Any& aValue )
+void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
- if ( IsScItemWid( pMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
// for Item WIDs, call ScCellRangesBase directly
- ScCellRangesBase::SetOnePropertyValue(pMap, aValue);
+ ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
return;
}
@@ -8259,7 +8191,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
SCTAB nTab = GetTab_Impl();
ScDocFunc aFunc(*pDocSh);
- if ( pMap->nWID == SC_WID_UNO_PAGESTL )
+ if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
{
rtl::OUString aStrVal;
aValue >>= aStrVal;
@@ -8288,17 +8220,17 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
pDocSh->SetDocumentModified();
}
}
- else if ( pMap->nWID == SC_WID_UNO_CELLVIS )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
BOOL bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
aFunc.SetTableVisible( nTab, bVis, TRUE );
}
- else if ( pMap->nWID == SC_WID_UNO_ISACTIVE )
+ else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
{
if (pDoc->IsScenario(nTab))
pDoc->SetActiveScenario( nTab, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
}
- else if ( pMap->nWID == SC_WID_UNO_BORDCOL )
+ else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
{
if (pDoc->IsScenario(nTab))
{
@@ -8318,7 +8250,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
}
}
}
- else if ( pMap->nWID == SC_WID_UNO_PROTECT )
+ else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
{
if (pDoc->IsScenario(nTab))
{
@@ -8351,7 +8283,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
}
- else if ( pMap->nWID == SC_WID_UNO_SHOWBORD )
+ else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
{
if (pDoc->IsScenario(nTab))
{
@@ -8384,7 +8316,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
}
- else if ( pMap->nWID == SC_WID_UNO_PRINTBORD )
+ else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
{
if (pDoc->IsScenario(nTab))
{
@@ -8417,7 +8349,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
}
- else if ( pMap->nWID == SC_WID_UNO_COPYBACK )
+ else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
{
if (pDoc->IsScenario(nTab))
{
@@ -8450,7 +8382,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
}
- else if ( pMap->nWID == SC_WID_UNO_COPYSTYL )
+ else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
{
if (pDoc->IsScenario(nTab))
{
@@ -8483,7 +8415,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
}
- else if ( pMap->nWID == SC_WID_UNO_COPYFORM )
+ else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
{
if (pDoc->IsScenario(nTab))
{
@@ -8516,7 +8448,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
}
}
- else if ( pMap->nWID == SC_WID_UNO_TABLAYOUT )
+ else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
{
sal_Int16 nValue = 0;
if (aValue >>= nValue)
@@ -8527,7 +8459,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
aFunc.SetLayoutRTL(nTab, sal_False, sal_True);
}
}
- else if ( pMap->nWID == SC_WID_UNO_AUTOPRINT )
+ else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
{
BOOL bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue );
if (bAutoPrint)
@@ -8539,15 +8471,15 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const
}
}
else
- ScCellRangeObj::SetOnePropertyValue(pMap, aValue); // base class, no Item WID
+ ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
}
-void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
uno::Any& rAny )
throw(uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
ScDocShell* pDocSh = GetDocShell();
if (!pDocSh)
@@ -8555,32 +8487,32 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
ScDocument* pDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- if ( pMap->nWID == SC_WID_UNO_PAGESTL )
+ if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
{
rAny <<= rtl::OUString( ScStyleNameConversion::DisplayToProgrammaticName(
pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ) );
}
- else if ( pMap->nWID == SC_WID_UNO_CELLVIS )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
BOOL bVis = pDoc->IsVisible( nTab );
ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
}
- else if ( pMap->nWID == SC_WID_UNO_LINKDISPBIT )
+ else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT )
{
// no target bitmaps for individual entries (would be all equal)
// ScLinkTargetTypeObj::SetLinkTargetBitmap( aAny, SC_LINKTARGETTYPE_SHEET );
}
- else if ( pMap->nWID == SC_WID_UNO_LINKDISPNAME )
+ else if ( pEntry->nWID == SC_WID_UNO_LINKDISPNAME )
{
// LinkDisplayName for hyperlink dialog
rAny <<= getName(); // sheet name
}
- else if ( pMap->nWID == SC_WID_UNO_ISACTIVE )
+ else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
{
if (pDoc->IsScenario(nTab))
ScUnoHelpFunctions::SetBoolInAny( rAny, pDoc->IsActiveScenario( nTab ));
}
- else if ( pMap->nWID == SC_WID_UNO_BORDCOL )
+ else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
{
if (pDoc->IsScenario(nTab))
{
@@ -8592,7 +8524,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
rAny <<= static_cast<sal_Int32>(aColor.GetColor());
}
}
- else if ( pMap->nWID == SC_WID_UNO_PROTECT )
+ else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
{
if (pDoc->IsScenario(nTab))
{
@@ -8604,7 +8536,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PROTECT) != 0 );
}
}
- else if ( pMap->nWID == SC_WID_UNO_SHOWBORD )
+ else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
{
if (pDoc->IsScenario(nTab))
{
@@ -8616,7 +8548,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_SHOWFRAME) != 0 );
}
}
- else if ( pMap->nWID == SC_WID_UNO_PRINTBORD )
+ else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
{
if (pDoc->IsScenario(nTab))
{
@@ -8628,7 +8560,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_PRINTFRAME) != 0 );
}
}
- else if ( pMap->nWID == SC_WID_UNO_COPYBACK )
+ else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
{
if (pDoc->IsScenario(nTab))
{
@@ -8640,7 +8572,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_TWOWAY) != 0 );
}
}
- else if ( pMap->nWID == SC_WID_UNO_COPYSTYL )
+ else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
{
if (pDoc->IsScenario(nTab))
{
@@ -8652,7 +8584,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
ScUnoHelpFunctions::SetBoolInAny( rAny, (nFlags & SC_SCENARIO_ATTRIB) != 0 );
}
}
- else if ( pMap->nWID == SC_WID_UNO_COPYFORM )
+ else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
{
if (pDoc->IsScenario(nTab))
{
@@ -8664,26 +8596,26 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
ScUnoHelpFunctions::SetBoolInAny( rAny, !(nFlags & SC_SCENARIO_VALUE));
}
}
- else if ( pMap->nWID == SC_WID_UNO_TABLAYOUT )
+ else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
{
if (pDoc->IsLayoutRTL(nTab))
rAny <<= sal_Int16(com::sun::star::text::WritingMode2::RL_TB);
else
rAny <<= sal_Int16(com::sun::star::text::WritingMode2::LR_TB);
}
- else if ( pMap->nWID == SC_WID_UNO_AUTOPRINT )
+ else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
{
BOOL bAutoPrint = pDoc->IsPrintEntireSheet( nTab );
ScUnoHelpFunctions::SetBoolInAny( rAny, bAutoPrint );
}
else
- ScCellRangeObj::GetOnePropertyValue(pMap, rAny);
+ ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
}
const SfxItemPropertyMap* ScTableSheetObj::GetItemPropertyMap()
{
- return lcl_GetSheetPropertyMap();
+ return pSheetPropSet->getPropertyMap();
}
// XServiceInfo
@@ -8767,7 +8699,7 @@ ScTableSheetObj* ScTableSheetObj::getImplementation( const uno::Reference<uno::X
ScTableColumnObj::ScTableColumnObj( ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab ) :
ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol,MAXROW,nTab) ),
- aColPropSet(lcl_GetColumnPropertyMap())
+ pColPropSet(lcl_GetColumnPropertySet())
{
}
@@ -8849,19 +8781,19 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableColumnObj::getPropertySe
{
ScUnoGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aColPropSet.getPropertyMap() ));
+ new SfxItemPropertySetInfo( pColPropSet->getPropertyMap() ));
return aRef;
}
-void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno::Any& aValue )
+void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
- if ( IsScItemWid( pMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
// for Item WIDs, call ScCellRangesBase directly
- ScCellRangesBase::SetOnePropertyValue(pMap, aValue);
+ ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
return;
}
@@ -8879,7 +8811,7 @@ void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, cons
SCCOLROW nColArr[2];
nColArr[0] = nColArr[1] = nCol;
- if ( pMap->nWID == SC_WID_UNO_CELLWID )
+ if ( pEntry->nWID == SC_WID_UNO_CELLWID )
{
sal_Int32 nNewWidth = 0;
if ( aValue >>= nNewWidth )
@@ -8890,14 +8822,14 @@ void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, cons
(USHORT)nNewWidth, TRUE, TRUE );
}
}
- else if ( pMap->nWID == SC_WID_UNO_CELLVIS )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
BOOL bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
aFunc.SetWidthOrHeight( TRUE, 1, nColArr, nTab, eMode, 0, TRUE, TRUE );
// SC_SIZE_DIRECT mit Groesse 0 blendet aus
}
- else if ( pMap->nWID == SC_WID_UNO_OWIDTH )
+ else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
{
BOOL bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
if (bOpt)
@@ -8905,7 +8837,7 @@ void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, cons
SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, TRUE, TRUE );
// FALSE bei Spalten momentan ohne Auswirkung
}
- else if ( pMap->nWID == SC_WID_UNO_NEWPAGE || pMap->nWID == SC_WID_UNO_MANPAGE )
+ else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
{
BOOL bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
if (bSet)
@@ -8914,15 +8846,15 @@ void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, cons
aFunc.RemovePageBreak( TRUE, rRange.aStart, TRUE, TRUE, TRUE );
}
else
- ScCellRangeObj::SetOnePropertyValue(pMap, aValue); // base class, no Item WID
+ ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
}
-void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
uno::Any& rAny )
throw(uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
ScDocShell* pDocSh = GetDocShell();
if (!pDocSh)
@@ -8934,7 +8866,7 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
SCCOL nCol = rRange.aStart.Col();
SCTAB nTab = rRange.aStart.Tab();
- if ( pMap->nWID == SC_WID_UNO_CELLWID )
+ if ( pEntry->nWID == SC_WID_UNO_CELLWID )
{
// for hidden column, return original height
USHORT nWidth = pDoc->GetOriginalWidth( nCol, nTab );
@@ -8942,42 +8874,42 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
nWidth = (USHORT) TwipsToHMM(nWidth);
rAny <<= (sal_Int32)( nWidth );
}
- else if ( pMap->nWID == SC_WID_UNO_CELLVIS )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
BOOL bVis = !(pDoc->GetColFlags( nCol, nTab ) & CR_HIDDEN);
ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
}
- else if ( pMap->nWID == SC_WID_UNO_OWIDTH )
+ else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
{
//! momentan immer gesetzt ??!?!
BOOL bOpt = !(pDoc->GetColFlags( nCol, nTab ) & CR_MANUALSIZE);
ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
}
- else if ( pMap->nWID == SC_WID_UNO_NEWPAGE )
+ else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
{
BOOL bBreak = ( 0 != (pDoc->GetColFlags( nCol, nTab ) & (CR_PAGEBREAK|CR_MANUALBREAK)) );
ScUnoHelpFunctions::SetBoolInAny( rAny, bBreak );
}
- else if ( pMap->nWID == SC_WID_UNO_MANPAGE )
+ else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
{
BOOL bBreak = ( 0 != (pDoc->GetColFlags( nCol, nTab ) & (CR_MANUALBREAK)) );
ScUnoHelpFunctions::SetBoolInAny( rAny, bBreak );
}
else
- ScCellRangeObj::GetOnePropertyValue(pMap, rAny);
+ ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
}
const SfxItemPropertyMap* ScTableColumnObj::GetItemPropertyMap()
{
- return lcl_GetColumnPropertyMap();
+ return pColPropSet->getPropertyMap();
}
//------------------------------------------------------------------------
ScTableRowObj::ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab) :
ScCellRangeObj( pDocSh, ScRange(0,nRow,nTab, MAXCOL,nRow,nTab) ),
- aRowPropSet(lcl_GetRowPropertyMap())
+ pRowPropSet(lcl_GetRowPropertySet())
{
}
@@ -8992,19 +8924,19 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableRowObj::getPropertySetIn
{
ScUnoGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aRowPropSet.getPropertyMap() ));
+ new SfxItemPropertySetInfo( pRowPropSet->getPropertyMap() ));
return aRef;
}
-void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno::Any& aValue )
+void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue )
throw(lang::IllegalArgumentException, uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
- if ( IsScItemWid( pMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
// for Item WIDs, call ScCellRangesBase directly
- ScCellRangesBase::SetOnePropertyValue(pMap, aValue);
+ ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
return;
}
@@ -9023,7 +8955,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const u
SCCOLROW nRowArr[2];
nRowArr[0] = nRowArr[1] = nRow;
- if ( pMap->nWID == SC_WID_UNO_CELLHGT )
+ if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
{
sal_Int32 nNewHeight = 0;
if ( aValue >>= nNewHeight )
@@ -9034,14 +8966,14 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const u
(USHORT)nNewHeight, TRUE, TRUE );
}
}
- else if ( pMap->nWID == SC_WID_UNO_CELLVIS )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
BOOL bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
aFunc.SetWidthOrHeight( FALSE, 1, nRowArr, nTab, eMode, 0, TRUE, TRUE );
// SC_SIZE_DIRECT mit Groesse 0 blendet aus
}
- else if ( pMap->nWID == SC_WID_UNO_CELLFILT )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
{
BOOL bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue );
// ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
@@ -9054,7 +8986,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const u
nFlags &= ~CR_FILTERED;
pDoc->SetRowFlags(nRow, nTab, nFlags);
}
- else if ( pMap->nWID == SC_WID_UNO_OHEIGHT )
+ else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
{
BOOL bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
if (bOpt)
@@ -9066,7 +8998,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const u
aFunc.SetWidthOrHeight( FALSE, 1, nRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, TRUE, TRUE );
}
}
- else if ( pMap->nWID == SC_WID_UNO_NEWPAGE || pMap->nWID == SC_WID_UNO_MANPAGE )
+ else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
{
BOOL bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
if (bSet)
@@ -9075,15 +9007,15 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const u
aFunc.RemovePageBreak( FALSE, rRange.aStart, TRUE, TRUE, TRUE );
}
else
- ScCellRangeObj::SetOnePropertyValue(pMap, aValue); // base class, no Item WID
+ ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
}
-void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
+void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
uno::Any& rAny )
throw(uno::RuntimeException)
{
- if ( pMap )
+ if ( pEntry )
{
ScDocShell* pDocSh = GetDocShell();
if (!pDocSh)
@@ -9094,7 +9026,7 @@ void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
SCROW nRow = rRange.aStart.Row();
SCTAB nTab = rRange.aStart.Tab();
- if ( pMap->nWID == SC_WID_UNO_CELLHGT )
+ if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
{
// for hidden row, return original height
USHORT nHeight = pDoc->GetOriginalHeight( nRow, nTab );
@@ -9102,39 +9034,39 @@ void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertyMap* pMap,
nHeight = (USHORT) TwipsToHMM(nHeight);
rAny <<= (sal_Int32)( nHeight );
}
- else if ( pMap->nWID == SC_WID_UNO_CELLVIS )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
{
BOOL bVis = !(pDoc->GetRowFlags( nRow, nTab ) & CR_HIDDEN);
ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
}
- else if ( pMap->nWID == SC_WID_UNO_CELLFILT )
+ else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
{
BOOL bVis = ((pDoc->GetRowFlags( nRow, nTab ) & CR_FILTERED) != 0);
ScUnoHelpFunctions::SetBoolInAny( rAny, bVis );
}
- else if ( pMap->nWID == SC_WID_UNO_OHEIGHT )
+ else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
{
BOOL bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & CR_MANUALSIZE);
ScUnoHelpFunctions::SetBoolInAny( rAny, bOpt );
}
- else if ( pMap->nWID == SC_WID_UNO_NEWPAGE )
+ else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
{
BOOL bBreak = ( 0 != (pDoc->GetRowFlags( nRow, nTab ) & (CR_PAGEBREAK|CR_MANUALBREAK)) );
ScUnoHelpFunctions::SetBoolInAny( rAny, bBreak );
}
- else if ( pMap->nWID == SC_WID_UNO_MANPAGE )
+ else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
{
BOOL bBreak = ( 0 != (pDoc->GetRowFlags( nRow, nTab ) & (CR_MANUALBREAK)) );
ScUnoHelpFunctions::SetBoolInAny( rAny, bBreak );
}
else
- ScCellRangeObj::GetOnePropertyValue(pMap, rAny);
+ ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
}
const SfxItemPropertyMap* ScTableRowObj::GetItemPropertyMap()
{
- return lcl_GetRowPropertyMap();
+ return pRowPropSet->getPropertyMap();
}
//------------------------------------------------------------------------
@@ -9608,90 +9540,124 @@ struct ScPatternHashCode
}
};
+// Hash map to find a range by its start row
+typedef ::std::hash_map< SCROW, ScRange > ScRowRangeHashMap;
+
+typedef ::std::vector<ScRange> ScRangeVector;
+
// Hash map entry.
-// Keeps track of column positions and calls Join only for ranges between empty columns.
+// The Join method depends on the column-wise order of ScAttrRectIterator
class ScUniqueFormatsEntry
{
- ScRangeListRef aCompletedRanges;
- ScRangeListRef aJoinedRanges;
- SCCOL nLastColumn;
- SCCOL nLastStart;
+ enum EntryState { STATE_EMPTY, STATE_SINGLE, STATE_COMPLEX };
- void MoveToCompleted();
+ EntryState eState;
+ ScRange aSingleRange;
+ ScRowRangeHashMap aJoinedRanges; // "active" ranges to be merged
+ ScRangeVector aCompletedRanges; // ranges that will no longer be touched
+ ScRangeListRef aReturnRanges; // result as ScRangeList for further use
public:
- ScUniqueFormatsEntry() : nLastColumn(0), nLastStart(0) {}
+ ScUniqueFormatsEntry() : eState( STATE_EMPTY ) {}
ScUniqueFormatsEntry( const ScUniqueFormatsEntry& r ) :
- aCompletedRanges( r.aCompletedRanges ),
+ eState( r.eState ),
+ aSingleRange( r.aSingleRange ),
aJoinedRanges( r.aJoinedRanges ),
- nLastColumn( r.nLastColumn ),
- nLastStart( r.nLastStart ) {}
+ aCompletedRanges( r.aCompletedRanges ),
+ aReturnRanges( r.aReturnRanges ) {}
~ScUniqueFormatsEntry() {}
- void Join( const ScRange& rRange );
+ void Join( const ScRange& rNewRange );
const ScRangeList& GetRanges();
- void Clear()
- {
- aCompletedRanges.Clear();
- aJoinedRanges.Clear();
- }
+ void Clear() { aReturnRanges.Clear(); } // aJoinedRanges and aCompletedRanges are cleared in GetRanges
};
-void ScUniqueFormatsEntry::MoveToCompleted()
+void ScUniqueFormatsEntry::Join( const ScRange& rNewRange )
{
- if ( !aCompletedRanges.Is() )
- aCompletedRanges = new ScRangeList;
+ // Special-case handling for single range
- if ( aJoinedRanges.Is() )
+ if ( eState == STATE_EMPTY )
{
- for ( const ScRange* pRange = aJoinedRanges->First(); pRange; pRange = aJoinedRanges->Next() )
- aCompletedRanges->Append( *pRange );
- aJoinedRanges->RemoveAll();
+ aSingleRange = rNewRange;
+ eState = STATE_SINGLE;
+ return;
}
-}
-
-void ScUniqueFormatsEntry::Join( const ScRange& rRange )
-{
- if ( !aJoinedRanges.Is() )
+ if ( eState == STATE_SINGLE )
{
- // first range - store and initialize columns
- aJoinedRanges = new ScRangeList;
- aJoinedRanges->Append( rRange );
- nLastColumn = rRange.aEnd.Col();
- nLastStart = rRange.aStart.Col();
+ if ( aSingleRange.aStart.Row() == rNewRange.aStart.Row() &&
+ aSingleRange.aEnd.Row() == rNewRange.aEnd.Row() &&
+ aSingleRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
+ {
+ aSingleRange.aEnd.SetCol( rNewRange.aEnd.Col() );
+ return; // still a single range
+ }
+
+ SCROW nSingleRow = aSingleRange.aStart.Row();
+ aJoinedRanges.insert( ScRowRangeHashMap::value_type( nSingleRow, aSingleRange ) );
+ eState = STATE_COMPLEX;
+ // continue normally
}
- else
- {
- // This works only if the start columns never go back
- DBG_ASSERT( rRange.aStart.Col() >= nLastStart, "wrong column order in ScUniqueFormatsEntry" );
- if ( rRange.aStart.Col() <= nLastColumn + 1 )
+ // This is called in the order of ScAttrRectIterator results.
+ // rNewRange can only be joined with an existing entry if it's the same rows, starting in the next column.
+ // If the old entry for the start row extends to a different end row, or ends in a different column, it
+ // can be moved to aCompletedRanges because it can't be joined with following iterator results.
+ // Everything happens within one sheet, so Tab can be ignored.
+
+ SCROW nStartRow = rNewRange.aStart.Row();
+ ScRowRangeHashMap::iterator aIter( aJoinedRanges.find( nStartRow ) ); // find the active entry for the start row
+ if ( aIter != aJoinedRanges.end() )
+ {
+ ScRange& rOldRange = aIter->second;
+ if ( rOldRange.aEnd.Row() == rNewRange.aEnd.Row() &&
+ rOldRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
{
- // The new range may touch one of the existing ranges, have to use Join.
- aJoinedRanges->Join( rRange );
+ // extend existing range
+ rOldRange.aEnd.SetCol( rNewRange.aEnd.Col() );
}
else
{
- // The new range starts right of all existing ranges.
- // The existing ranges can be ignored for all future Join calls.
-
- MoveToCompleted(); // aJoinedRanges is emptied
- aJoinedRanges->Append( rRange );
+ // move old range to aCompletedRanges, keep rNewRange for joining
+ aCompletedRanges.push_back( rOldRange );
+ rOldRange = rNewRange; // replace in hash map
}
-
- if ( rRange.aEnd.Col() > nLastColumn )
- nLastColumn = rRange.aEnd.Col();
- nLastStart = rRange.aStart.Col();
+ }
+ else
+ {
+ // keep rNewRange for joining
+ aJoinedRanges.insert( ScRowRangeHashMap::value_type( nStartRow, rNewRange ) );
}
}
const ScRangeList& ScUniqueFormatsEntry::GetRanges()
{
- if ( aJoinedRanges.Is() && !aCompletedRanges.Is() )
- return *aJoinedRanges;
+ if ( eState == STATE_SINGLE )
+ {
+ aReturnRanges = new ScRangeList;
+ aReturnRanges->Append( aSingleRange );
+ return *aReturnRanges;
+ }
+
+ // move remaining entries from aJoinedRanges to aCompletedRanges
+
+ ScRowRangeHashMap::const_iterator aJoinedEnd = aJoinedRanges.end();
+ for ( ScRowRangeHashMap::const_iterator aJoinedIter = aJoinedRanges.begin(); aJoinedIter != aJoinedEnd; ++aJoinedIter )
+ aCompletedRanges.push_back( aJoinedIter->second );
+ aJoinedRanges.clear();
+
+ // sort all ranges for a predictable API result
+
+ std::sort( aCompletedRanges.begin(), aCompletedRanges.end() );
+
+ // fill and return ScRangeList
+
+ aReturnRanges = new ScRangeList;
+ ScRangeVector::const_iterator aCompEnd( aCompletedRanges.end() );
+ for ( ScRangeVector::const_iterator aCompIter( aCompletedRanges.begin() ); aCompIter != aCompEnd; ++aCompIter )
+ aReturnRanges->Append( *aCompIter );
+ aCompletedRanges.clear();
- MoveToCompleted(); // aCompletedRanges is always set after this
- return *aCompletedRanges;
+ return *aReturnRanges;
}
typedef ::std::hash_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > ScUniqueFormatsHashMap;
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 142c567f8b42..ccd1b558342b 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -45,6 +45,7 @@
#include "unoreflist.hxx"
#include "compiler.hxx"
#include "reftokenhelper.hxx"
+#include "chartlis.hxx"
#include <sfx2/objsh.hxx>
#include <tools/table.hxx>
@@ -89,12 +90,23 @@ using ::boost::shared_ptr;
namespace
{
-const SfxItemPropertyMap* lcl_GetDataSequencePropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetDataProviderPropertyMap()
{
- static SfxItemPropertyMap aDataSequencePropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aDataProviderPropertyMap_Impl[] =
{
- {MAP_CHAR_LEN(SC_UNONAME_ISHIDDEN), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0, &getBooleanCppuType(), 0, 0 },
+ {0,0,0,0,0,0}
+ };
+ return aDataProviderPropertyMap_Impl;
+}
+
+const SfxItemPropertyMapEntry* lcl_GetDataSequencePropertyMap()
+{
+ static SfxItemPropertyMapEntry aDataSequencePropertyMap_Impl[] =
+ {
+ {MAP_CHAR_LEN(SC_UNONAME_HIDDENVALUES), 0, &getCppuType((uno::Sequence<sal_Int32>*)0 ), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ROLE), 0, &getCppuType((::com::sun::star::chart2::data::DataSequenceRole*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0, &getBooleanCppuType(), 0, 0 },
{0,0,0,0,0,0}
};
return aDataSequencePropertyMap_Impl;
@@ -656,9 +668,6 @@ void Chart2Positioner::createPositionMap()
(bNoGlue ? 0 : static_cast<sal_uInt32>(nCol1));
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol)
{
- if ((mpDoc->GetColFlags(nCol, nTab) & CR_HIDDEN) != 0)
- continue;
-
if (bNoGlue || meGlue == GLUETYPE_ROWS)
{
pCol = static_cast<Table*>(pCols->Get(nInsCol));
@@ -683,9 +692,6 @@ void Chart2Positioner::createPositionMap()
sal_uInt32 nInsRow = static_cast<sal_uInt32>(bNoGlue ? nNoGlueRow : nRow1);
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow, ++nInsRow)
{
- if ((mpDoc->GetRowFlags(nRow, nTab) & CR_HIDDEN) != 0)
- continue;
-
ScSingleRefData aCellData;
aCellData.InitFlags();
aCellData.SetFlag3D(true);
@@ -966,6 +972,8 @@ void lcl_convertTokenToString(OUString& rStr, const ScSharedTokenRef& rToken, Sc
ScChart2DataProvider::ScChart2DataProvider( ScDocument* pDoc )
: m_pDocument( pDoc)
+ , m_aPropSet(lcl_GetDataProviderPropertyMap())
+ , m_bIncludeHiddenCells( sal_True)
{
if ( m_pDocument )
m_pDocument->AddUnoObject( *this);
@@ -1043,7 +1051,7 @@ void lcl_SeperateOneRowRange(ScRange aR, const ScAddress& rPos, ScRangeListRef&
}
vector<ScSharedTokenRef> aTokens;
- ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
return !aTokens.empty();
}
@@ -1348,7 +1356,7 @@ private:
{
bool bExternal = ScRefTokenHelper::isExternalRef(mpHeaderCell);
if (bExternal != ScRefTokenHelper::isExternalRef(pRange))
- // internval vs external.
+ // internal vs external.
return false;
if (bExternal)
@@ -1437,7 +1445,7 @@ ScChart2DataProvider::createDataSource(
}
vector<ScSharedTokenRef> aRefTokens;
- ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
if (aRefTokens.empty())
// Invalid range representation. Bail out.
throw lang::IllegalArgumentException();
@@ -1498,7 +1506,7 @@ ScChart2DataProvider::createDataSource(
{
auto_ptr< vector<ScSharedTokenRef> > pTokens(new vector<ScSharedTokenRef>);
pTokens->push_back(pLabelToken);
- Reference < chart2::data::XDataSequence > xLabelSeq(new ScChart2DataSequence(m_pDocument, this, pTokens.release()));
+ Reference < chart2::data::XDataSequence > xLabelSeq(new ScChart2DataSequence(m_pDocument, this, pTokens.release(), m_bIncludeHiddenCells));
Reference< beans::XPropertySet > xLabelProps(xLabelSeq, uno::UNO_QUERY);
if (xLabelProps.is())
xLabelProps->setPropertyValue(
@@ -1511,7 +1519,7 @@ ScChart2DataProvider::createDataSource(
}
auto_ptr< vector<ScSharedTokenRef> > pTokens(new vector<ScSharedTokenRef>);
pTokens->swap(aRefTokens2);
- uno::Reference< chart2::data::XDataSequence > xSeq( new ScChart2DataSequence( m_pDocument, this, pTokens.release()) );
+ uno::Reference< chart2::data::XDataSequence > xSeq( new ScChart2DataSequence( m_pDocument, this, pTokens.release(), m_bIncludeHiddenCells) );
pHeader->setValues(xSeq);
}
if (pHeader)
@@ -1569,7 +1577,7 @@ ScChart2DataProvider::createDataSource(
auto_ptr< vector<ScSharedTokenRef> > pTokens(new vector<ScSharedTokenRef>);
pTokens->reserve(1);
pTokens->push_back(pHeaderCell);
- xLabelSeq.set(new ScChart2DataSequence(m_pDocument, this, pTokens.release()));
+ xLabelSeq.set(new ScChart2DataSequence(m_pDocument, this, pTokens.release(), m_bIncludeHiddenCells));
uno::Reference< beans::XPropertySet > xLabelProps(xLabelSeq, uno::UNO_QUERY);
if (xLabelProps.is())
xLabelProps->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ROLE)), uno::makeAny(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("label"))));
@@ -1586,7 +1594,7 @@ ScChart2DataProvider::createDataSource(
// FIXME: if there are no labels the column or row name should be taken
- uno::Reference < chart2::data::XDataSequence > xSeq(new ScChart2DataSequence(m_pDocument, this, pRanges.release()));
+ uno::Reference < chart2::data::XDataSequence > xSeq(new ScChart2DataSequence(m_pDocument, this, pRanges.release(), m_bIncludeHiddenCells));
pLabeled->setValues(xSeq);
pLabeled->setLabel(xLabelSeq);
@@ -2172,7 +2180,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
return false;
vector<ScSharedTokenRef> aTokens;
- ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
return !aTokens.empty();
}
@@ -2189,6 +2197,12 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL
if(!m_pDocument || (aRangeRepresentation.getLength() == 0))
return xResult;
+ // Note: the range representation must be in Calc A1 format. The import
+ // filters use this method to pass data ranges, and they have no idea what
+ // the current formula syntax is. In the future we should add another
+ // method to allow the client code to directly pass tokens representing
+ // ranges.
+
vector<ScSharedTokenRef> aRefTokens;
ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
if (aRefTokens.empty())
@@ -2197,7 +2211,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL
// ScChart2DataSequence manages the life cycle of pRefTokens.
vector<ScSharedTokenRef>* pRefTokens = new vector<ScSharedTokenRef>();
pRefTokens->swap(aRefTokens);
- xResult.set(new ScChart2DataSequence(m_pDocument, this, pRefTokens));
+ xResult.set(new ScChart2DataSequence(m_pDocument, this, pRefTokens, m_bIncludeHiddenCells));
return xResult;
}
@@ -2234,7 +2248,7 @@ rtl::OUString SAL_CALL ScChart2DataProvider::convertRangeToXML( const rtl::OUStr
return aRet;
vector<ScSharedTokenRef> aRefTokens;
- ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
if (aRefTokens.empty())
throw lang::IllegalArgumentException();
@@ -2375,6 +2389,88 @@ private:
}
+// DataProvider XPropertySet -------------------------------------------------
+
+uno::Reference< beans::XPropertySetInfo> SAL_CALL
+ScChart2DataProvider::getPropertySetInfo() throw( uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+ static uno::Reference<beans::XPropertySetInfo> aRef =
+ new SfxItemPropertySetInfo( m_aPropSet.getPropertyMap() );
+ return aRef;
+}
+
+
+void SAL_CALL ScChart2DataProvider::setPropertyValue(
+ const ::rtl::OUString& rPropertyName, const uno::Any& rValue)
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS)))
+ {
+ if ( !(rValue >>= m_bIncludeHiddenCells))
+ throw lang::IllegalArgumentException();
+ }
+ else
+ throw beans::UnknownPropertyException();
+}
+
+
+uno::Any SAL_CALL ScChart2DataProvider::getPropertyValue(
+ const ::rtl::OUString& rPropertyName)
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aRet;
+ if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS)))
+ aRet <<= m_bIncludeHiddenCells;
+ else
+ throw beans::UnknownPropertyException();
+ return aRet;
+}
+
+
+void SAL_CALL ScChart2DataProvider::addPropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener>& /*xListener*/)
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not yet implemented" );
+}
+
+
+void SAL_CALL ScChart2DataProvider::removePropertyChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener>& /*rListener*/)
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not yet implemented" );
+}
+
+
+void SAL_CALL ScChart2DataProvider::addVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener>& /*rListener*/)
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not yet implemented" );
+}
+
+
+void SAL_CALL ScChart2DataProvider::removeVetoableChangeListener(
+ const ::rtl::OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener>& /*rListener*/ )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not yet implemented" );
+}
+
void ScChart2DataProvider::detectRangesFromDataSource(vector<ScSharedTokenRef>& rRefTokens,
chart::ChartDataRowSource& rRowSource,
bool& rRowSourceDetected,
@@ -2393,7 +2489,7 @@ void ScChart2DataProvider::detectRangesFromDataSource(vector<ScSharedTokenRef>&
{
const OUString& rRangeRep = *itr;
vector<ScSharedTokenRef> aTokens;
- ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument);
+ ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument, m_pDocument->GetGrammar());
CollectRefTokens func;
func = for_each(aTokens.begin(), aTokens.end(), func);
@@ -2660,10 +2756,25 @@ ScChart2DataSequence::Item::Item() :
::rtl::math::setNan(&mfValue);
}
+ScChart2DataSequence::HiddenRangeListener::HiddenRangeListener(ScChart2DataSequence& rParent) :
+ mrParent(rParent)
+{
+}
+
+ScChart2DataSequence::HiddenRangeListener::~HiddenRangeListener()
+{
+}
+
+void ScChart2DataSequence::HiddenRangeListener::notify()
+{
+ mrParent.setDataChangedHint(true);
+}
+
ScChart2DataSequence::ScChart2DataSequence( ScDocument* pDoc,
const uno::Reference < chart2::data::XDataProvider >& xDP,
- vector<ScSharedTokenRef>* pTokens)
- : m_bHidden( sal_False)
+ vector<ScSharedTokenRef>* pTokens,
+ bool bIncludeHiddenCells )
+ : m_bIncludeHiddenCells( bIncludeHiddenCells)
, m_nObjectId( 0 )
, m_pDocument( pDoc)
, m_pTokens(pTokens)
@@ -2671,6 +2782,7 @@ ScChart2DataSequence::ScChart2DataSequence( ScDocument* pDoc,
, m_pExtRefListener(NULL)
, m_xDataProvider( xDP)
, m_aPropSet(lcl_GetDataSequencePropertyMap())
+ , m_pHiddenListener(NULL)
, m_pValueListener( NULL )
, m_bGotDataChangedHint(false)
, m_bExtDataRebuildQueued(false)
@@ -2700,6 +2812,12 @@ ScChart2DataSequence::~ScChart2DataSequence()
if ( m_pDocument )
{
m_pDocument->RemoveUnoObject( *this);
+ if (m_pHiddenListener.get())
+ {
+ ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
+ if (pCLC)
+ pCLC->EndListeningHiddenRange(m_pHiddenListener.get());
+ }
StopListeningToAllExternalRefs();
}
@@ -2714,6 +2832,14 @@ void ScChart2DataSequence::RefChanged()
if( m_pDocument )
{
+ ScChartListenerCollection* pCLC = NULL;
+ if (m_pHiddenListener.get())
+ {
+ pCLC = m_pDocument->GetChartListenerCollection();
+ if (pCLC)
+ pCLC->EndListeningHiddenRange(m_pHiddenListener.get());
+ }
+
vector<ScSharedTokenRef>::const_iterator itr = m_pTokens->begin(), itrEnd = m_pTokens->end();
for (; itr != itrEnd; ++itr)
{
@@ -2722,6 +2848,8 @@ void ScChart2DataSequence::RefChanged()
continue;
m_pDocument->StartListeningArea(aRange, m_pValueListener);
+ if (pCLC)
+ pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get());
}
}
}
@@ -2765,18 +2893,22 @@ void ScChart2DataSequence::BuildDataCache()
{
for (SCROW nRow = aRange.aStart.Row(); nRow <= aRange.aEnd.Row(); ++nRow)
{
- m_aDataArray.push_back(Item());
- Item& rItem = m_aDataArray.back();
- ++nDataCount;
- USHORT nWidth = m_pDocument->GetColWidth(nCol, nTab);
- USHORT nHeight = m_pDocument->GetRowHeight(nRow, nTab);
- if (!nWidth || !nHeight)
+ bool bColHidden = (m_pDocument->GetColFlags(nCol, nTab) & CR_HIDDEN);
+ bool bRowHidden = (m_pDocument->GetRowFlags(nRow, nTab) & CR_HIDDEN);
+ if (bColHidden || bRowHidden)
{
// hidden cell
++nHiddenValueCount;
aHiddenValues.push_back(nDataCount-1);
+
+ if( !m_bIncludeHiddenCells )
+ continue;
}
+ m_aDataArray.push_back(Item());
+ Item& rItem = m_aDataArray.back();
+ ++nDataCount;
+
ScAddress aAdr(nCol, nRow, nTab);
ScBaseCell* pCell = m_pDocument->GetCell(aAdr);
if (!pCell)
@@ -2805,8 +2937,10 @@ void ScChart2DataSequence::BuildDataCache()
break;
if (pFCell->HasValueData())
+ {
rItem.mfValue = pFCell->GetValue();
rItem.mbIsValue = true;
+ }
}
break;
#if DBG_UTIL
@@ -2987,7 +3121,6 @@ void ScChart2DataSequence::CopyData(const ScChart2DataSequence& r)
m_aHiddenValues = r.m_aHiddenValues;
m_aRole = r.m_aRole;
- m_bHidden = r.m_bHidden;
if (r.m_pRangeIndices.get())
m_pRangeIndices.reset(new vector<sal_uInt32>(*r.m_pRangeIndices));
@@ -3025,6 +3158,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
if ( m_bGotDataChangedHint && m_pDocument )
{
m_aDataArray.clear();
+ m_aDataArray.clear();
lang::EventObject aEvent;
aEvent.Source.set((cppu::OWeakObject*)this);
@@ -3037,6 +3171,14 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
m_bGotDataChangedHint = false;
}
}
+ else if ( nId == SC_HINT_CALCALL )
+ {
+ // broadcast from DoHardRecalc - set m_bGotDataChangedHint
+ // (SFX_HINT_DATACHANGED follows separately)
+
+ if ( m_aValueListeners.Count() )
+ m_bGotDataChangedHint = true;
+ }
}
else if ( rHint.ISA( ScUpdateRefHint ) )
{
@@ -3124,7 +3266,7 @@ IMPL_LINK( ScChart2DataSequence, ValueListenerHdl, SfxHint*, pHint )
// in the range are notified. So only a flag is set that is checked when
// SFX_HINT_DATACHANGED is received.
- m_bGotDataChangedHint = true;
+ setDataChangedHint(true);
}
return 0;
}
@@ -3513,7 +3655,7 @@ uno::Reference< util::XCloneable > SAL_CALL ScChart2DataSequence::createClone()
}
}
- auto_ptr<ScChart2DataSequence> p(new ScChart2DataSequence(m_pDocument, m_xDataProvider, pTokensNew.release()));
+ auto_ptr<ScChart2DataSequence> p(new ScChart2DataSequence(m_pDocument, m_xDataProvider, pTokensNew.release(), m_bIncludeHiddenCells));
p->CopyData(*this);
Reference< util::XCloneable > xClone(p.release());
@@ -3541,11 +3683,23 @@ void SAL_CALL ScChart2DataSequence::addModifyListener( const uno::Reference< uti
if (!m_pValueListener)
m_pValueListener = new ScLinkListener( LINK( this, ScChart2DataSequence, ValueListenerHdl ) );
+ if (!m_pHiddenListener.get())
+ m_pHiddenListener.reset(new HiddenRangeListener(*this));
+
if( m_pDocument )
{
- ULONG nCount = aRanges.Count();
- for (ULONG i=0; i<nCount; i++)
- m_pDocument->StartListeningArea( *aRanges.GetObject(i), m_pValueListener );
+ ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
+ vector<ScSharedTokenRef>::const_iterator itr = m_pTokens->begin(), itrEnd = m_pTokens->end();
+ for (; itr != itrEnd; ++itr)
+ {
+ ScRange aRange;
+ if (!ScRefTokenHelper::getRangeFromToken(aRange, *itr))
+ continue;
+
+ m_pDocument->StartListeningArea( aRange, m_pValueListener );
+ if (pCLC)
+ pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get());
+ }
}
acquire(); // don't lose this object (one ref for all listeners)
@@ -3576,6 +3730,13 @@ void SAL_CALL ScChart2DataSequence::removeModifyListener( const uno::Reference<
if (m_pValueListener)
m_pValueListener->EndListeningAll();
+ if (m_pHiddenListener.get() && m_pDocument)
+ {
+ ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
+ if (pCLC)
+ pCLC->EndListeningHiddenRange(m_pHiddenListener.get());
+ }
+
release(); // release the ref for the listeners
}
@@ -3610,10 +3771,13 @@ void SAL_CALL ScChart2DataSequence::setPropertyValue(
if ( !(rValue >>= m_aRole))
throw lang::IllegalArgumentException();
}
- else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN)))
+ else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS)))
{
- if ( !(rValue >>= m_bHidden))
+ sal_Bool bOldValue = m_bIncludeHiddenCells;
+ if ( !(rValue >>= m_bIncludeHiddenCells))
throw lang::IllegalArgumentException();
+ if( bOldValue != m_bIncludeHiddenCells )
+ m_aDataArray.clear();//data array is dirty now
}
else
throw beans::UnknownPropertyException();
@@ -3629,8 +3793,8 @@ uno::Any SAL_CALL ScChart2DataSequence::getPropertyValue(
uno::Any aRet;
if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ROLE)))
aRet <<= m_aRole;
- else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN)))
- aRet <<= m_bHidden;
+ else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS)))
+ aRet <<= m_bIncludeHiddenCells;
else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SC_UNONAME_HIDDENVALUES)))
{
// This property is read-only thus cannot be set externally via
@@ -3692,6 +3856,11 @@ void SAL_CALL ScChart2DataSequence::removeVetoableChangeListener(
OSL_ENSURE( false, "Not yet implemented" );
}
+void ScChart2DataSequence::setDataChangedHint(bool b)
+{
+ m_bGotDataChangedHint = b;
+}
+
// XUnoTunnel
// sal_Int64 SAL_CALL ScChart2DataSequence::getSomething(
@@ -3740,7 +3909,7 @@ ScChart2EmptyDataSequence::ScChart2EmptyDataSequence( ScDocument* pDoc,
const uno::Reference < chart2::data::XDataProvider >& xDP,
const ScRangeListRef& rRangeList,
sal_Bool bColumn)
- : m_bHidden( sal_False)
+ : m_bIncludeHiddenCells( sal_True)
, m_xRanges( rRangeList)
, m_pDocument( pDoc)
, m_xDataProvider( xDP)
@@ -3889,8 +4058,8 @@ uno::Reference< util::XCloneable > SAL_CALL ScChart2EmptyDataSequence::createClo
{
xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ROLE )),
uno::makeAny( m_aRole ));
- xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ISHIDDEN )),
- uno::makeAny( m_bHidden ));
+ xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS )),
+ uno::makeAny( m_bIncludeHiddenCells ));
}
return xClone;
}
@@ -3935,9 +4104,9 @@ void SAL_CALL ScChart2EmptyDataSequence::setPropertyValue(
if ( !(rValue >>= m_aRole))
throw lang::IllegalArgumentException();
}
- else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN)))
+ else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS)))
{
- if ( !(rValue >>= m_bHidden))
+ if ( !(rValue >>= m_bIncludeHiddenCells))
throw lang::IllegalArgumentException();
}
else
@@ -3954,8 +4123,8 @@ uno::Any SAL_CALL ScChart2EmptyDataSequence::getPropertyValue(
uno::Any aRet;
if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ROLE)))
aRet <<= m_aRole;
- else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN)))
- aRet <<= m_bHidden;
+ else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS)))
+ aRet <<= m_bIncludeHiddenCells;
else
throw beans::UnknownPropertyException();
// TODO: support optional properties
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index c5d9540ef00c..87045ff5c053 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -56,9 +56,9 @@ using namespace com::sun::star;
#define SCSAVEVERSION "SaveVersionOnClose"
-const SfxItemPropertyMap* lcl_GetConfigPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap()
{
- static SfxItemPropertyMap aConfigPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aConfigPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_SHOWZERO), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_SHOWNOTES), 0, &getBooleanCppuType(), 0, 0},
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 04b250d4523b..c68baf36ba2b 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -31,14 +31,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
+#include <algorithm>
#include <svtools/smplhint.hxx>
#include <rtl/uuid.h>
#include "dapiuno.hxx"
#include "datauno.hxx"
#include "miscuno.hxx"
+#include "convuno.hxx"
#include "docsh.hxx"
#include "tabvwsh.hxx"
#include "pivot.hxx"
@@ -61,74 +61,123 @@
#include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
#include <comphelper/extract.hxx>
+#include <comphelper/sequence.hxx>
using namespace com::sun::star;
+using namespace com::sun::star::sheet;
-using ::com::sun::star::lang::IllegalArgumentException;
-using ::com::sun::star::sheet::DataPilotFieldFilter;
-using ::com::sun::star::sheet::DataPilotTablePositionData;
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+
+using ::com::sun::star::container::ElementExistException;
+using ::com::sun::star::container::NoSuchElementException;
+using ::com::sun::star::container::XEnumeration;
+using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::container::XNamed;
+
+using ::com::sun::star::beans::PropertyVetoException;
+using ::com::sun::star::beans::UnknownPropertyException;
+using ::com::sun::star::beans::XPropertyChangeListener;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::com::sun::star::beans::XVetoableChangeListener;
+
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::lang::WrappedTargetException;
+
using ::com::sun::star::table::CellAddress;
using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Any;
-//------------------------------------------------------------------------
+// ============================================================================
+
+namespace {
-const SfxItemPropertyMap* lcl_GetDataPilotDescriptorBaseMap()
+const SfxItemPropertyMapEntry* lcl_GetDataPilotDescriptorBaseMap()
{
- static SfxItemPropertyMap aDataPilotDescriptorBaseMap_Impl[] =
+ static SfxItemPropertyMapEntry aDataPilotDescriptorBaseMap_Impl[] =
{
- {MAP_CHAR_LEN(SC_UNO_COLGRAND), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNO_DRILLDOWN),0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNO_IGNEMPROWS),0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNO_RPTEMPTY), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNO_ROWGRAND), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNO_SHOWFILT), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_COLGRAND), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_DRILLDOWN), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_IGNEMPROWS), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_RPTEMPTY), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_ROWGRAND), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_SHOWFILT), 0, &getBooleanCppuType(), 0, 0 },
{0,0,0,0,0,0}
};
return aDataPilotDescriptorBaseMap_Impl;
}
-//------------------------------------------------------------------------
-
-const SfxItemPropertyMap* lcl_GetDataPilotFieldMap()
-{
- static SfxItemPropertyMap aDataPilotFieldMap_Impl[] =
- {
- {MAP_CHAR_LEN(SC_UNONAME_AUTOSHOW), 0, &getCppuType((sheet::DataPilotFieldAutoShowInfo*)0),0 | beans::PropertyAttribute::MAYBEVOID, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_FUNCTION), 0, &getCppuType((sheet::GeneralFunction*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_GROUPINFO), 0, &getCppuType((sheet::DataPilotFieldGroupInfo*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_HASAUTOSHOW), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_HASLAYOUTINFO),0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_HASREFERENCE), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_HASSORTINFO), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_ISGROUP), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_LAYOUTINFO), 0, &getCppuType((sheet::DataPilotFieldLayoutInfo*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_ORIENT), 0, &getCppuType((sheet::DataPilotFieldOrientation*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFERENCE), 0, &getCppuType((sheet::DataPilotFieldReference*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_SELPAGE), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_SHOWEMPTY), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_SORTINFO), 0, &getCppuType((sheet::DataPilotFieldSortInfo*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_USESELPAGE), 0, &getBooleanCppuType(), 0, 0 },
+// ----------------------------------------------------------------------------
+
+const SfxItemPropertyMapEntry* lcl_GetDataPilotFieldMap()
+{
+ using namespace ::com::sun::star::beans::PropertyAttribute;
+ static SfxItemPropertyMapEntry aDataPilotFieldMap_Impl[] =
+ {
+ {MAP_CHAR_LEN(SC_UNONAME_AUTOSHOW), 0, &getCppuType((DataPilotFieldAutoShowInfo*)0), MAYBEVOID, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_FUNCTION), 0, &getCppuType((GeneralFunction*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_GROUPINFO), 0, &getCppuType((DataPilotFieldGroupInfo*)0), MAYBEVOID, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_HASAUTOSHOW), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_HASLAYOUTINFO),0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_HASREFERENCE), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_HASSORTINFO), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_ISGROUP), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_LAYOUTINFO), 0, &getCppuType((DataPilotFieldLayoutInfo*)0), MAYBEVOID, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_ORIENT), 0, &getCppuType((DataPilotFieldOrientation*)0), MAYBEVOID, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_REFERENCE), 0, &getCppuType((DataPilotFieldReference*)0), MAYBEVOID, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_SELPAGE), 0, &getCppuType((OUString*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_SHOWEMPTY), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_SORTINFO), 0, &getCppuType((DataPilotFieldSortInfo*)0), MAYBEVOID, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_SUBTOTALS), 0, &getCppuType((Sequence<GeneralFunction>*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_USESELPAGE), 0, &getBooleanCppuType(), 0, 0 },
{0,0,0,0,0,0}
};
return aDataPilotFieldMap_Impl;
}
-const SfxItemPropertyMap* lcl_GetDataPilotItemMap()
+// ----------------------------------------------------------------------------
+
+const SfxItemPropertyMapEntry* lcl_GetDataPilotItemMap()
{
- static SfxItemPropertyMap aDataPilotItemMap_Impl[] =
+ static SfxItemPropertyMapEntry aDataPilotItemMap_Impl[] =
{
- {MAP_CHAR_LEN(SC_UNONAME_ISHIDDEN), 0, &getBooleanCppuType(), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_POS), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_SHOWDETAIL), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_ISHIDDEN), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_POS), 0, &getCppuType((sal_Int32*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNONAME_SHOWDETAIL), 0, &getBooleanCppuType(), 0, 0 },
{0,0,0,0,0,0}
};
return aDataPilotItemMap_Impl;
}
-//------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+inline bool lclCheckValidDouble( double fValue, sal_Bool bAuto )
+{
+ return bAuto || ::rtl::math::isFinite( fValue );
+}
+
+bool lclCheckMinMaxStep( const DataPilotFieldGroupInfo& rInfo )
+{
+ return
+ lclCheckValidDouble( rInfo.Start, rInfo.HasAutoStart ) &&
+ lclCheckValidDouble( rInfo.End, rInfo.HasAutoEnd ) &&
+ (rInfo.HasAutoStart || rInfo.HasAutoEnd || (rInfo.Start <= rInfo.End)) &&
+ lclCheckValidDouble( rInfo.Step, sal_False ) &&
+ (0.0 <= rInfo.Step);
+}
+
+} // namespace
+
+// ============================================================================
SC_SIMPLE_SERVICE_INFO( ScDataPilotDescriptor, "ScDataPilotDescriptor", "stardiv::one::sheet::DataPilotDescriptor" )
SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldObj, "ScDataPilotFieldObj", "com.sun.star.sheet.DataPilotField" )
@@ -144,54 +193,45 @@ SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupItemObj, "ScDataPilotFieldGroupItem
//------------------------------------------------------------------------
-//! irgendwann ueberall die neuen enum-Werte benutzen
-#define DATA_PILOT_HIDDEN sheet::DataPilotFieldOrientation_HIDDEN
-#define DATA_PILOT_COLUMN sheet::DataPilotFieldOrientation_COLUMN
-#define DATA_PILOT_ROW sheet::DataPilotFieldOrientation_ROW
-#define DATA_PILOT_PAGE sheet::DataPilotFieldOrientation_PAGE
-#define DATA_PILOT_DATA sheet::DataPilotFieldOrientation_DATA
-
-//------------------------------------------------------------------------
-
// name that is used in the API for the data layout field
#define SC_DATALAYOUT_NAME "Data"
//------------------------------------------------------------------------
-sheet::GeneralFunction ScDataPilotConversion::FirstFunc( USHORT nBits )
+GeneralFunction ScDataPilotConversion::FirstFunc( USHORT nBits )
{
- if ( nBits & PIVOT_FUNC_SUM ) return sheet::GeneralFunction_SUM;
- if ( nBits & PIVOT_FUNC_COUNT ) return sheet::GeneralFunction_COUNT;
- if ( nBits & PIVOT_FUNC_AVERAGE ) return sheet::GeneralFunction_AVERAGE;
- if ( nBits & PIVOT_FUNC_MAX ) return sheet::GeneralFunction_MAX;
- if ( nBits & PIVOT_FUNC_MIN ) return sheet::GeneralFunction_MIN;
- if ( nBits & PIVOT_FUNC_PRODUCT ) return sheet::GeneralFunction_PRODUCT;
- if ( nBits & PIVOT_FUNC_COUNT_NUM ) return sheet::GeneralFunction_COUNTNUMS;
- if ( nBits & PIVOT_FUNC_STD_DEV ) return sheet::GeneralFunction_STDEV;
- if ( nBits & PIVOT_FUNC_STD_DEVP ) return sheet::GeneralFunction_STDEVP;
- if ( nBits & PIVOT_FUNC_STD_VAR ) return sheet::GeneralFunction_VAR;
- if ( nBits & PIVOT_FUNC_STD_VARP ) return sheet::GeneralFunction_VARP;
- if ( nBits & PIVOT_FUNC_AUTO ) return sheet::GeneralFunction_AUTO;
- return sheet::GeneralFunction_NONE;
+ if ( nBits & PIVOT_FUNC_SUM ) return GeneralFunction_SUM;
+ if ( nBits & PIVOT_FUNC_COUNT ) return GeneralFunction_COUNT;
+ if ( nBits & PIVOT_FUNC_AVERAGE ) return GeneralFunction_AVERAGE;
+ if ( nBits & PIVOT_FUNC_MAX ) return GeneralFunction_MAX;
+ if ( nBits & PIVOT_FUNC_MIN ) return GeneralFunction_MIN;
+ if ( nBits & PIVOT_FUNC_PRODUCT ) return GeneralFunction_PRODUCT;
+ if ( nBits & PIVOT_FUNC_COUNT_NUM ) return GeneralFunction_COUNTNUMS;
+ if ( nBits & PIVOT_FUNC_STD_DEV ) return GeneralFunction_STDEV;
+ if ( nBits & PIVOT_FUNC_STD_DEVP ) return GeneralFunction_STDEVP;
+ if ( nBits & PIVOT_FUNC_STD_VAR ) return GeneralFunction_VAR;
+ if ( nBits & PIVOT_FUNC_STD_VARP ) return GeneralFunction_VARP;
+ if ( nBits & PIVOT_FUNC_AUTO ) return GeneralFunction_AUTO;
+ return GeneralFunction_NONE;
}
-USHORT ScDataPilotConversion::FunctionBit( sheet::GeneralFunction eFunc )
+USHORT ScDataPilotConversion::FunctionBit( GeneralFunction eFunc )
{
USHORT nRet = PIVOT_FUNC_NONE; // 0
switch (eFunc)
{
- case sheet::GeneralFunction_SUM: nRet = PIVOT_FUNC_SUM; break;
- case sheet::GeneralFunction_COUNT: nRet = PIVOT_FUNC_COUNT; break;
- case sheet::GeneralFunction_AVERAGE: nRet = PIVOT_FUNC_AVERAGE; break;
- case sheet::GeneralFunction_MAX: nRet = PIVOT_FUNC_MAX; break;
- case sheet::GeneralFunction_MIN: nRet = PIVOT_FUNC_MIN; break;
- case sheet::GeneralFunction_PRODUCT: nRet = PIVOT_FUNC_PRODUCT; break;
- case sheet::GeneralFunction_COUNTNUMS: nRet = PIVOT_FUNC_COUNT_NUM; break;
- case sheet::GeneralFunction_STDEV: nRet = PIVOT_FUNC_STD_DEV; break;
- case sheet::GeneralFunction_STDEVP: nRet = PIVOT_FUNC_STD_DEVP; break;
- case sheet::GeneralFunction_VAR: nRet = PIVOT_FUNC_STD_VAR; break;
- case sheet::GeneralFunction_VARP: nRet = PIVOT_FUNC_STD_VARP; break;
- case sheet::GeneralFunction_AUTO: nRet = PIVOT_FUNC_AUTO; break;
+ case GeneralFunction_SUM: nRet = PIVOT_FUNC_SUM; break;
+ case GeneralFunction_COUNT: nRet = PIVOT_FUNC_COUNT; break;
+ case GeneralFunction_AVERAGE: nRet = PIVOT_FUNC_AVERAGE; break;
+ case GeneralFunction_MAX: nRet = PIVOT_FUNC_MAX; break;
+ case GeneralFunction_MIN: nRet = PIVOT_FUNC_MIN; break;
+ case GeneralFunction_PRODUCT: nRet = PIVOT_FUNC_PRODUCT; break;
+ case GeneralFunction_COUNTNUMS: nRet = PIVOT_FUNC_COUNT_NUM; break;
+ case GeneralFunction_STDEV: nRet = PIVOT_FUNC_STD_DEV; break;
+ case GeneralFunction_STDEVP: nRet = PIVOT_FUNC_STD_DEVP; break;
+ case GeneralFunction_VAR: nRet = PIVOT_FUNC_STD_VAR; break;
+ case GeneralFunction_VARP: nRet = PIVOT_FUNC_STD_VARP; break;
+ case GeneralFunction_AUTO: nRet = PIVOT_FUNC_AUTO; break;
default:
{
// added to avoid warnings
@@ -200,6 +240,16 @@ USHORT ScDataPilotConversion::FunctionBit( sheet::GeneralFunction eFunc )
return nRet;
}
+void ScDataPilotConversion::FillGroupInfo( DataPilotFieldGroupInfo& rInfo, const ScDPNumGroupInfo& rGroupInfo )
+{
+ rInfo.HasDateValues = rGroupInfo.DateValues;
+ rInfo.HasAutoStart = rGroupInfo.AutoStart;
+ rInfo.Start = rGroupInfo.Start;
+ rInfo.HasAutoEnd = rGroupInfo.AutoEnd;
+ rInfo.End = rGroupInfo.End;
+ rInfo.Step = rGroupInfo.Step;
+}
+
//------------------------------------------------------------------------
ScDPObject* lcl_GetDPObject( ScDocShell* pDocShell, SCTAB nTab, const String& rName )
@@ -236,31 +286,23 @@ String lcl_CreatePivotName( ScDocShell* pDocShell )
return String(); // sollte nicht vorkommen
}
-sal_Int32 lcl_GetObjectIndex( ScDPObject* pDPObj, const ScFieldIdentifier& rIdent )
+sal_Int32 lcl_GetObjectIndex( ScDPObject* pDPObj, const ScFieldIdentifier& rFieldId )
{
// used for items - nRepeat in identifier can be ignored
-
if ( pDPObj )
{
sal_Int32 nCount = pDPObj->GetDimCount();
- for ( sal_Int32 nDim = 0; nDim < nCount; nDim++ )
+ for ( sal_Int32 nDim = 0; nDim < nCount; ++nDim )
{
BOOL bIsDataLayout = FALSE;
- String aDimName( pDPObj->GetDimName( nDim, bIsDataLayout ) );
- if ( rIdent.bDataLayoutField ? bIsDataLayout : ( aDimName == rIdent.sFieldName ) )
+ OUString aDimName( pDPObj->GetDimName( nDim, bIsDataLayout ) );
+ if ( rFieldId.mbDataLayout ? bIsDataLayout : (aDimName == rFieldId.maFieldName) )
return nDim;
}
}
return -1; // none
}
-BOOL lcl_GetMembers( ScDataPilotDescriptorBase* pParent, const ScFieldIdentifier& rIdent, uno::Reference<container::XNameAccess>& xMembers )
-{
- ScDPObject* pDPObj(pParent->GetDPObject());
- sal_Int32 nObjIndex = lcl_GetObjectIndex( pDPObj, rIdent );
- return pDPObj && pDPObj->GetMembersNA( nObjIndex, xMembers );
-}
-
//------------------------------------------------------------------------
ScDataPilotTablesObj::ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT) :
@@ -289,7 +331,7 @@ void ScDataPilotTablesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
// XDataPilotTables
-ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl(SCSIZE nIndex)
+ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nIndex )
{
if (pDocShell)
{
@@ -300,7 +342,7 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl(SCSIZE nIndex)
// count tables on this sheet
// api only handles sheet data at this time
//! allow all data sources!!!
- SCSIZE nFound = 0;
+ sal_Int32 nFound = 0;
USHORT nCount = pColl->GetCount();
for (USHORT i=0; i<nCount; i++)
{
@@ -320,18 +362,15 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl(SCSIZE nIndex)
return NULL;
}
-ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByName_Impl(const rtl::OUString& aName)
+ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByName_Impl(const OUString& rName)
{
- if (hasByName(aName))
- {
- String aNamStr(aName);
- return new ScDataPilotTableObj( pDocShell, nTab, aNamStr );
- }
- return NULL;
+ if (hasByName(rName))
+ return new ScDataPilotTableObj( pDocShell, nTab, rName );
+ return 0;
}
-uno::Reference<sheet::XDataPilotDescriptor> SAL_CALL ScDataPilotTablesObj::createDataPilotDescriptor()
- throw(uno::RuntimeException)
+Reference<XDataPilotDescriptor> SAL_CALL ScDataPilotTablesObj::createDataPilotDescriptor()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
if (pDocShell)
@@ -339,37 +378,33 @@ uno::Reference<sheet::XDataPilotDescriptor> SAL_CALL ScDataPilotTablesObj::creat
return NULL;
}
-bool lcl_IsDuplicated( const uno::Reference<beans::XPropertySet> xDimProps )
+bool lcl_IsDuplicated( const Reference<XPropertySet> xDimProps )
{
- bool bRet = false;
-
try
{
- uno::Any aAny = xDimProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIGINAL)));
- uno::Reference<container::XNamed> xOriginal( aAny, uno::UNO_QUERY );
- if ( xOriginal.is() )
- bRet = true;
+ Any aAny = xDimProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ORIGINAL ) ) );
+ Reference< XNamed > xOriginal( aAny, UNO_QUERY );
+ return xOriginal.is();
}
- catch(uno::Exception&)
+ catch( Exception& )
{
}
-
- return bRet;
+ return false;
}
-rtl::OUString lcl_GetOriginalName( const uno::Reference<container::XNamed> xDim )
+OUString lcl_GetOriginalName( const Reference< XNamed > xDim )
{
- uno::Reference<container::XNamed> xOriginal;
+ Reference< XNamed > xOriginal;
- uno::Reference<beans::XPropertySet> xDimProps( xDim, uno::UNO_QUERY );
+ Reference< XPropertySet > xDimProps( xDim, UNO_QUERY );
if ( xDimProps.is() )
{
try
{
- uno::Any aAny = xDimProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIGINAL)));
+ Any aAny = xDimProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIGINAL)));
aAny >>= xOriginal;
}
- catch(uno::Exception&)
+ catch( Exception& )
{
}
}
@@ -380,17 +415,17 @@ rtl::OUString lcl_GetOriginalName( const uno::Reference<container::XNamed> xDim
return xOriginal->getName();
}
-void SAL_CALL ScDataPilotTablesObj::insertNewByName( const rtl::OUString& aNewName,
- const table::CellAddress& aOutputAddress,
- const uno::Reference<sheet::XDataPilotDescriptor>& xDescriptor )
- throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotTablesObj::insertNewByName( const OUString& aNewName,
+ const CellAddress& aOutputAddress,
+ const Reference<XDataPilotDescriptor>& xDescriptor )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
if (!xDescriptor.is()) return;
// inserting with already existing name?
if ( aNewName.getLength() && hasByName( aNewName ) )
- throw uno::RuntimeException(); // no other exceptions specified
+ throw RuntimeException(); // no other exceptions specified
BOOL bDone = FALSE;
ScDataPilotDescriptorBase* pImp = ScDataPilotDescriptorBase::getImplementation( xDescriptor );
@@ -418,11 +453,11 @@ void SAL_CALL ScDataPilotTablesObj::insertNewByName( const rtl::OUString& aNewNa
}
if (!bDone)
- throw uno::RuntimeException(); // no other exceptions specified
+ throw RuntimeException(); // no other exceptions specified
}
-void SAL_CALL ScDataPilotTablesObj::removeByName( const rtl::OUString& aName )
- throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotTablesObj::removeByName( const OUString& aName )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
String aNameStr(aName);
@@ -433,21 +468,20 @@ void SAL_CALL ScDataPilotTablesObj::removeByName( const rtl::OUString& aName )
aFunc.DataPilotUpdate( pDPObj, NULL, TRUE, TRUE ); // remove - incl. undo etc.
}
else
- throw uno::RuntimeException(); // no other exceptions specified
+ throw RuntimeException(); // no other exceptions specified
}
// XEnumerationAccess
-uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotTablesObj::createEnumeration()
- throw(uno::RuntimeException)
+Reference< XEnumeration > SAL_CALL ScDataPilotTablesObj::createEnumeration() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotTablesEnumeration")));
+ return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotTablesEnumeration")));
}
// XIndexAccess
-sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(uno::RuntimeException)
+sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException)
{
ScUnoGuard aGuard;
if ( pDocShell )
@@ -475,26 +509,23 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(uno::RuntimeException)
return 0;
}
-uno::Any SAL_CALL ScDataPilotTablesObj::getByIndex( sal_Int32 nIndex )
- throw(lang::IndexOutOfBoundsException,
- lang::WrappedTargetException, uno::RuntimeException)
+Any SAL_CALL ScDataPilotTablesObj::getByIndex( sal_Int32 nIndex )
+ throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- uno::Reference<sheet::XDataPilotTable2> xTable(GetObjectByIndex_Impl(static_cast<SCSIZE>(nIndex)));
- if (xTable.is())
- return uno::makeAny(xTable);
- else
- throw lang::IndexOutOfBoundsException();
-// return uno::Any();
+ Reference<XDataPilotTable2> xTable(GetObjectByIndex_Impl(nIndex));
+ if (!xTable.is())
+ throw IndexOutOfBoundsException();
+ return Any( xTable );
}
-uno::Type SAL_CALL ScDataPilotTablesObj::getElementType() throw(uno::RuntimeException)
+uno::Type SAL_CALL ScDataPilotTablesObj::getElementType() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return getCppuType((uno::Reference<sheet::XDataPilotTable2>*)0);
+ return getCppuType((Reference<XDataPilotTable2>*)0);
}
-sal_Bool SAL_CALL ScDataPilotTablesObj::hasElements() throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotTablesObj::hasElements() throw(RuntimeException)
{
ScUnoGuard aGuard;
return ( getCount() != 0 );
@@ -502,21 +533,18 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasElements() throw(uno::RuntimeExceptio
// XNameAccess
-uno::Any SAL_CALL ScDataPilotTablesObj::getByName( const rtl::OUString& aName )
- throw(container::NoSuchElementException,
- lang::WrappedTargetException, uno::RuntimeException)
+Any SAL_CALL ScDataPilotTablesObj::getByName( const OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- uno::Reference<sheet::XDataPilotTable2> xTable(GetObjectByName_Impl(aName));
- if (xTable.is())
- return uno::makeAny(xTable);
- else
- throw container::NoSuchElementException();
-// return uno::Any();
+ Reference<XDataPilotTable2> xTable(GetObjectByName_Impl(aName));
+ if (!xTable.is())
+ throw NoSuchElementException();
+ return Any( xTable );
}
-uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
- throw(uno::RuntimeException)
+Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
if (pDocShell)
@@ -540,8 +568,8 @@ uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
}
USHORT nPos = 0;
- uno::Sequence<rtl::OUString> aSeq(nFound);
- rtl::OUString* pAry = aSeq.getArray();
+ Sequence<OUString> aSeq(nFound);
+ OUString* pAry = aSeq.getArray();
for (i=0; i<nCount; i++)
{
ScDPObject* pDPObj = (*pColl)[i];
@@ -552,11 +580,11 @@ uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
return aSeq;
}
}
- return uno::Sequence<rtl::OUString>(0);
+ return Sequence<OUString>(0);
}
-sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const rtl::OUString& aName )
- throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
if (pDocShell)
@@ -586,7 +614,7 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const rtl::OUString& aName )
//------------------------------------------------------------------------
ScDataPilotDescriptorBase::ScDataPilotDescriptorBase(ScDocShell* pDocSh) :
- aPropSet( lcl_GetDataPilotDescriptorBaseMap() ),
+ maPropSet( lcl_GetDataPilotDescriptorBaseMap() ),
pDocShell( pDocSh )
{
pDocShell->GetDocument()->AddUnoObject(*this);
@@ -598,12 +626,13 @@ ScDataPilotDescriptorBase::~ScDataPilotDescriptorBase()
pDocShell->GetDocument()->RemoveUnoObject(*this);
}
-uno::Any SAL_CALL ScDataPilotDescriptorBase::queryInterface( const uno::Type& rType )
- throw(uno::RuntimeException)
+Any SAL_CALL ScDataPilotDescriptorBase::queryInterface( const uno::Type& rType )
+ throw(RuntimeException)
{
- SC_QUERYINTERFACE( sheet::XDataPilotDescriptor )
- SC_QUERYINTERFACE( beans::XPropertySet )
- SC_QUERYINTERFACE( container::XNamed ) // base of XDataPilotDescriptor
+ SC_QUERYINTERFACE( XDataPilotDescriptor )
+ SC_QUERYINTERFACE( XPropertySet )
+ SC_QUERYINTERFACE( XDataPilotDataLayoutFieldSupplier )
+ SC_QUERYINTERFACE( XNamed ) // base of XDataPilotDescriptor
SC_QUERYINTERFACE( lang::XUnoTunnel )
SC_QUERYINTERFACE( lang::XTypeProvider )
SC_QUERYINTERFACE( lang::XServiceInfo )
@@ -621,27 +650,28 @@ void SAL_CALL ScDataPilotDescriptorBase::release() throw()
OWeakObject::release();
}
-uno::Sequence<uno::Type> SAL_CALL ScDataPilotDescriptorBase::getTypes()
- throw(uno::RuntimeException)
+Sequence< uno::Type > SAL_CALL ScDataPilotDescriptorBase::getTypes()
+ throw(RuntimeException)
{
- static uno::Sequence<uno::Type> aTypes;
+ static Sequence< uno::Type > aTypes;
if ( aTypes.getLength() == 0 )
{
- aTypes.realloc(5);
+ aTypes.realloc( 6 );
uno::Type* pPtr = aTypes.getArray();
- pPtr[0] = getCppuType((const uno::Reference<sheet::XDataPilotDescriptor>*)0);
- pPtr[1] = getCppuType((const uno::Reference<beans::XPropertySet>*)0);
- pPtr[2] = getCppuType((const uno::Reference<lang::XUnoTunnel>*)0);
- pPtr[3] = getCppuType((const uno::Reference<lang::XTypeProvider>*)0);
- pPtr[4] = getCppuType((const uno::Reference<lang::XServiceInfo>*)0);
+ pPtr[ 0 ] = getCppuType( (const Reference< XDataPilotDescriptor >*)0 );
+ pPtr[ 1 ] = getCppuType( (const Reference< XPropertySet >*)0 );
+ pPtr[ 2 ] = getCppuType( (const Reference< XDataPilotDataLayoutFieldSupplier >*)0 );
+ pPtr[ 3 ] = getCppuType( (const Reference< lang::XUnoTunnel >*)0 );
+ pPtr[ 4 ] = getCppuType( (const Reference< lang::XTypeProvider >*)0 );
+ pPtr[ 5 ] = getCppuType( (const Reference< lang::XServiceInfo >*)0 );
}
return aTypes;
}
-uno::Sequence<sal_Int8> SAL_CALL ScDataPilotDescriptorBase::getImplementationId()
- throw(uno::RuntimeException)
+Sequence<sal_Int8> SAL_CALL ScDataPilotDescriptorBase::getImplementationId()
+ throw(RuntimeException)
{
- static uno::Sequence< sal_Int8 > aId;
+ static Sequence< sal_Int8 > aId;
if( aId.getLength() == 0 )
{
aId.realloc( 16 );
@@ -663,119 +693,98 @@ void ScDataPilotDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
// XDataPilotDescriptor
-table::CellRangeAddress SAL_CALL ScDataPilotDescriptorBase::getSourceRange()
- throw(uno::RuntimeException)
+CellRangeAddress SAL_CALL ScDataPilotDescriptorBase::getSourceRange()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- table::CellRangeAddress aRet;
-
ScDPObject* pDPObject(GetDPObject());
- if (pDPObject && pDPObject->IsSheetData())
- {
- const ScSheetSourceDesc* pSheetDesc = pDPObject->GetSheetDesc();
- aRet.StartColumn = pSheetDesc->aSourceRange.aStart.Col();
- aRet.EndColumn = pSheetDesc->aSourceRange.aEnd.Col();
- aRet.StartRow = pSheetDesc->aSourceRange.aStart.Row();
- aRet.EndRow = pSheetDesc->aSourceRange.aEnd.Row();
- aRet.Sheet = pSheetDesc->aSourceRange.aStart.Tab();
- }
- else
- throw uno::RuntimeException();
+ if (!pDPObject || !pDPObject->IsSheetData())
+ throw RuntimeException();
+ CellRangeAddress aRet;
+ ScUnoConversion::FillApiRange( aRet, pDPObject->GetSheetDesc()->aSourceRange );
return aRet;
}
-void SAL_CALL ScDataPilotDescriptorBase::setSourceRange(
- const table::CellRangeAddress& aSourceRange )
- throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotDescriptorBase::setSourceRange( const CellRangeAddress& aSourceRange ) throw(RuntimeException)
{
ScUnoGuard aGuard;
ScDPObject* pDPObject = GetDPObject();
- if (pDPObject)
- {
- ScSheetSourceDesc aSheetDesc;
- if (pDPObject->IsSheetData())
- aSheetDesc = *(pDPObject->GetSheetDesc());
- aSheetDesc.aSourceRange.aStart.SetCol((SCCOL)aSourceRange.StartColumn);
- aSheetDesc.aSourceRange.aEnd.SetCol((SCCOL)aSourceRange.EndColumn);
- aSheetDesc.aSourceRange.aStart.SetRow((SCROW)aSourceRange.StartRow);
- aSheetDesc.aSourceRange.aEnd.SetRow((SCROW)aSourceRange.EndRow);
- aSheetDesc.aSourceRange.aStart.SetTab((SCTAB)aSourceRange.Sheet);
- pDPObject->SetSheetDesc(aSheetDesc);
- SetDPObject(pDPObject);
- }
- else
- throw uno::RuntimeException();
+ if (!pDPObject)
+ throw RuntimeException();
+
+ ScSheetSourceDesc aSheetDesc;
+ if (pDPObject->IsSheetData())
+ aSheetDesc = *pDPObject->GetSheetDesc();
+ ScUnoConversion::FillScRange( aSheetDesc.aSourceRange, aSourceRange );
+ pDPObject->SetSheetDesc( aSheetDesc );
+ SetDPObject( pDPObject );
}
-uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScDataPilotDescriptorBase::getFilterDescriptor()
- throw(uno::RuntimeException)
+Reference<XSheetFilterDescriptor> SAL_CALL ScDataPilotDescriptorBase::getFilterDescriptor()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
return new ScDataPilotFilterDescriptor( pDocShell, this );
}
-uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataPilotFields()
- throw(uno::RuntimeException)
+Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataPilotFields()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScDataPilotFieldsObj( this, SC_FIELDORIENT_ALL );
+ return new ScDataPilotFieldsObj( *this );
}
-uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getColumnFields()
- throw(uno::RuntimeException)
+Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getColumnFields()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScDataPilotFieldsObj( this, DATA_PILOT_COLUMN );
+ return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_COLUMN );
}
-uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getRowFields()
- throw(uno::RuntimeException)
+Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getRowFields()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScDataPilotFieldsObj( this, DATA_PILOT_ROW );
+ return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_ROW );
}
-uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getPageFields()
- throw(uno::RuntimeException)
+Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getPageFields()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScDataPilotFieldsObj( this, DATA_PILOT_PAGE );
+ return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_PAGE );
}
-uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataFields()
- throw(uno::RuntimeException)
+Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataFields()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScDataPilotFieldsObj( this, DATA_PILOT_DATA );
+ return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_DATA );
}
-uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getHiddenFields()
- throw(uno::RuntimeException)
+Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getHiddenFields()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScDataPilotFieldsObj( this, DATA_PILOT_HIDDEN );
+ return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_HIDDEN );
}
// XPropertySet
-uno::Reference< beans::XPropertySetInfo > SAL_CALL ScDataPilotDescriptorBase::getPropertySetInfo( )
- throw(uno::RuntimeException)
+Reference< XPropertySetInfo > SAL_CALL ScDataPilotDescriptorBase::getPropertySetInfo( )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- static uno::Reference<beans::XPropertySetInfo> aRef =
- new SfxItemPropertySetInfo( aPropSet.getPropertyMap() );
+ static Reference<XPropertySetInfo> aRef =
+ new SfxItemPropertySetInfo( maPropSet.getPropertyMap() );
return aRef;
}
-void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Any& aValue )
- throw(beans::UnknownPropertyException,
- beans::PropertyVetoException,
- lang::IllegalArgumentException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
ScDPObject* pDPObject = GetDPObject();
@@ -813,7 +822,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const ::rtl::OUString
aNewData.SetDrillDown(::cppu::any2bool( aValue ));
}
else
- throw beans::UnknownPropertyException();
+ throw UnknownPropertyException();
pDPObject->SetSaveData( aNewData );
}
@@ -822,13 +831,11 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const ::rtl::OUString
}
}
-uno::Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue(const ::rtl::OUString& aPropertyName )
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- uno::Any aRet;
+ Any aRet;
ScDPObject* pDPObject(GetDPObject());
if (pDPObject)
@@ -865,49 +872,60 @@ uno::Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue(const ::rtl::OUStr
aRet = ::cppu::bool2any( aNewData.GetDrillDown() );
}
else
- throw beans::UnknownPropertyException();
+ throw UnknownPropertyException();
}
}
return aRet;
}
-void SAL_CALL ScDataPilotDescriptorBase::addPropertyChangeListener( const ::rtl::OUString& /* aPropertyName */,
- const uno::Reference<beans::XPropertyChangeListener >& /* xListener */ )
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL ScDataPilotDescriptorBase::addPropertyChangeListener(
+ const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener >& /* xListener */ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ScDataPilotDescriptorBase::removePropertyChangeListener( const ::rtl::OUString& /* aPropertyName */,
- const uno::Reference<beans::XPropertyChangeListener >& /* aListener */ )
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL ScDataPilotDescriptorBase::removePropertyChangeListener(
+ const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener >& /* aListener */ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ScDataPilotDescriptorBase::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */,
- const uno::Reference<beans::XVetoableChangeListener >& /* aListener */ )
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL ScDataPilotDescriptorBase::addVetoableChangeListener(
+ const OUString& /* PropertyName */, const Reference<XVetoableChangeListener >& /* aListener */ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ScDataPilotDescriptorBase::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */,
- const uno::Reference<beans::XVetoableChangeListener >& /* aListener */ )
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL ScDataPilotDescriptorBase::removeVetoableChangeListener(
+ const OUString& /* PropertyName */, const Reference<XVetoableChangeListener >& /* aListener */ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
+// XDataPilotDataLayoutFieldSupplier
+
+Reference< XDataPilotField > SAL_CALL ScDataPilotDescriptorBase::getDataLayoutField() throw(RuntimeException)
+{
+ ScUnoGuard aGuard;
+ if( ScDPObject* pDPObject = GetDPObject() )
+ {
+ if( ScDPSaveData* pSaveData = pDPObject->GetSaveData() )
+ {
+ if( /*ScDPSaveDimension* pDataDim =*/ pSaveData->GetDataLayoutDimension() )
+ {
+ ScFieldIdentifier aFieldId( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_DATALAYOUT_NAME ) ), 0, true );
+ return new ScDataPilotFieldObj( *this, aFieldId );
+ }
+ }
+ }
+ return 0;
+}
+
// XUnoTunnel
sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething(
- const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
+ const Sequence<sal_Int8 >& rId ) throw(RuntimeException)
{
if ( rId.getLength() == 16 &&
0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
@@ -919,15 +937,15 @@ sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething(
}
// static
-const uno::Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId()
+const Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId()
{
- static uno::Sequence<sal_Int8> * pSeq = 0;
+ static Sequence<sal_Int8> * pSeq = 0;
if( !pSeq )
{
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if( !pSeq )
{
- static uno::Sequence< sal_Int8 > aSeq( 16 );
+ static Sequence< sal_Int8 > aSeq( 16 );
rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
pSeq = &aSeq;
}
@@ -937,10 +955,10 @@ const uno::Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId()
// static
ScDataPilotDescriptorBase* ScDataPilotDescriptorBase::getImplementation(
- const uno::Reference<sheet::XDataPilotDescriptor> xObj )
+ const Reference<XDataPilotDescriptor> xObj )
{
ScDataPilotDescriptorBase* pRet = NULL;
- uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
+ Reference<lang::XUnoTunnel> xUT( xObj, UNO_QUERY );
if (xUT.is())
pRet = reinterpret_cast<ScDataPilotDescriptorBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
return pRet;
@@ -959,13 +977,13 @@ ScDataPilotTableObj::~ScDataPilotTableObj()
{
}
-uno::Any SAL_CALL ScDataPilotTableObj::queryInterface( const uno::Type& rType )
- throw(uno::RuntimeException)
+Any SAL_CALL ScDataPilotTableObj::queryInterface( const uno::Type& rType )
+ throw(RuntimeException)
{
// since we manually do resolve the query for XDataPilotTable2
// we also need to do the same for XDataPilotTable
- SC_QUERYINTERFACE( sheet::XDataPilotTable )
- SC_QUERYINTERFACE( sheet::XDataPilotTable2 )
+ SC_QUERYINTERFACE( XDataPilotTable )
+ SC_QUERYINTERFACE( XDataPilotTable2 )
return ScDataPilotDescriptorBase::queryInterface( rType );
}
@@ -980,30 +998,29 @@ void SAL_CALL ScDataPilotTableObj::release() throw()
ScDataPilotDescriptorBase::release();
}
-uno::Sequence<uno::Type> SAL_CALL ScDataPilotTableObj::getTypes()
- throw(uno::RuntimeException)
+Sequence< uno::Type > SAL_CALL ScDataPilotTableObj::getTypes() throw(RuntimeException)
{
- static uno::Sequence<uno::Type> aTypes;
+ static Sequence< uno::Type > aTypes;
if ( aTypes.getLength() == 0 )
{
- uno::Sequence<uno::Type> aParentTypes(ScDataPilotDescriptorBase::getTypes());
- long nParentLen = aParentTypes.getLength();
+ Sequence< uno::Type > aParentTypes = ScDataPilotDescriptorBase::getTypes();
+ sal_Int32 nParentLen = aParentTypes.getLength();
const uno::Type* pParentPtr = aParentTypes.getConstArray();
aTypes.realloc( nParentLen + 1 );
uno::Type* pPtr = aTypes.getArray();
- pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XDataPilotTable2>*)0);
+ for (sal_Int32 i = 0; i < nParentLen; ++i)
+ pPtr[ i ] = pParentPtr[ i ]; // parent types first
- for (long i=0; i<nParentLen; i++)
- pPtr[i] = pParentPtr[i]; // parent types first
+ pPtr[ nParentLen ] = getCppuType( (const Reference< XDataPilotTable2 >*)0 );
}
return aTypes;
}
-uno::Sequence<sal_Int8> SAL_CALL ScDataPilotTableObj::getImplementationId()
- throw(uno::RuntimeException)
+Sequence<sal_Int8> SAL_CALL ScDataPilotTableObj::getImplementationId()
+ throw(RuntimeException)
{
- static uno::Sequence< sal_Int8 > aId;
+ static Sequence< sal_Int8 > aId;
if( aId.getLength() == 0 )
{
aId.realloc( 16 );
@@ -1031,17 +1048,17 @@ void ScDataPilotTableObj::SetDPObject( ScDPObject* pDPObject )
// "rest of XDataPilotDescriptor"
-rtl::OUString SAL_CALL ScDataPilotTableObj::getName() throw(uno::RuntimeException)
+OUString SAL_CALL ScDataPilotTableObj::getName() throw(RuntimeException)
{
ScUnoGuard aGuard;
ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
if (pDPObj)
return pDPObj->GetName();
- return rtl::OUString();
+ return OUString();
}
-void SAL_CALL ScDataPilotTableObj::setName( const rtl::OUString& aNewName )
- throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotTableObj::setName( const OUString& aNewName )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
@@ -1058,17 +1075,17 @@ void SAL_CALL ScDataPilotTableObj::setName( const rtl::OUString& aNewName )
}
}
-rtl::OUString SAL_CALL ScDataPilotTableObj::getTag() throw(uno::RuntimeException)
+OUString SAL_CALL ScDataPilotTableObj::getTag() throw(RuntimeException)
{
ScUnoGuard aGuard;
ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
if (pDPObj)
return pDPObj->GetTag();
- return rtl::OUString();
+ return OUString();
}
-void SAL_CALL ScDataPilotTableObj::setTag( const ::rtl::OUString& aNewTag )
- throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotTableObj::setTag( const OUString& aNewTag )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
@@ -1084,11 +1101,10 @@ void SAL_CALL ScDataPilotTableObj::setTag( const ::rtl::OUString& aNewTag )
// XDataPilotTable
-table::CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange()
- throw(uno::RuntimeException)
+CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange() throw(RuntimeException)
{
ScUnoGuard aGuard;
- table::CellRangeAddress aRet;
+ CellRangeAddress aRet;
ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
if (pDPObj)
{
@@ -1102,7 +1118,7 @@ table::CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange()
return aRet;
}
-void SAL_CALL ScDataPilotTableObj::refresh() throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotTableObj::refresh() throw(RuntimeException)
{
ScUnoGuard aGuard;
ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
@@ -1161,25 +1177,16 @@ CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRangeByType( sal_Int32 n
throw (IllegalArgumentException, RuntimeException)
{
ScUnoGuard aGuard;
- if (nType < 0 || nType > ::com::sun::star::sheet::DataPilotOutputRangeType::RESULT)
+ if (nType < 0 || nType > DataPilotOutputRangeType::RESULT)
throw IllegalArgumentException();
- table::CellRangeAddress aRet;
- ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName);
- if (!pDPObj)
- return aRet;
-
- const ScRange aRange = pDPObj->GetOutputRangeByType(nType);
- aRet.Sheet = aRange.aStart.Tab();
- aRet.StartColumn = aRange.aStart.Col();
- aRet.StartRow = aRange.aStart.Row();
- aRet.EndColumn = aRange.aEnd.Col();
- aRet.EndRow = aRange.aEnd.Row();
-
+ CellRangeAddress aRet;
+ if (ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName))
+ ScUnoConversion::FillApiRange( aRet, pDPObj->GetOutputRangeByType( nType ) );
return aRet;
}
-//------------------------------------------------------------------------
+// ============================================================================
ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) :
ScDataPilotDescriptorBase( pDocSh ),
@@ -1220,121 +1227,158 @@ void ScDataPilotDescriptor::SetDPObject( ScDPObject* pDPObject )
// "rest of XDataPilotDescriptor"
-rtl::OUString SAL_CALL ScDataPilotDescriptor::getName() throw(uno::RuntimeException)
+OUString SAL_CALL ScDataPilotDescriptor::getName() throw(RuntimeException)
{
ScUnoGuard aGuard;
return mpDPObject->GetName();
}
-void SAL_CALL ScDataPilotDescriptor::setName( const rtl::OUString& aNewName )
- throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotDescriptor::setName( const OUString& aNewName )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
mpDPObject->SetName( aNewName );
}
-rtl::OUString SAL_CALL ScDataPilotDescriptor::getTag() throw(uno::RuntimeException)
+OUString SAL_CALL ScDataPilotDescriptor::getTag() throw(RuntimeException)
{
ScUnoGuard aGuard;
return mpDPObject->GetTag();
}
-void SAL_CALL ScDataPilotDescriptor::setTag( const ::rtl::OUString& aNewTag )
- throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotDescriptor::setTag( const OUString& aNewTag )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
mpDPObject->SetTag( aNewTag );
}
-//------------------------------------------------------------------------
+// ============================================================================
-ScDataPilotFieldsObj::ScDataPilotFieldsObj(ScDataPilotDescriptorBase* pPar, USHORT nTy) :
- pParent( pPar ),
- nType( nTy )
+ScDataPilotChildObjBase::ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent ) :
+ mrParent( rParent )
{
- pParent->acquire();
+ mrParent.acquire();
}
-ScDataPilotFieldsObj::~ScDataPilotFieldsObj()
+ScDataPilotChildObjBase::ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) :
+ mrParent( rParent ),
+ maFieldId( rFieldId )
+{
+ mrParent.acquire();
+}
+
+ScDataPilotChildObjBase::~ScDataPilotChildObjBase()
{
- pParent->release();
+ mrParent.release();
}
-BOOL lcl_GetDim(ScDPObject* pDPObj, const ScFieldIdentifier& rIdent, ScDPSaveDimension*& rpDim)
+ScDPObject* ScDataPilotChildObjBase::GetDPObject() const
{
- BOOL bRet = FALSE;
- ScDPSaveData* pSave = pDPObj->GetSaveData();
- if ( pSave )
+ return mrParent.GetDPObject();
+}
+
+void ScDataPilotChildObjBase::SetDPObject( ScDPObject* pDPObject )
+{
+ mrParent.SetDPObject( pDPObject );
+}
+
+ScDPSaveDimension* ScDataPilotChildObjBase::GetDPDimension( ScDPObject** ppDPObject ) const
+{
+ if( ScDPObject* pDPObj = GetDPObject() )
{
- if ( rIdent.bDataLayoutField )
- {
- rpDim = pSave->GetDataLayoutDimension();
- bRet = TRUE;
- }
- else if ( rIdent.nRepeat == 0 )
- {
- rpDim = pSave->GetDimensionByName( rIdent.sFieldName );
- bRet = TRUE;
- }
- else
+ if( ppDPObject ) *ppDPObject = pDPObj;
+ if( ScDPSaveData* pSaveData = pDPObj->GetSaveData() )
{
- // count all dimensions with the given name
-
- String aNameStr( rIdent.sFieldName );
- const List& rDimensions = pSave->GetDimensions();
- sal_Int32 nDimCount = rDimensions.Count();
- sal_Int32 nFound = 0;
- for ( sal_Int32 nDim = 0; nDim < nDimCount && !bRet; nDim++ )
+ if( maFieldId.mbDataLayout )
+ return pSaveData->GetDataLayoutDimension();
+
+ if( maFieldId.mnFieldIdx == 0 )
+ return pSaveData->GetDimensionByName( maFieldId.maFieldName );
+
+ // find dimension with specified index (search in duplicated dimensions)
+ String aFieldName = maFieldId.maFieldName; // needed for comparison
+ const List& rDimensions = pSaveData->GetDimensions();
+ ULONG nDimCount = rDimensions.Count();
+ sal_Int32 nFoundIdx = 0;
+ for( ULONG nDim = 0; nDim < nDimCount; ++nDim )
{
- ScDPSaveDimension* pOneDim = static_cast<ScDPSaveDimension*>(rDimensions.GetObject(nDim));
- if ( !pOneDim->IsDataLayout() && pOneDim->GetName() == aNameStr )
+ ScDPSaveDimension* pDim = static_cast< ScDPSaveDimension* >( rDimensions.GetObject( nDim ) );
+ if( !pDim->IsDataLayout() && (pDim->GetName() == aFieldName) )
{
- if ( nFound == rIdent.nRepeat )
- {
- rpDim = pOneDim;
- bRet = TRUE;
- }
- else
- ++nFound;
+ if( nFoundIdx == maFieldId.mnFieldIdx )
+ return pDim;
+ ++nFoundIdx;
}
}
}
}
- return bRet;
+ return 0;
+}
+
+sal_Int32 ScDataPilotChildObjBase::GetMemberCount() const
+{
+ sal_Int32 nRet = 0;
+ Reference<XNameAccess> xMembersNA = GetMembers();
+ if (xMembersNA.is())
+ {
+ Reference< XIndexAccess > xMembersIA( new ScNameToIndexAccess( xMembersNA ) );
+ nRet = xMembersIA->getCount();
+ }
+ return nRet;
+}
+
+Reference< XNameAccess > ScDataPilotChildObjBase::GetMembers() const
+{
+ Reference< XNameAccess > xMembersNA;
+ if( ScDPObject* pDPObj = GetDPObject() )
+ pDPObj->GetMembersNA( lcl_GetObjectIndex( pDPObj, maFieldId ), xMembersNA );
+ return xMembersNA;
}
-SCSIZE lcl_GetFieldCount( const com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& rSource, USHORT nType )
+// ============================================================================
+
+ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent ) :
+ ScDataPilotChildObjBase( rParent )
+{
+}
+
+ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent, DataPilotFieldOrientation eOrient ) :
+ ScDataPilotChildObjBase( rParent ),
+ maOrient( eOrient )
+{
+}
+
+ScDataPilotFieldsObj::~ScDataPilotFieldsObj()
+{
+}
+
+sal_Int32 lcl_GetFieldCount( const Reference<XDimensionsSupplier>& rSource, const Any& rOrient )
{
- SCSIZE nRet = 0;
+ sal_Int32 nRet = 0;
- uno::Reference<container::XNameAccess> xDimsName(rSource->getDimensions());
- uno::Reference<container::XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
+ Reference<XNameAccess> xDimsName(rSource->getDimensions());
+ Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
sal_Int32 nIntCount = xIntDims->getCount();
- if (nType != SC_FIELDORIENT_ALL)
+ if (rOrient.hasValue())
{
// all fields of the specified orientation, including duplicated
-
- uno::Reference<beans::XPropertySet> xDim;
- sheet::DataPilotFieldOrientation aOrient;
+ Reference<XPropertySet> xDim;
for (sal_Int32 i = 0; i < nIntCount; ++i)
{
- xDim.set(xIntDims->getByIndex(i), uno::UNO_QUERY);
- if (xDim.is())
- {
- xDim->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIENTAT))) >>= aOrient;
- if (aOrient == nType)
- ++nRet;
- }
+ xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
+ if (xDim.is() && (xDim->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIENTAT))) == rOrient))
+ ++nRet;
}
}
else
{
// count all non-duplicated fields
- uno::Reference<beans::XPropertySet> xDim;
+ Reference<XPropertySet> xDim;
for (sal_Int32 i = 0; i < nIntCount; ++i)
{
- xDim.set(xIntDims->getByIndex(i), uno::UNO_QUERY);
+ xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
if ( xDim.is() && !lcl_IsDuplicated( xDim ) )
++nRet;
}
@@ -1343,37 +1387,32 @@ SCSIZE lcl_GetFieldCount( const com::sun::star::uno::Reference<com::sun::star::s
return nRet;
}
-BOOL lcl_GetFieldDataByIndex( const com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& rSource,
- USHORT nType, SCSIZE nIndex, ScFieldIdentifier& rField )
+BOOL lcl_GetFieldDataByIndex( const Reference<XDimensionsSupplier>& rSource,
+ const Any& rOrient, SCSIZE nIndex, ScFieldIdentifier& rFieldId )
{
BOOL bOk = FALSE;
SCSIZE nPos = 0;
sal_Int32 nDimIndex = 0;
- uno::Reference<container::XNameAccess> xDimsName(rSource->getDimensions());
- uno::Reference<container::XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
+ Reference<XNameAccess> xDimsName(rSource->getDimensions());
+ Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName ));
sal_Int32 nIntCount = xIntDims->getCount();
- uno::Reference<beans::XPropertySet> xDim;
- if (nType != SC_FIELDORIENT_ALL)
+ Reference<XPropertySet> xDim;
+ if (rOrient.hasValue())
{
- sheet::DataPilotFieldOrientation aOrient;
sal_Int32 i = 0;
while (i < nIntCount && !bOk)
{
- xDim.set(xIntDims->getByIndex(i), uno::UNO_QUERY);
- if (xDim.is())
+ xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
+ if (xDim.is() && (xDim->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIENTAT))) == rOrient))
{
- xDim->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIENTAT))) >>= aOrient;
- if (aOrient == nType)
+ if (nPos == nIndex)
{
- if (nPos == nIndex)
- {
- bOk = sal_True;
- nDimIndex = i;
- }
- else
- ++nPos;
+ bOk = sal_True;
+ nDimIndex = i;
}
+ else
+ ++nPos;
}
++i;
}
@@ -1383,7 +1422,7 @@ BOOL lcl_GetFieldDataByIndex( const com::sun::star::uno::Reference<com::sun::sta
sal_Int32 i = 0;
while (i < nIntCount && !bOk)
{
- xDim.set(xIntDims->getByIndex(i), uno::UNO_QUERY);
+ xDim.set(xIntDims->getByIndex(i), UNO_QUERY);
if ( xDim.is() && !lcl_IsDuplicated( xDim ) )
{
if (nPos == nIndex)
@@ -1400,30 +1439,30 @@ BOOL lcl_GetFieldDataByIndex( const com::sun::star::uno::Reference<com::sun::sta
if ( bOk )
{
- xDim.set( xIntDims->getByIndex(nDimIndex), uno::UNO_QUERY );
- uno::Reference<container::XNamed> xDimName( xDim, uno::UNO_QUERY );
+ xDim.set( xIntDims->getByIndex(nDimIndex), UNO_QUERY );
+ Reference<XNamed> xDimName( xDim, UNO_QUERY );
if ( xDimName.is() )
{
- rtl::OUString sOriginalName( lcl_GetOriginalName( xDimName ) );
- rField.sFieldName = sOriginalName;
- rField.bDataLayoutField = ScUnoHelpFunctions::GetBoolProperty( xDim,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ISDATALA)) );
+ OUString sOriginalName( lcl_GetOriginalName( xDimName ) );
+ rFieldId.maFieldName = sOriginalName;
+ rFieldId.mbDataLayout = ScUnoHelpFunctions::GetBoolProperty( xDim,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ISDATALA)) );
sal_Int32 nRepeat = 0;
- if ( nType != SC_FIELDORIENT_ALL && lcl_IsDuplicated( xDim ) )
+ if ( rOrient.hasValue() && lcl_IsDuplicated( xDim ) )
{
// find the repeat count
// (this relies on the original dimension always being before the duplicates)
- uno::Reference<container::XNamed> xPrevName;
+ Reference<XNamed> xPrevName;
for (sal_Int32 i = 0; i < nDimIndex; ++i)
{
- xPrevName.set( xIntDims->getByIndex(i), uno::UNO_QUERY );
+ xPrevName.set( xIntDims->getByIndex(i), UNO_QUERY );
if ( xPrevName.is() && lcl_GetOriginalName( xPrevName ) == sOriginalName )
++nRepeat;
}
}
- rField.nRepeat = nRepeat;
+ rFieldId.mnFieldIdx = nRepeat;
}
else
bOk = sal_False;
@@ -1432,127 +1471,111 @@ BOOL lcl_GetFieldDataByIndex( const com::sun::star::uno::Reference<com::sun::sta
return bOk;
}
-BOOL lcl_GetFieldDataByName( ScDPObject* pDPObj, USHORT /* nType */, const rtl::OUString& sName, ScFieldIdentifier& rField )
+BOOL lcl_GetFieldDataByName( ScDPObject* pDPObj, const OUString& rFieldName, ScFieldIdentifier& rFieldId )
{
// "By name" is always the first match.
// The name "Data" always refers to the data layout field.
- rField.sFieldName = sName;
- rField.bDataLayoutField = sName.equalsAscii( SC_DATALAYOUT_NAME );
- rField.nRepeat = 0;
+ rFieldId.maFieldName = rFieldName;
+ rFieldId.mnFieldIdx = 0;
+ rFieldId.mbDataLayout = rFieldName.equalsAscii( SC_DATALAYOUT_NAME );
pDPObj->GetSource(); // IsDimNameInUse doesn't update source data
// check if the named field exists (not for data layout)
- return ( rField.bDataLayoutField || pDPObj->IsDimNameInUse( sName ) );
+ return rFieldId.mbDataLayout || pDPObj->IsDimNameInUse( rFieldName );
}
// XDataPilotFields
-ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByIndex_Impl(SCSIZE nIndex) const
+ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const
{
- ScDPObject* pObj = pParent->GetDPObject();
-
// TODO
- if (pObj)
+ if (ScDPObject* pObj = GetDPObject())
{
- ScFieldIdentifier aSourceIdent;
- BOOL bOk = lcl_GetFieldDataByIndex( pObj->GetSource(), nType, nIndex, aSourceIdent );
-
- if (bOk)
- return new ScDataPilotFieldObj( pParent, nType, aSourceIdent );
+ ScFieldIdentifier aFieldId;
+ if (lcl_GetFieldDataByIndex( pObj->GetSource(), maOrient, nIndex, aFieldId ))
+ return new ScDataPilotFieldObj( mrParent, aFieldId, maOrient );
}
-
- return NULL;
+ return 0;
}
-ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByName_Impl(const rtl::OUString& aName) const
+ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByName_Impl(const OUString& aName) const
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ if (ScDPObject* pDPObj = GetDPObject())
{
- ScFieldIdentifier aSourceIdent;
- if (lcl_GetFieldDataByName( pDPObj, nType, aName, aSourceIdent ))
- {
- return new ScDataPilotFieldObj( pParent, nType, aSourceIdent );
- }
+ ScFieldIdentifier aFieldId;
+ if (lcl_GetFieldDataByName( pDPObj, aName, aFieldId ))
+ return new ScDataPilotFieldObj( mrParent, aFieldId, maOrient );
}
- return NULL;
+ return 0;
}
// XEnumerationAccess
-uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotFieldsObj::createEnumeration()
- throw(uno::RuntimeException)
+Reference<XEnumeration> SAL_CALL ScDataPilotFieldsObj::createEnumeration()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldsEnumeration")));
+ return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldsEnumeration")));
}
// XIndexAccess
-sal_Int32 SAL_CALL ScDataPilotFieldsObj::getCount() throw(uno::RuntimeException)
+sal_Int32 SAL_CALL ScDataPilotFieldsObj::getCount() throw(RuntimeException)
{
ScUnoGuard aGuard;
// TODO
- ScDPObject* pDPObj(pParent->GetDPObject());
-
- return pDPObj ? static_cast<sal_Int32>(lcl_GetFieldCount( pDPObj->GetSource(), nType )) : 0;
+ ScDPObject* pDPObj = GetDPObject();
+ return pDPObj ? lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) : 0;
}
-uno::Any SAL_CALL ScDataPilotFieldsObj::getByIndex( sal_Int32 nIndex )
- throw(lang::IndexOutOfBoundsException,
- lang::WrappedTargetException, uno::RuntimeException)
+Any SAL_CALL ScDataPilotFieldsObj::getByIndex( sal_Int32 nIndex )
+ throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- uno::Reference<beans::XPropertySet> xField(GetObjectByIndex_Impl(static_cast<SCSIZE>(nIndex)));
- if (xField.is())
- return uno::makeAny(xField);
- else
- throw lang::IndexOutOfBoundsException();
+ Reference< XPropertySet > xField( GetObjectByIndex_Impl( nIndex ) );
+ if (!xField.is())
+ throw IndexOutOfBoundsException();
+ return Any( xField );
}
-uno::Type SAL_CALL ScDataPilotFieldsObj::getElementType() throw(uno::RuntimeException)
+uno::Type SAL_CALL ScDataPilotFieldsObj::getElementType() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return getCppuType((uno::Reference<beans::XPropertySet>*)0);
+ return getCppuType((Reference<XPropertySet>*)0);
}
-sal_Bool SAL_CALL ScDataPilotFieldsObj::hasElements() throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotFieldsObj::hasElements() throw(RuntimeException)
{
ScUnoGuard aGuard;
return ( getCount() != 0 );
}
-uno::Any SAL_CALL ScDataPilotFieldsObj::getByName( const rtl::OUString& aName )
- throw(container::NoSuchElementException,
- lang::WrappedTargetException, uno::RuntimeException)
+Any SAL_CALL ScDataPilotFieldsObj::getByName( const OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- uno::Reference<beans::XPropertySet> xField(GetObjectByName_Impl(aName));
- if (xField.is())
- return uno::makeAny(xField);
- else
- throw container::NoSuchElementException();
+ Reference<XPropertySet> xField(GetObjectByName_Impl(aName));
+ if (!xField.is())
+ throw NoSuchElementException();
+ return Any( xField );
}
-uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames()
- throw(uno::RuntimeException)
+Sequence<OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
// TODO
-
- ScDPObject* pDPObj(pParent->GetDPObject());
-
- if (pDPObj)
+ if (ScDPObject* pDPObj = GetDPObject())
{
- uno::Sequence<rtl::OUString> aSeq(static_cast<sal_Int32>(lcl_GetFieldCount(pDPObj->GetSource(), nType)));
- rtl::OUString* pAry = aSeq.getArray();
+ Sequence< OUString > aSeq( lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) );
+ OUString* pAry = aSeq.getArray();
const List& rDimensions = pDPObj->GetSaveData()->GetDimensions();
sal_Int32 nDimCount = rDimensions.Count();
for (sal_Int32 nDim = 0; nDim < nDimCount; nDim++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)rDimensions.GetObject(nDim);
- if(pDim->GetOrientation() == nType)
+ if(maOrient.hasValue() && (pDim->GetOrientation() == maOrient.get< DataPilotFieldOrientation >()))
{
*pAry = pDim->GetName();
++pAry;
@@ -1560,11 +1583,11 @@ uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames()
}
return aSeq;
}
- return uno::Sequence<rtl::OUString>();
+ return Sequence<OUString>();
}
-sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const rtl::OUString& aName )
- throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const OUString& aName )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
@@ -1573,101 +1596,92 @@ sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const rtl::OUString& aName )
//------------------------------------------------------------------------
-ScDataPilotFieldObj::ScDataPilotFieldObj( ScDataPilotDescriptorBase* pPar,
- USHORT nST, const ScFieldIdentifier& rIdent ) :
- aPropSet( lcl_GetDataPilotFieldMap() ),
- pParent( pPar ),
- nSourceType( nST ),
- aSourceIdent( rIdent ),
- nLastFunc( sheet::GeneralFunction_NONE )
+ScDataPilotFieldObj::ScDataPilotFieldObj(
+ ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) :
+ ScDataPilotChildObjBase( rParent, rFieldId ),
+ maPropSet( lcl_GetDataPilotFieldMap() )
+{
+}
+
+ScDataPilotFieldObj::ScDataPilotFieldObj( ScDataPilotDescriptorBase& rParent,
+ const ScFieldIdentifier& rFieldId, const Any& rOrient ) :
+ ScDataPilotChildObjBase( rParent, rFieldId ),
+ maPropSet( lcl_GetDataPilotFieldMap() ),
+ maOrient( rOrient )
{
- pParent->acquire();
}
ScDataPilotFieldObj::~ScDataPilotFieldObj()
{
- pParent->release();
}
// XNamed
-rtl::OUString SAL_CALL ScDataPilotFieldObj::getName() throw(uno::RuntimeException)
+OUString SAL_CALL ScDataPilotFieldObj::getName() throw(RuntimeException)
{
ScUnoGuard aGuard;
-// TODO
- rtl::OUString sRet;
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ OUString aName;
+ if( ScDPSaveDimension* pDim = GetDPDimension() )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- if (pDim->IsDataLayout())
- return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(SC_DATALAYOUT_NAME));
- else
- sRet = pDim->GetLayoutName();
- }
+ if( pDim->IsDataLayout() )
+ aName = OUString( RTL_CONSTASCII_USTRINGPARAM( SC_DATALAYOUT_NAME ) );
+ else
+ aName = pDim->GetLayoutName();
}
- return sRet;
+ return aName;
}
-void SAL_CALL ScDataPilotFieldObj::setName( const rtl::OUString& aNewName )
- throw(uno::RuntimeException)
+void SAL_CALL ScDataPilotFieldObj::setName( const OUString& rName ) throw(RuntimeException)
{
ScUnoGuard aGuard;
-// TODO
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScDPObject* pDPObj = 0;
+ ScDPSaveDimension* pDim = GetDPDimension( &pDPObj );
+ if( pDim && !pDim->IsDataLayout() )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- if (!pDim->IsDataLayout())
- {
- String aName(aNewName);
- pDim->SetLayoutName(&aName);
- pParent->SetDPObject(pDPObj);
- }
- }
+ String aName( rName );
+ pDim->SetLayoutName( &aName );
+ SetDPObject( pDPObj );
}
}
// XPropertySet
-uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDataPilotFieldObj::getPropertySetInfo()
- throw(uno::RuntimeException)
+Reference<XPropertySetInfo> SAL_CALL ScDataPilotFieldObj::getPropertySetInfo()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
+ static Reference<XPropertySetInfo> aRef(
+ new SfxItemPropertySetInfo( maPropSet.getPropertyMap() ));
return aRef;
}
-void SAL_CALL ScDataPilotFieldObj::setPropertyValue(
- const rtl::OUString& aPropertyName, const uno::Any& aValue )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
String aNameString(aPropertyName);
if ( aNameString.EqualsAscii( SC_UNONAME_FUNCTION ) )
{
- //! test for correct enum type?
- sheet::GeneralFunction eFunction = (sheet::GeneralFunction)
- ScUnoHelpFunctions::GetEnumFromAny( aValue );
- setFunction( eFunction );
+ GeneralFunction eFunction = GeneralFunction_NONE;
+ if( aValue >>= eFunction )
+ setFunction( eFunction );
+ }
+ else if ( aNameString.EqualsAscii( SC_UNONAME_SUBTOTALS ) )
+ {
+ Sequence< GeneralFunction > aSubtotals;
+ if( aValue >>= aSubtotals )
+ setSubtotals( aSubtotals );
}
else if ( aNameString.EqualsAscii( SC_UNONAME_ORIENT ) )
{
//! test for correct enum type?
- sheet::DataPilotFieldOrientation eOrient = (sheet::DataPilotFieldOrientation)
+ DataPilotFieldOrientation eOrient = (DataPilotFieldOrientation)
ScUnoHelpFunctions::GetEnumFromAny( aValue );
setOrientation( eOrient );
}
else if ( aNameString.EqualsAscii( SC_UNONAME_SELPAGE ) )
{
- rtl::OUString sCurrentPage;
+ OUString sCurrentPage;
if (aValue >>= sCurrentPage)
setCurrentPage(sCurrentPage);
}
@@ -1682,7 +1696,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue(
}
else if ( aNameString.EqualsAscii( SC_UNONAME_AUTOSHOW ) )
{
- sheet::DataPilotFieldAutoShowInfo aInfo;
+ DataPilotFieldAutoShowInfo aInfo;
if (aValue >>= aInfo)
setAutoShowInfo(&aInfo);
}
@@ -1693,7 +1707,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue(
}
else if ( aNameString.EqualsAscii( SC_UNONAME_LAYOUTINFO ) )
{
- sheet::DataPilotFieldLayoutInfo aInfo;
+ DataPilotFieldLayoutInfo aInfo;
if (aValue >>= aInfo)
setLayoutInfo(&aInfo);
}
@@ -1704,7 +1718,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue(
}
else if ( aNameString.EqualsAscii( SC_UNONAME_REFERENCE ) )
{
- sheet::DataPilotFieldReference aRef;
+ DataPilotFieldReference aRef;
if (aValue >>= aRef)
setReference(&aRef);
}
@@ -1715,7 +1729,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue(
}
else if ( aNameString.EqualsAscii( SC_UNONAME_SORTINFO ) )
{
- sheet::DataPilotFieldSortInfo aInfo;
+ DataPilotFieldSortInfo aInfo;
if (aValue >>= aInfo)
setSortInfo(&aInfo);
}
@@ -1726,7 +1740,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue(
}
else if ( aNameString.EqualsAscii( SC_UNONAME_GROUPINFO ) )
{
- sheet::DataPilotFieldGroupInfo aInfo;
+ DataPilotFieldGroupInfo aInfo;
if (aValue >>= aInfo)
setGroupInfo(&aInfo);
}
@@ -1736,16 +1750,17 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue(
}
}
-uno::Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const rtl::OUString& aPropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException,
- uno::RuntimeException)
+Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
String aNameString(aPropertyName);
- uno::Any aRet;
+ Any aRet;
if ( aNameString.EqualsAscii( SC_UNONAME_FUNCTION ) )
aRet <<= getFunction();
+ else if ( aNameString.EqualsAscii( SC_UNONAME_SUBTOTALS ) )
+ aRet <<= getSubtotals();
else if ( aNameString.EqualsAscii( SC_UNONAME_ORIENT ) )
aRet <<= getOrientation();
else if ( aNameString.EqualsAscii( SC_UNONAME_SELPAGE ) )
@@ -1756,33 +1771,33 @@ uno::Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const rtl::OUString& aP
aRet = ::cppu::bool2any(getAutoShowInfo() != NULL);
else if ( aNameString.EqualsAscii( SC_UNONAME_AUTOSHOW ) )
{
- const sheet::DataPilotFieldAutoShowInfo* pInfo = getAutoShowInfo();
+ const DataPilotFieldAutoShowInfo* pInfo = getAutoShowInfo();
if (pInfo)
- aRet <<= sheet::DataPilotFieldAutoShowInfo(*pInfo);
+ aRet <<= DataPilotFieldAutoShowInfo(*pInfo);
}
else if ( aNameString.EqualsAscii( SC_UNONAME_HASLAYOUTINFO ) )
aRet = ::cppu::bool2any(getLayoutInfo() != NULL);
else if ( aNameString.EqualsAscii( SC_UNONAME_LAYOUTINFO ) )
{
- const sheet::DataPilotFieldLayoutInfo* pInfo = getLayoutInfo();
+ const DataPilotFieldLayoutInfo* pInfo = getLayoutInfo();
if (pInfo)
- aRet <<= sheet::DataPilotFieldLayoutInfo(*pInfo);
+ aRet <<= DataPilotFieldLayoutInfo(*pInfo);
}
else if ( aNameString.EqualsAscii( SC_UNONAME_HASREFERENCE ) )
aRet = ::cppu::bool2any(getReference() != NULL);
else if ( aNameString.EqualsAscii( SC_UNONAME_REFERENCE ) )
{
- const sheet::DataPilotFieldReference* pRef = getReference();
+ const DataPilotFieldReference* pRef = getReference();
if (pRef)
- aRet <<= sheet::DataPilotFieldReference(*pRef);
+ aRet <<= DataPilotFieldReference(*pRef);
}
else if ( aNameString.EqualsAscii( SC_UNONAME_HASSORTINFO ) )
aRet = ::cppu::bool2any(getSortInfo() != NULL);
else if ( aNameString.EqualsAscii( SC_UNONAME_SORTINFO ) )
{
- const sheet::DataPilotFieldSortInfo* pInfo = getSortInfo();
+ const DataPilotFieldSortInfo* pInfo = getSortInfo();
if (pInfo)
- aRet <<= sheet::DataPilotFieldSortInfo(*pInfo);
+ aRet <<= DataPilotFieldSortInfo(*pInfo);
}
else if ( aNameString.EqualsAscii( SC_UNONAME_ISGROUP ) )
aRet = ::cppu::bool2any(hasGroupInfo());
@@ -1798,546 +1813,495 @@ uno::Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const rtl::OUString& aP
// XDatePilotField
-uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotFieldObj::getItems()
- throw (uno::RuntimeException)
+Reference<XIndexAccess> SAL_CALL ScDataPilotFieldObj::getItems()
+ throw (RuntimeException)
{
- if (!xItems.is())
- xItems.set(new ScDataPilotItemsObj(pParent, aSourceIdent));
- return xItems;
+ ScUnoGuard aGuard;
+ if (!mxItems.is())
+ mxItems.set( new ScDataPilotItemsObj( mrParent, maFieldId ) );
+ return mxItems;
}
SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDataPilotFieldObj )
-sheet::DataPilotFieldOrientation ScDataPilotFieldObj::getOrientation(void) const
+DataPilotFieldOrientation ScDataPilotFieldObj::getOrientation() const
{
- sheet::DataPilotFieldOrientation eOrient = DATA_PILOT_HIDDEN;
-// TODO
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- eOrient = (sheet::DataPilotFieldOrientation)pDim->GetOrientation();
- }
-
- return eOrient;
+ ScUnoGuard aGuard;
+ ScDPSaveDimension* pDim = GetDPDimension();
+ return pDim ? static_cast< DataPilotFieldOrientation >( pDim->GetOrientation() ) : DataPilotFieldOrientation_HIDDEN;
}
-void ScDataPilotFieldObj::setOrientation(sheet::DataPilotFieldOrientation eNew)
+void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
{
- if ( eNew == nSourceType )
- return; // nix
+ ScUnoGuard aGuard;
+ if (maOrient.hasValue() && (eNew == maOrient.get< DataPilotFieldOrientation >()))
+ return;
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
+ ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+
+ /* If the field was taken from getDataPilotFields(), don't reset the
+ orientation for an existing use, but create a duplicated field
+ instead (for "Data" orientation only). */
+ if ( !maOrient.hasValue() && !maFieldId.mbDataLayout &&
+ (pDim->GetOrientation() != DataPilotFieldOrientation_HIDDEN) &&
+ (eNew == DataPilotFieldOrientation_DATA) )
{
- if ( nSourceType == SC_FIELDORIENT_ALL && pDim->GetOrientation() != DATA_PILOT_HIDDEN &&
- !aSourceIdent.bDataLayoutField && eNew == DATA_PILOT_DATA )
- {
- // If the field was taken from getDataPilotFields, don't reset the orientation
- // for an existing use, create a duplicated field instead (for "Data" orientation only)
- ScDPSaveDimension* pNewDim = NULL;
- ScDPSaveData* pSave = pDPObj->GetSaveData();
+ ScDPSaveDimension* pNewDim = 0;
- // look for existing duplicate with orientation "hidden"
+ // look for existing duplicate with orientation "hidden"
- String aNameStr( aSourceIdent.sFieldName );
- const List& rDimensions = pSave->GetDimensions();
- sal_Int32 nDimCount = rDimensions.Count();
- sal_Int32 nFound = 0;
- for ( sal_Int32 nDim = 0; nDim < nDimCount && !pNewDim; nDim++ )
+ String aNameStr( maFieldId.maFieldName );
+ const List& rDimensions = pSaveData->GetDimensions();
+ sal_Int32 nDimCount = rDimensions.Count();
+ sal_Int32 nFound = 0;
+ for ( sal_Int32 nDim = 0; nDim < nDimCount && !pNewDim; nDim++ )
+ {
+ ScDPSaveDimension* pOneDim = static_cast<ScDPSaveDimension*>(rDimensions.GetObject(nDim));
+ if ( !pOneDim->IsDataLayout() && (pOneDim->GetName() == aNameStr) )
{
- ScDPSaveDimension* pOneDim = static_cast<ScDPSaveDimension*>(rDimensions.GetObject(nDim));
- if ( !pOneDim->IsDataLayout() && pOneDim->GetName() == aNameStr )
- {
- if ( pOneDim->GetOrientation() == DATA_PILOT_HIDDEN )
- pNewDim = pOneDim; // use this one
- else
- ++nFound; // count existing non-hidden occurences
- }
+ if ( pOneDim->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
+ pNewDim = pOneDim; // use this one
+ else
+ ++nFound; // count existing non-hidden occurences
}
-
- if ( !pNewDim ) // if none found, create a new duplicated dimension
- pNewDim = &pSave->DuplicateDimension( *pDim );
-
- aSourceIdent.nRepeat = nFound; // keep accessing the new one
- pDim = pNewDim;
}
- pDim->SetOrientation(sal::static_int_cast<USHORT>(eNew));
- pParent->SetDPObject(pDPObj);
+ if ( !pNewDim ) // if none found, create a new duplicated dimension
+ pNewDim = &pSaveData->DuplicateDimension( *pDim );
- nSourceType = sal::static_int_cast<USHORT>(eNew); // modifying the same object's orientation again doesn't create another duplicate
+ maFieldId.mnFieldIdx = nFound; // keep accessing the new one
+ pDim = pNewDim;
}
+
+ pDim->SetOrientation(sal::static_int_cast<USHORT>(eNew));
+
+ // move changed field behind all other fields (make it the last field in dimension)
+ pSaveData->SetPosition( pDim, pSaveData->GetDimensions().Count() );
+
+ SetDPObject( pDPObj );
+
+ maOrient <<= eNew; // modifying the same object's orientation again doesn't create another duplicate
}
}
-sheet::GeneralFunction ScDataPilotFieldObj::getFunction(void) const
+GeneralFunction ScDataPilotFieldObj::getFunction() const
{
- sheet::GeneralFunction eRet = sheet::GeneralFunction_NONE;
-
-// TODO
+ ScUnoGuard aGuard;
+ GeneralFunction eRet = GeneralFunction_NONE;
+ if( ScDPSaveDimension* pDim = GetDPDimension() )
+ {
+ if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
+ {
+ // for non-data fields, property Function is the subtotals
+ long nSubCount = pDim->GetSubTotalsCount();
+ if ( nSubCount > 0 )
+ eRet = (GeneralFunction)pDim->GetSubTotalFunc(0); // always use the first one
+ // else keep NONE
+ }
+ else
+ eRet = (GeneralFunction)pDim->GetFunction();
+ }
+ return eRet;
+}
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+void ScDataPilotFieldObj::setFunction(GeneralFunction eNewFunc)
+{
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
+ if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
{
- if ( pDim->GetOrientation() != DATA_PILOT_DATA )
+ // for non-data fields, property Function is the subtotals
+ if ( eNewFunc == GeneralFunction_NONE )
+ pDim->SetSubTotals( 0, NULL );
+ else
{
- // for non-data fields, property Function is the subtotals
- long nSubCount = pDim->GetSubTotalsCount();
- if ( nSubCount > 0 )
- eRet = (sheet::GeneralFunction)pDim->GetSubTotalFunc(0); // always use the first one
- // else keep NONE
+ USHORT nFunc = sal::static_int_cast<USHORT>( eNewFunc );
+ pDim->SetSubTotals( 1, &nFunc );
}
- else
- eRet = (sheet::GeneralFunction)pDim->GetFunction();
}
+ else
+ pDim->SetFunction( sal::static_int_cast<USHORT>( eNewFunc ) );
+ SetDPObject( pDPObj );
}
+}
- return eRet;
+Sequence< GeneralFunction > ScDataPilotFieldObj::getSubtotals() const
+{
+ ScUnoGuard aGuard;
+ Sequence< GeneralFunction > aRet;
+ if( ScDPSaveDimension* pDim = GetDPDimension() )
+ {
+ if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
+ {
+ // for non-data fields, property Functions is the sequence of subtotals
+ sal_Int32 nCount = static_cast< sal_Int32 >( pDim->GetSubTotalsCount() );
+ if ( nCount > 0 )
+ {
+ aRet.realloc( nCount );
+ for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
+ aRet[ nIdx ] = (GeneralFunction)pDim->GetSubTotalFunc( nIdx );
+ }
+ }
+ }
+ return aRet;
}
-void ScDataPilotFieldObj::setFunction(sheet::GeneralFunction eNewFunc)
+void ScDataPilotFieldObj::setSubtotals( const Sequence< GeneralFunction >& rSubtotals )
{
-// TODO
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
+ if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
{
- if ( pDim->GetOrientation() != DATA_PILOT_DATA )
+ sal_Int32 nCount = rSubtotals.getLength();
+ if( nCount == 1 )
{
- // for non-data fields, property Function is the subtotals
- if ( eNewFunc == sheet::GeneralFunction_NONE )
+ // count 1: all values are allowed (including NONE and AUTO)
+ if( rSubtotals[ 0 ] == GeneralFunction_NONE )
pDim->SetSubTotals( 0, NULL );
else
{
- USHORT nFunc = sal::static_int_cast<USHORT>( eNewFunc );
+ USHORT nFunc = sal::static_int_cast<USHORT>( rSubtotals[ 0 ] );
pDim->SetSubTotals( 1, &nFunc );
}
}
- else
- pDim->SetFunction( sal::static_int_cast<USHORT>( eNewFunc ) );
- pParent->SetDPObject(pDPObj);
+ else if( nCount > 1 )
+ {
+ // set multiple functions, ignore NONE and AUTO in this case
+ ::std::vector< USHORT > aSubt;
+ for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
+ {
+ GeneralFunction eFunc = rSubtotals[ nIdx ];
+ if( (eFunc != GeneralFunction_NONE) && (eFunc != GeneralFunction_AUTO) )
+ {
+ // do not insert functions twice
+ USHORT nFunc = static_cast< USHORT >( eFunc );
+ if( ::std::find( aSubt.begin(), aSubt.end(), nFunc ) == aSubt.end() )
+ aSubt.push_back( nFunc );
+ }
+ }
+ // set values from vector to ScDPSaveDimension
+ if ( aSubt.empty() )
+ pDim->SetSubTotals( 0, NULL );
+ else
+ pDim->SetSubTotals( static_cast< long >( aSubt.size() ), &aSubt.front() );
+ }
}
+ SetDPObject( pDPObj );
}
}
-rtl::OUString ScDataPilotFieldObj::getCurrentPage() const
+OUString ScDataPilotFieldObj::getCurrentPage() const
{
- rtl::OUString sRet;
-
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- if (pDim->HasCurrentPage())
- sRet = pDim->GetCurrentPage();
- }
-
- return sRet;
+ ScUnoGuard aGuard;
+ ScDPSaveDimension* pDim = GetDPDimension();
+ if( pDim && pDim->HasCurrentPage() )
+ return pDim->GetCurrentPage();
+ return OUString();
}
-void ScDataPilotFieldObj::setCurrentPage(const rtl::OUString& sPage)
+void ScDataPilotFieldObj::setCurrentPage( const OUString& rPage )
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- String sCur(sPage);
- pDim->SetCurrentPage(&sCur);
- pParent->SetDPObject(pDPObj);
- }
+ String aPage( rPage );
+ pDim->SetCurrentPage( &aPage );
+ SetDPObject( pDPObj );
}
}
sal_Bool ScDataPilotFieldObj::getUseCurrentPage() const
{
- sal_Bool bRet = sal_False;
-
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- bRet = pDim->HasCurrentPage();
- }
-
- return bRet;
+ ScUnoGuard aGuard;
+ ScDPSaveDimension* pDim = GetDPDimension();
+ return pDim && pDim->HasCurrentPage();
}
-void ScDataPilotFieldObj::setUseCurrentPage(sal_Bool bUse)
+void ScDataPilotFieldObj::setUseCurrentPage( sal_Bool bUse )
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
+ if( bUse )
{
- if (bUse)
+ /* It is somehow useless to set the property "HasSelectedPage" to
+ true, because it is still needed to set an explicit page name. */
+ if( !pDim->HasCurrentPage() )
{
- String sCur;
- pDim->SetCurrentPage(&sCur);
+ String aPage;
+ pDim->SetCurrentPage( &aPage );
}
- else
- pDim->SetCurrentPage(NULL);
- pParent->SetDPObject(pDPObj);
}
+ else
+ pDim->SetCurrentPage( 0 );
+ SetDPObject( pDPObj );
}
}
-const sheet::DataPilotFieldAutoShowInfo* ScDataPilotFieldObj::getAutoShowInfo()
+const DataPilotFieldAutoShowInfo* ScDataPilotFieldObj::getAutoShowInfo()
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- return pDim->GetAutoShowInfo();
- }
- return NULL;
+ ScUnoGuard aGuard;
+ ScDPSaveDimension* pDim = GetDPDimension();
+ return pDim ? pDim->GetAutoShowInfo() : 0;
}
-void ScDataPilotFieldObj::setAutoShowInfo(const sheet::DataPilotFieldAutoShowInfo* pInfo)
+void ScDataPilotFieldObj::setAutoShowInfo( const DataPilotFieldAutoShowInfo* pInfo )
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- pDim->SetAutoShowInfo(pInfo);
- pParent->SetDPObject(pDPObj);
- }
+ pDim->SetAutoShowInfo( pInfo );
+ SetDPObject( pDPObj );
}
}
-const sheet::DataPilotFieldLayoutInfo* ScDataPilotFieldObj::getLayoutInfo()
+const DataPilotFieldLayoutInfo* ScDataPilotFieldObj::getLayoutInfo()
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- return pDim->GetLayoutInfo();
- }
-
- return NULL;
+ ScUnoGuard aGuard;
+ ScDPSaveDimension* pDim = GetDPDimension();
+ return pDim ? pDim->GetLayoutInfo() : 0;
}
-void ScDataPilotFieldObj::setLayoutInfo(const sheet::DataPilotFieldLayoutInfo* pInfo)
+void ScDataPilotFieldObj::setLayoutInfo( const DataPilotFieldLayoutInfo* pInfo )
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- pDim->SetLayoutInfo(pInfo);
- pParent->SetDPObject(pDPObj);
- }
+ pDim->SetLayoutInfo( pInfo );
+ SetDPObject( pDPObj );
}
}
-const sheet::DataPilotFieldReference* ScDataPilotFieldObj::getReference()
+const DataPilotFieldReference* ScDataPilotFieldObj::getReference()
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- return pDim->GetReferenceValue();
- }
-
- return NULL;
+ ScUnoGuard aGuard;
+ ScDPSaveDimension* pDim = GetDPDimension();
+ return pDim ? pDim->GetReferenceValue() : 0;
}
-void ScDataPilotFieldObj::setReference(const sheet::DataPilotFieldReference* pInfo)
+void ScDataPilotFieldObj::setReference( const DataPilotFieldReference* pInfo )
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- pDim->SetReferenceValue(pInfo);
- pParent->SetDPObject(pDPObj);
- }
+ pDim->SetReferenceValue( pInfo );
+ SetDPObject( pDPObj );
}
}
-const sheet::DataPilotFieldSortInfo* ScDataPilotFieldObj::getSortInfo()
+const DataPilotFieldSortInfo* ScDataPilotFieldObj::getSortInfo()
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- return pDim->GetSortInfo();
- }
-
- return NULL;
+ ScUnoGuard aGuard;
+ ScDPSaveDimension* pDim = GetDPDimension();
+ return pDim ? pDim->GetSortInfo() : 0;
}
-void ScDataPilotFieldObj::setSortInfo(const sheet::DataPilotFieldSortInfo* pInfo)
+void ScDataPilotFieldObj::setSortInfo( const DataPilotFieldSortInfo* pInfo )
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- pDim->SetSortInfo(pInfo);
- pParent->SetDPObject(pDPObj);
- }
+ pDim->SetSortInfo( pInfo );
+ SetDPObject( pDPObj );
}
}
sal_Bool ScDataPilotFieldObj::getShowEmpty() const
{
- sal_Bool bRet = sal_False;
-
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- bRet = pDim->GetShowEmpty();
- }
-
- return bRet;
+ ScUnoGuard aGuard;
+ ScDPSaveDimension* pDim = GetDPDimension();
+ return pDim && pDim->GetShowEmpty();
}
-void ScDataPilotFieldObj::setShowEmpty(sal_Bool bShow)
+void ScDataPilotFieldObj::setShowEmpty( sal_Bool bShow )
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- pDim->SetShowEmpty(bShow);
- pParent->SetDPObject(pDPObj);
- }
+ pDim->SetShowEmpty( bShow );
+ SetDPObject( pDPObj );
}
}
-void ScDataPilotFieldObj::SetGroupInfo(const ScDPNumGroupInfo& rGroupInfo,
- sheet::DataPilotFieldGroupInfo& rInfo)
+sal_Bool ScDataPilotFieldObj::hasGroupInfo()
{
- rInfo.HasDateValues = rGroupInfo.DateValues;
- rInfo.HasAutoStart = rGroupInfo.AutoStart;
- rInfo.Start = rGroupInfo.Start;
- rInfo.HasAutoEnd = rGroupInfo.AutoEnd;
- rInfo.End = rGroupInfo.End;
- rInfo.Step = rGroupInfo.Step;
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
+ if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() )
+ return pDimData->GetNamedGroupDim( pDim->GetName() ) || pDimData->GetNumGroupDim( pDim->GetName() );
+ return sal_False;
}
-void ScDataPilotFieldObj::FillGroupInfo(const ScDPSaveGroupDimension* pGroupDim,
- const ScDPSaveNumGroupDimension* pNumGroupDim, sheet::DataPilotFieldGroupInfo& rInfo)
+DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo()
{
- if (pGroupDim || pNumGroupDim)
+ ScUnoGuard aGuard;
+ DataPilotFieldGroupInfo aInfo;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- if (pGroupDim)
+ if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() )
{
- rInfo.GroupBy = pGroupDim->GetDatePart();
- if (pParent)
+ if( const ScDPSaveGroupDimension* pGroupDim = pDimData->GetNamedGroupDim( pDim->GetName() ) )
{
- uno::Reference<container::XNameAccess> xFields(pParent->getDataPilotFields(), uno::UNO_QUERY);
- if (xFields.is())
+ // grouped by ...
+ aInfo.GroupBy = pGroupDim->GetDatePart();
+
+ // find source field
+ try
{
- rInfo.SourceField.set(xFields->getByName(pGroupDim->GetSourceDimName()), uno::UNO_QUERY);
+ Reference< XNameAccess > xFields( mrParent.getDataPilotFields(), UNO_QUERY_THROW );
+ aInfo.SourceField.set( xFields->getByName( pGroupDim->GetSourceDimName() ), UNO_QUERY );
}
- }
- SetGroupInfo(pGroupDim->GetDateInfo(), rInfo);
- if (!pGroupDim->GetDatePart())
- {
- ScFieldGroups aGroups;
- sal_Int32 nCount = pGroupDim->GetGroupCount();
- for (sal_Int32 i = 0; i < nCount; ++i)
+ catch( Exception& )
{
- const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( i );
- if (pGroup)
+ }
+
+ ScDataPilotConversion::FillGroupInfo( aInfo, pGroupDim->GetDateInfo() );
+ if( pGroupDim->GetDatePart() == 0 )
+ {
+ // fill vector of group and group member information
+ ScFieldGroups aGroups;
+ for( sal_Int32 nIdx = 0, nCount = pGroupDim->GetGroupCount(); nIdx < nCount; ++nIdx )
{
- ScFieldGroup aGroup;
- aGroup.sName = pGroup->GetGroupName();
- sal_Int32 nElemCount = pGroup->GetElementCount();
- for(sal_Int32 j = 0; j < nElemCount; ++j)
+ if( const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( nIdx ) )
{
- const String* pElem = pGroup->GetElementByIndex( j );
- if (pElem)
- {
- aGroup.aMembers.push_back(*pElem);
- }
+ ScFieldGroup aGroup;
+ aGroup.maName = pGroup->GetGroupName();
+ for( sal_Int32 nMemIdx = 0, nMemCount = pGroup->GetElementCount(); nMemIdx < nMemCount; ++nMemIdx )
+ if( const String* pMem = pGroup->GetElementByIndex( nMemIdx ) )
+ aGroup.maMembers.push_back( *pMem );
+ aGroups.push_back( aGroup );
}
- aGroups.push_back(aGroup);
}
+ aInfo.Groups = new ScDataPilotFieldGroupsObj( aGroups );
}
- rInfo.Groups = new ScDataPilotFieldGroupsObj(aGroups);
- }
- }
- else
- {
- if (pNumGroupDim->GetDatePart())
- {
- rInfo.GroupBy = pNumGroupDim->GetDatePart();
- SetGroupInfo(pNumGroupDim->GetDateInfo(), rInfo);
- }
- else
- {
- SetGroupInfo(pNumGroupDim->GetInfo(), rInfo);
- }
- }
- }
-}
-
-sal_Bool ScDataPilotFieldObj::hasGroupInfo()
-{
- sal_Bool bRet = sal_False;
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- const ScDPSaveData* pDPSave = pDPObj->GetSaveData();
- const ScDPDimensionSaveData* pDimData = pDPSave->GetExistingDimensionData();
- if (pDimData)
- {
- bRet = (pDimData->GetNamedGroupDim(pDim->GetName()) || pDimData->GetNumGroupDim(pDim->GetName()));
}
- }
- }
- return bRet;
-}
-
-sheet::DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo()
-{
- sheet::DataPilotFieldGroupInfo aInfo;
-
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
- {
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- const ScDPSaveData* pDPSave = pDPObj->GetSaveData();
- const ScDPDimensionSaveData* pDimData = pDPSave->GetExistingDimensionData();
- if (pDimData)
+ else if( const ScDPSaveNumGroupDimension* pNumGroupDim = pDimData->GetNumGroupDim( pDim->GetName() ) )
{
- FillGroupInfo(pDimData->GetNamedGroupDim(pDim->GetName()),
- pDimData->GetNumGroupDim(pDim->GetName()), aInfo);
+ if (pNumGroupDim->GetDatePart())
+ {
+ ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetDateInfo() );
+ aInfo.GroupBy = pNumGroupDim->GetDatePart();
+ }
+ else
+ {
+ ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetInfo() );
+ }
}
}
}
-
return aInfo;
}
-void ScDataPilotFieldObj::setGroupInfo(const sheet::DataPilotFieldGroupInfo* pInfo)
+void ScDataPilotFieldObj::setGroupInfo( const DataPilotFieldGroupInfo* pInfo )
{
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScUnoGuard aGuard;
+ ScDPObject* pDPObj = 0;
+ if( /*ScDPSaveDimension* pDim =*/ GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetDim(pDPObj, aSourceIdent, pDim))
+ ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+ if( pInfo && lclCheckMinMaxStep( *pInfo ) )
{
- ScDPSaveData* pSaveData = pDPObj->GetSaveData();
- if (pInfo)
+ ScDPNumGroupInfo aInfo;
+ aInfo.Enable = sal_True;
+ aInfo.DateValues = pInfo->HasDateValues;
+ aInfo.AutoStart = pInfo->HasAutoStart;
+ aInfo.AutoEnd = pInfo->HasAutoEnd;
+ aInfo.Start = pInfo->Start;
+ aInfo.End = pInfo->End;
+ aInfo.Step = pInfo->Step;
+ Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY );
+ if( xNamed.is() )
{
- ScDPNumGroupInfo aInfo;
- aInfo.Enable = sal_True;
- aInfo.DateValues = pInfo->HasDateValues;
- aInfo.AutoStart = pInfo->HasAutoStart;
- aInfo.AutoEnd = pInfo->HasAutoEnd;
- aInfo.Start = pInfo->Start;
- aInfo.End = pInfo->End;
- aInfo.Step = pInfo->Step;
- uno::Reference<container::XNamed> xNamed(pInfo->SourceField, uno::UNO_QUERY);
- if (xNamed.is())
+ ScDPSaveGroupDimension aGroupDim( xNamed->getName(), getName() );
+ if( pInfo->GroupBy )
+ aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy);
+ else
{
- ScDPSaveGroupDimension aGroupDim(xNamed->getName(), getName());
- if (pInfo->GroupBy)
- aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy);
- else
+ Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY);
+ if (xIndex.is())
{
- uno::Reference<container::XIndexAccess> xIndex(pInfo->Groups, uno::UNO_QUERY);
- if (xIndex.is())
+ sal_Int32 nCount(xIndex->getCount());
+ for(sal_Int32 i = 0; i < nCount; i++)
{
- sal_Int32 nCount(xIndex->getCount());
- for(sal_Int32 i = 0; i < nCount; i++)
+ Reference<XNamed> xGroupNamed(xIndex->getByIndex(i), UNO_QUERY);
+ if (xGroupNamed.is())
{
- uno::Reference<container::XNamed> xGroupNamed(xIndex->getByIndex(i), uno::UNO_QUERY);
- if (xGroupNamed.is())
+ ScDPSaveGroupItem aItem(xGroupNamed->getName());
+ Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY);
+ if (xGroupIndex.is())
{
- ScDPSaveGroupItem aItem(xGroupNamed->getName());
- uno::Reference<container::XIndexAccess> xGroupIndex(xGroupNamed, uno::UNO_QUERY);
- if (xGroupIndex.is())
+ sal_Int32 nItemCount(xGroupIndex->getCount());
+ for (sal_Int32 j = 0; j < nItemCount; ++j)
{
- sal_Int32 nItemCount(xGroupIndex->getCount());
- for (sal_Int32 j = 0; j < nItemCount; ++j)
- {
- uno::Reference<container::XNamed> xItemNamed(xGroupIndex->getByIndex(j), uno::UNO_QUERY);
- if (xItemNamed.is())
- aItem.AddElement(xItemNamed->getName());
- }
+ Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY);
+ if (xItemNamed.is())
+ aItem.AddElement(xItemNamed->getName());
}
- aGroupDim.AddGroupItem(aItem);
}
+ aGroupDim.AddGroupItem(aItem);
}
}
}
- ScDPDimensionSaveData aDimSaveData;
-
- aDimSaveData.AddGroupDimension(aGroupDim);
- pSaveData->SetDimensionData(&aDimSaveData);
}
- else //NumGroup
- {
- ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData(); // created if not there
- ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() );
- if ( pExisting )
- {
- if (pInfo->GroupBy)
- pExisting->SetDateInfo(aInfo, pInfo->GroupBy);
- // modify existing group dimension
- pExisting->SetGroupInfo( aInfo );
- }
- else
- {
- // create new group dimension
- ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo );
- if (pInfo->GroupBy)
- aNumGroupDim.SetDateInfo(aInfo, pInfo->GroupBy);
- pDimData->AddNumGroupDimension( aNumGroupDim );
- }
-
-// pSaveData->SetDimensionData(pDimData); not neccessary
- }
+ // get dimension savedata or create new if none
+ ScDPDimensionSaveData& rDimSaveData = *pSaveData->GetDimensionData();
+ rDimSaveData.ReplaceGroupDimension( aGroupDim );
}
- else
+ else // no source field in group info -> numeric group
{
- pSaveData->SetDimensionData(NULL);
+ ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData(); // created if not there
+
+ ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() );
+ if ( pExisting )
+ {
+ if (pInfo->GroupBy)
+ pExisting->SetDateInfo(aInfo, pInfo->GroupBy);
+ // modify existing group dimension
+ pExisting->SetGroupInfo( aInfo );
+ }
+ else if (pInfo->GroupBy)
+ {
+ // create new group dimension
+ ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo, pInfo->GroupBy );
+ pDimData->AddNumGroupDimension( aNumGroupDim );
+ }
+ else
+ {
+ // create new group dimension
+ ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo );
+ pDimData->AddNumGroupDimension( aNumGroupDim );
+ }
}
- pDPObj->SetSaveData(*pSaveData);
- pParent->SetDPObject(pDPObj);
}
+ else // null passed as argument
+ {
+ pSaveData->SetDimensionData( 0 );
+ }
+
+ pDPObj->SetSaveData( *pSaveData );
+ SetDPObject( pDPObj );
}
}
-sal_Bool ScDataPilotFieldObj::HasString(const uno::Sequence< ::rtl::OUString >& rItems, const rtl::OUString& aString)
+sal_Bool ScDataPilotFieldObj::HasString(const Sequence< OUString >& rItems, const OUString& aString)
{
sal_Bool bRet = sal_False;
@@ -2353,311 +2317,330 @@ sal_Bool ScDataPilotFieldObj::HasString(const uno::Sequence< ::rtl::OUString >&
}
// XDataPilotFieldGrouping
-uno::Reference < sheet::XDataPilotField > SAL_CALL
- ScDataPilotFieldObj::createNameGroup(const uno::Sequence< rtl::OUString >& rItems)
- throw (::com::sun::star::uno::RuntimeException, lang::IllegalArgumentException)
+Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( const Sequence< OUString >& rItems )
+ throw (RuntimeException, IllegalArgumentException)
{
ScUnoGuard aGuard;
- uno::Reference < sheet::XDataPilotField > xRet;
- rtl::OUString sNewDim;
+ Reference< XDataPilotField > xRet;
+ OUString sNewDim;
- if (!rItems.getLength())
- throw lang::IllegalArgumentException();
+ if( !rItems.hasElements() )
+ throw IllegalArgumentException();
- ScDPObject* pDPObj(pParent->GetDPObject());
- if ( pDPObj )
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- ScDPSaveDimension* pDim = NULL;
- if ( rItems.getLength() > 0 && lcl_GetDim(pDPObj, aSourceIdent, pDim))
- {
- String aDimName (pDim->GetName());
+ String aDimName = pDim->GetName();
- ScDPSaveData aSaveData(*pDPObj->GetSaveData());
- ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData(); // created if not there
+ ScDPSaveData aSaveData = *pDPObj->GetSaveData();
+ ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData(); // created if not there
- // find original base
- String aBaseDimName( aDimName );
- const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName );
- if ( pBaseGroupDim )
- {
- // any entry's SourceDimName is the original base
- aBaseDimName = pBaseGroupDim->GetSourceDimName();
- }
+ // find original base
+ String aBaseDimName( aDimName );
+ const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName );
+ if ( pBaseGroupDim )
+ {
+ // any entry's SourceDimName is the original base
+ aBaseDimName = pBaseGroupDim->GetSourceDimName();
+ }
- // find existing group dimension
- // (using the selected dim, can be intermediate group dim)
- ScDPSaveGroupDimension* pGroupDimension = pDimData->GetGroupDimAccForBase( aDimName );
+ // find existing group dimension
+ // (using the selected dim, can be intermediate group dim)
+ ScDPSaveGroupDimension* pGroupDimension = pDimData->GetGroupDimAccForBase( aDimName );
- // remove the selected items from their groups
- // (empty groups are removed, too)
- sal_Int32 nEntryCount = rItems.getLength();
- sal_Int32 nEntry;
- if ( pGroupDimension )
+ // remove the selected items from their groups
+ // (empty groups are removed, too)
+ sal_Int32 nEntryCount = rItems.getLength();
+ sal_Int32 nEntry;
+ if ( pGroupDimension )
+ {
+ for (nEntry=0; nEntry<nEntryCount; nEntry++)
{
- for (nEntry=0; nEntry<nEntryCount; nEntry++)
+ String aEntryName(rItems[nEntry]);
+ if ( pBaseGroupDim )
{
- String aEntryName(rItems[nEntry]);
- if ( pBaseGroupDim )
- {
- // for each selected (intermediate) group, remove all its items
- // (same logic as for adding, below)
- const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
- if ( pBaseGroup )
- pBaseGroup->RemoveElementsFromGroups( *pGroupDimension ); // remove all elements
- else
- pGroupDimension->RemoveFromGroups( aEntryName );
- }
+ // for each selected (intermediate) group, remove all its items
+ // (same logic as for adding, below)
+ const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
+ if ( pBaseGroup )
+ pBaseGroup->RemoveElementsFromGroups( *pGroupDimension ); // remove all elements
else
pGroupDimension->RemoveFromGroups( aEntryName );
}
+ else
+ pGroupDimension->RemoveFromGroups( aEntryName );
}
+ }
- ScDPSaveGroupDimension* pNewGroupDim = NULL;
- if ( !pGroupDimension )
- {
- // create a new group dimension
- String aGroupDimName = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, NULL );
- pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, aGroupDimName );
- sNewDim = aGroupDimName;
+ ScDPSaveGroupDimension* pNewGroupDim = 0;
+ if ( !pGroupDimension )
+ {
+ // create a new group dimension
+ String aGroupDimName = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, NULL );
+ pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, aGroupDimName );
+ sNewDim = aGroupDimName;
- pGroupDimension = pNewGroupDim; // make changes to the new dim if none existed
+ pGroupDimension = pNewGroupDim; // make changes to the new dim if none existed
- if ( pBaseGroupDim )
+ if ( pBaseGroupDim )
+ {
+ // If it's a higher-order group dimension, pre-allocate groups for all
+ // non-selected original groups, so the individual base members aren't
+ // used for automatic groups (this would make the original groups hard
+ // to find).
+ //! Also do this when removing groups?
+ //! Handle this case dynamically with automatic groups?
+
+ long nGroupCount = pBaseGroupDim->GetGroupCount();
+ for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ )
{
- // If it's a higher-order group dimension, pre-allocate groups for all
- // non-selected original groups, so the individual base members aren't
- // used for automatic groups (this would make the original groups hard
- // to find).
- //! Also do this when removing groups?
- //! Handle this case dynamically with automatic groups?
-
- long nGroupCount = pBaseGroupDim->GetGroupCount();
- for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ )
- {
- const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
+ const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
- StrData aStrData( pBaseGroup->GetGroupName() );
- if ( !HasString(rItems, aStrData.GetString()) ) //! ignore case?
- {
- // add an additional group for each item that is not in the selection
- ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() );
- aGroup.AddElementsFromGroup( *pBaseGroup );
- pGroupDimension->AddGroupItem( aGroup );
- }
+ StrData aStrData( pBaseGroup->GetGroupName() );
+ if ( !HasString(rItems, aStrData.GetString()) ) //! ignore case?
+ {
+ // add an additional group for each item that is not in the selection
+ ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() );
+ aGroup.AddElementsFromGroup( *pBaseGroup );
+ pGroupDimension->AddGroupItem( aGroup );
}
}
}
- String aGroupDimName = pGroupDimension->GetGroupDimName();
+ }
+ String aGroupDimName = pGroupDimension->GetGroupDimName();
+
+ //! localized prefix string
+ String aGroupName = pGroupDimension->CreateGroupName( String( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) );
+ ScDPSaveGroupItem aGroup( aGroupName );
+ Reference< XNameAccess > xMembers = GetMembers();
+ if (!xMembers.is())
+ {
+ delete pNewGroupDim;
+ throw RuntimeException();
+ }
+
+ for (nEntry=0; nEntry<nEntryCount; nEntry++)
+ {
+ String aEntryName(rItems[nEntry]);
- //! localized prefix string
- String aGroupName = pGroupDimension->CreateGroupName( String::CreateFromAscii("Group") );
- ScDPSaveGroupItem aGroup( aGroupName );
- uno::Reference<container::XNameAccess> xMembers;
- if (!lcl_GetMembers(pParent, aSourceIdent, xMembers))
+ if (!xMembers->hasByName(aEntryName))
{
delete pNewGroupDim;
- throw uno::RuntimeException();
+ throw IllegalArgumentException();
}
- for (nEntry=0; nEntry<nEntryCount; nEntry++)
+ if ( pBaseGroupDim )
{
- String aEntryName(rItems[nEntry]);
-
- if (!xMembers->hasByName(aEntryName))
- {
- delete pNewGroupDim;
- throw lang::IllegalArgumentException();
- }
-
- if ( pBaseGroupDim )
- {
- // for each selected (intermediate) group, add all its items
- const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
- if ( pBaseGroup )
- aGroup.AddElementsFromGroup( *pBaseGroup );
- else
- aGroup.AddElement( aEntryName ); // no group found -> automatic group, add the item itself
- }
+ // for each selected (intermediate) group, add all its items
+ const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName );
+ if ( pBaseGroup )
+ aGroup.AddElementsFromGroup( *pBaseGroup );
else
- aGroup.AddElement( aEntryName ); // no group dimension, add all items directly
+ aGroup.AddElement( aEntryName ); // no group found -> automatic group, add the item itself
}
+ else
+ aGroup.AddElement( aEntryName ); // no group dimension, add all items directly
+ }
- pGroupDimension->AddGroupItem( aGroup );
-
- if ( pNewGroupDim )
- {
- pDimData->AddGroupDimension( *pNewGroupDim );
- delete pNewGroupDim; // AddGroupDimension copies the object
- // don't access pGroupDimension after here
- }
- pGroupDimension = pNewGroupDim = NULL;
+ pGroupDimension->AddGroupItem( aGroup );
- // set orientation
- ScDPSaveDimension* pSaveDimension = aSaveData.GetDimensionByName( aGroupDimName );
- if ( pSaveDimension->GetOrientation() == sheet::DataPilotFieldOrientation_HIDDEN )
- {
- ScDPSaveDimension* pOldDimension = aSaveData.GetDimensionByName( aDimName );
- pSaveDimension->SetOrientation( pOldDimension->GetOrientation() );
- long nPosition = 0; //! before (immediate) base
- aSaveData.SetPosition( pSaveDimension, nPosition );
- }
+ if ( pNewGroupDim )
+ {
+ pDimData->AddGroupDimension( *pNewGroupDim );
+ delete pNewGroupDim; // AddGroupDimension copies the object
+ // don't access pGroupDimension after here
+ }
+ pGroupDimension = pNewGroupDim = NULL;
- // apply changes
- pDPObj->SetSaveData( aSaveData );
- pParent->SetDPObject(pDPObj);
+ // set orientation
+ ScDPSaveDimension* pSaveDimension = aSaveData.GetDimensionByName( aGroupDimName );
+ if ( pSaveDimension->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
+ {
+ ScDPSaveDimension* pOldDimension = aSaveData.GetDimensionByName( aDimName );
+ pSaveDimension->SetOrientation( pOldDimension->GetOrientation() );
+ long nPosition = 0; //! before (immediate) base
+ aSaveData.SetPosition( pSaveDimension, nPosition );
}
+
+ // apply changes
+ pDPObj->SetSaveData( aSaveData );
+ SetDPObject( pDPObj );
}
- if (sNewDim.getLength())
+ // if new grouping field has been created (on first group), return it
+ if( sNewDim.getLength() > 0 )
{
- uno::Reference< container::XNameAccess > xFields(pParent->getDataPilotFields(), uno::UNO_QUERY);
+ Reference< XNameAccess > xFields(mrParent.getDataPilotFields(), UNO_QUERY);
if (xFields.is())
{
- xRet.set(xFields->getByName(sNewDim), uno::UNO_QUERY);
+ xRet.set(xFields->getByName(sNewDim), UNO_QUERY);
DBG_ASSERT(xRet.is(), "there is a name, so there should be also a field");
}
}
-
return xRet;
}
-String lcl_GetDateByName( sal_Int32 nGroupBy )
-{
- String aRet; //! globstr-ID
- switch (nGroupBy)
- {
- //! use translated strings from globstr.src
- case com::sun::star::sheet::DataPilotFieldGroupBy::SECONDS: aRet = String::CreateFromAscii("Seconds"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::MINUTES: aRet = String::CreateFromAscii("Minutes"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::HOURS: aRet = String::CreateFromAscii("Hours"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::DAYS: aRet = String::CreateFromAscii("Days"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS: aRet = String::CreateFromAscii("Months"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::QUARTERS: aRet = String::CreateFromAscii("Quarters"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::YEARS: aRet = String::CreateFromAscii("Years"); break;
- default:
- DBG_ERROR("invalid date part");
- }
- return aRet;
-}
-
-uno::Reference < sheet::XDataPilotField > SAL_CALL
- ScDataPilotFieldObj::createDateGroup(const sheet::DataPilotFieldGroupInfo& rInfo)
- throw (::com::sun::star::uno::RuntimeException, lang::IllegalArgumentException)
+Reference < XDataPilotField > SAL_CALL ScDataPilotFieldObj::createDateGroup( const DataPilotFieldGroupInfo& rInfo )
+ throw (RuntimeException, IllegalArgumentException)
{
ScUnoGuard aGuard;
+ using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
- if (!rInfo.HasDateValues)
- throw lang::IllegalArgumentException();
-
- uno::Reference < sheet::XDataPilotField > xRet;
+ // check min/max/step, HasDateValues must be set always
+ if( !rInfo.HasDateValues || !lclCheckMinMaxStep( rInfo ) )
+ throw IllegalArgumentException();
+ // only a single date flag is allowed
+ if( (rInfo.GroupBy == 0) || (rInfo.GroupBy > YEARS) || ((rInfo.GroupBy & (rInfo.GroupBy - 1)) != 0) )
+ throw IllegalArgumentException();
+ // step must be zero, if something else than DAYS is specified
+ if( rInfo.Step >= ((rInfo.GroupBy == DAYS) ? 32768.0 : 1.0) )
+ throw IllegalArgumentException();
- ScDPObject* pDPObj(pParent->GetDPObject());
- if ( pDPObj )
- {
- ScDPSaveDimension* pDim = NULL;
- if ( lcl_GetDim(pDPObj, aSourceIdent, pDim))
+ String aGroupDimName;
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
+ {
+ ScDPNumGroupInfo aInfo;
+ aInfo.Enable = sal_True;
+ aInfo.DateValues = (rInfo.GroupBy == DAYS) && (rInfo.Step >= 1.0);
+ aInfo.AutoStart = rInfo.HasAutoStart;
+ aInfo.AutoEnd = rInfo.HasAutoEnd;
+ aInfo.Start = rInfo.Start;
+ aInfo.End = rInfo.End;
+ aInfo.Step = static_cast< sal_Int32 >( rInfo.Step );
+
+ // create a local copy of the entire save data (will be written back below)
+ ScDPSaveData aSaveData = *pDPObj->GetSaveData();
+ // get or create dimension save data
+ ScDPDimensionSaveData& rDimData = *aSaveData.GetDimensionData();
+
+ // find source dimension name
+ const String& rDimName = pDim->GetName();
+ const ScDPSaveGroupDimension* pGroupDim = rDimData.GetNamedGroupDim( rDimName );
+ String aSrcDimName = pGroupDim ? pGroupDim->GetSourceDimName() : rDimName;
+
+ // find a group dimension for the base field, or get numeric grouping
+ pGroupDim = rDimData.GetFirstNamedGroupDim( aSrcDimName );
+ const ScDPSaveNumGroupDimension* pNumGroupDim = rDimData.GetNumGroupDim( aSrcDimName );
+
+ // do not group by dates, if named groups or numeric grouping is present
+ bool bHasNamedGrouping = pGroupDim && !pGroupDim->GetDateInfo().Enable;
+ bool bHasNumGrouping = pNumGroupDim && pNumGroupDim->GetInfo().Enable && !pNumGroupDim->GetInfo().DateValues && !pNumGroupDim->GetDateInfo().Enable;
+ if( bHasNamedGrouping || bHasNumGrouping )
+ throw IllegalArgumentException();
+
+ if( aInfo.DateValues ) // create day ranges grouping
{
- ScDPNumGroupInfo aInfo;
- aInfo.DateValues = rInfo.HasDateValues;
- aInfo.AutoStart = rInfo.HasAutoStart;
- aInfo.Start = rInfo.Start;
- aInfo.AutoEnd = rInfo.HasAutoEnd;
- aInfo.End = rInfo.End;
- aInfo.Step = rInfo.Step;
-
- String aDimName (pDim->GetName());
-
- ScDPSaveData aData( *pDPObj->GetSaveData() );
- ScDPDimensionSaveData* pDimData = aData.GetDimensionData(); // created if not there
-
- // find original base
- String aBaseDimName( aDimName );
- const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName );
- if ( pBaseGroupDim )
+ // first remove all named group dimensions
+ while( pGroupDim )
{
- // any entry's SourceDimName is the original base
- aBaseDimName = pBaseGroupDim->GetSourceDimName();
+ String aGroupDimName2 = pGroupDim->GetGroupDimName();
+ // find next group dimension before deleting this group
+ pGroupDim = rDimData.GetNextNamedGroupDim( aGroupDimName2 );
+ // remove from dimension save data
+ rDimData.RemoveGroupDimension( aGroupDimName2 );
+ // also remove save data settings for the dimension that no longer exists
+ aSaveData.RemoveDimensionByName( aGroupDimName2 );
}
-
- if ( rInfo.GroupBy )
+ // create or replace the number grouping dimension
+ ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo );
+ rDimData.ReplaceNumGroupDimension( aNumGroupDim );
+ }
+ else // create date grouping
+ {
+ // collect all existing date flags
+ sal_Int32 nDateParts = rDimData.CollectDateParts( aSrcDimName );
+ if( nDateParts == 0 )
{
- // create date group dimensions
-
- sal_Bool bFirst(sal_False);
- if (!pBaseGroupDim) // it's the base Dim
+ // insert numeric group dimension, if no date groups exist yet (or replace day range grouping)
+ ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo, rInfo.GroupBy );
+ rDimData.ReplaceNumGroupDimension( aNumGroupDim );
+ }
+ else if( (nDateParts & rInfo.GroupBy) == 0 ) // do nothing if date field exists already
+ {
+ // create new named group dimension for additional date groups
+ aGroupDimName = rDimData.CreateDateGroupDimName( rInfo.GroupBy, *pDPObj, true, 0 );
+ ScDPSaveGroupDimension aGroupDim( aSrcDimName, aGroupDimName, aInfo, rInfo.GroupBy );
+ rDimData.AddGroupDimension( aGroupDim );
+
+ // set orientation of new named group dimension
+ ScDPSaveDimension& rSaveDim = *aSaveData.GetDimensionByName( aGroupDimName );
+ if( rSaveDim.GetOrientation() == DataPilotFieldOrientation_HIDDEN )
{
- // test whether there is already grouping
- const ScDPSaveNumGroupDimension* pNumGroupDim = pDimData->GetNumGroupDim(pDim->GetName());
- if (pNumGroupDim)
- {
- if (!pNumGroupDim->GetDateInfo().DateValues)
- bFirst = sal_True;
- }
- else
- bFirst = sal_True;
+ ScDPSaveDimension& rOldDim = *aSaveData.GetDimensionByName( aSrcDimName );
+ rSaveDim.SetOrientation( rOldDim.GetOrientation() );
+ aSaveData.SetPosition( &rSaveDim, 0 ); //! before (immediate) base
}
+ }
+ }
- ScDPNumGroupInfo aEmpty;
- if ( bFirst )
- {
- // innermost part: create NumGroupDimension (replacing original values)
- // Dimension name is left unchanged
+ // apply changes
+ pDPObj->SetSaveData( aSaveData );
+ SetDPObject( pDPObj );
+ }
- if ( rInfo.GroupBy == com::sun::star::sheet::DataPilotFieldGroupBy::DAYS && rInfo.Step != 0.0 )
- {
- // only days, and a step value specified: use numerical grouping
- // with DateValues flag, not date grouping
+ // return the UNO object of the new dimension, after writing back saved data
+ Reference< XDataPilotField > xRet;
+ if( aGroupDimName.Len() > 0 ) try
+ {
+ Reference< XNameAccess > xFields( mrParent.getDataPilotFields(), UNO_QUERY_THROW );
+ xRet.set( xFields->getByName( aGroupDimName ), UNO_QUERY );
+ }
+ catch( Exception& )
+ {
+ }
+ return xRet;
+}
- ScDPNumGroupInfo aNumInfo( aInfo );
- aNumInfo.DateValues = sal_True;
+// ============================================================================
- ScDPSaveNumGroupDimension aNumGroupDim( aBaseDimName, aNumInfo );
- pDimData->AddNumGroupDimension( aNumGroupDim );
- }
- else
- {
- ScDPSaveNumGroupDimension aNumGroupDim( aBaseDimName, aEmpty );
- aNumGroupDim.SetDateInfo( aInfo, rInfo.GroupBy );
- pDimData->AddNumGroupDimension( aNumGroupDim );
- }
- }
- else
- {
- // additional parts: create GroupDimension (shown as additional dimensions)
+namespace {
- String aPartName = lcl_GetDateByName( rInfo.GroupBy );
+bool lclExtractGroupMembers( ScFieldGroupMembers& rMembers, const Any& rElement )
+{
+ // allow empty value to create a new group
+ if( !rElement.hasValue() )
+ return true;
- String aGroupDimName = pDimData->CreateGroupDimName(
- aPartName, *pDPObj, true, NULL );
- ScDPSaveGroupDimension aGroupDim( aBaseDimName, aGroupDimName );
- aGroupDim.SetDateInfo( aInfo, rInfo.GroupBy );
- pDimData->AddGroupDimension( aGroupDim );
+ // try to extract a simple sequence of strings
+ Sequence< OUString > aSeq;
+ if( rElement >>= aSeq )
+ {
+ if( aSeq.hasElements() )
+ rMembers.insert( rMembers.end(), aSeq.getConstArray(), aSeq.getConstArray() + aSeq.getLength() );
+ return true;
+ }
- // set orientation
- ScDPSaveDimension* pSaveDimension = aData.GetDimensionByName( aGroupDimName );
- if ( pSaveDimension->GetOrientation() == sheet::DataPilotFieldOrientation_HIDDEN )
- {
- ScDPSaveDimension* pOldDimension = aData.GetDimensionByName( aBaseDimName );
- pSaveDimension->SetOrientation( pOldDimension->GetOrientation() );
- long nPosition = 0; //! before (immediate) base
- aData.SetPosition( pSaveDimension, nPosition );
- }
- }
+ // try to use XIndexAccess providing objects that support XNamed
+ Reference< XIndexAccess > xItemsIA( rElement, UNO_QUERY );
+ if( xItemsIA.is() )
+ {
+ for( sal_Int32 nIdx = 0, nCount = xItemsIA->getCount(); nIdx < nCount; ++nIdx )
+ {
+ try // getByIndex() should not throw, but we cannot be sure
+ {
+ Reference< XNamed > xItemName( xItemsIA->getByIndex( nIdx ), UNO_QUERY_THROW );
+ rMembers.push_back( xItemName->getName() );
+ }
+ catch( Exception& )
+ {
+ // ignore exceptions, go ahead with next element in the array
}
-
- // apply changes
- pDPObj->SetSaveData( aData );
- pParent->SetDPObject(pDPObj);
}
+ return true;
}
- return xRet;
+ // nothing valid inside the Any -> return false
+ return false;
}
-//------------------------------------------------------------------------
-ScDataPilotFieldGroupsObj::ScDataPilotFieldGroupsObj(const ScFieldGroups& rGroups) :
- aGroups(rGroups)
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+ScDataPilotFieldGroupsObj::ScDataPilotFieldGroupsObj( const ScFieldGroups& rGroups ) :
+ maGroups( rGroups )
{
}
@@ -2667,637 +2650,486 @@ ScDataPilotFieldGroupsObj::~ScDataPilotFieldGroupsObj()
// XNameAccess
-uno::Any SAL_CALL ScDataPilotFieldGroupsObj::getByName( const rtl::OUString& aName )
- throw(container::NoSuchElementException,
- lang::WrappedTargetException, uno::RuntimeException)
+Any SAL_CALL ScDataPilotFieldGroupsObj::getByName( const OUString& rName )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
-
- ScFieldGroups::const_iterator aItr(aGroups.begin());
- ScFieldGroups::const_iterator aEndItr(aGroups.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (aItr->sName == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
- if (bFound)
- return uno::makeAny(uno::Reference < container::XNameAccess > (new ScDataPilotFieldGroupObj(*aItr)));
- else
- throw container::NoSuchElementException();
-
-// return uno::Any();
+ if( implFindByName( rName ) == maGroups.end() )
+ throw NoSuchElementException();
+ return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, rName ) ) );
}
-uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotFieldGroupsObj::getElementNames()
- throw(uno::RuntimeException)
+Sequence< OUString > SAL_CALL ScDataPilotFieldGroupsObj::getElementNames() throw(RuntimeException)
{
ScUnoGuard aGuard;
-// TODO
-
- uno::Sequence<rtl::OUString> aSeq(aGroups.size());
- ScFieldGroups::const_iterator aItr(aGroups.begin());
- ScFieldGroups::const_iterator aEndItr(aGroups.end());
- sal_Int32 i(0);
- while (aItr != aEndItr)
+ Sequence< OUString > aSeq;
+ if( !maGroups.empty() )
{
- aSeq[i] = aItr->sName;
- ++aItr;
- ++i;
+ aSeq.realloc( static_cast< sal_Int32 >( maGroups.size() ) );
+ OUString* pName = aSeq.getArray();
+ for( ScFieldGroups::iterator aIt = maGroups.begin(), aEnd = maGroups.end(); aIt != aEnd; ++aIt, ++pName )
+ *pName = aIt->maName;
}
return aSeq;
}
-sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasByName( const rtl::OUString& aName )
- throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasByName( const OUString& rName ) throw(RuntimeException)
{
ScUnoGuard aGuard;
-
- ScFieldGroups::const_iterator aItr(aGroups.begin());
- ScFieldGroups::const_iterator aEndItr(aGroups.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (aItr->sName == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
-
- return bFound;
+ return implFindByName( rName ) != maGroups.end();
}
// XNameReplace
-void SAL_CALL ScDataPilotFieldGroupsObj::replaceByName( const ::rtl::OUString& aName,
- const uno::Any& aElement )
- throw (lang::IllegalArgumentException,
- container::NoSuchElementException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+
+void SAL_CALL ScDataPilotFieldGroupsObj::replaceByName( const OUString& rName, const Any& rElement )
+ throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- ScFieldGroups::iterator aItr(aGroups.begin());
- ScFieldGroups::iterator aEndItr(aGroups.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (aItr->sName == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
- if (bFound)
- {
- uno::Reference<container::XNamed> xNamed(aElement, uno::UNO_QUERY);
- if (xNamed.is())
- {
- ScFieldGroup aGroup;
- aGroup.sName = xNamed->getName();
- uno::Reference<container::XIndexAccess> xIndex(xNamed, uno::UNO_QUERY);
- if (xIndex.is())
- {
- sal_Int32 nCount(xIndex->getCount());
- for (sal_Int32 i = 0; i < nCount; ++i)
- {
- uno::Reference<container::XNamed> xItem(xIndex->getByIndex(i), uno::UNO_QUERY);
- if (xItem.is())
- aGroup.aMembers.push_back(xNamed->getName());
- else
- throw lang::IllegalArgumentException();
- }
- }
- else
- throw lang::IllegalArgumentException();
+ if( rName.getLength() == 0 )
+ throw IllegalArgumentException();
- aGroups.erase(aItr);
- aGroups.push_back(aGroup);
- }
- else
- throw lang::IllegalArgumentException();
- }
- else
- throw container::NoSuchElementException();
+ ScFieldGroups::iterator aIt = implFindByName( rName );
+ if( aIt == maGroups.end() )
+ throw NoSuchElementException();
+
+ // read all item names provided by the passed object
+ ScFieldGroupMembers aMembers;
+ if( !lclExtractGroupMembers( aMembers, rElement ) )
+ throw IllegalArgumentException();
+
+ // copy and forget, faster than vector assignment
+ aIt->maMembers.swap( aMembers );
}
// XNameContainer
-void SAL_CALL ScDataPilotFieldGroupsObj::insertByName( const ::rtl::OUString& aName,
- const uno::Any& aElement )
- throw (lang::IllegalArgumentException,
- container::ElementExistException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+
+void SAL_CALL ScDataPilotFieldGroupsObj::insertByName( const OUString& rName, const Any& rElement )
+ throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- ScFieldGroups::const_iterator aItr(aGroups.begin());
- ScFieldGroups::const_iterator aEndItr(aGroups.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (aItr->sName == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
- if (!bFound)
- {
- uno::Reference<container::XNamed> xNamed(aElement, uno::UNO_QUERY);
- if (xNamed.is())
- {
- ScFieldGroup aGroup;
- aGroup.sName = xNamed->getName();
- uno::Reference<container::XIndexAccess> xIndex(xNamed, uno::UNO_QUERY);
- if (xIndex.is())
- {
- sal_Int32 nCount(xIndex->getCount());
- for (sal_Int32 i = 0; i < nCount; ++i)
- {
- uno::Reference<container::XNamed> xItem(xIndex->getByIndex(i), uno::UNO_QUERY);
- if (xItem.is())
- aGroup.aMembers.push_back(xNamed->getName());
- else
- throw lang::IllegalArgumentException();
- }
- }
- else
- throw lang::IllegalArgumentException();
+ if( rName.getLength() == 0 )
+ throw IllegalArgumentException();
- aGroups.push_back(aGroup);
- }
- else
- throw lang::IllegalArgumentException();
- }
- else
- throw container::ElementExistException();
+ ScFieldGroups::iterator aIt = implFindByName( rName );
+ if( aIt != maGroups.end() )
+ throw ElementExistException();
+
+ // read all item names provided by the passed object
+ ScFieldGroupMembers aMembers;
+ if( !lclExtractGroupMembers( aMembers, rElement ) )
+ throw IllegalArgumentException();
+
+ // create the new entry if no error has been occured
+ maGroups.resize( maGroups.size() + 1 );
+ ScFieldGroup& rGroup = maGroups.back();
+ rGroup.maName = rName;
+ rGroup.maMembers.swap( aMembers );
}
-void SAL_CALL ScDataPilotFieldGroupsObj::removeByName( const ::rtl::OUString& aName )
- throw (container::NoSuchElementException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL ScDataPilotFieldGroupsObj::removeByName( const OUString& rName )
+ throw (NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- ScFieldGroups::iterator aItr(aGroups.begin());
- ScFieldGroups::iterator aEndItr(aGroups.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (aItr->sName == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
- if (bFound)
- aGroups.erase(aItr);
- else
- throw container::NoSuchElementException();
+ if( rName.getLength() == 0 )
+ throw IllegalArgumentException();
+
+ ScFieldGroups::iterator aIt = implFindByName( rName );
+ if( aIt == maGroups.end() )
+ throw NoSuchElementException();
+
+ maGroups.erase( aIt );
+}
+
+// XIndexAccess
+
+sal_Int32 SAL_CALL ScDataPilotFieldGroupsObj::getCount() throw(RuntimeException)
+{
+ ScUnoGuard aGuard;
+ return static_cast< sal_Int32 >( maGroups.size() );
+}
+
+Any SAL_CALL ScDataPilotFieldGroupsObj::getByIndex( sal_Int32 nIndex )
+ throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ ScUnoGuard aGuard;
+ if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >( maGroups.size() )))
+ throw IndexOutOfBoundsException();
+ return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, maGroups[ nIndex ].maName ) ) );
}
// XEnumerationAccess
-uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotFieldGroupsObj::createEnumeration()
- throw(uno::RuntimeException)
+Reference<XEnumeration> SAL_CALL ScDataPilotFieldGroupsObj::createEnumeration() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldGroupsEnumeration")));
+ return new ScIndexEnumeration( this, OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.DataPilotFieldGroupsEnumeration" ) ) );
}
-// XIndexAccess
+// XElementAccess
-sal_Int32 SAL_CALL ScDataPilotFieldGroupsObj::getCount() throw(uno::RuntimeException)
+uno::Type SAL_CALL ScDataPilotFieldGroupsObj::getElementType() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return aGroups.size();
+ return getCppuType( (Reference< XNameAccess >*)0 );
}
-uno::Any SAL_CALL ScDataPilotFieldGroupsObj::getByIndex( sal_Int32 nIndex )
- throw(lang::IndexOutOfBoundsException,
- lang::WrappedTargetException, uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasElements() throw(RuntimeException)
{
ScUnoGuard aGuard;
- if (nIndex >= 0 && nIndex < sal::static_int_cast<sal_Int32>(aGroups.size()))
- return uno::makeAny(uno::Reference < container::XNameAccess > (new ScDataPilotFieldGroupObj(aGroups[nIndex])));
- else
- throw lang::IndexOutOfBoundsException();
+ return !maGroups.empty();
}
-uno::Type SAL_CALL ScDataPilotFieldGroupsObj::getElementType() throw(uno::RuntimeException)
+// implementation
+
+ScFieldGroup& ScDataPilotFieldGroupsObj::getFieldGroup( const OUString& rName ) throw(RuntimeException)
{
ScUnoGuard aGuard;
- return getCppuType((uno::Reference<container::XNameAccess>*)0);
+ ScFieldGroups::iterator aIt = implFindByName( rName );
+ if( aIt == maGroups.end() )
+ throw RuntimeException();
+ return *aIt;
}
-sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasElements() throw(uno::RuntimeException)
+void ScDataPilotFieldGroupsObj::renameFieldGroup( const OUString& rOldName, const OUString& rNewName ) throw(RuntimeException)
{
ScUnoGuard aGuard;
- return ( !aGroups.empty() );
+ ScFieldGroups::iterator aOldIt = implFindByName( rOldName );
+ ScFieldGroups::iterator aNewIt = implFindByName( rNewName );
+ // new name must not exist yet
+ if( (aOldIt == maGroups.end()) || ((aNewIt != maGroups.end()) && (aNewIt != aOldIt)) )
+ throw RuntimeException();
+ aOldIt->maName = rNewName;
}
-//------------------------------------------------------------------------
+// private
+
+ScFieldGroups::iterator ScDataPilotFieldGroupsObj::implFindByName( const OUString& rName )
+{
+ for( ScFieldGroups::iterator aIt = maGroups.begin(), aEnd = maGroups.end(); aIt != aEnd; ++aIt )
+ if( aIt->maName == rName )
+ return aIt;
+ return maGroups.end();
+}
+
+// ============================================================================
+
+namespace {
+
+OUString lclExtractMember( const Any& rElement )
+{
+ if( rElement.has< OUString >() )
+ return rElement.get< OUString >();
+
+ Reference< XNamed > xNamed( rElement, UNO_QUERY );
+ if( xNamed.is() )
+ return xNamed->getName();
+
+ return OUString();
+}
+
+} // namespace
-ScDataPilotFieldGroupObj::ScDataPilotFieldGroupObj(const ScFieldGroup& rGroup) :
- aGroup(rGroup)
+// ----------------------------------------------------------------------------
+
+ScDataPilotFieldGroupObj::ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, const OUString& rGroupName ) :
+ mrParent( rParent ),
+ maGroupName( rGroupName )
{
+ mrParent.acquire();
}
ScDataPilotFieldGroupObj::~ScDataPilotFieldGroupObj()
{
+ mrParent.release();
}
// XNameAccess
-uno::Any SAL_CALL ScDataPilotFieldGroupObj::getByName( const rtl::OUString& aName )
- throw(container::NoSuchElementException,
- lang::WrappedTargetException, uno::RuntimeException)
+Any SAL_CALL ScDataPilotFieldGroupObj::getByName( const OUString& rName )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
-
- std::vector< rtl::OUString >::const_iterator aItr(aGroup.aMembers.begin());
- std::vector< rtl::OUString >::const_iterator aEndItr(aGroup.aMembers.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (*aItr == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
- if (bFound)
- return uno::makeAny(uno::Reference < container::XNamed > (new ScDataPilotFieldGroupItemObj(*aItr)));
-
- return uno::Any();
+ ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
+ ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
+ if( aIt == rMembers.end() )
+ throw NoSuchElementException();
+ return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, *aIt ) ) );
}
-uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotFieldGroupObj::getElementNames()
- throw(uno::RuntimeException)
+Sequence< OUString > SAL_CALL ScDataPilotFieldGroupObj::getElementNames() throw(RuntimeException)
{
ScUnoGuard aGuard;
-// TODO
-
- uno::Sequence<rtl::OUString> aSeq(aGroup.aMembers.size());
- std::vector< rtl::OUString >::const_iterator aItr(aGroup.aMembers.begin());
- std::vector< rtl::OUString >::const_iterator aEndItr(aGroup.aMembers.end());
- sal_Int32 i(0);
- while (aItr != aEndItr)
- {
- aSeq[i] = *aItr;
- ++aItr;
- ++i;
- }
- return aSeq;
+ return ::comphelper::containerToSequence( mrParent.getFieldGroup( maGroupName ).maMembers );
}
-sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasByName( const rtl::OUString& aName )
- throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasByName( const OUString& rName ) throw(RuntimeException)
{
ScUnoGuard aGuard;
-
- std::vector< rtl::OUString >::const_iterator aItr(aGroup.aMembers.begin());
- std::vector< rtl::OUString >::const_iterator aEndItr(aGroup.aMembers.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (*aItr == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
-
- return bFound;
+ ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
+ return ::std::find( rMembers.begin(), rMembers.end(), rName ) != rMembers.end();
}
// XNameReplace
-void SAL_CALL ScDataPilotFieldGroupObj::replaceByName( const ::rtl::OUString& aName,
- const uno::Any& aElement )
- throw (lang::IllegalArgumentException,
- container::NoSuchElementException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+
+void SAL_CALL ScDataPilotFieldGroupObj::replaceByName( const OUString& rName, const Any& rElement )
+ throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- std::vector<rtl::OUString>::iterator aItr(aGroup.aMembers.begin());
- std::vector<rtl::OUString>::iterator aEndItr(aGroup.aMembers.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (*aItr == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
- if (bFound)
- {
- uno::Reference<container::XNamed> xNamed(aElement, uno::UNO_QUERY);
- if (xNamed.is())
- {
- aGroup.aMembers.erase(aItr);
- aGroup.aMembers.push_back(xNamed->getName());
- }
- else
- throw lang::IllegalArgumentException();
- }
- else
- throw container::NoSuchElementException();
+ // it should be possible to quickly rename an item -> accept string or XNamed
+ OUString aNewName = lclExtractMember( rElement );
+ if( (rName.getLength() == 0) || (aNewName.getLength() == 0) )
+ throw IllegalArgumentException();
+ if( rName == aNewName )
+ return;
+
+ ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
+ ScFieldGroupMembers::iterator aOldIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
+ ScFieldGroupMembers::iterator aNewIt = ::std::find( rMembers.begin(), rMembers.end(), aNewName );
+ // throw if passed member name does not exist
+ if( aOldIt == rMembers.end() )
+ throw NoSuchElementException();
+ // throw if new name already exists
+ if( aNewIt != rMembers.end() )
+ throw IllegalArgumentException();
+ *aOldIt = aNewName;
}
// XNameContainer
-void SAL_CALL ScDataPilotFieldGroupObj::insertByName( const ::rtl::OUString& aName,
- const uno::Any& aElement )
- throw (lang::IllegalArgumentException,
- container::ElementExistException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+
+void SAL_CALL ScDataPilotFieldGroupObj::insertByName( const OUString& rName, const Any& /*rElement*/ )
+ throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- std::vector<rtl::OUString>::iterator aItr(aGroup.aMembers.begin());
- std::vector<rtl::OUString>::iterator aEndItr(aGroup.aMembers.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (*aItr == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
- if (!bFound)
- {
- uno::Reference<container::XNamed> xNamed(aElement, uno::UNO_QUERY);
- if (xNamed.is())
- {
- if (aName == xNamed->getName())
- aGroup.aMembers.push_back(aName);
- else
- throw lang::IllegalArgumentException();
- }
- else
- throw lang::IllegalArgumentException();
- }
- else
- throw container::ElementExistException();
+ // we will ignore the passed element and just try to insert the name
+ if( rName.getLength() == 0 )
+ throw IllegalArgumentException();
+
+ ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
+ ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
+ // throw if passed name already exists
+ if( aIt != rMembers.end() )
+ throw IllegalArgumentException();
+ rMembers.push_back( rName );
}
-void SAL_CALL ScDataPilotFieldGroupObj::removeByName( const ::rtl::OUString& aName )
- throw (container::NoSuchElementException,
- lang::WrappedTargetException,
- uno::RuntimeException)
+void SAL_CALL ScDataPilotFieldGroupObj::removeByName( const OUString& rName )
+ throw (NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- std::vector<rtl::OUString>::iterator aItr(aGroup.aMembers.begin());
- std::vector<rtl::OUString>::iterator aEndItr(aGroup.aMembers.end());
- sal_Bool bFound(sal_False);
- while (!bFound && aItr != aEndItr)
- {
- if (*aItr == aName)
- bFound = sal_True;
- else
- ++aItr;
- }
- if (bFound)
- aGroup.aMembers.erase(aItr);
- else
- throw container::NoSuchElementException();
+ if( rName.getLength() == 0 )
+ throw IllegalArgumentException();
+ ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
+ ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName );
+ // throw if passed name does not exist
+ if( aIt == rMembers.end() )
+ throw NoSuchElementException();
+ rMembers.erase( aIt );
}
-// XEnumerationAccess
+// XIndexAccess
-uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotFieldGroupObj::createEnumeration()
- throw(uno::RuntimeException)
+sal_Int32 SAL_CALL ScDataPilotFieldGroupObj::getCount() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldGroupEnumeration")));
+ return static_cast< sal_Int32 >( mrParent.getFieldGroup( maGroupName ).maMembers.size() );
}
-// XIndexAccess
-
-sal_Int32 SAL_CALL ScDataPilotFieldGroupObj::getCount() throw(uno::RuntimeException)
+Any SAL_CALL ScDataPilotFieldGroupObj::getByIndex( sal_Int32 nIndex )
+ throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- return aGroup.aMembers.size();
+ ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers;
+ if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >( rMembers.size() )))
+ throw IndexOutOfBoundsException();
+ return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, rMembers[ nIndex ] ) ) );
}
-uno::Any SAL_CALL ScDataPilotFieldGroupObj::getByIndex( sal_Int32 nIndex )
- throw(lang::IndexOutOfBoundsException,
- lang::WrappedTargetException, uno::RuntimeException)
+// XEnumerationAccess
+
+Reference< XEnumeration > SAL_CALL ScDataPilotFieldGroupObj::createEnumeration() throw(RuntimeException)
{
ScUnoGuard aGuard;
- if (nIndex >= 0 && nIndex < sal::static_int_cast<sal_Int32>(aGroup.aMembers.size()))
- return uno::makeAny(uno::Reference < container::XNamed > (new ScDataPilotFieldGroupItemObj(aGroup.aMembers[nIndex])));
- else
- throw lang::IndexOutOfBoundsException();
+ return new ScIndexEnumeration( this, OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.DataPilotFieldGroupEnumeration" ) ) );
}
-uno::Type SAL_CALL ScDataPilotFieldGroupObj::getElementType() throw(uno::RuntimeException)
+// XElementAccess
+
+uno::Type SAL_CALL ScDataPilotFieldGroupObj::getElementType() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return getCppuType((uno::Reference<container::XNamed>*)0);
+ return getCppuType( (Reference< XNamed >*)0 );
}
-sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasElements() throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasElements() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return ( !aGroup.aMembers.empty() );
+ return !mrParent.getFieldGroup( maGroupName ).maMembers.empty();
}
// XNamed
-::rtl::OUString SAL_CALL ScDataPilotFieldGroupObj::getName() throw(::com::sun::star::uno::RuntimeException)
+
+OUString SAL_CALL ScDataPilotFieldGroupObj::getName() throw(RuntimeException)
{
ScUnoGuard aGuard;
-
- return aGroup.sName;
+ return maGroupName;
}
-void SAL_CALL ScDataPilotFieldGroupObj::setName( const ::rtl::OUString& aName )
- throw(::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScDataPilotFieldGroupObj::setName( const OUString& rName ) throw(RuntimeException)
{
ScUnoGuard aGuard;
-
- aGroup.sName = aName;
+ mrParent.renameFieldGroup( maGroupName, rName );
+ // if call to renameFieldGroup() did not throw, remember the new name
+ maGroupName = rName;
}
-//------------------------------------------------------------------------
+// ============================================================================
-ScDataPilotFieldGroupItemObj::ScDataPilotFieldGroupItemObj(const rtl::OUString& rName)
- : sName(rName)
+ScDataPilotFieldGroupItemObj::ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, const OUString& rName ) :
+ mrParent( rParent ),
+ maName( rName )
{
+ mrParent.acquire();
}
ScDataPilotFieldGroupItemObj::~ScDataPilotFieldGroupItemObj()
{
+ mrParent.release();
}
- // XNamed
-::rtl::OUString SAL_CALL ScDataPilotFieldGroupItemObj::getName() throw(::com::sun::star::uno::RuntimeException)
+// XNamed
+
+OUString SAL_CALL ScDataPilotFieldGroupItemObj::getName() throw(RuntimeException)
{
ScUnoGuard aGuard;
-
- return sName;
+ return maName;
}
-void SAL_CALL ScDataPilotFieldGroupItemObj::setName( const ::rtl::OUString& aName )
- throw(::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScDataPilotFieldGroupItemObj::setName( const OUString& rName ) throw(RuntimeException)
{
ScUnoGuard aGuard;
-
- sName = aName;
+ mrParent.replaceByName( maName, Any( rName ) );
+ // if call to replaceByName() did not throw, remember the new name
+ maName = rName;
}
-//------------------------------------------------------------------------
+// ============================================================================
-ScDataPilotItemsObj::ScDataPilotItemsObj(ScDataPilotDescriptorBase* pPar, const ScFieldIdentifier& rIdent) :
- pParent( pPar ),
- aSourceIdent( rIdent )
+ScDataPilotItemsObj::ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) :
+ ScDataPilotChildObjBase( rParent, rFieldId )
{
- pParent->acquire();
}
ScDataPilotItemsObj::~ScDataPilotItemsObj()
{
- pParent->release();
}
-SCSIZE lcl_GetItemCount( ScDataPilotDescriptorBase* pParent, const ScFieldIdentifier& rIdent )
-{
- SCSIZE nRet = 0;
-
- uno::Reference<container::XNameAccess> xMembers;
- if (lcl_GetMembers(pParent, rIdent, xMembers))
- {
- uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
- nRet = static_cast<SCSIZE>(xMembersIndex->getCount());
- }
+// XDataPilotItems
- return nRet;
-}
-
-// XDataPilotItemss
-
-ScDataPilotItemObj* ScDataPilotItemsObj::GetObjectByIndex_Impl(SCSIZE nIndex) const
+ScDataPilotItemObj* ScDataPilotItemsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const
{
-// TODO
- if (nIndex < lcl_GetItemCount(pParent, aSourceIdent))
- return new ScDataPilotItemObj( pParent, aSourceIdent, nIndex );
-
- return NULL;
+ return ((0 <= nIndex) && (nIndex < GetMemberCount())) ?
+ new ScDataPilotItemObj( mrParent, maFieldId, nIndex ) : 0;
}
// XNameAccess
-uno::Any SAL_CALL ScDataPilotItemsObj::getByName( const rtl::OUString& aName )
- throw(container::NoSuchElementException,
- lang::WrappedTargetException, uno::RuntimeException)
+Any SAL_CALL ScDataPilotItemsObj::getByName( const OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
-
+ Reference<XNameAccess> xMembers = GetMembers();
+ if (xMembers.is())
{
- uno::Reference<container::XNameAccess> xMembers;
- if (lcl_GetMembers(pParent, aSourceIdent, xMembers))
+ Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
+ sal_Int32 nCount = xMembersIndex->getCount();
+ sal_Bool bFound(sal_False);
+ sal_Int32 nItem = 0;
+ while (nItem < nCount && !bFound )
{
- uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
- sal_Int32 nCount = xMembersIndex->getCount();
- sal_Bool bFound(sal_False);
- sal_Int32 nItem = 0;
- while (nItem < nCount && !bFound )
- {
- uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(nItem), uno::UNO_QUERY);
- if (xMember.is() && aName == xMember->getName())
- return uno::makeAny(uno::Reference<beans::XPropertySet> (GetObjectByIndex_Impl(static_cast<SCSIZE>(nItem))));
- else
- nItem++;
- }
- if (!bFound)
- throw container::NoSuchElementException();
+ Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
+ if (xMember.is() && (aName == xMember->getName()))
+ return Any( Reference< XPropertySet >( GetObjectByIndex_Impl( nItem ) ) );
+ ++nItem;
}
+ if (!bFound)
+ throw NoSuchElementException();
}
-
- return uno::Any();
+ return Any();
}
-uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotItemsObj::getElementNames()
- throw(uno::RuntimeException)
+Sequence<OUString> SAL_CALL ScDataPilotItemsObj::getElementNames()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
-// TODO
-
- uno::Sequence<rtl::OUString> aSeq;
- if( ScDPObject* pDPObj = pParent->GetDPObject() )
- {
- sal_Int32 nObjIndex = lcl_GetObjectIndex( pDPObj, aSourceIdent );
- pDPObj->GetMembers( nObjIndex, aSeq );
- }
+ Sequence< OUString > aSeq;
+ if( ScDPObject* pDPObj = GetDPObject() )
+ pDPObj->GetMembers( lcl_GetObjectIndex( pDPObj, maFieldId ), aSeq );
return aSeq;
}
-sal_Bool SAL_CALL ScDataPilotItemsObj::hasByName( const rtl::OUString& aName )
- throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotItemsObj::hasByName( const OUString& aName )
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
-
- sal_Bool bFound(sal_False);
+ sal_Bool bFound = sal_False;
+ Reference<XNameAccess> xMembers = GetMembers();
+ if (xMembers.is())
{
- uno::Reference<container::XNameAccess> xMembers;
- if (lcl_GetMembers(pParent, aSourceIdent, xMembers))
+ Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
+ sal_Int32 nCount = xMembersIndex->getCount();
+ sal_Int32 nItem = 0;
+ while (nItem < nCount && !bFound )
{
- uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
- sal_Int32 nCount = xMembersIndex->getCount();
- sal_Int32 nItem = 0;
- while (nItem < nCount && !bFound )
- {
- uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(nItem), uno::UNO_QUERY);
- if (xMember.is() && aName == xMember->getName())
- bFound = sal_True;
- else
- nItem++;
- }
+ Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
+ if (xMember.is() && aName == xMember->getName())
+ bFound = sal_True;
+ else
+ nItem++;
}
}
-
return bFound;
}
// XEnumerationAccess
-uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotItemsObj::createEnumeration()
- throw(uno::RuntimeException)
+Reference<XEnumeration> SAL_CALL ScDataPilotItemsObj::createEnumeration()
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotItemsEnumeration")));
+ return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotItemsEnumeration")));
}
// XIndexAccess
-sal_Int32 SAL_CALL ScDataPilotItemsObj::getCount() throw(uno::RuntimeException)
+sal_Int32 SAL_CALL ScDataPilotItemsObj::getCount() throw(RuntimeException)
{
ScUnoGuard aGuard;
-// TODO
- return static_cast<sal_Int32>(lcl_GetItemCount( pParent, aSourceIdent ));
+ return GetMemberCount();
}
-uno::Any SAL_CALL ScDataPilotItemsObj::getByIndex( sal_Int32 nIndex )
- throw(lang::IndexOutOfBoundsException,
- lang::WrappedTargetException, uno::RuntimeException)
+Any SAL_CALL ScDataPilotItemsObj::getByIndex( sal_Int32 nIndex )
+ throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- uno::Reference<beans::XPropertySet> xItem(GetObjectByIndex_Impl(static_cast<SCSIZE>(nIndex)));
- if (xItem.is())
- return uno::makeAny(xItem);
- else
- throw lang::IndexOutOfBoundsException();
+ Reference< XPropertySet > xItem( GetObjectByIndex_Impl( nIndex ) );
+ if (!xItem.is())
+ throw IndexOutOfBoundsException();
+ return Any( xItem );
}
-uno::Type SAL_CALL ScDataPilotItemsObj::getElementType() throw(uno::RuntimeException)
+uno::Type SAL_CALL ScDataPilotItemsObj::getElementType() throw(RuntimeException)
{
ScUnoGuard aGuard;
- return getCppuType((uno::Reference<beans::XPropertySet>*)0);
+ return getCppuType((Reference<XPropertySet>*)0);
}
-sal_Bool SAL_CALL ScDataPilotItemsObj::hasElements() throw(uno::RuntimeException)
+sal_Bool SAL_CALL ScDataPilotItemsObj::hasElements() throw(RuntimeException)
{
ScUnoGuard aGuard;
return ( getCount() != 0 );
@@ -3305,92 +3137,77 @@ sal_Bool SAL_CALL ScDataPilotItemsObj::hasElements() throw(uno::RuntimeException
//------------------------------------------------------------------------
-ScDataPilotItemObj::ScDataPilotItemObj(ScDataPilotDescriptorBase* pPar, const ScFieldIdentifier& rIdent, SCSIZE nI)
- : aPropSet( lcl_GetDataPilotItemMap() ),
- pParent(pPar),
- aSourceIdent(rIdent),
- nIndex(nI)
+ScDataPilotItemObj::ScDataPilotItemObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId, sal_Int32 nIndex ) :
+ ScDataPilotChildObjBase( rParent, rFieldId ),
+ maPropSet( lcl_GetDataPilotItemMap() ),
+ mnIndex( nIndex )
{
- pParent->acquire();
}
ScDataPilotItemObj::~ScDataPilotItemObj()
{
- pParent->release();
}
// XNamed
-::rtl::OUString SAL_CALL ScDataPilotItemObj::getName() throw(::com::sun::star::uno::RuntimeException)
+OUString SAL_CALL ScDataPilotItemObj::getName() throw(RuntimeException)
{
ScUnoGuard aGuard;
- rtl::OUString sRet;
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ OUString sRet;
+ Reference<XNameAccess> xMembers = GetMembers();
+ if (xMembers.is())
{
- uno::Reference<container::XNameAccess> xMembers;
- if (lcl_GetMembers(pParent, aSourceIdent, xMembers))
+ Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
+ sal_Int32 nCount = xMembersIndex->getCount();
+ if (mnIndex < nCount)
{
- uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
- sal_Int32 nCount = xMembersIndex->getCount();
- if (nIndex < static_cast<SCSIZE>(nCount))
- {
- uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(static_cast<sal_Int32>(nIndex)), uno::UNO_QUERY);
- sRet = xMember->getName();
- }
+ Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
+ sRet = xMember->getName();
}
}
return sRet;
}
-void SAL_CALL ScDataPilotItemObj::setName( const ::rtl::OUString& /* aName */ )
- throw(::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScDataPilotItemObj::setName( const OUString& /* aName */ )
+ throw(RuntimeException)
{
}
// XPropertySet
-::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+Reference< XPropertySetInfo >
SAL_CALL ScDataPilotItemObj::getPropertySetInfo( )
- throw(::com::sun::star::uno::RuntimeException)
+ throw(RuntimeException)
{
ScUnoGuard aGuard;
- static uno::Reference<beans::XPropertySetInfo> aRef =
- new SfxItemPropertySetInfo( aPropSet.getPropertyMap() );
+ static Reference<XPropertySetInfo> aRef =
+ new SfxItemPropertySetInfo( maPropSet.getPropertyMap() );
return aRef;
}
-void SAL_CALL ScDataPilotItemObj::setPropertyValue( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Any& aValue )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScDataPilotItemObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- String aNameString = aPropertyName;
-
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ ScDPObject* pDPObj = 0;
+ if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- uno::Reference<container::XNameAccess> xMembers;
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetMembers(pParent, aSourceIdent, xMembers) && lcl_GetDim(pDPObj, aSourceIdent, pDim))
+ Reference<XNameAccess> xMembers = GetMembers();
+ if( xMembers.is() )
{
- uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
+ Reference<XIndexAccess> xMembersIndex( new ScNameToIndexAccess( xMembers ) );
sal_Int32 nCount = xMembersIndex->getCount();
- if (nIndex < static_cast<SCSIZE>(nCount) )
+ if( mnIndex < nCount )
{
- uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(static_cast<sal_Int32>(nIndex)), uno::UNO_QUERY);
+ Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY);
String sName(xMember->getName());
ScDPSaveMember* pMember = pDim->GetMemberByName(sName);
if (pMember)
{
bool bGetNewIndex = false;
- if ( aNameString.EqualsAscii( SC_UNONAME_SHOWDETAIL ) )
+ if ( aPropertyName.equalsAscii( SC_UNONAME_SHOWDETAIL ) )
pMember->SetShowDetails(cppu::any2bool(aValue));
- else if ( aNameString.EqualsAscii( SC_UNONAME_ISHIDDEN ) )
+ else if ( aPropertyName.equalsAscii( SC_UNONAME_ISHIDDEN ) )
pMember->SetIsVisible(!cppu::any2bool(aValue));
- else if ( aNameString.EqualsAscii( SC_UNONAME_POS ) )
+ else if ( aPropertyName.equalsAscii( SC_UNONAME_POS ) )
{
sal_Int32 nNewPos = 0;
if ( ( aValue >>= nNewPos ) && nNewPos >= 0 && nNewPos < nCount )
@@ -3400,18 +3217,18 @@ void SAL_CALL ScDataPilotItemObj::setPropertyValue( const ::rtl::OUString& aProp
bGetNewIndex = true;
}
else
- throw lang::IllegalArgumentException();
+ throw IllegalArgumentException();
}
- pParent->SetDPObject(pDPObj);
+ SetDPObject( pDPObj );
if ( bGetNewIndex ) // after SetDPObject, get the new index
{
- rtl::OUString aOUName( sName );
- uno::Sequence<rtl::OUString> aItemNames = xMembers->getElementNames();
+ OUString aOUName( sName );
+ Sequence< OUString > aItemNames = xMembers->getElementNames();
sal_Int32 nItemCount = aItemNames.getLength();
for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem)
if (aItemNames[nItem] == aOUName)
- nIndex = nItem;
+ mnIndex = nItem;
}
}
}
@@ -3419,67 +3236,56 @@ void SAL_CALL ScDataPilotItemObj::setPropertyValue( const ::rtl::OUString& aProp
}
}
-::com::sun::star::uno::Any SAL_CALL ScDataPilotItemObj::getPropertyValue(
- const ::rtl::OUString& aPropertyName )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException)
+Any SAL_CALL ScDataPilotItemObj::getPropertyValue( const OUString& aPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
ScUnoGuard aGuard;
- uno::Any aRet;
- String aNameString = aPropertyName;
-
- ScDPObject* pDPObj(pParent->GetDPObject());
- if (pDPObj)
+ Any aRet;
+ if( ScDPSaveDimension* pDim = GetDPDimension() )
{
- uno::Reference<container::XNameAccess> xMembers;
- ScDPSaveDimension* pDim = NULL;
- if (lcl_GetMembers(pParent, aSourceIdent, xMembers) && lcl_GetDim(pDPObj, aSourceIdent, pDim))
+ Reference< XNameAccess > xMembers = GetMembers();
+ if( xMembers.is() )
{
- uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
+ Reference< XIndexAccess > xMembersIndex( new ScNameToIndexAccess( xMembers ) );
sal_Int32 nCount = xMembersIndex->getCount();
- if (nIndex < static_cast<SCSIZE>(nCount) )
+ if( mnIndex < nCount )
{
- uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(static_cast<sal_Int32>(nIndex)), uno::UNO_QUERY);
- String sName(xMember->getName());
- ScDPSaveMember* pMember = pDim->GetExistingMemberByName(sName);
- if ( aNameString.EqualsAscii( SC_UNONAME_SHOWDETAIL ) )
+ Reference< XNamed > xMember( xMembersIndex->getByIndex( mnIndex ), UNO_QUERY );
+ String sName( xMember->getName() );
+ ScDPSaveMember* pMember = pDim->GetExistingMemberByName( sName );
+ if( aPropertyName.equalsAscii( SC_UNONAME_SHOWDETAIL ) )
{
if (pMember && pMember->HasShowDetails())
{
- aRet = cppu::bool2any(pMember->GetShowDetails());
+ aRet <<= (bool)pMember->GetShowDetails();
}
else
{
- uno::Reference<beans::XPropertySet> xMemberProps(xMember, uno::UNO_QUERY);
- if(xMemberProps.is())
- {
- aRet = xMemberProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHOWDETA)));
- }
+ Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY );
+ if( xMemberProps.is() )
+ aRet = xMemberProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SHOWDETA ) ) );
else
- aRet = cppu::bool2any(sal_True);
+ aRet <<= true;
}
}
- else if ( aNameString.EqualsAscii( SC_UNONAME_ISHIDDEN ) )
+ else if ( aPropertyName.equalsAscii( SC_UNONAME_ISHIDDEN ) )
{
if (pMember && pMember->HasIsVisible())
{
- aRet = cppu::bool2any(!pMember->GetIsVisible());
+ aRet <<= !pMember->GetIsVisible();
}
else
{
- uno::Reference<beans::XPropertySet> xMemberProps(xMember, uno::UNO_QUERY);
- if(xMemberProps.is())
- {
- aRet = cppu::bool2any(!cppu::any2bool(xMemberProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ISVISIBL)))));
- }
+ Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY );
+ if( xMemberProps.is() )
+ aRet <<= !cppu::any2bool( xMemberProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ISVISIBL ) ) ) );
else
- aRet = cppu::bool2any(sal_False);
+ aRet <<= false;
}
}
- else if ( aNameString.EqualsAscii( SC_UNONAME_POS ) )
+ else if ( aPropertyName.equalsAscii( SC_UNONAME_POS ) )
{
- aRet <<= static_cast<sal_Int32>( nIndex );
+ aRet <<= mnIndex;
}
}
}
@@ -3487,39 +3293,27 @@ void SAL_CALL ScDataPilotItemObj::setPropertyValue( const ::rtl::OUString& aProp
return aRet;
}
-void SAL_CALL ScDataPilotItemObj::addPropertyChangeListener( const ::rtl::OUString& /* aPropertyName */,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& /* xListener */ )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScDataPilotItemObj::addPropertyChangeListener(
+ const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* xListener */ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ScDataPilotItemObj::removePropertyChangeListener( const ::rtl::OUString& /* aPropertyName */,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& /* aListener */ )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScDataPilotItemObj::removePropertyChangeListener(
+ const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* aListener */ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ScDataPilotItemObj::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& /* aListener */ )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScDataPilotItemObj::addVetoableChangeListener(
+ const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ScDataPilotItemObj::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& /* aListener */ )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScDataPilotItemObj::removeVetoableChangeListener(
+ const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 5183ea104721..13f2c26c6e47 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -45,6 +45,8 @@
#include <com/sun/star/table/TableOrientation.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/sheet/DataImportMode.hpp>
+#include <com/sun/star/sheet/FilterOperator2.hpp>
+#include <com/sun/star/sheet/TableFilterField2.hpp>
#include "datauno.hxx"
#include "dapiuno.hxx"
@@ -75,11 +77,11 @@ SV_IMPL_PTRARR( XDBRefreshListenerArr_Impl, XDBRefreshListenerPtr );
// alles ohne Which-ID, Map nur fuer PropertySetInfo
-const SfxItemPropertyMap* lcl_GetSubTotalPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetSubTotalPropertyMap()
{
// some old property names are for 5.2 compatibility
- static SfxItemPropertyMap aSubTotalPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aSubTotalPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_BINDFMT), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_CASE), 0, &getBooleanCppuType(), 0, 0},
@@ -98,9 +100,9 @@ const SfxItemPropertyMap* lcl_GetSubTotalPropertyMap()
return aSubTotalPropertyMap_Impl;
}
-const SfxItemPropertyMap* lcl_GetFilterPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetFilterPropertyMap()
{
- static SfxItemPropertyMap aFilterPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aFilterPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_CONTHDR), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_COPYOUT), 0, &getBooleanCppuType(), 0, 0},
@@ -116,9 +118,9 @@ const SfxItemPropertyMap* lcl_GetFilterPropertyMap()
return aFilterPropertyMap_Impl;
}
-const SfxItemPropertyMap* lcl_GetDBRangePropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetDBRangePropertyMap()
{
- static SfxItemPropertyMap aDBRangePropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aDBRangePropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_AUTOFLT), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_FLTCRT), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0},
@@ -1106,7 +1108,7 @@ void ScFilterDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
}
-// XSheetFilterDescriptor
+// XSheetFilterDescriptor and XSheetFilterDescriptor2
uno::Sequence<sheet::TableFilterField> SAL_CALL ScFilterDescriptorBase::getFilterFields()
throw(uno::RuntimeException)
@@ -1177,6 +1179,80 @@ uno::Sequence<sheet::TableFilterField> SAL_CALL ScFilterDescriptorBase::getFilte
return aSeq;
}
+uno::Sequence<sheet::TableFilterField2> SAL_CALL ScFilterDescriptorBase::getFilterFields2()
+throw(uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+ ScQueryParam aParam;
+ GetData(aParam);
+
+ SCSIZE nEntries = aParam.GetEntryCount(); // allozierte Eintraege im Param
+ SCSIZE nCount = 0; // aktive
+ while ( nCount < nEntries &&
+ aParam.GetEntry(nCount).bDoQuery )
+ ++nCount;
+
+ sheet::TableFilterField2 aField;
+ uno::Sequence<sheet::TableFilterField2> aSeq(static_cast<sal_Int32>(nCount));
+ sheet::TableFilterField2* pAry = aSeq.getArray();
+ for (SCSIZE i=0; i<nCount; i++)
+ {
+ const ScQueryEntry& rEntry = aParam.GetEntry(i);
+
+ rtl::OUString aStringValue;
+ if (rEntry.pStr)
+ aStringValue = *rEntry.pStr;
+
+ aField.Connection = (rEntry.eConnect == SC_AND) ? sheet::FilterConnection_AND : sheet::FilterConnection_OR;
+ aField.Field = rEntry.nField;
+ aField.IsNumeric = !rEntry.bQueryByString;
+ aField.StringValue = aStringValue;
+ aField.NumericValue = rEntry.nVal;
+
+ switch (rEntry.eOp) // ScQueryOp
+ {
+ case SC_EQUAL:
+ {
+ aField.Operator = sheet::FilterOperator2::EQUAL;
+ if (!rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING)
+ {
+ if (rEntry.nVal == SC_EMPTYFIELDS)
+ {
+ aField.Operator = sheet::FilterOperator2::EMPTY;
+ aField.NumericValue = 0;
+ }
+ else if (rEntry.nVal == SC_NONEMPTYFIELDS)
+ {
+ aField.Operator = sheet::FilterOperator2::NOT_EMPTY;
+ aField.NumericValue = 0;
+ }
+ }
+ }
+ break;
+ case SC_LESS: aField.Operator = sheet::FilterOperator2::LESS; break;
+ case SC_GREATER: aField.Operator = sheet::FilterOperator2::GREATER; break;
+ case SC_LESS_EQUAL: aField.Operator = sheet::FilterOperator2::LESS_EQUAL; break;
+ case SC_GREATER_EQUAL: aField.Operator = sheet::FilterOperator2::GREATER_EQUAL; break;
+ case SC_NOT_EQUAL: aField.Operator = sheet::FilterOperator2::NOT_EQUAL; break;
+ case SC_TOPVAL: aField.Operator = sheet::FilterOperator2::TOP_VALUES; break;
+ case SC_BOTVAL: aField.Operator = sheet::FilterOperator2::BOTTOM_VALUES; break;
+ case SC_TOPPERC: aField.Operator = sheet::FilterOperator2::TOP_PERCENT; break;
+ case SC_BOTPERC: aField.Operator = sheet::FilterOperator2::BOTTOM_PERCENT; break;
+ case SC_CONTAINS: aField.Operator = sheet::FilterOperator2::CONTAINS; break;
+ case SC_DOES_NOT_CONTAIN: aField.Operator = sheet::FilterOperator2::DOES_NOT_CONTAIN; break;
+ case SC_BEGINS_WITH: aField.Operator = sheet::FilterOperator2::BEGINS_WITH; break;
+ case SC_DOES_NOT_BEGIN_WITH: aField.Operator = sheet::FilterOperator2::DOES_NOT_BEGIN_WITH; break;
+ case SC_ENDS_WITH: aField.Operator = sheet::FilterOperator2::ENDS_WITH; break;
+ case SC_DOES_NOT_END_WITH: aField.Operator = sheet::FilterOperator2::DOES_NOT_END_WITH; break;
+ default:
+ DBG_ERROR("Falscher Filter-enum");
+ aField.Operator = sheet::FilterOperator2::EMPTY;
+ }
+ pAry[i] = aField;
+ }
+ return aSeq;
+}
+
void SAL_CALL ScFilterDescriptorBase::setFilterFields(
const uno::Sequence<sheet::TableFilterField>& aFilterFields )
throw(uno::RuntimeException)
@@ -1251,6 +1327,86 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields(
PutData(aParam);
}
+void SAL_CALL ScFilterDescriptorBase::setFilterFields2(
+ const uno::Sequence<sheet::TableFilterField2>& aFilterFields )
+ throw(uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+ ScQueryParam aParam;
+ GetData(aParam);
+
+ SCSIZE nCount = static_cast<SCSIZE>(aFilterFields.getLength());
+ DBG_ASSERT( nCount <= MAXQUERY, "setFilterFields: zu viele" );
+
+ aParam.Resize( nCount );
+
+ const sheet::TableFilterField2* pAry = aFilterFields.getConstArray();
+ SCSIZE i;
+ for (i=0; i<nCount; i++)
+ {
+ ScQueryEntry& rEntry = aParam.GetEntry(i);
+ if (!rEntry.pStr)
+ rEntry.pStr = new String; // sollte nicht sein (soll immer initialisiert sein)
+
+ rEntry.bDoQuery = TRUE;
+ rEntry.eConnect = (pAry[i].Connection == sheet::FilterConnection_AND) ? SC_AND : SC_OR;
+ rEntry.nField = pAry[i].Field;
+ rEntry.bQueryByString = !pAry[i].IsNumeric;
+ *rEntry.pStr = String( pAry[i].StringValue );
+ rEntry.nVal = pAry[i].NumericValue;
+
+ if (!rEntry.bQueryByString && pDocSh)
+ {
+ pDocSh->GetDocument()->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, *rEntry.pStr);
+ }
+
+ switch (pAry[i].Operator) // FilterOperator
+ {
+ case sheet::FilterOperator2::EQUAL: rEntry.eOp = SC_EQUAL; break;
+ case sheet::FilterOperator2::LESS: rEntry.eOp = SC_LESS; break;
+ case sheet::FilterOperator2::GREATER: rEntry.eOp = SC_GREATER; break;
+ case sheet::FilterOperator2::LESS_EQUAL: rEntry.eOp = SC_LESS_EQUAL; break;
+ case sheet::FilterOperator2::GREATER_EQUAL: rEntry.eOp = SC_GREATER_EQUAL; break;
+ case sheet::FilterOperator2::NOT_EQUAL: rEntry.eOp = SC_NOT_EQUAL; break;
+ case sheet::FilterOperator2::TOP_VALUES: rEntry.eOp = SC_TOPVAL; break;
+ case sheet::FilterOperator2::BOTTOM_VALUES: rEntry.eOp = SC_BOTVAL; break;
+ case sheet::FilterOperator2::TOP_PERCENT: rEntry.eOp = SC_TOPPERC; break;
+ case sheet::FilterOperator2::BOTTOM_PERCENT: rEntry.eOp = SC_BOTPERC; break;
+ case sheet::FilterOperator2::CONTAINS: rEntry.eOp = SC_CONTAINS; break;
+ case sheet::FilterOperator2::DOES_NOT_CONTAIN: rEntry.eOp = SC_DOES_NOT_CONTAIN; break;
+ case sheet::FilterOperator2::BEGINS_WITH: rEntry.eOp = SC_BEGINS_WITH; break;
+ case sheet::FilterOperator2::DOES_NOT_BEGIN_WITH: rEntry.eOp = SC_DOES_NOT_BEGIN_WITH;break;
+ case sheet::FilterOperator2::ENDS_WITH: rEntry.eOp = SC_ENDS_WITH; break;
+ case sheet::FilterOperator2::DOES_NOT_END_WITH: rEntry.eOp = SC_DOES_NOT_END_WITH; break;
+ case sheet::FilterOperator2::EMPTY:
+ {
+ rEntry.eOp = SC_EQUAL;
+ rEntry.nVal = SC_EMPTYFIELDS;
+ rEntry.bQueryByString = FALSE;
+ *rEntry.pStr = EMPTY_STRING;
+ }
+ break;
+ case sheet::FilterOperator2::NOT_EMPTY:
+ {
+ rEntry.eOp = SC_EQUAL;
+ rEntry.nVal = SC_NONEMPTYFIELDS;
+ rEntry.bQueryByString = FALSE;
+ *rEntry.pStr = EMPTY_STRING;
+ }
+ break;
+ default:
+ DBG_ERROR("Falscher Query-enum");
+ rEntry.eOp = SC_EQUAL;
+ }
+ }
+
+ SCSIZE nParamCount = aParam.GetEntryCount(); // Param wird nicht unter 8 resized
+ for (i=nCount; i<nParamCount; i++)
+ aParam.GetEntry(i).bDoQuery = FALSE; // ueberzaehlige Felder zuruecksetzen
+
+ PutData(aParam);
+}
+
// Rest sind Properties
// XPropertySet
diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx
index f329db1569ce..bc6f135ce174 100644
--- a/sc/source/ui/unoobj/defltuno.cxx
+++ b/sc/source/ui/unoobj/defltuno.cxx
@@ -53,9 +53,9 @@ using namespace ::com::sun::star;
//------------------------------------------------------------------------
-const SfxItemPropertyMap* lcl_GetDocDefaultsMap()
+const SfxItemPropertyMapEntry* lcl_GetDocDefaultsMap()
{
- static SfxItemPropertyMap aDocDefaultsMap_Impl[] =
+ static SfxItemPropertyMapEntry aDocDefaultsMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
{MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
@@ -93,7 +93,8 @@ SC_SIMPLE_SERVICE_INFO( ScDocDefaultsObj, "ScDocDefaultsObj", "com.sun.star.shee
//------------------------------------------------------------------------
ScDocDefaultsObj::ScDocDefaultsObj(ScDocShell* pDocSh) :
- pDocShell( pDocSh )
+ pDocShell( pDocSh ),
+ aPropertyMap(lcl_GetDocDefaultsMap())
{
pDocShell->GetDocument()->AddUnoObject(*this);
}
@@ -129,8 +130,8 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDocDefaultsObj::getPropertySe
throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( lcl_GetDocDefaultsMap() ));
+ static uno::Reference<beans::XPropertySetInfo> aRef = new SfxItemPropertySetInfo(
+ &aPropertyMap );
return aRef;
}
@@ -145,11 +146,10 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
if ( !pDocShell )
throw uno::RuntimeException();
- const SfxItemPropertyMap* pMap =
- SfxItemPropertyMap::GetByName( lcl_GetDocDefaultsMap(), aPropertyName );
- if ( !pMap )
+ const SfxItemPropertySimpleEntry* pEntry = aPropertyMap.getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
- if(!pMap->nWID)
+ if(!pEntry->nWID)
{
if(aPropertyName.compareToAscii(SC_UNO_STANDARDDEC) == 0)
{
@@ -184,9 +184,9 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
throw uno::RuntimeException();
}
}
- else if ( pMap->nWID == ATTR_FONT_LANGUAGE ||
- pMap->nWID == ATTR_CJK_FONT_LANGUAGE ||
- pMap->nWID == ATTR_CTL_FONT_LANGUAGE )
+ else if ( pEntry->nWID == ATTR_FONT_LANGUAGE ||
+ pEntry->nWID == ATTR_CJK_FONT_LANGUAGE ||
+ pEntry->nWID == ATTR_CTL_FONT_LANGUAGE )
{
// for getPropertyValue the PoolDefaults are sufficient,
// but setPropertyValue has to be handled differently
@@ -204,9 +204,9 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
LanguageType eLatin, eCjk, eCtl;
pDoc->GetLanguage( eLatin, eCjk, eCtl );
- if ( pMap->nWID == ATTR_CJK_FONT_LANGUAGE )
+ if ( pEntry->nWID == ATTR_CJK_FONT_LANGUAGE )
eCjk = eNew;
- else if ( pMap->nWID == ATTR_CTL_FONT_LANGUAGE )
+ else if ( pEntry->nWID == ATTR_CTL_FONT_LANGUAGE )
eCtl = eNew;
else
eLatin = eNew;
@@ -217,9 +217,9 @@ void SAL_CALL ScDocDefaultsObj::setPropertyValue(
else
{
ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
- SfxPoolItem* pNewItem = pPool->GetDefaultItem(pMap->nWID).Clone();
+ SfxPoolItem* pNewItem = pPool->GetDefaultItem(pEntry->nWID).Clone();
- if( !pNewItem->PutValue( aValue, pMap->nMemberId ) )
+ if( !pNewItem->PutValue( aValue, pEntry->nMemberId ) )
throw lang::IllegalArgumentException();
pPool->SetPoolDefaultItem( *pNewItem );
@@ -241,12 +241,11 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyValue( const rtl::OUString& aProp
throw uno::RuntimeException();
uno::Any aRet;
- const SfxItemPropertyMap* pMap =
- SfxItemPropertyMap::GetByName( lcl_GetDocDefaultsMap(), aPropertyName );
- if ( !pMap )
+ const SfxItemPropertySimpleEntry* pEntry = aPropertyMap.getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
- if (!pMap->nWID)
+ if (!pEntry->nWID)
{
if(aPropertyName.compareToAscii(SC_UNO_STANDARDDEC) == 0)
{
@@ -275,8 +274,8 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyValue( const rtl::OUString& aProp
else
{
ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
- const SfxPoolItem& rItem = pPool->GetDefaultItem( pMap->nWID );
- rItem.QueryValue( aRet, pMap->nMemberId );
+ const SfxPoolItem& rItem = pPool->GetDefaultItem( pEntry->nWID );
+ rItem.QueryValue( aRet, pEntry->nMemberId );
}
return aRet;
}
@@ -293,14 +292,13 @@ beans::PropertyState SAL_CALL ScDocDefaultsObj::getPropertyState( const rtl::OUS
if ( !pDocShell )
throw uno::RuntimeException();
- const SfxItemPropertyMap* pMap =
- SfxItemPropertyMap::GetByName( lcl_GetDocDefaultsMap(), aPropertyName );
- if ( !pMap )
+ const SfxItemPropertySimpleEntry* pEntry = aPropertyMap.getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
- USHORT nWID = pMap->nWID;
+ USHORT nWID = pEntry->nWID;
if ( nWID == ATTR_FONT || nWID == ATTR_CJK_FONT || nWID == ATTR_CTL_FONT || !nWID )
{
// static default for font is system-dependent,
@@ -343,15 +341,14 @@ void SAL_CALL ScDocDefaultsObj::setPropertyToDefault( const rtl::OUString& aProp
if ( !pDocShell )
throw uno::RuntimeException();
- const SfxItemPropertyMap* pMap =
- SfxItemPropertyMap::GetByName( lcl_GetDocDefaultsMap(), aPropertyName );
- if ( !pMap )
+ const SfxItemPropertySimpleEntry* pEntry = aPropertyMap.getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
- if (pMap->nWID)
+ if (pEntry->nWID)
{
ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
- pPool->ResetPoolDefaultItem( pMap->nWID );
+ pPool->ResetPoolDefaultItem( pEntry->nWID );
ItemsChanged();
}
@@ -368,18 +365,17 @@ uno::Any SAL_CALL ScDocDefaultsObj::getPropertyDefault( const rtl::OUString& aPr
if ( !pDocShell )
throw uno::RuntimeException();
- const SfxItemPropertyMap* pMap =
- SfxItemPropertyMap::GetByName( lcl_GetDocDefaultsMap(), aPropertyName );
- if ( !pMap )
+ const SfxItemPropertySimpleEntry* pEntry = aPropertyMap.getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
uno::Any aRet;
- if (pMap->nWID)
+ if (pEntry->nWID)
{
ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
- const SfxPoolItem* pItem = pPool->GetItem( pMap->nWID, SFX_ITEMS_STATICDEFAULT );
+ const SfxPoolItem* pItem = pPool->GetItem( pEntry->nWID, SFX_ITEMS_STATICDEFAULT );
if (pItem)
- pItem->QueryValue( aRet, pMap->nMemberId );
+ pItem->QueryValue( aRet, pEntry->nMemberId );
}
return aRet;
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a82319b7b6cd..c924205bdce5 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -104,39 +104,39 @@ using namespace com::sun::star;
// alles ohne Which-ID, Map nur fuer PropertySetInfo
//! umbenennen, sind nicht mehr nur Options
-const SfxItemPropertyMap* lcl_GetDocOptPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetDocOptPropertyMap()
{
- static SfxItemPropertyMap aDocOptPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aDocOptPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_APPLYFMDES), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_AREALINKS), 0, &getCppuType((uno::Reference<sheet::XAreaLinks>*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_AUTOCONTFOC), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_BASICLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
{MAP_CHAR_LEN(SC_UNO_DIALOGLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN), 0, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN), PROP_UNO_CALCASSHOWN, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_COLLABELRNG), 0, &getCppuType((uno::Reference<sheet::XLabelRanges>*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_DDELINKS), 0, &getCppuType((uno::Reference<container::XNameAccess>*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_DEFTABSTOP), 0, &getCppuType((sal_Int16*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_DEFTABSTOP), PROP_UNO_DEFTABSTOP, &getCppuType((sal_Int16*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_EXTERNALDOCLINKS), 0, &getCppuType((uno::Reference<sheet::XExternalDocLinks>*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_FORBIDDEN), 0, &getCppuType((uno::Reference<i18n::XForbiddenCharacters>*)0), beans::PropertyAttribute::READONLY, 0},
{MAP_CHAR_LEN(SC_UNO_HASDRAWPAGES), 0, &getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_IGNORECASE), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_ITERENABLED), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_ITERCOUNT), 0, &getCppuType((sal_Int32*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_ITEREPSILON), 0, &getCppuType((double*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_LOOKUPLABELS), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_MATCHWHOLE), 0, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_IGNORECASE), PROP_UNO_IGNORECASE, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_ITERENABLED), PROP_UNO_ITERENABLED, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_ITERCOUNT), PROP_UNO_ITERCOUNT, &getCppuType((sal_Int32*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_ITEREPSILON), PROP_UNO_ITEREPSILON, &getCppuType((double*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_LOOKUPLABELS), PROP_UNO_LOOKUPLABELS, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_MATCHWHOLE), PROP_UNO_MATCHWHOLE, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_NAMEDRANGES), 0, &getCppuType((uno::Reference<sheet::XNamedRanges>*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_DATABASERNG), 0, &getCppuType((uno::Reference<sheet::XDatabaseRanges>*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_NULLDATE), 0, &getCppuType((util::Date*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_NULLDATE), PROP_UNO_NULLDATE, &getCppuType((util::Date*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_ROWLABELRNG), 0, &getCppuType((uno::Reference<sheet::XLabelRanges>*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_SHEETLINKS), 0, &getCppuType((uno::Reference<container::XNameAccess>*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_SPELLONLINE), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_STANDARDDEC), 0, &getCppuType((sal_Int16*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_REGEXENABLED), 0, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_SPELLONLINE), PROP_UNO_SPELLONLINE, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_STANDARDDEC), PROP_UNO_STANDARDDEC, &getCppuType((sal_Int16*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_REGEXENABLED), PROP_UNO_REGEXENABLED, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_RUNTIMEUID), 0, &getCppuType(static_cast< const rtl::OUString * >(0)), beans::PropertyAttribute::READONLY, 0},
{MAP_CHAR_LEN(SC_UNO_HASVALIDSIGNATURES),0, &getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
{MAP_CHAR_LEN(SC_UNO_ISLOADED), 0, &getBooleanCppuType(), 0, 0},
@@ -154,9 +154,9 @@ const SfxItemPropertyMap* lcl_GetDocOptPropertyMap()
//! StandardDecimals als Property und vom NumberFormatter ????????
-const SfxItemPropertyMap* lcl_GetColumnsPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetColumnsPropertyMap()
{
- static SfxItemPropertyMap aColumnsPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aColumnsPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_MANPAGE), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_NEWPAGE), 0, &getBooleanCppuType(), 0, 0 },
@@ -168,9 +168,9 @@ const SfxItemPropertyMap* lcl_GetColumnsPropertyMap()
return aColumnsPropertyMap_Impl;
}
-const SfxItemPropertyMap* lcl_GetRowsPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetRowsPropertyMap()
{
- static SfxItemPropertyMap aRowsPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aRowsPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_CELLHGT), 0, &getCppuType((sal_Int32*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_CELLFILT), 0, &getBooleanCppuType(), 0, 0 },
@@ -180,7 +180,7 @@ const SfxItemPropertyMap* lcl_GetRowsPropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_CELLVIS), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
{MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
- // not sorted, not used with SfxItemPropertyMap::GetByName
+ // not sorted, not used with SfxItemPropertyMapEntry::GetByName
{0,0,0,0,0,0}
};
return aRowsPropertyMap_Impl;
@@ -271,10 +271,10 @@ SfxObjectShell* ScModelObj::GetEmbeddedObject() const
return pDocShell;
}
-void ScModelObj::UpdateAllRowHeights()
+void ScModelObj::UpdateAllRowHeights(const ScMarkData* pTabMark)
{
if (pDocShell)
- pDocShell->UpdateAllRowHeights();
+ pDocShell->UpdateAllRowHeights(pTabMark);
}
ScDrawLayer* ScModelObj::MakeDrawLayer()
@@ -1330,7 +1330,7 @@ void SAL_CALL ScModelObj::setPropertyValue(
const ScDocOptions& rOldOpt = pDoc->GetDocOptions();
ScDocOptions aNewOpt = rOldOpt;
- BOOL bOpt = ScDocOptionsHelper::setPropertyValue( aNewOpt, aPropertyName, aValue );
+ BOOL bOpt = ScDocOptionsHelper::setPropertyValue( aNewOpt, *aPropSet.getPropertyMap(), aPropertyName, aValue );
if (bOpt)
{
// done...
@@ -1402,14 +1402,13 @@ void SAL_CALL ScModelObj::setPropertyValue(
}
else if ( aString.EqualsAscii( SC_UNO_ISADJUSTHEIGHTENABLED ) )
{
+ bool bOldAdjustHeightEnabled = pDoc->IsAdjustHeightEnabled();
bool bAdjustHeightEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- pDoc->EnableAdjustHeight( bAdjustHeightEnabled );
- if ( bAdjustHeightEnabled )
+ if( bOldAdjustHeightEnabled != bAdjustHeightEnabled )
{
- for ( SCTAB nTab = 0; nTab < pDoc->GetTableCount(); ++nTab )
- {
- pDocShell->AdjustRowHeight( 0, MAXROW, nTab );
- }
+ pDoc->EnableAdjustHeight( bAdjustHeightEnabled );
+ if( bAdjustHeightEnabled )
+ pDocShell->UpdateAllRowHeights();
}
}
else if ( aString.EqualsAscii( SC_UNO_ISEXECUTELINKENABLED ) )
@@ -1457,7 +1456,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
{
ScDocument* pDoc = pDocShell->GetDocument();
const ScDocOptions& rOpt = pDoc->GetDocOptions();
- aRet = ScDocOptionsHelper::getPropertyValue( rOpt, aPropertyName );
+ aRet = ScDocOptionsHelper::getPropertyValue( rOpt, *aPropSet.getPropertyMap(), aPropertyName );
if ( aRet.hasValue() )
{
// done...
@@ -2792,7 +2791,26 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
nRowArr[1] = nEndRow;
String aNameString(aPropertyName);
- if ( aNameString.EqualsAscii( SC_UNONAME_CELLHGT ) )
+ if ( aNameString.EqualsAscii( SC_UNONAME_OHEIGHT ) )
+ {
+ sal_Int32 nNewHeight = 0;
+ if ( pDoc->IsImportingXML() && ( aValue >>= nNewHeight ) )
+ {
+ // used to set the stored row height for rows with optimal height when loading
+ pDoc->SetRowHeightRange( nStartRow, nEndRow, nTab, (USHORT)HMMToTwips(nNewHeight) );
+ }
+ else
+ {
+ BOOL bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
+ if (bOpt)
+ aFunc.SetWidthOrHeight( FALSE, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, TRUE, TRUE );
+ else
+ {
+ //! manually set old heights again?
+ }
+ }
+ }
+ else if ( aNameString.EqualsAscii( SC_UNONAME_CELLHGT ) )
{
sal_Int32 nNewHeight = 0;
if ( aValue >>= nNewHeight )
@@ -2814,16 +2832,6 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
else
pDoc->GetRowFlagsArrayModifiable( nTab).AndValue( nStartRow, nEndRow, sal::static_int_cast<BYTE>(~CR_FILTERED) );
}
- else if ( aNameString.EqualsAscii( SC_UNONAME_OHEIGHT ) )
- {
- BOOL bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
- if (bOpt)
- aFunc.SetWidthOrHeight( FALSE, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, TRUE, TRUE );
- else
- {
- //! manually set old heights again?
- }
- }
else if ( aNameString.EqualsAscii( SC_UNONAME_NEWPAGE) || aNameString.EqualsAscii( SC_UNONAME_MANPAGE) )
{
//! single function to set/remove all breaks?
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index 80f77998fe44..476409fa5113 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -51,6 +51,7 @@
#include "unoguard.hxx"
#include "drwlayer.hxx"
#include "userdat.hxx"
+#include "postit.hxx"
#include "AccessibleText.hxx"
//------------------------------------------------------------------------
@@ -223,7 +224,7 @@ SvxEditSource* ScAnnotationEditSource::Clone() const
SdrObject* ScAnnotationEditSource::GetCaptionObj()
{
ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos );
- return pNote ? pNote->GetCaption() : 0;
+ return pNote ? pNote->GetOrCreateCaption( aCellPos ) : 0;
}
SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder()
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 9127de05316e..94078ff91af4 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -63,9 +63,9 @@ using namespace com::sun::star;
// alles ohne Which-ID, Map nur fuer PropertySetInfo
-const SfxItemPropertyMap* lcl_GetURLPropertyMap()
+const SfxItemPropertySet* lcl_GetURLPropertySet()
{
- static SfxItemPropertyMap aURLPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aURLPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ANCTYPE), 0, &getCppuType((text::TextContentAnchorType*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ANCTYPES), 0, &getCppuType((uno::Sequence<text::TextContentAnchorType>*)0), beans::PropertyAttribute::READONLY, 0 },
@@ -75,24 +75,26 @@ const SfxItemPropertyMap* lcl_GetURLPropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_URL), 0, &getCppuType((rtl::OUString*)0), 0, 0},
{0,0,0,0,0,0}
};
- return aURLPropertyMap_Impl;
+ static SfxItemPropertySet aURLPropertySet_Impl( aURLPropertyMap_Impl );
+ return &aURLPropertySet_Impl;
}
-const SfxItemPropertyMap* lcl_GetHeaderFieldPropertyMap()
+const SfxItemPropertySet* lcl_GetHeaderFieldPropertySet()
{
- static SfxItemPropertyMap aHeaderFieldPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aHeaderFieldPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ANCTYPE), 0, &getCppuType((text::TextContentAnchorType*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ANCTYPES), 0, &getCppuType((uno::Sequence<text::TextContentAnchorType>*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_TEXTWRAP), 0, &getCppuType((text::WrapTextMode*)0), beans::PropertyAttribute::READONLY, 0 },
{0,0,0,0,0,0}
};
- return aHeaderFieldPropertyMap_Impl;
+ static SfxItemPropertySet aHeaderFieldPropertySet_Impl( aHeaderFieldPropertyMap_Impl );
+ return &aHeaderFieldPropertySet_Impl;
}
-const SfxItemPropertyMap* lcl_GetFileFieldPropertyMap()
+const SfxItemPropertySet* lcl_GetFileFieldPropertySet()
{
- static SfxItemPropertyMap aFileFieldPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aFileFieldPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ANCTYPE), 0, &getCppuType((text::TextContentAnchorType*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNONAME_ANCTYPES), 0, &getCppuType((uno::Sequence<text::TextContentAnchorType>*)0), beans::PropertyAttribute::READONLY, 0 },
@@ -100,7 +102,8 @@ const SfxItemPropertyMap* lcl_GetFileFieldPropertyMap()
{MAP_CHAR_LEN(SC_UNONAME_TEXTWRAP), 0, &getCppuType((text::WrapTextMode*)0), beans::PropertyAttribute::READONLY, 0 },
{0,0,0,0,0,0}
};
- return aFileFieldPropertyMap_Impl;
+ static SfxItemPropertySet aFileFieldPropertySet_Impl( aFileFieldPropertyMap_Impl );
+ return &aFileFieldPropertySet_Impl;
}
//------------------------------------------------------------------------
@@ -443,7 +446,7 @@ void SAL_CALL ScCellFieldsObj::removeRefreshListener( const uno::Reference<util:
ScCellFieldObj::ScCellFieldObj(ScDocShell* pDocSh, const ScAddress& rPos,
const ESelection& rSel) :
OComponentHelper( getMutex() ),
- aPropSet( lcl_GetURLPropertyMap() ),
+ pPropSet( lcl_GetURLPropertySet() ),
pDocShell( pDocSh ),
aCellPos( rPos ),
aSelection( rSel )
@@ -674,8 +677,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellFieldObj::getPropertySetI
throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
+ static uno::Reference<beans::XPropertySetInfo> aRef = pPropSet->getPropertySetInfo();
return aRef;
}
@@ -1129,7 +1131,7 @@ sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue )
ScHeaderFieldObj::ScHeaderFieldObj(ScHeaderFooterContentObj* pContent, USHORT nP,
USHORT nT, const ESelection& rSel) :
OComponentHelper( getMutex() ),
- aPropSet( (nT == SC_SERVICE_FILEFIELD) ? lcl_GetFileFieldPropertyMap() : lcl_GetHeaderFieldPropertyMap() ),
+ pPropSet( (nT == SC_SERVICE_FILEFIELD) ? lcl_GetFileFieldPropertySet() : lcl_GetHeaderFieldPropertySet() ),
pContentObj( pContent ),
nPart( nP ),
nType( nT ),
@@ -1381,14 +1383,12 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScHeaderFieldObj::getPropertySe
if (nType == SC_SERVICE_FILEFIELD)
{
// file field has different properties
- static uno::Reference<beans::XPropertySetInfo> aFileFieldInfo(
- new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
+ static uno::Reference<beans::XPropertySetInfo> aFileFieldInfo = pPropSet->getPropertySetInfo();
return aFileFieldInfo;
}
else
{
- static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
+ static uno::Reference<beans::XPropertySetInfo> aRef = pPropSet->getPropertySetInfo();
return aRef;
}
}
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index 79221cb153a0..f9407b544f76 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -42,7 +42,6 @@
#include "fmtuno.hxx"
#include "miscuno.hxx"
-#include "conditio.hxx"
#include "validat.hxx"
#include "document.hxx"
#include "unoguard.hxx"
@@ -51,15 +50,16 @@
#include "tokenarray.hxx"
#include "tokenuno.hxx"
-using namespace com::sun::star;
+using namespace ::com::sun::star;
+using namespace ::formula;
//------------------------------------------------------------------------
// Map nur fuer PropertySetInfo
-const SfxItemPropertyMap* lcl_GetValidatePropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetValidatePropertyMap()
{
- static SfxItemPropertyMap aValidatePropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aValidatePropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ERRALSTY), 0, &getCppuType((sheet::ValidationAlertStyle*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNONAME_ERRMESS), 0, &getCppuType((rtl::OUString*)0), 0, 0},
@@ -130,12 +130,17 @@ ScConditionMode lcl_ConditionOperatorToMode( sheet::ConditionOperator eOper )
//------------------------------------------------------------------------
-//UNUSED2008-05 ScTableConditionalFormat::ScTableConditionalFormat()
-//UNUSED2008-05 {
-//UNUSED2008-05 }
+ScCondFormatEntryItem::ScCondFormatEntryItem() :
+ meGrammar1( FormulaGrammar::GRAM_UNSPECIFIED ),
+ meGrammar2( FormulaGrammar::GRAM_UNSPECIFIED ),
+ meMode( SC_COND_NONE )
+{
+}
+
+//------------------------------------------------------------------------
-ScTableConditionalFormat::ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
- const formula::FormulaGrammar::Grammar eGrammar)
+ScTableConditionalFormat::ScTableConditionalFormat(
+ ScDocument* pDoc, ULONG nKey, FormulaGrammar::Grammar eGrammar)
{
// Eintrag aus dem Dokument lesen...
@@ -156,11 +161,11 @@ ScTableConditionalFormat::ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
{
ScCondFormatEntryItem aItem;
const ScCondFormatEntry* pFormatEntry = pFormat->GetEntry(i);
- aItem.mnMode = sal::static_int_cast<USHORT>(pFormatEntry->GetOperation());
+ aItem.meMode = pFormatEntry->GetOperation();
aItem.maPos = pFormatEntry->GetValidSrcPos();
aItem.maExpr1 = pFormatEntry->GetExpression(aItem.maPos, 0, 0, eGrammar);
aItem.maExpr2 = pFormatEntry->GetExpression(aItem.maPos, 1, 0, eGrammar);
- aItem.meGrammar = eGrammar;
+ aItem.meGrammar1 = aItem.meGrammar2 = eGrammar;
aItem.maStyle = pFormatEntry->GetStyle();
AddEntry_Impl(aItem);
@@ -170,8 +175,20 @@ ScTableConditionalFormat::ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey,
}
}
+namespace {
+
+FormulaGrammar::Grammar lclResolveGrammar( FormulaGrammar::Grammar eExtGrammar, FormulaGrammar::Grammar eIntGrammar )
+{
+ if( eExtGrammar != FormulaGrammar::GRAM_UNSPECIFIED )
+ return eExtGrammar;
+ OSL_ENSURE( eIntGrammar != FormulaGrammar::GRAM_UNSPECIFIED, "lclResolveGrammar - unspecified grammar, using GRAM_PODF_A1" );
+ return (eIntGrammar == FormulaGrammar::GRAM_UNSPECIFIED) ? FormulaGrammar::GRAM_PODF_A1 : eIntGrammar;
+}
+
+} // namespace
+
void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat,
- ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar ) const
+ ScDocument* pDoc, FormulaGrammar::Grammar eGrammar) const
{
// ScConditionalFormat = Core-Struktur, muss leer sein
@@ -185,15 +202,12 @@ void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat,
ScCondFormatEntryItem aData;
pEntry->GetData(aData);
- if (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED)
- eGrammar = aData.meGrammar;
- if (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED)
- {
- DBG_ERRORFILE("FillFormat: unspecified grammar, using GRAM_PODF_A1");
- eGrammar = formula::FormulaGrammar::GRAM_PODF_A1;
- }
- ScCondFormatEntry aCoreEntry( static_cast<ScConditionMode>(aData.mnMode),
- aData.maExpr1, aData.maExpr2, pDoc, aData.maPos, aData.maStyle, eGrammar );
+
+ FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar, aData.meGrammar1 );
+ FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar, aData.meGrammar2 );
+
+ ScCondFormatEntry aCoreEntry( aData.meMode, aData.maExpr1, aData.maExpr2,
+ pDoc, aData.maPos, aData.maStyle, aData.maExprNmsp1, aData.maExprNmsp2, eGrammar1, eGrammar2 );
if ( aData.maPosStr.Len() )
aCoreEntry.SetSrcString( aData.maPosStr );
@@ -248,69 +262,86 @@ void SAL_CALL ScTableConditionalFormat::addNew(
{
ScUnoGuard aGuard;
ScCondFormatEntryItem aEntry;
- aEntry.mnMode = sal::static_int_cast<USHORT>(SC_COND_NONE);
+ aEntry.meMode = SC_COND_NONE;
const beans::PropertyValue* pPropArray = aConditionalEntry.getConstArray();
long nPropCount = aConditionalEntry.getLength();
for (long i = 0; i < nPropCount; i++)
{
const beans::PropertyValue& rProp = pPropArray[i];
- String aPropName(rProp.Name);
- if ( aPropName.EqualsAscii( SC_UNONAME_OPERATOR ) )
+ if ( rProp.Name.equalsAscii( SC_UNONAME_OPERATOR ) )
{
sheet::ConditionOperator eOper = (sheet::ConditionOperator)
ScUnoHelpFunctions::GetEnumFromAny( rProp.Value );
- aEntry.mnMode = sal::static_int_cast<USHORT>(lcl_ConditionOperatorToMode( eOper ));
+ aEntry.meMode = lcl_ConditionOperatorToMode( eOper );
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_FORMULA1 ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULA1 ) )
{
rtl::OUString aStrVal;
uno::Sequence<sheet::FormulaToken> aTokens;
if ( rProp.Value >>= aStrVal )
- aEntry.maExpr1 = String( aStrVal );
+ aEntry.maExpr1 = aStrVal;
else if ( rProp.Value >>= aTokens )
{
aEntry.maExpr1.Erase();
aEntry.maTokens1 = aTokens;
}
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_FORMULA2 ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULA2 ) )
{
rtl::OUString aStrVal;
uno::Sequence<sheet::FormulaToken> aTokens;
if ( rProp.Value >>= aStrVal )
- aEntry.maExpr2 = String( aStrVal );
+ aEntry.maExpr2 = aStrVal;
else if ( rProp.Value >>= aTokens )
{
aEntry.maExpr2.Erase();
aEntry.maTokens2 = aTokens;
}
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_SOURCEPOS ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_SOURCEPOS ) )
{
table::CellAddress aAddress;
if ( rProp.Value >>= aAddress )
aEntry.maPos = ScAddress( (SCCOL)aAddress.Column, (SCROW)aAddress.Row, aAddress.Sheet );
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_SOURCESTR ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_SOURCESTR ) )
{
rtl::OUString aStrVal;
if ( rProp.Value >>= aStrVal )
aEntry.maPosStr = String( aStrVal );
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_STYLENAME ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_STYLENAME ) )
{
rtl::OUString aStrVal;
if ( rProp.Value >>= aStrVal )
aEntry.maStyle = ScStyleNameConversion::ProgrammaticToDisplayName(
aStrVal, SFX_STYLE_FAMILY_PARA );
}
- else if ( aPropName.EqualsAscii( SC_UNONAME_GRAMMAR ) )
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULANMSP1 ) )
+ {
+ rtl::OUString aStrVal;
+ if ( rProp.Value >>= aStrVal )
+ aEntry.maExprNmsp1 = aStrVal;
+ }
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULANMSP2 ) )
+ {
+ rtl::OUString aStrVal;
+ if ( rProp.Value >>= aStrVal )
+ aEntry.maExprNmsp2 = aStrVal;
+ }
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_GRAMMAR1 ) )
{
sal_Int32 nVal = 0;
if ( rProp.Value >>= nVal )
- aEntry.meGrammar = static_cast<formula::FormulaGrammar::Grammar>(nVal);
+ aEntry.meGrammar1 = static_cast< FormulaGrammar::Grammar >( nVal );
+ }
+ else if ( rProp.Name.equalsAscii( SC_UNONAME_GRAMMAR2 ) )
+ {
+ sal_Int32 nVal = 0;
+ if ( rProp.Value >>= nVal )
+ aEntry.meGrammar2 = static_cast< FormulaGrammar::Grammar >( nVal );
}
else
{
@@ -523,14 +554,14 @@ sheet::ConditionOperator SAL_CALL ScTableConditionalEntry::getOperator()
throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- return lcl_ConditionModeToOperator( static_cast<ScConditionMode>(aData.mnMode) );
+ return lcl_ConditionModeToOperator( aData.meMode );
}
void SAL_CALL ScTableConditionalEntry::setOperator( sheet::ConditionOperator nOperator )
throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- aData.mnMode = sal::static_int_cast<USHORT>( lcl_ConditionOperatorToMode( nOperator ) );
+ aData.meMode = lcl_ConditionOperatorToMode( nOperator );
if (pParent)
pParent->DataChanged();
}
@@ -619,7 +650,7 @@ ScTableValidationObj::ScTableValidationObj(ScDocument* pDoc, ULONG nKey,
aSrcPos = pData->GetValidSrcPos(); // #b4974740# valid pos for expressions
aExpr1 = pData->GetExpression( aSrcPos, 0, 0, eGrammar );
aExpr2 = pData->GetExpression( aSrcPos, 1, 0, eGrammar );
- meGrammar = eGrammar;
+ meGrammar1 = meGrammar2 = eGrammar;
nValMode = sal::static_int_cast<USHORT>( pData->GetDataMode() );
bIgnoreBlank = pData->IsIgnoreBlank();
nShowList = pData->GetListType();
@@ -647,18 +678,14 @@ ScValidationData* ScTableValidationObj::CreateValidationData( ScDocument* pDoc,
{
// ScValidationData = Core-Struktur
- if (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED)
- eGrammar = meGrammar;
- if (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED)
- {
- DBG_ERRORFILE("CreateValidationData: unspecified grammar, using GRAM_PODF_A1");
- eGrammar = formula::FormulaGrammar::GRAM_PODF_A1;
- }
+ FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar, meGrammar1 );
+ FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar, meGrammar2 );
ScValidationData* pRet = new ScValidationData( (ScValidationMode)nValMode,
(ScConditionMode)nMode,
aExpr1, aExpr2, pDoc, aSrcPos,
- eGrammar );
+ maExprNmsp1, maExprNmsp2,
+ eGrammar1, eGrammar2 );
pRet->SetIgnoreBlank(bIgnoreBlank);
pRet->SetListType(nShowList);
@@ -702,7 +729,9 @@ void ScTableValidationObj::ClearData_Impl()
aSrcPos.Set(0,0,0);
aExpr1.Erase();
aExpr2.Erase();
- meGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED; // will be overriden when needed
+ maExprNmsp1.Erase();
+ maExprNmsp2.Erase();
+ meGrammar1 = meGrammar2 = FormulaGrammar::GRAM_UNSPECIFIED; // will be overriden when needed
aInputTitle.Erase();
aInputMessage.Erase();
aErrorTitle.Erase();
@@ -905,13 +934,37 @@ void SAL_CALL ScTableValidationObj::setPropertyValue(
if ( aValue >>= aStrVal )
aPosString = String( aStrVal );
}
- else if ( aString.EqualsAscii( SC_UNONAME_GRAMMAR ) )
+ else if ( aString.EqualsAscii( SC_UNONAME_FORMULANMSP1 ) )
+ {
+ // internal - only for XML filter, not in PropertySetInfo, only set
+
+ rtl::OUString aStrVal;
+ if ( aValue >>= aStrVal )
+ maExprNmsp1 = aStrVal;
+ }
+ else if ( aString.EqualsAscii( SC_UNONAME_FORMULANMSP2 ) )
+ {
+ // internal - only for XML filter, not in PropertySetInfo, only set
+
+ rtl::OUString aStrVal;
+ if ( aValue >>= aStrVal )
+ maExprNmsp2 = aStrVal;
+ }
+ else if ( aString.EqualsAscii( SC_UNONAME_GRAMMAR1 ) )
+ {
+ // internal - only for XML filter, not in PropertySetInfo, only set
+
+ sal_Int32 nVal = 0;
+ if ( aValue >>= nVal )
+ meGrammar1 = static_cast< FormulaGrammar::Grammar >(nVal);
+ }
+ else if ( aString.EqualsAscii( SC_UNONAME_GRAMMAR2 ) )
{
// internal - only for XML filter, not in PropertySetInfo, only set
sal_Int32 nVal = 0;
if ( aValue >>= nVal )
- meGrammar = static_cast<formula::FormulaGrammar::Grammar>(nVal);
+ meGrammar2 = static_cast< FormulaGrammar::Grammar >(nVal);
}
DataChanged();
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 8e56ceedf616..1d9f3a1d9213 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -51,7 +51,7 @@
#include "cell.hxx"
#include "docoptio.hxx"
#include "optuno.hxx"
-
+#include <docuno.hxx>
// for lcl_CopyData:
#include "markdata.hxx"
#include "patattr.hxx"
@@ -201,6 +201,7 @@ BOOL lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange,
ScFunctionAccess::ScFunctionAccess() :
pOptions( NULL ),
+ aPropertyMap( ScDocOptionsHelper::GetPropertyMap() ),
bInvalid( FALSE )
{
StartListening( *SFX_APP() ); // for SFX_HINT_DEINITIALIZING
@@ -278,7 +279,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScFunctionAccess::getPropertySe
{
ScUnoGuard aGuard;
static uno::Reference<beans::XPropertySetInfo> aRef(
- new SfxItemPropertySetInfo( ScDocOptionsHelper::GetPropertyMap() ));
+ new SfxItemPropertySetInfo( &aPropertyMap ));
return aRef;
}
@@ -295,7 +296,7 @@ void SAL_CALL ScFunctionAccess::setPropertyValue(
// options aren't initialized from configuration - always get the same default behaviour
- BOOL bDone = ScDocOptionsHelper::setPropertyValue( *pOptions, aPropertyName, aValue );
+ BOOL bDone = ScDocOptionsHelper::setPropertyValue( *pOptions, aPropertyMap, aPropertyName, aValue );
if (!bDone)
throw beans::UnknownPropertyException();
}
@@ -311,7 +312,7 @@ uno::Any SAL_CALL ScFunctionAccess::getPropertyValue( const rtl::OUString& aProp
// options aren't initialized from configuration - always get the same default behaviour
- return ScDocOptionsHelper::getPropertyValue( *pOptions, aPropertyName );
+ return ScDocOptionsHelper::getPropertyValue( *pOptions, aPropertyMap, aPropertyName );
}
SC_IMPL_DUMMY_PROPERTY_LISTENER( ScFunctionAccess )
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index d4573d408397..0a07b057740b 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -68,9 +68,9 @@ using ::std::vector;
//------------------------------------------------------------------------
// fuer Sheet- und Area-Links benutzt:
-const SfxItemPropertyMap* lcl_GetSheetLinkMap()
+const SfxItemPropertyMapEntry* lcl_GetSheetLinkMap()
{
- static SfxItemPropertyMap aSheetLinkMap_Impl[] =
+ static SfxItemPropertyMapEntry aSheetLinkMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_FILTER), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_FILTOPT), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 823a088ba3d3..536e1f2a1a65 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -60,9 +60,9 @@ using namespace ::com::sun::star;
//------------------------------------------------------------------------
-const SfxItemPropertyMap* lcl_GetNamedRangeMap()
+const SfxItemPropertyMapEntry* lcl_GetNamedRangeMap()
{
- static SfxItemPropertyMap aNamedRangeMap_Impl[] =
+ static SfxItemPropertyMapEntry aNamedRangeMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_LINKDISPBIT), 0, &getCppuType((uno::Reference<awt::XBitmap>*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNO_LINKDISPNAME), 0, &getCppuType((rtl::OUString*)0), beans::PropertyAttribute::READONLY, 0 },
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index b7d836007935..e44dab865d46 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: notesuno.cxx,v $
- * $Revision: 1.11.128.4 $
+ * $Revision: 1.11 $
*
* This file is part of OpenOffice.org.
*
@@ -64,13 +64,14 @@ using namespace com::sun::star;
//------------------------------------------------------------------------
// keine Properties fuer Text in Notizen
-const SfxItemPropertyMap* lcl_GetAnnotationPropertyMap()
+const SvxItemPropertySet* lcl_GetAnnotationPropertySet()
{
- static SfxItemPropertyMap aAnnotationPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aAnnotationPropertyMap_Impl[] =
{
{0,0,0,0,0,0}
};
- return aAnnotationPropertyMap_Impl;
+ static SvxItemPropertySet aAnnotationPropertySet_Impl( aAnnotationPropertyMap_Impl );
+ return &aAnnotationPropertySet_Impl;
}
//------------------------------------------------------------------------
@@ -219,14 +220,14 @@ rtl::OUString SAL_CALL ScAnnotationObj::getAuthor() throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
const ScPostIt* pNote = ImplGetNote();
- return pNote ? pNote->GetAuthor() : EMPTY_STRING;
+ return pNote ? pNote->GetAuthor() : rtl::OUString();
}
rtl::OUString SAL_CALL ScAnnotationObj::getDate() throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
const ScPostIt* pNote = ImplGetNote();
- return pNote ? pNote->GetDate() : EMPTY_STRING;
+ return pNote ? pNote->GetDate() : rtl::OUString();
}
sal_Bool SAL_CALL ScAnnotationObj::getIsVisible() throw(uno::RuntimeException)
@@ -257,7 +258,7 @@ SvxUnoText& ScAnnotationObj::GetUnoText()
if (!pUnoText)
{
ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
- pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertyMap(),
+ pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(),
uno::Reference<text::XText>() );
pUnoText->acquire();
}
@@ -268,7 +269,6 @@ const ScPostIt* ScAnnotationObj::ImplGetNote() const
{
return pDocShell ? pDocShell->GetDocument()->GetNote( aCellPos ) : 0;
}
-
//------------------------------------------------------------------------
ScAnnotationShapeObj::ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos) :
@@ -287,7 +287,7 @@ SvxUnoText& ScAnnotationShapeObj::GetUnoText()
if (!pUnoText)
{
ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
- pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertyMap(),
+ pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(),
uno::Reference<text::XText>() );
pUnoText->acquire();
}
@@ -298,7 +298,7 @@ uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape()
{
if (!xShape.is())
if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) )
- if( SdrObject* pCaption = pNote->GetCaption() )
+ if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) )
xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
return xShape;
}
diff --git a/sc/source/ui/unoobj/optuno.cxx b/sc/source/ui/unoobj/optuno.cxx
index bc2a11f0105d..8c3deefba6d5 100644
--- a/sc/source/ui/unoobj/optuno.cxx
+++ b/sc/source/ui/unoobj/optuno.cxx
@@ -46,24 +46,23 @@
using namespace com::sun::star;
//------------------------------------------------------------------------
-
// static
-const SfxItemPropertyMap* ScDocOptionsHelper::GetPropertyMap()
+const SfxItemPropertyMapEntry* ScDocOptionsHelper::GetPropertyMap()
{
- static SfxItemPropertyMap aMap[] =
+ static SfxItemPropertyMapEntry aMap[] =
{
- {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_DEFTABSTOP), 0, &getCppuType((sal_Int16*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_IGNORECASE), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_ITERENABLED), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_ITERCOUNT), 0, &getCppuType((sal_Int32*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_ITEREPSILON), 0, &getCppuType((double*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_LOOKUPLABELS), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_MATCHWHOLE), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_NULLDATE), 0, &getCppuType((util::Date*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_SPELLONLINE), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_STANDARDDEC), 0, &getCppuType((sal_Int16*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_REGEXENABLED), 0, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN), PROP_UNO_CALCASSHOWN , &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_DEFTABSTOP), PROP_UNO_DEFTABSTOP , &getCppuType((sal_Int16*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_IGNORECASE), PROP_UNO_IGNORECASE , &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_ITERENABLED), PROP_UNO_ITERENABLED , &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_ITERCOUNT), PROP_UNO_ITERCOUNT , &getCppuType((sal_Int32*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_ITEREPSILON), PROP_UNO_ITEREPSILON , &getCppuType((double*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_LOOKUPLABELS), PROP_UNO_LOOKUPLABELS, &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_MATCHWHOLE), PROP_UNO_MATCHWHOLE , &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_NULLDATE), PROP_UNO_NULLDATE , &getCppuType((util::Date*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_SPELLONLINE), PROP_UNO_SPELLONLINE , &getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_STANDARDDEC), PROP_UNO_STANDARDDEC , &getCppuType((sal_Int16*)0), 0, 0},
+ {MAP_CHAR_LEN(SC_UNO_REGEXENABLED), PROP_UNO_REGEXENABLED, &getBooleanCppuType(), 0, 0},
{0,0,0,0,0,0}
};
return aMap;
@@ -71,102 +70,132 @@ const SfxItemPropertyMap* ScDocOptionsHelper::GetPropertyMap()
// static
sal_Bool ScDocOptionsHelper::setPropertyValue( ScDocOptions& rOptions,
+ const SfxItemPropertyMap& rPropMap,
const rtl::OUString& aPropertyName, const uno::Any& aValue )
{
//! use map (with new identifiers)
- sal_Bool bKnown = sal_True;
- String aString(aPropertyName);
-
- if ( aString.EqualsAscii( SC_UNO_CALCASSHOWN ) )
- rOptions.SetCalcAsShown( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aString.EqualsAscii( SC_UNO_IGNORECASE ) )
- rOptions.SetIgnoreCase( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aString.EqualsAscii( SC_UNO_ITERENABLED ) )
- rOptions.SetIter( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aString.EqualsAscii( SC_UNO_REGEXENABLED ) )
- rOptions.SetFormulaRegexEnabled( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aString.EqualsAscii( SC_UNO_LOOKUPLABELS ) )
- rOptions.SetLookUpColRowNames( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aString.EqualsAscii( SC_UNO_MATCHWHOLE ) )
- rOptions.SetMatchWholeCell( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aString.EqualsAscii( SC_UNO_SPELLONLINE ) )
- rOptions.SetAutoSpell( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
- else if ( aString.EqualsAscii( SC_UNO_DEFTABSTOP ) )
- {
- sal_Int16 nIntVal = 0;
- if ( aValue >>= nIntVal )
- rOptions.SetTabDistance( nIntVal );
- }
- else if ( aString.EqualsAscii( SC_UNO_ITERCOUNT ) )
- {
- sal_Int32 nIntVal = 0;
- if ( aValue >>= nIntVal )
- rOptions.SetIterCount( (USHORT)nIntVal );
- }
- else if ( aString.EqualsAscii( SC_UNO_STANDARDDEC ) )
- {
- sal_Int16 nIntVal = 0;
- if ( aValue >>= nIntVal )
- rOptions.SetStdPrecision( nIntVal );
- }
- else if ( aString.EqualsAscii( SC_UNO_ITEREPSILON ) )
- {
- double fDoubleVal = 0;
- if ( aValue >>= fDoubleVal )
- rOptions.SetIterEps( fDoubleVal );
- }
- else if ( aString.EqualsAscii( SC_UNO_NULLDATE ) )
+ const SfxItemPropertySimpleEntry* pEntry = rPropMap.getByName(aPropertyName );
+ if( !pEntry || !pEntry->nWID )
+ return sal_False;
+ switch( pEntry->nWID )
{
- util::Date aDate;
- if ( aValue >>= aDate )
- rOptions.SetDate( aDate.Day, aDate.Month, aDate.Year );
+ case PROP_UNO_CALCASSHOWN :
+ rOptions.SetCalcAsShown( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ break;
+ case PROP_UNO_DEFTABSTOP :
+ {
+ sal_Int16 nIntVal = 0;
+ if ( aValue >>= nIntVal )
+ rOptions.SetTabDistance( nIntVal );
+ }
+ break;
+ case PROP_UNO_IGNORECASE :
+ rOptions.SetIgnoreCase( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ break;
+ case PROP_UNO_ITERENABLED:
+ rOptions.SetIter( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ break;
+ case PROP_UNO_ITERCOUNT :
+ {
+ sal_Int32 nIntVal = 0;
+ if ( aValue >>= nIntVal )
+ rOptions.SetIterCount( (USHORT)nIntVal );
+ }
+ break;
+ case PROP_UNO_ITEREPSILON :
+ {
+ double fDoubleVal = 0;
+ if ( aValue >>= fDoubleVal )
+ rOptions.SetIterEps( fDoubleVal );
+ }
+ break;
+ case PROP_UNO_LOOKUPLABELS :
+ rOptions.SetLookUpColRowNames( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ break;
+ case PROP_UNO_MATCHWHOLE :
+ rOptions.SetMatchWholeCell( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ break;
+ case PROP_UNO_NULLDATE:
+ {
+ util::Date aDate;
+ if ( aValue >>= aDate )
+ rOptions.SetDate( aDate.Day, aDate.Month, aDate.Year );
+ }
+ break;
+ case PROP_UNO_SPELLONLINE:
+ rOptions.SetAutoSpell( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ break;
+ case PROP_UNO_STANDARDDEC:
+ {
+ sal_Int16 nIntVal = 0;
+ if ( aValue >>= nIntVal )
+ rOptions.SetStdPrecision( nIntVal );
+ }
+ break;
+ case PROP_UNO_REGEXENABLED:
+ rOptions.SetFormulaRegexEnabled( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ break;
+ default:;
}
- else
- bKnown = sal_False;
-
- return bKnown;
+ return sal_True;
}
// static
uno::Any ScDocOptionsHelper::getPropertyValue(
- const ScDocOptions& rOptions, const rtl::OUString& aPropertyName )
+ const ScDocOptions& rOptions,
+ const SfxItemPropertyMap& rPropMap,
+ const rtl::OUString& aPropertyName )
{
- //! use map (with new identifiers)
-
- String aString(aPropertyName);
uno::Any aRet;
-
- if ( aString.EqualsAscii( SC_UNO_CALCASSHOWN ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsCalcAsShown() );
- else if ( aString.EqualsAscii( SC_UNO_IGNORECASE ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsIgnoreCase() );
- else if ( aString.EqualsAscii( SC_UNO_ITERENABLED ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsIter() );
- else if ( aString.EqualsAscii( SC_UNO_REGEXENABLED ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsFormulaRegexEnabled() );
- else if ( aString.EqualsAscii( SC_UNO_LOOKUPLABELS ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsLookUpColRowNames() );
- else if ( aString.EqualsAscii( SC_UNO_MATCHWHOLE ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsMatchWholeCell() );
- else if ( aString.EqualsAscii( SC_UNO_SPELLONLINE ) )
- ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsAutoSpell() );
- else if ( aString.EqualsAscii( SC_UNO_DEFTABSTOP ) )
- aRet <<= (sal_Int16)( rOptions.GetTabDistance() );
- else if ( aString.EqualsAscii( SC_UNO_ITERCOUNT ) )
- aRet <<= (sal_Int32)( rOptions.GetIterCount() );
- else if ( aString.EqualsAscii( SC_UNO_STANDARDDEC ) )
- aRet <<= (sal_Int16)( rOptions.GetStdPrecision() );
- else if ( aString.EqualsAscii( SC_UNO_ITEREPSILON ) )
- aRet <<= (double)( rOptions.GetIterEps() );
- else if ( aString.EqualsAscii( SC_UNO_NULLDATE ) )
+ const SfxItemPropertySimpleEntry* pEntry = rPropMap.getByName( aPropertyName );
+ if( !pEntry || !pEntry->nWID )
+ return aRet;
+ switch( pEntry->nWID )
{
- USHORT nD, nM, nY;
- rOptions.GetDate( nD, nM, nY );
- util::Date aDate( nD, nM, nY );
- aRet <<= aDate;
+ case PROP_UNO_CALCASSHOWN :
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsCalcAsShown() );
+ break;
+ case PROP_UNO_DEFTABSTOP :
+ aRet <<= (sal_Int16)( rOptions.GetTabDistance() );
+ break;
+ case PROP_UNO_IGNORECASE :
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsIgnoreCase() );
+ break;
+ case PROP_UNO_ITERENABLED:
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsIter() );
+ break;
+ case PROP_UNO_ITERCOUNT:
+ aRet <<= (sal_Int32)( rOptions.GetIterCount() );
+ break;
+ case PROP_UNO_ITEREPSILON:
+ aRet <<= (double)( rOptions.GetIterEps() );
+ break;
+ case PROP_UNO_LOOKUPLABELS:
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsLookUpColRowNames() );
+ break;
+ case PROP_UNO_MATCHWHOLE:
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsMatchWholeCell() );
+ break;
+ case PROP_UNO_NULLDATE:
+ {
+ USHORT nD, nM, nY;
+ rOptions.GetDate( nD, nM, nY );
+ util::Date aDate( nD, nM, nY );
+ aRet <<= aDate;
+ }
+ break;
+ case PROP_UNO_SPELLONLINE:
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsAutoSpell() );
+ break;
+ case PROP_UNO_STANDARDDEC :
+ aRet <<= (sal_Int16)( rOptions.GetStdPrecision() );
+ break;
+ case PROP_UNO_REGEXENABLED:
+ ScUnoHelpFunctions::SetBoolInAny( aRet, rOptions.IsFormulaRegexEnabled() );
+ break;
+ default:;
}
-
return aRet;
}
@@ -190,7 +219,7 @@ void SAL_CALL ScDocOptionsObj::setPropertyValue(
{
ScUnoGuard aGuard;
- BOOL bDone = ScDocOptionsHelper::setPropertyValue( aOptions, aPropertyName, aValue );
+ BOOL bDone = ScDocOptionsHelper::setPropertyValue( aOptions, *GetPropertySet().getPropertyMap(), aPropertyName, aValue );
if (!bDone)
ScModelObj::setPropertyValue( aPropertyName, aValue );
@@ -202,7 +231,7 @@ uno::Any SAL_CALL ScDocOptionsObj::getPropertyValue( const rtl::OUString& aPrope
{
ScUnoGuard aGuard;
- uno::Any aRet(ScDocOptionsHelper::getPropertyValue( aOptions, aPropertyName ));
+ uno::Any aRet(ScDocOptionsHelper::getPropertyValue( aOptions, *GetPropertySet().getPropertyMap(), aPropertyName ));
if ( !aRet.hasValue() )
aRet = ScModelObj::getPropertyValue( aPropertyName );
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 1e735cc77866..1b17c2e130ac 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -356,7 +356,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
// error during storage creation means _here_ that the medium
// is broken, but we can not handle it in medium since unpossibility
// to create a storage does not _always_ means that the medium is broken
- aMedium.SetError( aMedium.GetLastStorageCreationState() );
+ aMedium.SetError( aMedium.GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if ( xInteraction.is() )
{
OUString empty;
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index eaca5a308236..8a5b92d0bd8c 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -39,6 +39,7 @@
#include <svx/svdobj.hxx>
#include <svx/unoshape.hxx>
#include <svx/unofield.hxx>
+#include <svx/shapepropertynotifier.hxx>
#include <toolkit/helper/convert.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -64,9 +65,9 @@ DECLARE_STL_USTRINGACCESS_MAP( uno::Sequence< sal_Int8 > *, ScShapeImplementati
static ScShapeImplementationIdMap aImplementationIdMap;
-const SfxItemPropertyMap* lcl_GetShapeMap()
+const SfxItemPropertyMapEntry* lcl_GetShapeMap()
{
- static SfxItemPropertyMap aShapeMap_Impl[] =
+ static SfxItemPropertyMapEntry aShapeMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ANCHOR), 0, &getCppuType((uno::Reference<uno::XInterface>*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_HORIPOS), 0, &getCppuType((sal_Int32*)0), 0, 0 },
@@ -89,11 +90,23 @@ const SvEventDescription* ScShapeObj::GetSupportedMacroItems()
//------------------------------------------------------------------------
+namespace
+{
+ void lcl_initializeNotifier( SdrObject& _rSdrObj, ::cppu::OWeakObject& _rShape )
+ {
+ ::svx::PPropertyValueProvider pProvider( new ::svx::PropertyValueProvider( _rShape, "Anchor" ) );
+ _rSdrObj.getShapePropertyChangeNotifier().registerProvider( ::svx::eSpreadsheetAnchor, pProvider );
+ }
+}
+
+//------------------------------------------------------------------------
+
ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) :
pShapePropertySet(NULL),
pShapePropertyState(NULL),
pImplementationId(NULL),
- bIsTextShape(FALSE)
+ bIsTextShape(FALSE),
+ bInitializedNotifier(false)
{
comphelper::increment( m_refCount );
@@ -113,6 +126,15 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) :
bIsTextShape = ( SvxUnoTextBase::getImplementation( mxShapeAgg ) != NULL );
}
+ {
+ SdrObject* pObj = GetSdrObject();
+ if ( pObj )
+ {
+ lcl_initializeNotifier( *pObj, *this );
+ bInitializedNotifier = true;
+ }
+ }
+
comphelper::decrement( m_refCount );
}
@@ -127,22 +149,11 @@ ScShapeObj::~ScShapeObj()
uno::Any SAL_CALL ScShapeObj::queryInterface( const uno::Type& rType )
throw(uno::RuntimeException)
{
- SC_QUERYINTERFACE( beans::XPropertySet )
- SC_QUERYINTERFACE( beans::XPropertyState )
- SC_QUERYINTERFACE( text::XTextContent )
- SC_QUERYINTERFACE( lang::XComponent )
- SC_QUERYINTERFACE( document::XEventsSupplier )
- if ( bIsTextShape )
- {
- // #105585# for text shapes, XText (and parent interfaces) must
- // be handled here, too (for ScCellFieldObj handling):
- SC_QUERYINTERFACE( text::XText )
- SC_QUERYINTERFACE( text::XSimpleText )
- SC_QUERYINTERFACE( text::XTextRange )
- }
- SC_QUERYINTERFACE( lang::XTypeProvider )
+ uno::Any aRet = ScShapeObj_Base::queryInterface( rType );
+
+ if ( !aRet.hasValue() && bIsTextShape )
+ aRet = ScShapeObj_TextBase::queryInterface( rType );
- uno::Any aRet(OWeakObject::queryInterface( rType ));
if ( !aRet.hasValue() && mxShapeAgg.is() )
aRet = mxShapeAgg->queryAggregation( rType );
@@ -151,12 +162,12 @@ uno::Any SAL_CALL ScShapeObj::queryInterface( const uno::Type& rType )
void SAL_CALL ScShapeObj::acquire() throw()
{
- OWeakObject::acquire();
+ OWeakObject::acquire();
}
void SAL_CALL ScShapeObj::release() throw()
{
- OWeakObject::release();
+ OWeakObject::release();
}
void ScShapeObj::GetShapePropertySet()
@@ -828,6 +839,18 @@ void SAL_CALL ScShapeObj::addPropertyChangeListener( const rtl::OUString& aPrope
GetShapePropertySet();
if (pShapePropertySet)
pShapePropertySet->addPropertyChangeListener( aPropertyName, aListener );
+
+ if ( !bInitializedNotifier )
+ {
+ // here's the latest chance to initialize the property notification at the SdrObject
+ // (in the ctor, where we also attempt to do this, we do not necessarily have
+ // and SdrObject, yet)
+ SdrObject* pObj = GetSdrObject();
+ OSL_ENSURE( pObj, "ScShapeObj::addPropertyChangeListener: no SdrObject -> no property change notification!" );
+ if ( pObj )
+ lcl_initializeNotifier( *pObj, *this );
+ bInitializedNotifier = true;
+ }
}
void SAL_CALL ScShapeObj::removePropertyChangeListener( const rtl::OUString& aPropertyName,
@@ -1245,23 +1268,22 @@ void SAL_CALL ScShapeObj::setString( const rtl::OUString& aText ) throw(uno::Run
uno::Sequence<uno::Type> SAL_CALL ScShapeObj::getTypes() throw(uno::RuntimeException)
{
- uno::Sequence< uno::Type > aTypeSequence;
+ uno::Sequence< uno::Type > aBaseTypes( ScShapeObj_Base::getTypes() );
+
+ uno::Sequence< uno::Type > aTextTypes;
+ if ( bIsTextShape )
+ aTextTypes = ScShapeObj_TextBase::getTypes();
uno::Reference<lang::XTypeProvider> xBaseProvider;
if ( mxShapeAgg.is() )
mxShapeAgg->queryAggregation( getCppuType((uno::Reference<lang::XTypeProvider>*) 0) ) >>= xBaseProvider;
-
DBG_ASSERT( xBaseProvider.is(), "ScShapeObj: No XTypeProvider from aggregated shape!" );
+
+ uno::Sequence< uno::Type > aAggTypes;
if( xBaseProvider.is() )
- {
- aTypeSequence = xBaseProvider->getTypes();
- long nBaseLen = aTypeSequence.getLength();
+ aAggTypes = xBaseProvider->getTypes();
- aTypeSequence.realloc( nBaseLen + 1 );
- uno::Type* pPtr = aTypeSequence.getArray();
- pPtr[nBaseLen + 0] = getCppuType((const uno::Reference<text::XTextContent>*)0);
- }
- return aTypeSequence;
+ return ::comphelper::concatSequences( aBaseTypes, aTextTypes, aAggTypes );
}
uno::Sequence<sal_Int8> SAL_CALL ScShapeObj::getImplementationId()
@@ -1469,3 +1491,34 @@ ScShapeObj::getEvents( ) throw(uno::RuntimeException)
return new ShapeUnoEventAccessImpl( this );
}
+::rtl::OUString SAL_CALL ScShapeObj::getImplementationName( ) throw (uno::RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sc.ScShapeObj" ) );
+}
+
+::sal_Bool SAL_CALL ScShapeObj::supportsService( const ::rtl::OUString& _ServiceName ) throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
+ for ( const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ pSupported != aSupported.getConstArray() + aSupported.getLength();
+ ++pSupported
+ )
+ if ( _ServiceName == *pSupported )
+ return sal_True;
+ return sal_False;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ScShapeObj::getSupportedServiceNames( ) throw (uno::RuntimeException)
+{
+ uno::Reference<lang::XServiceInfo> xSI;
+ if ( mxShapeAgg.is() )
+ mxShapeAgg->queryAggregation( lang::XServiceInfo::static_type() ) >>= xSI;
+
+ uno::Sequence< ::rtl::OUString > aSupported;
+ if ( xSI.is() )
+ aSupported = xSI->getSupportedServiceNames();
+
+ aSupported.realloc( aSupported.getLength() + 1 );
+ aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.Shape" ) );
+ return aSupported;
+}
diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx
index c3988128bbb7..14b271c16cb7 100644
--- a/sc/source/ui/unoobj/srchuno.cxx
+++ b/sc/source/ui/unoobj/srchuno.cxx
@@ -53,11 +53,11 @@ using namespace com::sun::star;
//! SearchWords sucht in ganzen Zellen - umbenennen ???
-// SfxItemPropertyMap nur fuer GetPropertySetInfo
+// SfxItemPropertyMapEntry nur fuer GetPropertySetInfo
-const SfxItemPropertyMap* lcl_GetSearchPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetSearchPropertyMap()
{
- static SfxItemPropertyMap aSearchPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aSearchPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_SRCHBACK), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_SRCHBYROW), 0, &getBooleanCppuType(), 0, 0},
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index ae8331ffa5fe..12cbdbdde1a1 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -83,9 +83,9 @@ using namespace ::com::sun::star;
//------------------------------------------------------------------------
-const SfxItemPropertyMap* lcl_GetCellStyleMap()
+const SfxItemPropertySet* lcl_GetCellStyleSet()
{
- static SfxItemPropertyMap aCellStyleMap_Impl[] =
+ static SfxItemPropertyMapEntry aCellStyleMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
@@ -166,14 +166,15 @@ const SfxItemPropertyMap* lcl_GetCellStyleMap()
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
{0,0,0,0,0,0}
};
- return aCellStyleMap_Impl;
+ static SfxItemPropertySet aCellStyleSet_Impl( aCellStyleMap_Impl );
+ return &aCellStyleSet_Impl;
}
// Map mit allen Seitenattributen, incl. Kopf-/Fusszeilenattribute
-const SfxItemPropertyMap* lcl_GetPageStyleMap()
+const SfxItemPropertySet * lcl_GetPageStyleSet()
{
- static SfxItemPropertyMap aPageStyleMap_Impl[] =
+ static SfxItemPropertyMapEntry aPageStyleMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_PAGE_BACKCOLOR), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
{MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICFILT), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_FILTER },
@@ -285,14 +286,15 @@ const SfxItemPropertyMap* lcl_GetPageStyleMap()
{MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
{0,0,0,0,0,0}
};
- return aPageStyleMap_Impl;
+ static SfxItemPropertySet aPageStyleSet_Impl( aPageStyleMap_Impl );
+ return &aPageStyleSet_Impl;
}
// Map mit Inhalten des Header-Item-Sets
const SfxItemPropertyMap* lcl_GetHeaderStyleMap()
{
- static SfxItemPropertyMap aHeaderStyleMap_Impl[] =
+ static SfxItemPropertyMapEntry aHeaderStyleMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
{MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_FILTER },
@@ -323,14 +325,15 @@ const SfxItemPropertyMap* lcl_GetHeaderStyleMap()
{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN),ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
{0,0,0,0,0,0}
};
- return aHeaderStyleMap_Impl;
+ static SfxItemPropertyMap aHeaderStyleMap( aHeaderStyleMap_Impl );
+ return &aHeaderStyleMap;
}
// Map mit Inhalten des Footer-Item-Sets
const SfxItemPropertyMap* lcl_GetFooterStyleMap()
{
- static SfxItemPropertyMap aFooterStyleMap_Impl[] =
+ static SfxItemPropertyMapEntry aFooterStyleMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
{MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_FILTER },
@@ -361,7 +364,8 @@ const SfxItemPropertyMap* lcl_GetFooterStyleMap()
{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN),ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
{0,0,0,0,0,0}
};
- return aFooterStyleMap_Impl;
+ static SfxItemPropertyMap aFooterStyleMap( aFooterStyleMap_Impl );
+ return &aFooterStyleMap;
}
@@ -1089,7 +1093,7 @@ void SAL_CALL ScStyleFamilyObj::removeVetoableChangeListener( const ::rtl::OUStr
//UNUSED2008-05 }
ScStyleObj::ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const String& rName) :
- aPropSet( (eFam == SFX_STYLE_FAMILY_PARA) ? lcl_GetCellStyleMap() : lcl_GetPageStyleMap() ),
+ pPropSet( (eFam == SFX_STYLE_FAMILY_PARA) ? lcl_GetCellStyleSet() : lcl_GetPageStyleSet() ),
pDocShell( pDocSh ),
eFamily( eFam ),
aStyleName( rName )
@@ -1307,34 +1311,34 @@ uno::Reference<container::XIndexReplace> ScStyleObj::CreateEmptyNumberingRules()
// beans::XPropertyState
-const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const String& rPropName,
- const SfxItemPropertyMap*& rpResultEntry )
+const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const ::rtl::OUString& rPropName,
+ const SfxItemPropertySimpleEntry*& rpResultEntry )
{
//! OUString as argument?
SfxStyleSheetBase* pStyle = GetStyle_Impl();
if (pStyle)
{
- const SfxItemPropertyMap* pMap = NULL;
+ const SfxItemPropertySimpleEntry* pEntry = NULL;
if ( eFamily == SFX_STYLE_FAMILY_PAGE )
{
- pMap = SfxItemPropertyMap::GetByName( lcl_GetHeaderStyleMap(), rPropName );
- if ( pMap ) // only item-wids in header/footer map
+ pEntry = lcl_GetHeaderStyleMap()->getByName( rPropName );
+ if ( pEntry ) // only item-wids in header/footer map
{
- rpResultEntry = pMap;
+ rpResultEntry = pEntry;
return &((const SvxSetItem&)pStyle->GetItemSet().Get(ATTR_PAGE_HEADERSET)).GetItemSet();
}
- pMap = SfxItemPropertyMap::GetByName( lcl_GetFooterStyleMap(), rPropName );
- if ( pMap ) // only item-wids in header/footer map
+ pEntry = lcl_GetFooterStyleMap()->getByName( rPropName );
+ if ( pEntry ) // only item-wids in header/footer map
{
- rpResultEntry = pMap;
+ rpResultEntry = pEntry;
return &((const SvxSetItem&)pStyle->GetItemSet().Get(ATTR_PAGE_FOOTERSET)).GetItemSet();
}
}
- pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropName );
- if ( pMap )
+ pEntry = pPropSet->getPropertyMap()->getByName( rPropName );
+ if ( pEntry )
{
- rpResultEntry = pMap;
+ rpResultEntry = pEntry;
return &pStyle->GetItemSet();
}
}
@@ -1348,10 +1352,9 @@ beans::PropertyState SAL_CALL ScStyleObj::getPropertyState( const rtl::OUString&
{
ScUnoGuard aGuard;
beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
- String aString(aPropertyName);
- const SfxItemPropertyMap* pResultEntry = NULL;
- const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aString, pResultEntry );
+ const SfxItemPropertySimpleEntry* pResultEntry = NULL;
+ const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
if ( pItemSet && pResultEntry )
{
@@ -1405,12 +1408,12 @@ void SAL_CALL ScStyleObj::setPropertyToDefault( const rtl::OUString& aPropertyNa
{
ScUnoGuard aGuard;
- const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
- pMap = SfxItemPropertyMap::GetByName( pMap, aPropertyName );
- if ( !pMap )
+ const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap();
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
- SetOnePropertyValue( pMap, NULL );
+ SetOnePropertyValue( aPropertyName, pEntry, NULL );
}
uno::Any SAL_CALL ScStyleObj::getPropertyDefault( const rtl::OUString& aPropertyName )
@@ -1418,11 +1421,10 @@ uno::Any SAL_CALL ScStyleObj::getPropertyDefault( const rtl::OUString& aProperty
uno::RuntimeException)
{
ScUnoGuard aGuard;
- String aString(aPropertyName);
uno::Any aAny;
- const SfxItemPropertyMap* pResultEntry = NULL;
- const SfxItemSet* pStyleSet = GetStyleItemSet_Impl( aString, pResultEntry );
+ const SfxItemPropertySimpleEntry* pResultEntry = NULL;
+ const SfxItemSet* pStyleSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
if ( pStyleSet && pResultEntry )
{
@@ -1467,14 +1469,14 @@ uno::Any SAL_CALL ScStyleObj::getPropertyDefault( const rtl::OUString& aProperty
case ATTR_PAGE_SCALETO:
{
const ScPageScaleToItem aItem((const ScPageScaleToItem&)pItemSet->Get(nWhich));
- if (aString.EqualsAscii( SC_UNO_PAGE_SCALETOX ))
+ if (aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX )))
aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetWidth()));
else
aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetHeight()));
}
break;
default:
- aAny = aPropSet.getPropertyValue( *pResultEntry, *pItemSet );
+ pPropSet->getPropertyValue( *pResultEntry, *pItemSet, aAny );
}
}
else if ( IsScUnoWid( nWhich ) )
@@ -1523,17 +1525,11 @@ void SAL_CALL ScStyleObj::setPropertyValues( const uno::Sequence< rtl::OUString
const rtl::OUString* pNames = aPropertyNames.getConstArray();
const uno::Any* pValues = aValues.getConstArray();
- const SfxItemPropertyMap* pPropertyMap = aPropSet.getPropertyMap();
- const SfxItemPropertyMap* pMap = pPropertyMap;
+ const SfxItemPropertyMap* pPropertyMap = pPropSet->getPropertyMap();
for (sal_Int32 i = 0; i < nCount; i++)
{
- String aNameString = pNames[i];
- pMap = SfxItemPropertyMap::GetByName( pMap, aNameString );
- SetOnePropertyValue( pMap, &pValues[i] );
- if (!pMap)
- pMap = pPropertyMap;
- else
- pMap++;
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( pNames[i] );
+ SetOnePropertyValue( pNames[i], pEntry, &pValues[i] );
}
}
}
@@ -1637,17 +1633,11 @@ void SAL_CALL ScStyleObj::setPropertiesToDefault( const uno::Sequence<rtl::OUStr
{
const rtl::OUString* pNames = aPropertyNames.getConstArray();
- const SfxItemPropertyMap* pPropertyMap = aPropSet.getPropertyMap();
- const SfxItemPropertyMap* pMap = pPropertyMap;
+ const SfxItemPropertyMap* pPropertyMap = pPropSet->getPropertyMap();
for (sal_Int32 i = 0; i < nCount; i++)
{
- String aNameString(pNames[i]);
- pMap = SfxItemPropertyMap::GetByName( pMap, aNameString );
- SetOnePropertyValue( pMap, NULL );
- if (!pMap)
- pMap = pPropertyMap;
- else
- pMap++;
+ const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( pNames[i] );
+ SetOnePropertyValue( pNames[i], pEntry, NULL );
}
}
}
@@ -1678,7 +1668,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScStyleObj::getPropertySetInfo(
throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- return aPropSet.getPropertySetInfo();
+ return pPropSet->getPropertySetInfo();
}
void SAL_CALL ScStyleObj::setPropertyValue(
@@ -1689,53 +1679,51 @@ void SAL_CALL ScStyleObj::setPropertyValue(
{
ScUnoGuard aGuard;
- const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
- pMap = SfxItemPropertyMap::GetByName( pMap, aPropertyName );
- if ( !pMap )
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( aPropertyName );
+ if ( !pEntry )
throw beans::UnknownPropertyException();
- SetOnePropertyValue( pMap, &aValue );
+ SetOnePropertyValue( aPropertyName, pEntry, &aValue );
}
-void ScStyleObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno::Any* pValue )
+void ScStyleObj::SetOnePropertyValue( const ::rtl::OUString& rPropertyName, const SfxItemPropertySimpleEntry* pEntry, const uno::Any* pValue )
throw(lang::IllegalArgumentException, uno::RuntimeException)
{
SfxStyleSheetBase* pStyle = GetStyle_Impl();
- if ( pStyle && pMap )
+ if ( pStyle && pEntry )
{
// #70909# cell styles cannot be modified if any sheet is protected
if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
throw uno::RuntimeException();
- String aString(String::CreateFromAscii( pMap->pName ));
-
SfxItemSet& rSet = pStyle->GetItemSet(); // direkt im lebenden Style aendern...
sal_Bool bDone = sal_False;
if ( eFamily == SFX_STYLE_FAMILY_PAGE )
{
- const SfxItemPropertyMap* pHeaderMap =
- SfxItemPropertyMap::GetByName( lcl_GetHeaderStyleMap(), aString );
- if ( pHeaderMap ) // only item-wids in header/footer map
+ if(pEntry->nWID == SC_WID_UNO_HEADERSET)
{
- SvxSetItem aNewHeader( (const SvxSetItem&)rSet.Get(ATTR_PAGE_HEADERSET) );
- if (pValue)
- aPropSet.setPropertyValue( *pHeaderMap, *pValue, aNewHeader.GetItemSet() );
- else
- aNewHeader.GetItemSet().ClearItem( pHeaderMap->nWID );
- rSet.Put( aNewHeader );
- bDone = sal_True;
+ const SfxItemPropertySimpleEntry* pHeaderEntry = lcl_GetHeaderStyleMap()->getByName( rPropertyName );
+ if ( pHeaderEntry ) // only item-wids in header/footer map
+ {
+ SvxSetItem aNewHeader( (const SvxSetItem&)rSet.Get(ATTR_PAGE_HEADERSET) );
+ if (pValue)
+ pPropSet->setPropertyValue( *pHeaderEntry, *pValue, aNewHeader.GetItemSet() );
+ else
+ aNewHeader.GetItemSet().ClearItem( pHeaderEntry->nWID );
+ rSet.Put( aNewHeader );
+ bDone = sal_True;
+ }
}
- else
+ else if(pEntry->nWID == SC_WID_UNO_FOOTERSET)
{
- const SfxItemPropertyMap* pFooterMap =
- SfxItemPropertyMap::GetByName( lcl_GetFooterStyleMap(), aString );
- if ( pFooterMap ) // only item-wids in header/footer map
+ const SfxItemPropertySimpleEntry* pFooterEntry = lcl_GetFooterStyleMap()->getByName( rPropertyName );
+ if ( pFooterEntry ) // only item-wids in header/footer map
{
SvxSetItem aNewFooter( (const SvxSetItem&)rSet.Get(ATTR_PAGE_FOOTERSET) );
if (pValue)
- aPropSet.setPropertyValue( *pFooterMap, *pValue, aNewFooter.GetItemSet() );
+ pPropSet->setPropertyValue( *pFooterEntry, *pValue, aNewFooter.GetItemSet() );
else
- aNewFooter.GetItemSet().ClearItem( pFooterMap->nWID );
+ aNewFooter.GetItemSet().ClearItem( pFooterEntry->nWID );
rSet.Put( aNewFooter );
bDone = sal_True;
}
@@ -1743,15 +1731,13 @@ void ScStyleObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno:
}
if (!bDone)
{
- const SfxItemPropertyMap* pOwnMap =
- SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), aString );
- if ( pOwnMap )
+ if ( pEntry )
{
- if ( IsScItemWid( pOwnMap->nWID ) )
+ if ( IsScItemWid( pEntry->nWID ) )
{
if (pValue)
{
- switch ( pOwnMap->nWID ) // fuer Item-Spezial-Behandlungen
+ switch ( pEntry->nWID ) // fuer Item-Spezial-Behandlungen
{
case ATTR_VALUE_FORMAT:
{
@@ -1782,7 +1768,7 @@ void ScStyleObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno:
{
sal_Int16 nVal = 0;
*pValue >>= nVal;
- rSet.Put( SfxUInt16Item( pOwnMap->nWID, (USHORT)HMMToTwips(nVal) ) );
+ rSet.Put( SfxUInt16Item( pEntry->nWID, (USHORT)HMMToTwips(nVal) ) );
}
break;
case ATTR_ROTATE_VALUE:
@@ -1835,7 +1821,7 @@ void ScStyleObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno:
rSet.ClearItem(ATTR_PAGE_SCALETO);
sal_Int16 nVal = 0;
*pValue >>= nVal;
- rSet.Put( SfxUInt16Item( pOwnMap->nWID, nVal ) );
+ rSet.Put( SfxUInt16Item( pEntry->nWID, nVal ) );
}
break;
case ATTR_PAGE_FIRSTPAGENO:
@@ -1852,7 +1838,7 @@ void ScStyleObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno:
sal_Bool bBool = sal_False;
*pValue >>= bBool;
//! sal_Bool-MID fuer ScViewObjectModeItem definieren?
- rSet.Put( ScViewObjectModeItem( pOwnMap->nWID,
+ rSet.Put( ScViewObjectModeItem( pEntry->nWID,
bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE ) );
}
break;
@@ -1895,7 +1881,7 @@ void ScStyleObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno:
if (*pValue >>= nPages)
{
ScPageScaleToItem aItem = ((const ScPageScaleToItem&)rSet.Get(ATTR_PAGE_SCALETO));
- if ( aString.EqualsAscii(SC_UNO_PAGE_SCALETOX))
+ if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX)))
aItem.SetWidth(static_cast<sal_uInt16>(nPages));
else
aItem.SetHeight(static_cast<sal_uInt16>(nPages));
@@ -1909,27 +1895,27 @@ void ScStyleObj::SetOnePropertyValue( const SfxItemPropertyMap* pMap, const uno:
// #65253# Default-Items mit falscher Slot-ID
// funktionieren im SfxItemPropertySet3 nicht
//! Slot-IDs aendern...
- if ( rSet.GetPool()->GetSlotId(pOwnMap->nWID) == pOwnMap->nWID &&
- rSet.GetItemState(pOwnMap->nWID, sal_False) == SFX_ITEM_DEFAULT )
+ if ( rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID &&
+ rSet.GetItemState(pEntry->nWID, sal_False) == SFX_ITEM_DEFAULT )
{
- rSet.Put( rSet.Get(pOwnMap->nWID) );
+ rSet.Put( rSet.Get(pEntry->nWID) );
}
- aPropSet.setPropertyValue( *pOwnMap, *pValue, rSet );
+ pPropSet->setPropertyValue( *pEntry, *pValue, rSet );
}
}
else
{
- rSet.ClearItem( pOwnMap->nWID );
+ rSet.ClearItem( pEntry->nWID );
// #67847# language for number formats
- if ( pOwnMap->nWID == ATTR_VALUE_FORMAT )
+ if ( pEntry->nWID == ATTR_VALUE_FORMAT )
rSet.ClearItem( ATTR_LANGUAGE_FORMAT );
//! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
}
}
- else if ( IsScUnoWid( pOwnMap->nWID ) )
+ else if ( IsScUnoWid( pEntry->nWID ) )
{
- switch ( pOwnMap->nWID )
+ switch ( pEntry->nWID )
{
case SC_WID_UNO_TBLBORD:
{
@@ -1987,10 +1973,9 @@ uno::Any SAL_CALL ScStyleObj::getPropertyValue( const rtl::OUString& aPropertyNa
uno::RuntimeException)
{
ScUnoGuard aGuard;
- String aString(aPropertyName);
uno::Any aAny;
- if ( aString.EqualsAscii( SC_UNONAME_DISPNAME ) ) // read-only
+ if ( aPropertyName.equalsAscii( SC_UNONAME_DISPNAME ) ) // read-only
{
// core always has the display name
SfxStyleSheetBase* pStyle = GetStyle_Impl();
@@ -1999,8 +1984,8 @@ uno::Any SAL_CALL ScStyleObj::getPropertyValue( const rtl::OUString& aPropertyNa
}
else
{
- const SfxItemPropertyMap* pResultEntry = NULL;
- const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aString, pResultEntry );
+ const SfxItemPropertySimpleEntry* pResultEntry = NULL;
+ const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
if ( pItemSet && pResultEntry )
{
@@ -2065,7 +2050,7 @@ uno::Any SAL_CALL ScStyleObj::getPropertyValue( const rtl::OUString& aPropertyNa
case ATTR_PAGE_SCALETO:
{
ScPageScaleToItem aItem((const ScPageScaleToItem&)pItemSet->Get(ATTR_PAGE_SCALETO));
- if (aString.EqualsAscii(SC_UNO_PAGE_SCALETOX))
+ if (aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX)))
aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetWidth()));
else
aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetHeight()));
@@ -2080,10 +2065,10 @@ uno::Any SAL_CALL ScStyleObj::getPropertyValue( const rtl::OUString& aPropertyNa
{
SfxItemSet aNoEmptySet( *pItemSet );
aNoEmptySet.Put( aNoEmptySet.Get( nWhich ) );
- aAny = aPropSet.getPropertyValue( *pResultEntry, aNoEmptySet );
+ pPropSet->getPropertyValue( *pResultEntry, aNoEmptySet, aAny );
}
else
- aAny = aPropSet.getPropertyValue( *pResultEntry, *pItemSet );
+ pPropSet->getPropertyValue( *pResultEntry, *pItemSet, aAny );
}
}
else if ( IsScUnoWid( nWhich ) )
@@ -2127,10 +2112,9 @@ sal_Bool SAL_CALL ScStyleObj::supportsService( const rtl::OUString& rServiceName
throw(uno::RuntimeException)
{
BOOL bPage = ( eFamily == SFX_STYLE_FAMILY_PAGE );
- String aServiceStr( rServiceName );
- return aServiceStr.EqualsAscii( SCSTYLE_SERVICE ) ||
- aServiceStr.EqualsAscii( bPage ? SCPAGESTYLE_SERVICE
- : SCCELLSTYLE_SERVICE );
+ return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SCSTYLE_SERVICE ) )||
+ rServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM ( bPage ? SCPAGESTYLE_SERVICE : SCCELLSTYLE_SERVICE ));
}
uno::Sequence<rtl::OUString> SAL_CALL ScStyleObj::getSupportedServiceNames()
diff --git a/sc/source/ui/unoobj/targuno.cxx b/sc/source/ui/unoobj/targuno.cxx
index 4f4dfc94e55d..0fed003b751b 100644
--- a/sc/source/ui/unoobj/targuno.cxx
+++ b/sc/source/ui/unoobj/targuno.cxx
@@ -66,9 +66,9 @@ sal_uInt16 nTypeResIds[SC_LINKTARGETTYPE_COUNT] =
SCSTR_CONTENT_DBAREA // SC_LINKTARGETTYPE_DBAREA
};
-const SfxItemPropertyMap* lcl_GetLinkTargetMap()
+const SfxItemPropertyMapEntry* lcl_GetLinkTargetMap()
{
- static SfxItemPropertyMap aLinkTargetMap_Impl[] =
+ static SfxItemPropertyMapEntry aLinkTargetMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_LINKDISPBIT), 0, &getCppuType((const uno::Reference<awt::XBitmap>*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNO_LINKDISPNAME), 0, &getCppuType((const ::rtl::OUString*)0), beans::PropertyAttribute::READONLY, 0 },
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 97e10e4e973e..bd481dfc49f0 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -68,9 +68,9 @@ using namespace com::sun::star;
//------------------------------------------------------------------------
-const SfxItemPropertyMap* lcl_GetHdFtPropertyMap()
+const SvxItemPropertySet * lcl_GetHdFtPropertySet()
{
- static SfxItemPropertyMap aHdFtPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aHdFtPropertyMap_Impl[] =
{
SVX_UNOEDIT_CHAR_PROPERTIES,
SVX_UNOEDIT_FONT_PROPERTIES,
@@ -85,7 +85,7 @@ const SfxItemPropertyMap* lcl_GetHdFtPropertyMap()
// modify PropertyMap to include CONVERT_TWIPS flag for font height
// (headers/footers are in twips)
- SfxItemPropertyMap* pEntry = aHdFtPropertyMap_Impl;
+ SfxItemPropertyMapEntry* pEntry = aHdFtPropertyMap_Impl;
while (pEntry->pName)
{
if ( ( pEntry->nWID == EE_CHAR_FONTHEIGHT ||
@@ -100,8 +100,8 @@ const SfxItemPropertyMap* lcl_GetHdFtPropertyMap()
}
bTwipsSet = TRUE;
}
-
- return aHdFtPropertyMap_Impl;
+ static SvxItemPropertySet aHdFtPropertySet_Impl( aHdFtPropertyMap_Impl );
+ return &aHdFtPropertySet_Impl;
}
//------------------------------------------------------------------------
@@ -349,7 +349,7 @@ void ScHeaderFooterTextObj::CreateUnoText_Impl()
{
// can't be aggregated because getString/setString is handled here
ScSharedHeaderFooterEditSource aEditSource( &aTextData );
- pUnoText = new SvxUnoText( &aEditSource, lcl_GetHdFtPropertyMap(), uno::Reference<text::XText>() );
+ pUnoText = new SvxUnoText( &aEditSource, lcl_GetHdFtPropertySet(), uno::Reference<text::XText>() );
pUnoText->acquire();
}
}
@@ -920,7 +920,7 @@ ScSimpleEditSourceHelper::~ScSimpleEditSourceHelper()
}
ScEditEngineTextObj::ScEditEngineTextObj() :
- SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertyMap(), uno::Reference<text::XText>() )
+ SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertySet(), uno::Reference<text::XText>() )
{
}
@@ -1104,7 +1104,7 @@ void ScCellTextData::Notify( SfxBroadcaster&, const SfxHint& rHint )
ScCellTextObj::ScCellTextObj(ScDocShell* pDocSh, const ScAddress& rP) :
ScCellTextData( pDocSh, rP ),
- SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertyMap(), uno::Reference<text::XText>() )
+ SvxUnoText( GetOriginalSource(), ScCellObj::GetEditPropertySet(), uno::Reference<text::XText>() )
{
}
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index d2ce4615fc65..e6e194d7eb75 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -51,17 +51,16 @@
#include "docsh.hxx"
#include "rangeseq.hxx"
#include "externalrefmgr.hxx"
-using namespace formula;
-using namespace com::sun::star;
+using namespace ::formula;
+using namespace ::com::sun::star;
-//------------------------------------------------------------------------
+// ============================================================================
-const SfxItemPropertyMap* lcl_GetFormulaParserMap()
+const SfxItemPropertyMapEntry* lcl_GetFormulaParserMap()
{
- static SfxItemPropertyMap aFormulaParserMap_Impl[] =
+ static SfxItemPropertyMapEntry aFormulaParserMap_Impl[] =
{
- {MAP_CHAR_LEN(SC_UNO_REFERENCEPOS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_COMPILEFAP), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_COMPILEENGLISH), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_IGNORELEADING), 0, &getBooleanCppuType(), 0, 0 },
@@ -74,7 +73,7 @@ const SfxItemPropertyMap* lcl_GetFormulaParserMap()
SC_SIMPLE_SERVICE_INFO( ScFormulaParserObj, "ScFormulaParserObj", SC_SERVICENAME_FORMULAPARS )
-//------------------------------------------------------------------------
+// ============================================================================
ScFormulaParserObj::ScFormulaParserObj(ScDocShell* pDocSh) :
mpDocShell( pDocSh ),
@@ -135,7 +134,8 @@ void ScFormulaParserObj::SetCompilerFlags( ScCompiler& rCompiler ) const
rCompiler.SetExternalLinks( maExternalLinks);
}
-uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( const rtl::OUString& aFormula )
+uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula(
+ const rtl::OUString& aFormula, const table::CellAddress& rReferencePos )
throw (uno::RuntimeException)
{
ScUnoGuard aGuard;
@@ -143,8 +143,10 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( co
if (mpDocShell)
{
+ ScAddress aRefPos( ScAddress::UNINITIALIZED );
+ ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
ScDocument* pDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( pDoc, maRefPos);
+ ScCompiler aCompiler( pDoc, aRefPos);
aCompiler.SetGrammar(pDoc->GetGrammar());
SetCompilerFlags( aCompiler );
@@ -156,7 +158,8 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( co
return aRet;
}
-rtl::OUString SAL_CALL ScFormulaParserObj::printFormula( const uno::Sequence<sheet::FormulaToken>& aTokens )
+rtl::OUString SAL_CALL ScFormulaParserObj::printFormula(
+ const uno::Sequence<sheet::FormulaToken>& aTokens, const table::CellAddress& rReferencePos )
throw (uno::RuntimeException)
{
ScUnoGuard aGuard;
@@ -167,7 +170,9 @@ rtl::OUString SAL_CALL ScFormulaParserObj::printFormula( const uno::Sequence<she
ScDocument* pDoc = mpDocShell->GetDocument();
ScTokenArray aCode;
(void)ScTokenConversion::ConvertToTokenArray( *pDoc, aCode, aTokens );
- ScCompiler aCompiler( pDoc, maRefPos, aCode);
+ ScAddress aRefPos( ScAddress::UNINITIALIZED );
+ ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
+ ScCompiler aCompiler( pDoc, aRefPos, aCode);
aCompiler.SetGrammar(pDoc->GetGrammar());
SetCompilerFlags( aCompiler );
@@ -197,13 +202,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
{
ScUnoGuard aGuard;
String aString(aPropertyName);
- if ( aString.EqualsAscii( SC_UNO_REFERENCEPOS ) )
- {
- table::CellAddress aAddress;
- aValue >>= aAddress;
- ScUnoConversion::FillScAddress( maRefPos, aAddress );
- } // if ( aString.EqualsAscii( SC_UNO_REFERENCEPOS ) )
- else if ( aString.EqualsAscii( SC_UNO_COMPILEFAP ) )
+ if ( aString.EqualsAscii( SC_UNO_COMPILEFAP ) )
{
aValue >>= mbCompileFAP;
}
@@ -218,7 +217,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
if (mxOpCodeMap.get() && mbEnglish != bOldEnglish)
{
ScDocument* pDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( pDoc, maRefPos);
+ ScCompiler aCompiler( pDoc, ScAddress());
aCompiler.SetGrammar(pDoc->GetGrammar());
mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish);
}
@@ -239,7 +238,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
if (aValue >>= maOpCodeMapping)
{
ScDocument* pDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( pDoc, maRefPos);
+ ScCompiler aCompiler( pDoc, ScAddress());
aCompiler.SetGrammar(pDoc->GetGrammar());
mxOpCodeMap = aCompiler.CreateOpCodeMap( maOpCodeMapping, mbEnglish);
}
@@ -262,13 +261,7 @@ uno::Any SAL_CALL ScFormulaParserObj::getPropertyValue( const rtl::OUString& aPr
ScUnoGuard aGuard;
uno::Any aRet;
String aString(aPropertyName);
- if ( aString.EqualsAscii( SC_UNO_REFERENCEPOS ) )
- {
- table::CellAddress aAddress;
- ScUnoConversion::FillApiAddress( aAddress, maRefPos );
- aRet <<= aAddress;
- }
- else if ( aString.EqualsAscii( SC_UNO_COMPILEFAP ) )
+ if ( aString.EqualsAscii( SC_UNO_COMPILEFAP ) )
{
aRet <<= mbCompileFAP;
}
@@ -299,7 +292,7 @@ uno::Any SAL_CALL ScFormulaParserObj::getPropertyValue( const rtl::OUString& aPr
SC_IMPL_DUMMY_PROPERTY_LISTENER( ScFormulaParserObj )
-//------------------------------------------------------------------------
+// ============================================================================
void lcl_ExternalRefToApi( sheet::SingleReference& rAPI, const ScSingleRefData& rRef )
{
@@ -345,7 +338,7 @@ void lcl_SingleRefToApi( sheet::SingleReference& rAPI, const ScSingleRefData& rR
bool ScTokenConversion::ConvertToTokenArray( ScDocument& rDoc,
ScTokenArray& rTokenArray, const uno::Sequence<sheet::FormulaToken>& rSequence )
{
- return rTokenArray.Fill(rSequence,rDoc.GetExternalRefManager());
+ return !rTokenArray.Fill(rSequence,rDoc.GetExternalRefManager());
}
// static
@@ -463,9 +456,13 @@ bool ScTokenConversion::ConvertToTokenSequence( ScDocument& rDoc,
return !bError;
}
-// -----------------------------------------------------------------------------
+
+// ============================================================================
+
ScFormulaOpCodeMapperObj::ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> _pCompiler)
: formula::FormulaOpCodeMapperObj(_pCompiler)
{
}
+// ============================================================================
+
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 21910e719d60..c1af5ac9bb99 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -71,6 +71,7 @@
#include "gridwin.hxx"
#include <com/sun/star/view/DocumentZoomType.hpp>
#include "AccessibilityHints.hxx"
+#include <svx/sdrhittesthelper.hxx>
using namespace com::sun::star;
@@ -80,9 +81,9 @@ using namespace com::sun::star;
// alles ohne Which-ID, Map nur fuer PropertySetInfo
-const SfxItemPropertyMap* lcl_GetViewOptPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetViewOptPropertyMap()
{
- static SfxItemPropertyMap aViewOptPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aViewOptPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(OLD_UNO_COLROWHDR), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_GRIDCOLOR), 0, &getCppuType((sal_Int32*)0), 0, 0},
@@ -1169,7 +1170,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP
SdrView* pDrawView = GetViewShell()->GetSdrView();
- if (pDrawPage && pDrawView)
+ if (pDrawPage && pDrawView && pDrawView->GetSdrPageView())
{
Window* pActiveWin = pData->GetActiveWin();
Point aPos = pActiveWin->PixelToLogic(rPoint);
@@ -1183,7 +1184,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP
while (i < nCount && !bFound)
{
SdrObject* pObj = pDrawPage->GetObj(i);
- if (pObj && pObj->IsHit(aPos, nHitLog))
+ if (pObj && SdrObjectPrimitiveHit(*pObj, aPos, nHitLog, *pDrawView->GetSdrPageView(), 0, false))
{
xTarget.set(pObj->getUnoShape(), uno::UNO_QUERY);
bFound = sal_True;
diff --git a/sc/source/ui/unoobj/warnpassword.cxx b/sc/source/ui/unoobj/warnpassword.cxx
index 6453bcbd0de7..6b11ac7c6641 100644
--- a/sc/source/ui/unoobj/warnpassword.cxx
+++ b/sc/source/ui/unoobj/warnpassword.cxx
@@ -95,3 +95,4 @@ bool ScWarnPassword::WarningOnPassword( SfxMedium& rMedium )
}
return bReturn;
}
+
diff --git a/sc/source/ui/vba/vbacontrol.cxx b/sc/source/ui/vba/vbacontrol.cxx
index ddb4b39a91a5..eaf9365016ec 100644
--- a/sc/source/ui/vba/vbacontrol.cxx
+++ b/sc/source/ui/vba/vbacontrol.cxx
@@ -185,14 +185,15 @@ void SAL_CALL ScVbaControl::setEnabled( sal_Bool bVisible ) throw (uno::RuntimeE
sal_Bool SAL_CALL ScVbaControl::getVisible() throw (uno::RuntimeException)
{
- uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
- return xWindow2->isVisible();
+ sal_Bool bVisible = sal_False;
+ m_xProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ) ) >>= bVisible;
+ return bVisible;
}
void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
{
- uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
- xWindow2->setVisible( bVisible );
+ m_xProps->setPropertyValue
+ (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ), uno::makeAny( bVisible ) );
}
double SAL_CALL ScVbaControl::getHeight() throw (uno::RuntimeException)
{
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 5019167b4374..d1ac4504ce96 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -77,7 +77,10 @@
#include <com/sun/star/sheet/XCellRangeMovement.hpp>
#include <com/sun/star/sheet/XCellRangeData.hpp>
#include <com/sun/star/sheet/FormulaResult.hpp>
+#include <com/sun/star/sheet/FilterOperator2.hpp>
#include <com/sun/star/sheet/TableFilterField.hpp>
+#include <com/sun/star/sheet/TableFilterField2.hpp>
+#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
#include <com/sun/star/sheet/XSheetFilterable.hpp>
#include <com/sun/star/sheet/FilterConnection.hpp>
#include <com/sun/star/util/CellProtection.hpp>
@@ -4027,7 +4030,7 @@ void lcl_SetAllQueryForField( ScDocShell* pDocShell, SCCOLROW nField, sal_Int16
}
// Modifies sCriteria, and nOp depending on the value of sCriteria
-void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference< beans::XPropertySet >& xDescProps, sheet::TableFilterField& rFilterField )
+void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference< beans::XPropertySet >& xDescProps, sheet::TableFilterField2& rFilterField )
{
// #TODO make this more efficient and cycle through
// sCriteria1 character by character to pick up <,<>,=, * etc.
@@ -4047,10 +4050,10 @@ void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference<
if ( ( nPos = sCriteria1.indexOf( EQUALS ) ) == 0 )
{
if ( sCriteria1.getLength() == EQUALS.getLength() )
- rFilterField.Operator = sheet::FilterOperator_EMPTY;
+ rFilterField.Operator = sheet::FilterOperator2::EMPTY;
else
{
- rFilterField.Operator = sheet::FilterOperator_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::EQUAL;
sCriteria1 = sCriteria1.copy( EQUALS.getLength() );
sCriteria1 = VBAToRegexp( sCriteria1 );
// UseRegularExpressions
@@ -4062,10 +4065,10 @@ void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference<
else if ( ( nPos = sCriteria1.indexOf( NOTEQUALS ) ) == 0 )
{
if ( sCriteria1.getLength() == NOTEQUALS.getLength() )
- rFilterField.Operator = sheet::FilterOperator_NOT_EMPTY;
+ rFilterField.Operator = sheet::FilterOperator2::NOT_EMPTY;
else
{
- rFilterField.Operator = sheet::FilterOperator_NOT_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::NOT_EQUAL;
sCriteria1 = sCriteria1.copy( NOTEQUALS.getLength() );
sCriteria1 = VBAToRegexp( sCriteria1 );
// UseRegularExpressions
@@ -4079,12 +4082,12 @@ void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference<
if ( ( nPos = sCriteria1.indexOf( GREATERTHANEQUALS ) ) == 0 )
{
sCriteria1 = sCriteria1.copy( GREATERTHANEQUALS.getLength() );
- rFilterField.Operator = sheet::FilterOperator_GREATER_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::GREATER_EQUAL;
}
else
{
sCriteria1 = sCriteria1.copy( GREATERTHAN.getLength() );
- rFilterField.Operator = sheet::FilterOperator_GREATER;
+ rFilterField.Operator = sheet::FilterOperator2::GREATER;
}
}
@@ -4094,17 +4097,17 @@ void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference<
if ( ( nPos = sCriteria1.indexOf( LESSTHANEQUALS ) ) == 0 )
{
sCriteria1 = sCriteria1.copy( LESSTHANEQUALS.getLength() );
- rFilterField.Operator = sheet::FilterOperator_LESS_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::LESS_EQUAL;
}
else
{
sCriteria1 = sCriteria1.copy( LESSTHAN.getLength() );
- rFilterField.Operator = sheet::FilterOperator_LESS;
+ rFilterField.Operator = sheet::FilterOperator2::LESS;
}
}
else
- rFilterField.Operator = sheet::FilterOperator_EQUAL;
+ rFilterField.Operator = sheet::FilterOperator2::EQUAL;
if ( bIsNumeric )
{
@@ -4213,13 +4216,16 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
bool bAll = false;;
if ( ( Field >>= nField ) )
{
- uno::Sequence< sheet::TableFilterField > sTabFilts;
- uno::Reference< sheet::XSheetFilterDescriptor > xDesc = xDataBaseRange->getFilterDescriptor();
- uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW );
+ uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc(
+ xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
+ if ( xDesc.is() )
+ {
+ uno::Sequence< sheet::TableFilterField2 > sTabFilts;
+ uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW );
if ( Criteria1.hasValue() )
{
sTabFilts.realloc( 1 );
- sTabFilts[0].Operator = sheet::FilterOperator_EQUAL;// sensible default
+ sTabFilts[0].Operator = sheet::FilterOperator2::EQUAL;// sensible default
if ( !bCritHasNumericValue )
{
Criteria1 >>= sCriteria1;
@@ -4252,16 +4258,16 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
switch ( nOperator )
{
case excel::XlAutoFilterOperator::xlBottom10Items:
- sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_VALUES;
+ sTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_VALUES;
break;
case excel::XlAutoFilterOperator::xlBottom10Percent:
- sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_PERCENT;
+ sTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_PERCENT;
break;
case excel::XlAutoFilterOperator::xlTop10Items:
- sTabFilts[0].Operator = sheet::FilterOperator_TOP_VALUES;
+ sTabFilts[0].Operator = sheet::FilterOperator2::TOP_VALUES;
break;
case excel::XlAutoFilterOperator::xlTop10Percent:
- sTabFilts[0].Operator = sheet::FilterOperator_TOP_PERCENT;
+ sTabFilts[0].Operator = sheet::FilterOperator2::TOP_PERCENT;
break;
case excel::XlAutoFilterOperator::xlOr:
nConn = sheet::FilterConnection_OR;
@@ -4300,12 +4306,12 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
{
Criteria2 >>= sTabFilts[1].NumericValue;
sTabFilts[1].IsNumeric = sal_True;
- sTabFilts[1].Operator = sheet::FilterOperator_EQUAL;
+ sTabFilts[1].Operator = sheet::FilterOperator2::EQUAL;
}
}
}
- xDesc->setFilterFields( sTabFilts );
+ xDesc->setFilterFields2( sTabFilts );
if ( !bAll )
{
xDataBaseRange->refresh();
@@ -4313,6 +4319,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
else
// was 0 based now seems to be 1
lcl_SetAllQueryForField( pShell, nField, nSheet );
+ }
}
else
{
@@ -4333,7 +4340,10 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
lcl_SetAllQueryForField( pShell, rEntry.nField, nSheet );
}
// remove exising filters
- xDataBaseRange->getFilterDescriptor()->setFilterFields( uno::Sequence< sheet::TableFilterField >() );
+ uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor(
+ xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
+ if( xSheetFilterDescriptor.is() )
+ xSheetFilterDescriptor->setFilterFields2( uno::Sequence< sheet::TableFilterField2 >() );
}
xDBRangeProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ), uno::Any(!bHasAuto) );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 5a5eba4d8d72..e5bb702402d8 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -66,7 +66,6 @@
#include <sot/formats.hxx>
#include <svx/postattr.hxx>
#include <svx/fontitem.hxx>
-#include <svx/charmap.hxx>
#include <svx/clipfmtitem.hxx>
#include <sfx2/passwd.hxx>
#include <svx/hlnkitem.hxx>
@@ -104,6 +103,7 @@
#include "dpsave.hxx"
#include "dpgroup.hxx" // for ScDPNumGroupInfo
#include "spellparam.hxx"
+#include "postit.hxx"
#include "globstr.hrc"
#include "scui_def.hxx" //CHINA001
@@ -1709,32 +1709,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
break;
case SID_TOGGLE_REL:
- {
- BOOL bOk = FALSE;
- SCCOL nCol = GetViewData()->GetCurX();
- SCROW nRow = GetViewData()->GetCurY();
- SCTAB nTab = GetViewData()->GetTabNo();
- ScDocument* pDoc = GetViewData()->GetDocument();
- CellType eType;
- pDoc->GetCellType( nCol, nRow, nTab, eType );
- if (eType == CELLTYPE_FORMULA)
- {
- String aOld;
- pDoc->GetFormula( nCol, nRow, nTab, aOld );
- xub_StrLen nLen = aOld.Len();
- ScRefFinder aFinder( aOld, pDoc );
- aFinder.ToggleRel( 0, nLen );
- if (aFinder.GetFound())
- {
- String aNew = aFinder.GetText();
- pTabViewShell->EnterData( nCol, nRow, nTab, aNew );
- pTabViewShell->UpdateInputHandler();
- bOk = TRUE;
- }
- }
- if (!bOk)
- pTabViewShell->ErrorMessage(STR_ERR_NOREF);
- }
+ pTabViewShell->DoRefConversion();
break;
case SID_DEC_INDENT:
@@ -1996,52 +1971,67 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_CHARMAP:
if( pReqArgs != NULL )
{
- const SvxFontItem& rFontItem = (const SvxFontItem&) rReq.GetArgs()->Get(SID_CHARMAP);
- const SfxStringItem& rStringItem = (const SfxStringItem&) rReq.GetArgs()->Get(SID_ATTR_SECIALCHAR);
- Font aFont;
-
- aFont.SetName( rFontItem.GetFamilyName() );
- aFont.SetStyleName( rFontItem.GetStyleName() );
- aFont.SetFamily( rFontItem.GetFamily() );
- aFont.SetPitch( rFontItem.GetPitch() );
- aFont.SetCharSet( rFontItem.GetCharSet() );
+ String aChars, aFontName;
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if ( pArgs )
+ pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem);
+ if ( pItem )
+ {
+ const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, pItem );
+ if ( pStringItem )
+ aChars = pStringItem->GetValue();
+ const SfxPoolItem* pFtItem = NULL;
+ pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem);
+ const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
+ if ( pFontItem )
+ aFontName = pFontItem->GetValue();
+ }
- pTabViewShell->InsertSpecialChar( rStringItem.GetValue(), aFont );
- if( ! rReq.IsAPI() )
- rReq.Done();
+ if ( aChars.Len() )
+ {
+ Font aFont;
+ pTabViewShell->GetSelectionPattern()->GetFont( aFont, SC_AUTOCOL_BLACK, NULL, NULL, NULL,
+ pTabViewShell->GetSelectionScriptType() );
+ if ( aFontName.Len() )
+ aFont = Font( aFontName, Size(1,1) );
+ pTabViewShell->InsertSpecialChar( aChars, aFont );
+ if( ! rReq.IsAPI() )
+ rReq.Done();
+ }
}
else
{
//CHINA001 SvxCharacterMap* pDlg = new SvxCharacterMap( pTabViewShell->GetDialogParent(), FALSE );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
- AbstractSvxCharacterMap* pDlg = pFact->CreateSvxCharacterMap( pTabViewShell->GetDialogParent(), RID_SVXDLG_CHARMAP, FALSE);
- DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
- Font aCurFont;
// font color doesn't matter here
+ Font aCurFont;
pTabViewShell->GetSelectionPattern()->GetFont( aCurFont, SC_AUTOCOL_BLACK, NULL, NULL, NULL,
pTabViewShell->GetSelectionScriptType() );
- pDlg->SetCharFont( aCurFont );
- if ( pDlg->Execute() == RET_OK )
- {
- Font aNewFont( pDlg->GetCharFont() );
+ SfxAllItemSet aSet( GetPool() );
+ aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+ aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT) ) );
- pTabViewShell->InsertSpecialChar( pDlg->GetCharacters(), aNewFont );
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( pTabViewShell->GetDialogParent(), aSet,
+ pTabViewShell->GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP );
- SfxStringItem aStringItem( SID_ATTR_SECIALCHAR,
- pDlg->GetCharacters() );
- SvxFontItem aFontItem( aNewFont.GetFamily(),
- aNewFont.GetName(),
- aNewFont.GetStyleName(),
- aNewFont.GetPitch(),
- aNewFont.GetCharSet(),
- SID_CHARMAP );
+ if ( pDlg->Execute() == RET_OK )
+ {
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, FALSE );
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
- rReq.AppendItem( aFontItem );
- rReq.AppendItem( aStringItem );
- rReq.Done();
+ if ( pItem && pFontItem )
+ {
+ Font aNewFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), Size(1,1) );
+ aNewFont.SetCharSet( pFontItem->GetCharSet() );
+ aNewFont.SetPitch( pFontItem->GetPitch() );
+ pTabViewShell->InsertSpecialChar( pItem->GetValue(), aNewFont );
+ rReq.AppendItem( *pFontItem );
+ rReq.AppendItem( *pItem );
+ rReq.Done();
+ }
}
delete pDlg;
}
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index c61466267ead..eabf33f3defc 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -138,6 +138,77 @@ bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange )
return bRet;
}
+BOOL lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam )
+{
+ ScTabViewShell* pTabViewShell = pData->GetViewShell();
+ ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDocument* pDoc = pData->GetDocument();
+ SCTAB nTab = pData->GetTabNo();
+ ScDirection eFillDir = DIR_TOP;
+ BOOL bSort = TRUE;
+ ScRange aExternalRange;
+
+ if( rSortParam.nCol1 != rSortParam.nCol2 )
+ eFillDir = DIR_LEFT;
+ if( rSortParam.nRow1 != rSortParam.nRow2 )
+ eFillDir = DIR_TOP;
+
+ SCSIZE nCount = pDoc->GetEmptyLinesInBlock( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab, eFillDir );
+
+ if( rSortParam.nRow2 == MAXROW )
+ aExternalRange = ScRange( rSortParam.nCol1,sal::static_int_cast<SCROW>( nCount ), nTab );
+ else
+ aExternalRange = ScRange( pData->GetCurX(), pData->GetCurY(), nTab );
+
+ SCROW nStartRow = aExternalRange.aStart.Row();
+ SCCOL nStartCol = aExternalRange.aStart.Col();
+ SCROW nEndRow = aExternalRange.aEnd.Row();
+ SCCOL nEndCol = aExternalRange.aEnd.Col();
+ pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, FALSE );
+ aExternalRange.aStart.SetRow( nStartRow );
+ aExternalRange.aStart.SetCol( nStartCol );
+ aExternalRange.aEnd.SetRow( nEndRow );
+ aExternalRange.aEnd.SetCol( nEndCol );
+
+ if(( rSortParam.nCol1 == rSortParam.nCol2 && aExternalRange.aStart.Col() != aExternalRange.aEnd.Col() ) ||
+ ( rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row() ) )
+ {
+ USHORT nFmt = SCA_VALID;
+ String aExtendStr,aCurrentStr;
+
+ pTabViewShell->AddHighlightRange( aExternalRange,Color( COL_LIGHTBLUE ) );
+ ScRange rExtendRange( aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), nTab, aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row(), nTab );
+ rExtendRange.Format( aExtendStr, nFmt, pDoc );
+
+ ScRange rCurrentRange( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab );
+ rCurrentRange.Format( aCurrentStr, nFmt, pDoc );
+
+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
+
+ VclAbstractDialog* pWarningDlg = pFact->CreateScSortWarningDlg( pTabViewShell->GetDialogParent(),aExtendStr,aCurrentStr,RID_SCDLG_SORT_WARNING );
+ DBG_ASSERT(pWarningDlg, "Dialog create fail!");//CHINA001
+ short bResult = pWarningDlg->Execute();
+ if( bResult == BTN_EXTEND_RANGE || bResult == BTN_CURRENT_SELECTION )
+ {
+ if( bResult == BTN_EXTEND_RANGE )
+ {
+ pTabViewShell->MarkRange( aExternalRange, FALSE );
+ pDBData->SetArea( nTab, aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row() );
+ }
+ }
+ else
+ {
+ bSort = FALSE;
+ pData->GetDocShell()->CancelAutoDBRange();
+ }
+
+ delete pWarningDlg;
+ pTabViewShell->ClearHighlightRanges();
+ }
+ return bSort;
+}
+
void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
@@ -332,40 +403,47 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
case SID_SORT_DESCENDING:
case SID_SORT_ASCENDING:
{
- SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+ //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
+ //the patch comes from maoyg
ScSortParam aSortParam;
ScDBData* pDBData = pTabViewShell->GetDBData();
- SCCOL nCol = GetViewData()->GetCurX();
- SCCOL nTab = GetViewData()->GetTabNo();
- ScDocument* pDoc = GetViewData()->GetDocument();
- BOOL bHasHeader = FALSE;
+ ScViewData* pData = GetViewData();
pDBData->GetSortParam( aSortParam );
- bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
+ if( lcl_GetSortParam( pData, aSortParam ) )
+ {
+ SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+ SCCOL nCol = GetViewData()->GetCurX();
+ SCCOL nTab = GetViewData()->GetTabNo();
+ ScDocument* pDoc = GetViewData()->GetDocument();
+
+ pDBData->GetSortParam( aSortParam );
+ BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
- if( nCol < aSortParam.nCol1 )
- nCol = aSortParam.nCol1;
- else if( nCol > aSortParam.nCol2 )
- nCol = aSortParam.nCol2;
+ if( nCol < aSortParam.nCol1 )
+ nCol = aSortParam.nCol1;
+ else if( nCol > aSortParam.nCol2 )
+ nCol = aSortParam.nCol2;
- aSortParam.bHasHeader = bHasHeader;
- aSortParam.bByRow = TRUE;
- aSortParam.bCaseSens = FALSE;
- aSortParam.bIncludePattern = FALSE;
- aSortParam.bInplace = TRUE;
- aSortParam.bDoSort[0] = TRUE;
- aSortParam.nField[0] = nCol;
- aSortParam.bAscending[0] = (nSlotId == SID_SORT_ASCENDING);
+ aSortParam.bHasHeader = bHasHeader;
+ aSortParam.bByRow = TRUE;
+ aSortParam.bCaseSens = FALSE;
+ aSortParam.bIncludePattern = TRUE;
+ aSortParam.bInplace = TRUE;
+ aSortParam.bDoSort[0] = TRUE;
+ aSortParam.nField[0] = nCol;
+ aSortParam.bAscending[0] = (nSlotId == SID_SORT_ASCENDING);
- for ( USHORT i=1; i<MAXSORT; i++ )
- aSortParam.bDoSort[i] = FALSE;
+ for ( USHORT i=1; i<MAXSORT; i++ )
+ aSortParam.bDoSort[i] = FALSE;
- aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
+ aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
- pTabViewShell->UISort( aSortParam ); // Teilergebnisse bei Bedarf neu
+ pTabViewShell->UISort( aSortParam ); // Teilergebnisse bei Bedarf neu
- rReq.Done();
+ rReq.Done();
+ }
}
break;
@@ -373,141 +451,155 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
const SfxItemSet* pArgs = rReq.GetArgs();
+ //#i60401 ux-ctest: Calc does not support all users' strategies regarding sorting data
+ //the patch comes from maoyg
+
if ( pArgs ) // Basic
{
ScSortParam aSortParam;
- ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScViewData* pData = GetViewData();
+
pDBData->GetSortParam( aSortParam );
- aSortParam.bInplace = TRUE; // von Basic immer
-
- const SfxPoolItem* pItem;
- if ( pArgs->GetItemState( SID_SORT_BYROW, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bByRow = ((const SfxBoolItem*)pItem)->GetValue();
- if ( pArgs->GetItemState( SID_SORT_HASHEADER, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bHasHeader = ((const SfxBoolItem*)pItem)->GetValue();
- if ( pArgs->GetItemState( SID_SORT_CASESENS, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bCaseSens = ((const SfxBoolItem*)pItem)->GetValue();
- if ( pArgs->GetItemState( SID_SORT_ATTRIBS, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bIncludePattern = ((const SfxBoolItem*)pItem)->GetValue();
- if ( pArgs->GetItemState( SID_SORT_USERDEF, TRUE, &pItem ) == SFX_ITEM_SET )
+
+ if( lcl_GetSortParam( pData, aSortParam ) )
{
- USHORT nUserIndex = ((const SfxUInt16Item*)pItem)->GetValue();
- aSortParam.bUserDef = ( nUserIndex != 0 );
- if ( nUserIndex )
- aSortParam.nUserIndex = nUserIndex - 1; // Basic: 1-basiert
- }
+ ScDocument* pDoc = GetViewData()->GetDocument();
+
+ pDBData->GetSortParam( aSortParam );
+ BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
+ if( bHasHeader )
+ aSortParam.bHasHeader = bHasHeader;
+
+ aSortParam.bInplace = TRUE; // von Basic immer
+
+ const SfxPoolItem* pItem;
+ if ( pArgs->GetItemState( SID_SORT_BYROW, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bByRow = ((const SfxBoolItem*)pItem)->GetValue();
+ if ( pArgs->GetItemState( SID_SORT_HASHEADER, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bHasHeader = ((const SfxBoolItem*)pItem)->GetValue();
+ if ( pArgs->GetItemState( SID_SORT_CASESENS, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bCaseSens = ((const SfxBoolItem*)pItem)->GetValue();
+ if ( pArgs->GetItemState( SID_SORT_ATTRIBS, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bIncludePattern = ((const SfxBoolItem*)pItem)->GetValue();
+ if ( pArgs->GetItemState( SID_SORT_USERDEF, TRUE, &pItem ) == SFX_ITEM_SET )
+ {
+ USHORT nUserIndex = ((const SfxUInt16Item*)pItem)->GetValue();
+ aSortParam.bUserDef = ( nUserIndex != 0 );
+ if ( nUserIndex )
+ aSortParam.nUserIndex = nUserIndex - 1; // Basic: 1-basiert
+ }
- SCCOLROW nField0 = 0;
- if ( pArgs->GetItemState( FN_PARAM_1, TRUE, &pItem ) == SFX_ITEM_SET )
- nField0 = ((const SfxInt32Item*)pItem)->GetValue();
- aSortParam.bDoSort[0] = ( nField0 != 0 );
- aSortParam.nField[0] = nField0 > 0 ? (nField0-1) : 0;
- if ( pArgs->GetItemState( FN_PARAM_2, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bAscending[0] = ((const SfxBoolItem*)pItem)->GetValue();
- SCCOLROW nField1 = 0;
- if ( pArgs->GetItemState( FN_PARAM_3, TRUE, &pItem ) == SFX_ITEM_SET )
- nField1 = ((const SfxInt32Item*)pItem)->GetValue();
- aSortParam.bDoSort[1] = ( nField1 != 0 );
- aSortParam.nField[1] = nField1 > 0 ? (nField1-1) : 0;
- if ( pArgs->GetItemState( FN_PARAM_4, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bAscending[1] = ((const SfxBoolItem*)pItem)->GetValue();
- SCCOLROW nField2 = 0;
- if ( pArgs->GetItemState( FN_PARAM_5, TRUE, &pItem ) == SFX_ITEM_SET )
- nField2 = ((const SfxInt32Item*)pItem)->GetValue();
- aSortParam.bDoSort[2] = ( nField2 != 0 );
- aSortParam.nField[2] = nField2 > 0 ? (nField2-1) : 0;
- if ( pArgs->GetItemState( FN_PARAM_6, TRUE, &pItem ) == SFX_ITEM_SET )
- aSortParam.bAscending[2] = ((const SfxBoolItem*)pItem)->GetValue();
-
- // Teilergebnisse bei Bedarf neu
- pTabViewShell->UISort( aSortParam );
- rReq.Done();
+ SCCOLROW nField0 = 0;
+ if ( pArgs->GetItemState( FN_PARAM_1, TRUE, &pItem ) == SFX_ITEM_SET )
+ nField0 = ((const SfxInt32Item*)pItem)->GetValue();
+ aSortParam.bDoSort[0] = ( nField0 != 0 );
+ aSortParam.nField[0] = nField0 > 0 ? (nField0-1) : 0;
+ if ( pArgs->GetItemState( FN_PARAM_2, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bAscending[0] = ((const SfxBoolItem*)pItem)->GetValue();
+ SCCOLROW nField1 = 0;
+ if ( pArgs->GetItemState( FN_PARAM_3, TRUE, &pItem ) == SFX_ITEM_SET )
+ nField1 = ((const SfxInt32Item*)pItem)->GetValue();
+ aSortParam.bDoSort[1] = ( nField1 != 0 );
+ aSortParam.nField[1] = nField1 > 0 ? (nField1-1) : 0;
+ if ( pArgs->GetItemState( FN_PARAM_4, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bAscending[1] = ((const SfxBoolItem*)pItem)->GetValue();
+ SCCOLROW nField2 = 0;
+ if ( pArgs->GetItemState( FN_PARAM_5, TRUE, &pItem ) == SFX_ITEM_SET )
+ nField2 = ((const SfxInt32Item*)pItem)->GetValue();
+ aSortParam.bDoSort[2] = ( nField2 != 0 );
+ aSortParam.nField[2] = nField2 > 0 ? (nField2-1) : 0;
+ if ( pArgs->GetItemState( FN_PARAM_6, TRUE, &pItem ) == SFX_ITEM_SET )
+ aSortParam.bAscending[2] = ((const SfxBoolItem*)pItem)->GetValue();
+
+ // Teilergebnisse bei Bedarf neu
+ pTabViewShell->UISort( aSortParam );
+ rReq.Done();
+ }
}
else
{
- //CHINA001 ScSortDlg* pDlg = NULL;
- SfxAbstractTabDialog* pDlg = NULL;
ScSortParam aSortParam;
- SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
+ ScDBData* pDBData = pTabViewShell->GetDBData();
+ ScViewData* pData = GetViewData();
- ScDBData* pDBData = pTabViewShell->GetDBData();
pDBData->GetSortParam( aSortParam );
- aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
- //CHINA001 pDlg = new ScSortDlg( pTabViewShell->GetDialogParent(), &aArgSet );
- ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
+ if( lcl_GetSortParam( pData, aSortParam ) )
+ {
+ SfxAbstractTabDialog* pDlg = NULL;
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
- pDlg = pFact->CreateScSortDlg( pTabViewShell->GetDialogParent(), &aArgSet, RID_SCDLG_SORT );
- DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
- pDlg->SetCurPageId(1);
+ pDBData->GetSortParam( aSortParam );
+ BOOL bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
+ if( bHasHeader )
+ aSortParam.bHasHeader = bHasHeader;
- if ( pDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- const ScSortParam& rOutParam = ((const ScSortItem&)
- pOutSet->Get( SCITEM_SORTDATA )).GetSortData();
+ aArgSet.Put( ScSortItem( SCITEM_SORTDATA, GetViewData(), &aSortParam ) );
- // Teilergebnisse bei Bedarf neu
- pTabViewShell->UISort( rOutParam );
+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
- if ( rOutParam.bInplace )
+ pDlg = pFact->CreateScSortDlg( pTabViewShell->GetDialogParent(), &aArgSet, RID_SCDLG_SORT );
+ DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
+ pDlg->SetCurPageId(1);
+
+ if ( pDlg->Execute() == RET_OK )
{
- rReq.AppendItem( SfxBoolItem( SID_SORT_BYROW,
- rOutParam.bByRow ) );
- rReq.AppendItem( SfxBoolItem( SID_SORT_HASHEADER,
- rOutParam.bHasHeader ) );
- rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
- rOutParam.bCaseSens ) );
- rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
- rOutParam.bIncludePattern ) );
- USHORT nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
- rReq.AppendItem( SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
- if ( rOutParam.bDoSort[0] )
- {
- rReq.AppendItem( SfxInt32Item( FN_PARAM_1,
- rOutParam.nField[0] + 1 ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_2,
- rOutParam.bAscending[0] ) );
- }
- if ( rOutParam.bDoSort[1] )
- {
- rReq.AppendItem( SfxInt32Item( FN_PARAM_3,
- rOutParam.nField[1] + 1 ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_4,
- rOutParam.bAscending[1] ) );
- }
- if ( rOutParam.bDoSort[2] )
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ const ScSortParam& rOutParam = ((const ScSortItem&)
+ pOutSet->Get( SCITEM_SORTDATA )).GetSortData();
+
+ // Teilergebnisse bei Bedarf neu
+ pTabViewShell->UISort( rOutParam );
+
+ if ( rOutParam.bInplace )
{
- rReq.AppendItem( SfxInt32Item( FN_PARAM_5,
- rOutParam.nField[2] + 1 ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_6,
- rOutParam.bAscending[2] ) );
+ rReq.AppendItem( SfxBoolItem( SID_SORT_BYROW,
+ rOutParam.bByRow ) );
+ rReq.AppendItem( SfxBoolItem( SID_SORT_HASHEADER,
+ rOutParam.bHasHeader ) );
+ rReq.AppendItem( SfxBoolItem( SID_SORT_CASESENS,
+ rOutParam.bCaseSens ) );
+ rReq.AppendItem( SfxBoolItem( SID_SORT_ATTRIBS,
+ rOutParam.bIncludePattern ) );
+ USHORT nUser = rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
+ rReq.AppendItem( SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
+ if ( rOutParam.bDoSort[0] )
+ {
+ rReq.AppendItem( SfxInt32Item( FN_PARAM_1,
+ rOutParam.nField[0] + 1 ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_2,
+ rOutParam.bAscending[0] ) );
+ }
+ if ( rOutParam.bDoSort[1] )
+ {
+ rReq.AppendItem( SfxInt32Item( FN_PARAM_3,
+ rOutParam.nField[1] + 1 ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_4,
+ rOutParam.bAscending[1] ) );
+ }
+ if ( rOutParam.bDoSort[2] )
+ {
+ rReq.AppendItem( SfxInt32Item( FN_PARAM_5,
+ rOutParam.nField[2] + 1 ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_6,
+ rOutParam.bAscending[2] ) );
+ }
}
+
+ rReq.Done();
}
+ else
+ GetViewData()->GetDocShell()->CancelAutoDBRange();
- rReq.Done();
+ delete pDlg;
}
- else
- GetViewData()->GetDocShell()->CancelAutoDBRange();
-
- delete pDlg;
}
}
break;
-/*
- {
-
- USHORT nId = ScPivotLayoutWrapper::GetChildWindowId();
- SfxChildWindow* pWnd = pSfxApp->GetChildWindow( nId );
-
- pScMod->SetRefDialog( nId, pWnd ? FALSE : TRUE );
-
- }
- break;
-*/
-
case SID_FILTER:
{
const SfxItemSet* pArgs = rReq.GetArgs();
@@ -980,9 +1072,40 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if ( pOutSet->GetItemState( FID_VALID_CONDMODE, TRUE, &pItem ) == SFX_ITEM_SET )
eOper = (ScConditionMode) ((const SfxAllEnumItem*)pItem)->GetValue();
if ( pOutSet->GetItemState( FID_VALID_VALUE1, TRUE, &pItem ) == SFX_ITEM_SET )
- aExpr1 = ((const SfxStringItem*)pItem)->GetValue();
+ {
+ String aTemp1 = ((const SfxStringItem*)pItem)->GetValue();
+ if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
+ {
+ sal_uInt32 nNumIndex = 0;
+ double nVal;
+ if (pDoc->GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
+ aExpr1 =String( ::rtl::math::doubleToUString( nVal,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), TRUE));
+ else
+ aExpr1 = aTemp1;
+ }
+ else
+ aExpr1 = aTemp1;
+ }
if ( pOutSet->GetItemState( FID_VALID_VALUE2, TRUE, &pItem ) == SFX_ITEM_SET )
- aExpr2 = ((const SfxStringItem*)pItem)->GetValue();
+ {
+ String aTemp2 = ((const SfxStringItem*)pItem)->GetValue();
+ if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME)
+ {
+ sal_uInt32 nNumIndex = 0;
+ double nVal;
+ if (pDoc->GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
+ aExpr2 =String( ::rtl::math::doubleToUString( nVal,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), TRUE));
+ else
+ aExpr2 = aTemp2;
+ }
+ else
+ aExpr2 = aTemp2;
+ }
+
if ( pOutSet->GetItemState( FID_VALID_BLANK, TRUE, &pItem ) == SFX_ITEM_SET )
bBlank = ((const SfxBoolItem*)pItem)->GetValue();
if ( pOutSet->GetItemState( FID_VALID_LISTTYPE, TRUE, &pItem ) == SFX_ITEM_SET )
@@ -1036,6 +1159,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
DBG_ASSERT( pDoc, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDoc is null!" );
ScImportExport aExport( pDoc, aRange );
+ aExport.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::None, 0, false ) );
// #i87703# text to columns fails with tab separator
aExport.SetDelimiter( static_cast< sal_Unicode >( 0 ) );
@@ -1210,6 +1334,10 @@ void __EXPORT ScCellShell::GetDBState( SfxItemSet& rSet )
{
rSet.DisableItem( nWhich );
}
+ else if (pDoc->GetDPAtBlock(aDummy))
+ {
+ rSet.DisableItem( nWhich );
+ }
else
rSet.Put( SfxBoolItem( nWhich, bAutoFilter ) );
}
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index a569e04ea238..dd79bb52a112 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -903,8 +903,8 @@ void ScCellShell::Execute( SfxRequest& rReq )
pTabViewShell->ResetBrushDocument(); // abort format paint brush
else if (pTabViewShell->HasHintWindow())
pTabViewShell->RemoveHintWindow(); // Eingabemeldung abschalten
- else if( IsFullScreen() )
- SetFullScreen( false );
+ else if( ScViewUtil::IsFullScreen( *pTabViewShell ) )
+ ScViewUtil::SetFullScreen( *pTabViewShell, false );
else
{
// TODO/LATER: when is this code executed?
@@ -950,16 +950,12 @@ void ScCellShell::Execute( SfxRequest& rReq )
DBG_ERROR("Execute von InputLine-Status");
break;
-
case SID_STATUS_DOCPOS:
- {
- //! Navigator an-/ausschalten (wie im Writer) ???
- //!pViewData->GetDispatcher().Execute( SID_NAVIGATOR,
- //! SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
- }
+ // Launch navigator.
+ GetViewData()->GetDispatcher().Execute(
+ SID_NAVIGATOR, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
break;
-
case SID_MARKAREA:
// called from Basic at the hidden view to select a range in the visible view
DBG_ERROR("old slot SID_MARKAREA");
@@ -971,27 +967,3 @@ void ScCellShell::Execute( SfxRequest& rReq )
}
}
-bool ScCellShell::IsFullScreen() const
-{
- USHORT nSlot = SID_WIN_FULLSCREEN;
- ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
- SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings();
- SfxPoolItem* pItem = 0;
- bool bIsFullScreen = false;
-
- if (rBindings.QueryState( nSlot, pItem ) >= SFX_ITEM_DEFAULT)
- bIsFullScreen = static_cast< SfxBoolItem* >( pItem )->GetValue();
- return bIsFullScreen;
-}
-
-void ScCellShell::SetFullScreen( bool bSet )
-{
- if( IsFullScreen() != bSet )
- {
- ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
- SfxBoolItem aItem( SID_WIN_FULLSCREEN, bSet );
- pTabViewShell->GetDispatcher()->Execute( SID_WIN_FULLSCREEN, SFX_CALLMODE_RECORD, &aItem, 0L );
- }
-}
-
-
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 297b81de8125..0d44603b64f8 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -112,7 +112,8 @@ ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode )
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDBData* pData = NULL;
ScRange aRange;
- if ( GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE )
+ ScMarkType eMarkType = GetViewData()->GetSimpleArea(aRange);
+ if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED )
pData = pDocSh->GetDBData( aRange, eMode, FALSE );
else if ( eMode != SC_DB_OLD )
pData = pDocSh->GetDBData(
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index a83ef83d3ec9..36667ee43c0f 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -949,25 +949,6 @@ BOOL ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo )
return bFound;
}
-String lcl_GetDatePartName( sal_Int32 nPart )
-{
- String aRet; //! globstr-ID
- switch (nPart)
- {
- //! use translated strings from globstr.src
- case com::sun::star::sheet::DataPilotFieldGroupBy::SECONDS: aRet = String::CreateFromAscii("Seconds"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::MINUTES: aRet = String::CreateFromAscii("Minutes"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::HOURS: aRet = String::CreateFromAscii("Hours"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::DAYS: aRet = String::CreateFromAscii("Days"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS: aRet = String::CreateFromAscii("Months"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::QUARTERS: aRet = String::CreateFromAscii("Quarters"); break;
- case com::sun::star::sheet::DataPilotFieldGroupBy::YEARS: aRet = String::CreateFromAscii("Years"); break;
- default:
- DBG_ERROR("invalid date part");
- }
- return aRet;
-}
-
void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nParts )
{
ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
@@ -987,25 +968,22 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar
ScDPDimensionSaveData* pDimData = aData.GetDimensionData(); // created if not there
// find original base
- String aBaseDimName( aDimName );
- const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName );
- if ( pBaseGroupDim )
- {
- // any entry's SourceDimName is the original base
+ String aBaseDimName = aDimName;
+ if( const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName ) )
aBaseDimName = pBaseGroupDim->GetSourceDimName();
- }
// remove all existing parts (the grouping is built completely new)
- const ScDPSaveNumGroupDimension* pExistingNum = pDimData->GetNumGroupDim( aBaseDimName );
- if ( pExistingNum )
- {
- pDimData->RemoveNumGroupDimension( aBaseDimName );
- // no changed names - SaveData is not affected
- }
-
- std::vector<String> aDeletedNames;
+ /* Remove numeric group dimension (exists once at most). No need
+ to delete anything in save data (grouping was done inplace in
+ an existing base dimension). */
+ pDimData->RemoveNumGroupDimension( aBaseDimName );
+ /* Remove named group dimension(s). Collect deleted dimension
+ names which may be reused while recreating the groups.
+ Dimensions have to be removed from dimension save data and from
+ save data too. */
+ std::vector< String > aDeletedNames;
const ScDPSaveGroupDimension* pExistingGroup = pDimData->GetGroupDimForBase( aBaseDimName );
while ( pExistingGroup )
{
@@ -1015,8 +993,8 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar
// also remove SaveData settings for the dimension that no longer exists
aData.RemoveDimensionByName( aGroupDimName );
- // the name can be used for the new group dimensions, although it is still in use
- // with the DataPilotSource
+ /* The name can be used for the new group dimensions, although
+ it is still in use with the DataPilotSource. */
aDeletedNames.push_back( aGroupDimName );
// see if there are more group dimensions
@@ -1046,7 +1024,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar
// innermost part: create NumGroupDimension (replacing original values)
// Dimension name is left unchanged
- if ( nParts == com::sun::star::sheet::DataPilotFieldGroupBy::DAYS && rInfo.Step != 0.0 )
+ if ( (nParts == sheet::DataPilotFieldGroupBy::DAYS) && (rInfo.Step >= 1.0) )
{
// only days, and a step value specified: use numerical grouping
// with DateValues flag, not date grouping
@@ -1059,8 +1037,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar
}
else
{
- ScDPSaveNumGroupDimension aNumGroupDim( aBaseDimName, aEmpty );
- aNumGroupDim.SetDateInfo( rInfo, nMask );
+ ScDPSaveNumGroupDimension aNumGroupDim( aBaseDimName, rInfo, nMask );
pDimData->AddNumGroupDimension( aNumGroupDim );
}
@@ -1069,10 +1046,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar
else
{
// additional parts: create GroupDimension (shown as additional dimensions)
-
- String aPartName = lcl_GetDatePartName( nMask );
- String aGroupDimName = pDimData->CreateGroupDimName(
- aPartName, *pDPObj, true, &aDeletedNames );
+ String aGroupDimName = pDimData->CreateDateGroupDimName( nMask, *pDPObj, true, &aDeletedNames );
ScDPSaveGroupDimension aGroupDim( aBaseDimName, aGroupDimName );
aGroupDim.SetDateInfo( rInfo, nMask );
pDimData->AddGroupDimension( aGroupDim );
@@ -1924,7 +1898,13 @@ void ScDBFunc::RepeatDB( BOOL bRecord )
pDBData->GetQueryParam( aQueryParam ); // Bereich kann sich geaendert haben
ScRange aAdvSource;
if (pDBData->GetAdvancedQuerySource(aAdvSource))
+ {
+ pDoc->CreateQueryParam(
+ aAdvSource.aStart.Col(), aAdvSource.aStart.Row(),
+ aAdvSource.aEnd.Col(), aAdvSource.aEnd.Row(),
+ aAdvSource.aStart.Tab(), aQueryParam );
Query( aQueryParam, &aAdvSource, FALSE );
+ }
else
Query( aQueryParam, NULL, FALSE );
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index b5f93446b605..d9c19f02058a 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -69,6 +69,7 @@
#include <vcl/sound.hxx>
#include <sot/formats.hxx>
#include <svtools/transfer.hxx>
+#include <svtools/stritem.hxx>
#define _EDITSH_CXX
#include "editsh.hxx"
@@ -332,16 +333,41 @@ void ScEditShell::Execute( SfxRequest& rReq )
String aString;
SvxFontItem aNewItem( EE_CHAR_FONTINFO );
- BOOL bOk = ScViewUtil::ExecuteCharMap( rItem, aNewItem, aString );
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if( pArgs )
+ pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem);
- // while the dialog was open, edit mode may have been stopped
- if (!SC_MOD()->IsInputMode())
+ if ( pItem )
{
- Sound::Beep();
- return;
+ aString = ((const SfxStringItem*)pItem)->GetValue();
+ const SfxPoolItem* pFtItem = NULL;
+ pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem);
+ const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
+ if ( pFontItem )
+ {
+ String aFontName(pFontItem->GetValue());
+ Font aFont(aFontName, Size(1,1)); // Size nur wg. CTOR
+ aNewItem = SvxFontItem( aFont.GetFamily(), aFont.GetName(),
+ aFont.GetStyleName(), aFont.GetPitch(),
+ aFont.GetCharSet(), ATTR_FONT );
+ }
+ else
+ aNewItem = rItem;
}
+ else
+ {
+ ScViewUtil::ExecuteCharMap( rItem, *pViewData->GetViewShell()->GetViewFrame(), aNewItem, aString );
- if (bOk)
+ // while the dialog was open, edit mode may have been stopped
+ if (!SC_MOD()->IsInputMode())
+ {
+ Sound::Beep();
+ return;
+ }
+ }
+
+ if ( aString.Len() )
{
// if string contains WEAK characters, set all fonts
BYTE nSetScript;
@@ -361,6 +387,14 @@ void ScEditShell::Execute( SfxRequest& rReq )
pTableView->InsertText(aString);
if (pTopView)
pTopView->InsertText(aString);
+
+ SfxStringItem aStringItem( SID_CHARMAP, aString );
+ SfxStringItem aFontItem( SID_ATTR_SPECIALCHAR, aNewItem.GetFamilyName() );
+ rReq.AppendItem( aFontItem );
+ rReq.AppendItem( aStringItem );
+ rReq.Done();
+
+
}
if (pTopView)
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 2215cbd4d1af..b2f3e12d1ee6 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1093,7 +1093,12 @@ void ScFormatShell::ExecuteAlignment( SfxRequest& rReq )
break;
case SID_H_ALIGNCELL:
- pTabViewShell->ApplyAttr( SvxHorJustifyItem( (SvxCellHorJustify)((const SvxHorJustifyItem*)pItem)->GetValue(), ATTR_HOR_JUSTIFY ) );
+ {
+ SvxCellHorJustify eJust = (SvxCellHorJustify)((const SvxHorJustifyItem*)pItem)->GetValue();
+ // #i78476# update alignment of text in cell edit mode
+ pTabViewShell->UpdateInputHandlerCellAdjust( eJust );
+ pTabViewShell->ApplyAttr( SvxHorJustifyItem( eJust, ATTR_HOR_JUSTIFY ) );
+ }
break;
case SID_V_ALIGNCELL:
pTabViewShell->ApplyAttr( SvxVerJustifyItem( (SvxCellVerJustify)((const SvxVerJustifyItem*)pItem)->GetValue(), ATTR_VER_JUSTIFY ) );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index d2c46e873e90..5397377b69cc 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -118,6 +118,9 @@
#include "userdat.hxx"
#include "drwlayer.hxx"
#include "attrib.hxx"
+#include "validat.hxx"
+#include "tabprotection.hxx"
+#include "postit.hxx"
// #114409#
#include <vcl/salbtype.hxx> // FRound
@@ -127,6 +130,11 @@
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <vcl/svapp.hxx>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
using namespace com::sun::star;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Any;
@@ -989,9 +997,50 @@ void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect )
nSelPos = SC_AUTOFILTER_CUSTOM;
}
}
+ else
+ {
+
+ ULONG nIndex = ((SfxUInt32Item*)pDoc->GetAttr(
+ nCol, nRow, nTab, ATTR_VALIDDATA ))->GetValue();
+ if ( nIndex )
+ {
+ const ScValidationData* pData = pDoc->GetValidationEntry( nIndex );
+ if (pData)
+ {
+ TypedStrData* pNew = NULL;
+ String aDocStr;
+ pDoc->GetString( nCol, nRow, nTab, aDocStr );
+ if ( pDoc->HasValueData( nCol, nRow, nTab ) )
+ {
+ double fVal = pDoc->GetValue(ScAddress(nCol, nRow, nTab));
+ pNew = new TypedStrData( aDocStr, fVal, SC_STRTYPE_VALUE );
+ }
+ else
+ pNew = new TypedStrData( aDocStr, 0.0, SC_STRTYPE_STANDARD );
+
+ bool bSortList = ( pData->GetListType() == ValidListType::SORTEDASCENDING);
+ if ( bSortList )
+ {
+ USHORT nStrIndex;
+ if (aStrings.Search(pNew,nStrIndex))
+ nSelPos = nStrIndex;
+ }
+ else
+ {
+ USHORT nCount = aStrings.GetCount();
+ for (i = 0; ((i < nCount) && ( LISTBOX_ENTRY_NOTFOUND == nSelPos)); i++)
+ {
+ if ( aStrings.Compare(aStrings[i], pNew)==0 )
+ nSelPos = i;
+ }
+ }
+ delete pNew;
+ }
+ }
+ }
// neu (309): irgendwas muss immer selektiert sein:
- if ( LISTBOX_ENTRY_NOTFOUND == nSelPos && pFilterBox->GetEntryCount() > 0 )
+ if ( LISTBOX_ENTRY_NOTFOUND == nSelPos && pFilterBox->GetEntryCount() > 0 && !bDataSelect)
nSelPos = 0;
// keine leere Auswahl-Liste anzeigen:
@@ -1010,6 +1059,11 @@ void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect )
// Select erst nach GrabFocus, damit das Focus-Rechteck richtig landet
if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
pFilterBox->SelectEntryPos( nSelPos );
+ else
+ {
+ if (bDataSelect)
+ pFilterBox->SetNoSelection();
+ }
pFilterBox->EndInit();
@@ -1092,6 +1146,13 @@ void ScGridWindow::ExecFilter( ULONG nSel,
if (SC_AUTOFILTER_CUSTOM == nSel)
{
+ SCTAB nAreaTab;
+ SCCOL nStartCol;
+ SCROW nStartRow;
+ SCCOL nEndCol;
+ SCROW nEndRow;
+ pDBData->GetArea( nAreaTab, nStartCol,nStartRow,nEndCol,nEndRow );
+ pViewData->GetView()->MarkRange( ScRange( nStartCol,nStartRow,nAreaTab,nEndCol,nEndRow,nAreaTab));
pViewData->GetView()->SetCursor(nCol,nRow); //! auch ueber Slot ??
pViewData->GetDispatcher().Execute( SID_FILTER, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD );
}
@@ -1973,8 +2034,9 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
Point aPos = rMEvt.GetPosPixel();
SCsCOL nPosX;
SCsROW nPosY;
+ SCTAB nTab = pViewData->GetTabNo();
pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( nPosX, nPosY, pViewData->GetTabNo() );
+ ScDPObject* pDPObj = pDoc->GetDPAtCursor( nPosX, nPosY, nTab );
if ( pDPObj && pDPObj->GetSaveData()->GetDrillDown() )
{
ScAddress aCellPos( nPosX, nPosY, pViewData->GetTabNo() );
@@ -2016,16 +2078,34 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
return;
}
- // edit cell contents
- pViewData->GetViewShell()->UpdateInputHandler();
- pScMod->SetInputMode( SC_INPUT_TABLE );
- if (pViewData->HasEditView(eWhich))
+ // Check for cell protection attribute.
+ ScTableProtection* pProtect = pDoc->GetTabProtection( nTab );
+ bool bEditAllowed = true;
+ if ( pProtect && pProtect->isProtected() )
{
- // Text-Cursor gleich an die geklickte Stelle setzen
- EditView* pEditView = pViewData->GetEditView( eWhich );
- MouseEvent aEditEvt( rMEvt.GetPosPixel(), 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 );
- pEditView->MouseButtonDown( aEditEvt );
- pEditView->MouseButtonUp( aEditEvt );
+ bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED);
+ bool bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+
+ if ( bSkipProtected && bSkipUnprotected )
+ bEditAllowed = false;
+ else if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
+ bEditAllowed = false;
+ }
+
+ if ( bEditAllowed )
+ {
+ // edit cell contents
+ pViewData->GetViewShell()->UpdateInputHandler();
+ pScMod->SetInputMode( SC_INPUT_TABLE );
+ if (pViewData->HasEditView(eWhich))
+ {
+ // Text-Cursor gleich an die geklickte Stelle setzen
+ EditView* pEditView = pViewData->GetEditView( eWhich );
+ MouseEvent aEditEvt( rMEvt.GetPosPixel(), 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 );
+ pEditView->MouseButtonDown( aEditEvt );
+ pEditView->MouseButtonUp( aEditEvt );
+ }
}
return;
}
@@ -2332,6 +2412,8 @@ void lcl_InitMouseEvent( ::com::sun::star::awt::MouseEvent& rEvent, const MouseE
rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
if ( rEvt.IsMod2() )
rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
+ if ( rEvt.IsMod3() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD3;
rEvent.Buttons = 0;
if ( rEvt.IsLeft() )
@@ -5613,112 +5695,107 @@ namespace sdr
mePaintType( eType ),
maRectangles( rRects )
{
+ // no AA for selection overlays
+ allowAntiAliase(false);
}
OverlayObjectCell::~OverlayObjectCell()
{
}
- void OverlayObjectCell::drawGeometry(OutputDevice& rOutputDevice)
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
{
- // safe original AA and switch off for selection
- const sal_uInt16 nOriginalAA(rOutputDevice.GetAntialiasing());
- rOutputDevice.SetAntialiasing(0);
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ const sal_uInt32 nCount(maRectangles.size());
- // set colors
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(getBaseColor());
-
- if ( mePaintType == SC_OVERLAY_BORDER_TRANSPARENT )
+ if(nCount)
{
- // to draw the border, all rectangles have to be collected into a PolyPolygon
-
- PolyPolygon aPolyPoly;
- sal_uInt32 nRectCount = maRectangles.size();
- for(sal_uInt32 nRect=0; nRect < nRectCount; ++nRect)
+ // create fill primities for all rectangles
+ // These ranges are meant as rectangles, so it is not sufficient to replace them
+ // using the derived polygon. That would leave out the bottom and right lines
+ // in a discrete width/height due to polygon painting conventions of leaving off those.
+ // To solve, it is either possible to create a view-dependent rectangle primitive
+ // handling this internally or to additionally create a hairline primitive to
+ // cover these areas (which i will do here)
+ const bool bIsTransparent(SC_OVERLAY_BORDER_TRANSPARENT == mePaintType);
+ aRetval.realloc(nCount * 2);
+
+ for(sal_uInt32 a(0);a < nCount; a++)
{
- const basegfx::B2DRange& rRange(maRectangles[nRect]);
- Rectangle aRectangle(FRound(rRange.getMinX()), FRound(rRange.getMinY()), FRound(rRange.getMaxX()), FRound(rRange.getMaxY()));
- if ( nRectCount == 1 || nRect+1 < nRectCount )
- {
- // simply add for all except the last rect
- aPolyPoly.Insert( Polygon( aRectangle ) );
- }
- else
- {
- PolyPolygon aTemp( aPolyPoly );
- aTemp.GetUnion( PolyPolygon( Polygon( aRectangle ) ), aPolyPoly );
- }
- }
-
- rOutputDevice.DrawTransparent(aPolyPoly, 75);
-
- rOutputDevice.SetLineColor(getBaseColor());
- rOutputDevice.SetFillColor();
-
- rOutputDevice.DrawPolyPolygon(aPolyPoly);
- }
- else
- {
- if ( mePaintType == SC_OVERLAY_INVERT )
- {
- rOutputDevice.Push();
- rOutputDevice.SetRasterOp( ROP_XOR );
- rOutputDevice.SetFillColor( COL_WHITE );
+ const basegfx::B2DRange& rRange(maRectangles[a]);
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
+
+ aRetval[a * 2] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
+ aRetval[(a * 2) + 1] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
}
- for(sal_uInt32 a(0L);a < maRectangles.size(); a++)
+ if(SC_OVERLAY_INVERT == mePaintType)
{
- const basegfx::B2DRange& rRange(maRectangles[a]);
- const Rectangle aRectangle(FRound(rRange.getMinX()), FRound(rRange.getMinY()), FRound(rRange.getMaxX()), FRound(rRange.getMaxY()));
+ // embed all in invert primitive
+ const drawinglayer::primitive2d::Primitive2DReference aInvert(
+ new drawinglayer::primitive2d::InvertPrimitive2D(
+ aRetval));
- switch(mePaintType)
- {
- case SC_OVERLAY_INVERT :
- {
- rOutputDevice.DrawRect( aRectangle );
- break;
- }
- case SC_OVERLAY_SOLID :
- {
- rOutputDevice.DrawRect(aRectangle);
- break;
- }
- default:
- {
- // SC_OVERLAY_BORDER_TRANSPARENT is handled separately
- }
- }
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
}
-
- if ( mePaintType == SC_OVERLAY_INVERT )
+ else if(bIsTransparent)
{
- rOutputDevice.Pop();
+ // embed all rectangles in 75% transparent paint
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha(
+ new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
+ aRetval,
+ 0.75));
+
+ // prepare merged PolyPoygon selection outline
+ const basegfx::B2DPolyPolygon aPolyPolygon(impGetOverlayPolyPolygon());
+ const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline(
+ new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+ aPolyPolygon,
+ aRGBColor));
+
+ // add both to result
+ aRetval.realloc(2);
+ aRetval[0] = aUnifiedAlpha;
+ aRetval[1] = aSelectionOutline;
}
}
- // restore original AA
- rOutputDevice.SetAntialiasing(nOriginalAA);
+ return aRetval;
}
- void OverlayObjectCell::createBaseRange(OutputDevice& /* rOutputDevice */)
+ basegfx::B2DPolyPolygon OverlayObjectCell::impGetOverlayPolyPolygon() const
{
- maBaseRange.reset();
+ PolyPolygon aPolyPoly;
+ const sal_uInt32 nRectCount(maRectangles.size());
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
+ for(sal_uInt32 nRect(0); nRect < nRectCount; ++nRect)
{
- maBaseRange.expand(maRectangles[a]);
- }
- }
+ const basegfx::B2DRange& rRange(maRectangles[nRect]);
+ const Rectangle aRectangle(
+ FRound(rRange.getMinX()), FRound(rRange.getMinY()),
+ FRound(rRange.getMaxX()), FRound(rRange.getMaxY()));
- void OverlayObjectCell::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
- {
- maRectangles[a].transform(rMatrix);
+ if ( nRectCount == 1 || nRect+1 < nRectCount )
+ {
+ // simply add for all except the last rect
+ aPolyPoly.Insert( Polygon( aRectangle ) );
+ }
+ else
+ {
+ PolyPolygon aTemp( aPolyPoly );
+ aTemp.GetUnion( PolyPolygon( Polygon( aRectangle ) ), aPolyPoly );
+ }
}
- }
+ return aPolyPoly.getB2DPolyPolygon();
+ }
} // end of namespace overlay
} // end of namespace sdr
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 8739ee2b0b91..f3d5b2781607 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -338,12 +338,12 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
SdrObject* pObj = 0;
SdrPageView* pPV = 0;
Point aMDPos = PixelToLogic( aPosPixel );
- if ( pDrView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER) )
+ if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
{
if ( pObj->IsGroupObject() )
{
SdrObject* pHit = 0;
- if ( pDrView->PickObj(aMDPos, pHit, pPV, SDRSEARCH_DEEP ) )
+ if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
pObj = pHit;
}
#ifdef ISSUE66550_HLINK_FOR_SHAPES
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index b638b89b7a65..b94837fc1793 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -76,6 +76,7 @@
#include <com/sun/star/accessibility/XAccessible.hpp>
#include "AccessibilityHints.hxx"
#include <vcl/svapp.hxx>
+#include "viewutil.hxx"
// STATIC DATA -----------------------------------------------------------
@@ -243,6 +244,10 @@ void ScPreview::CalcPages( SCTAB /*nToWhichTab*/ )
nTabsTested = 0;
}
+ // update all pending row heights with a single progress bar,
+ // instead of a separate progress for each sheet from ScPrintFunc
+ pDocShell->UpdatePendingRowHeights( nAnz-1, true );
+
// PrintOptions is passed to PrintFunc for SkipEmpty flag,
// but always all sheets are used (there is no selected sheet)
ScPrintOptions aOptions = SC_MOD()->GetPrintOptions();
@@ -696,7 +701,7 @@ void __EXPORT ScPreview::KeyInput( const KeyEvent& rKEvt )
switch(nKey)
{
case KEY_ADD: nSlot = SID_PREVIEW_ZOOMIN; break;
- case KEY_ESCAPE: nSlot = SID_PREVIEW_CLOSE; break;
+ case KEY_ESCAPE: nSlot = ScViewUtil::IsFullScreen( *pViewShell ) ? SID_CANCEL : SID_PREVIEW_CLOSE; break;
case KEY_SUBTRACT: nSlot = SID_PREVIEW_ZOOMOUT; break;
}
if(nSlot)
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index ae316bcee196..360c05e2f84a 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -827,6 +827,10 @@ void __EXPORT ScPreviewShell::Execute( SfxRequest& rReq )
case SID_CURSORRIGHT:
DoScroll( nSlot );
break;
+ case SID_CANCEL:
+ if( ScViewUtil::IsFullScreen( *this ) )
+ ScViewUtil::SetFullScreen( *this, false );
+ break;
default:
break;
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 4324b610dd0b..b7b8b9fbadf6 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -185,6 +185,7 @@ long lcl_LineTotal(const SvxBorderLine* pLine)
void ScPrintFunc::Construct( const ScPrintOptions* pOptions )
{
+ pDocShell->UpdatePendingRowHeights( nPrintTab );
pDoc = pDocShell->GetDocument();
SfxPrinter* pDocPrinter = pDoc->GetPrinter(); // auch fuer Preview den Drucker nehmen
@@ -886,7 +887,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
if ( !aPageSize.Width() || !aPageSize.Height() )
{
DBG_ERROR("PageSize Null ?!?!?");
- aPageSize = SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 );
+ aPageSize = SvxPaperInfo::GetPaperSize( PAPER_A4 );
}
pBorderItem = (const SvxBoxItem*) &pParamSet->Get(ATTR_BORDER);
@@ -2677,7 +2678,7 @@ void ScPrintFunc::ApplyPrintSettings()
aEnumSize.Width() = aEnumSize.Height();
aEnumSize.Height() = nTemp;
}
- Paper ePaper = SvxPaperInfo::GetSvPaper( aEnumSize, MAP_TWIP, TRUE );
+ Paper ePaper = SvxPaperInfo::GetSvxPaper( aEnumSize, MAP_TWIP, TRUE );
USHORT nPaperBin = ((const SvxPaperBinItem&)pParamSet->Get(ATTR_PAGE_PAPERBIN)).GetValue();
pPrinter->SetPaper( ePaper );
diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx
index 15b4329fb00e..e6b4a3d0c20e 100644
--- a/sc/source/ui/view/scextopt.cxx
+++ b/sc/source/ui/view/scextopt.cxx
@@ -42,9 +42,7 @@ ScExtDocSettings::ScExtDocSettings() :
maOleSize( ScAddress::INITIALIZE_INVALID ),
mfTabBarWidth( -1.0 ),
mnLinkCnt( 0 ),
- mnDisplTab( 0 ),
- mbWinProtected( false ),
- mbEncrypted( false )
+ mnDisplTab( 0 )
{
}
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index 288b50daed19..b8d0da840db7 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -47,6 +47,7 @@
//#include "dataobj.hxx"
#include "transobj.hxx"
#include "docsh.hxx"
+#include "tabprotection.hxx"
extern USHORT nScFillModeMouseModifier; // global.cxx
@@ -322,6 +323,26 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
{
ScTabView* pView = pViewData->GetView();
SCTAB nTab = pViewData->GetTabNo();
+ ScDocument* pDoc = pViewData->GetDocument();
+
+ if ( pDoc->IsTabProtected(nTab) )
+ {
+ if (nPosX < 0 || nPosY < 0)
+ return false;
+
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ bool bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+
+ if ( bSkipProtected && bSkipUnprotected )
+ return FALSE;
+
+ bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED);
+ if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
+ // Don't select this cell!
+ return FALSE;
+ }
+
ScModule* pScMod = SC_MOD();
ScTabViewShell* pViewShell = pViewData->GetViewShell();
bool bRefMode = ( pViewShell ? pViewShell->IsRefInputMode() : false );
@@ -375,7 +396,6 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
ScRange aDelRange;
BOOL bOldDelMark = pViewData->GetDelMark( aDelRange );
- ScDocument* pDoc = pViewData->GetDocument();
if ( nPosX+1 >= (SCsCOL) nStartX && nPosX <= (SCsCOL) nEndX &&
nPosY+1 >= (SCsROW) nStartY && nPosY <= (SCsROW) nEndY &&
@@ -511,7 +531,6 @@ BOOL ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, BOOL bScrol
BYTE nMode = pViewData->GetFillMode();
if ( nMode == SC_FILL_EMBED_LT || nMode == SC_FILL_EMBED_RB )
{
- ScDocument* pDoc = pViewData->GetDocument();
DBG_ASSERT( pDoc->IsEmbedded(), "!pDoc->IsEmbedded()" );
ScRange aRange;
pDoc->GetEmbedded( aRange);
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 9b3779a4abd6..3bfb8729cd37 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -61,8 +61,8 @@ ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) :
DropTargetHelper( this ),
DragSourceHelper( this ),
pViewData( pData ),
- nMouseClickPageId( TAB_PAGE_NOTFOUND ),
- nSelPageIdByMouse( TAB_PAGE_NOTFOUND ),
+ nMouseClickPageId( TABBAR_PAGE_NOTFOUND ),
+ nSelPageIdByMouse( TABBAR_PAGE_NOTFOUND ),
bErrorShown( FALSE )
{
ScDocument* pDoc = pViewData->GetDocument();
@@ -159,7 +159,7 @@ void ScTabControl::MouseButtonDown( const MouseEvent& rMEvt )
if( rMEvt.IsLeft() && (rMEvt.GetModifier() == 0) )
nMouseClickPageId = GetPageId( rMEvt.GetPosPixel() );
else
- nMouseClickPageId = TAB_PAGE_NOTFOUND;
+ nMouseClickPageId = TABBAR_PAGE_NOTFOUND;
TabBar::MouseButtonDown( rMEvt );
}
@@ -170,8 +170,9 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt )
// mouse button down and up on same page?
if( nMouseClickPageId != GetPageId( aPos ) )
- nMouseClickPageId = TAB_PAGE_NOTFOUND;
- else if ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() )
+ nMouseClickPageId = TABBAR_PAGE_NOTFOUND;
+
+ if ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() && nMouseClickPageId != 0 && nMouseClickPageId != TAB_PAGE_NOTFOUND )
{
SfxDispatcher* pDispatcher = pViewData->GetViewShell()->GetViewFrame()->GetDispatcher();
pDispatcher->Execute( FID_TAB_MENU_RENAME, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
@@ -179,11 +180,14 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt )
if( nMouseClickPageId == 0 )
{
- // free area clicked -> add new sheet
+ // Click in the area next to the existing tabs:
+ // #i70320# if several sheets are selected, deselect all ecxept the current sheet,
+ // otherwise add new sheet
+ USHORT nSlot = ( GetSelectPageCount() > 1 ) ? FID_TAB_DESELECTALL : FID_INS_TABLE;
SfxDispatcher* pDispatcher = pViewData->GetViewShell()->GetViewFrame()->GetDispatcher();
- pDispatcher->Execute( FID_INS_TABLE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
+ pDispatcher->Execute( nSlot, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
// forget page ID, to be really sure that the dialog is not called twice
- nMouseClickPageId = TAB_PAGE_NOTFOUND;
+ nMouseClickPageId = TABBAR_PAGE_NOTFOUND;
}
TabBar::MouseButtonUp( rMEvt );
@@ -195,7 +199,7 @@ void ScTabControl::Select()
nSelPageIdByMouse = nMouseClickPageId;
/* Reset nMouseClickPageId, so that next Select() call may invalidate
nSelPageIdByMouse (i.e. if called from keyboard). */
- nMouseClickPageId = TAB_PAGE_NOTFOUND;
+ nMouseClickPageId = TABBAR_PAGE_NOTFOUND;
ScModule* pScMod = SC_MOD();
ScDocument* pDoc = pViewData->GetDocument();
@@ -251,6 +255,7 @@ void ScTabControl::Select()
SfxBindings& rBind = pViewData->GetBindings();
rBind.Invalidate( FID_FILL_TAB );
+ rBind.Invalidate( FID_TAB_DESELECTALL );
rBind.Invalidate( FID_INS_TABLE );
rBind.Invalidate( FID_TAB_APPEND );
@@ -368,7 +373,7 @@ void ScTabControl::ActivateView(BOOL bActivate)
void ScTabControl::SetSheetLayoutRTL( BOOL bSheetRTL )
{
SetEffectiveRTL( bSheetRTL );
- nSelPageIdByMouse = TAB_PAGE_NOTFOUND;
+ nSelPageIdByMouse = TABBAR_PAGE_NOTFOUND;
}
@@ -550,9 +555,9 @@ sal_Int8 ScTabControl::AcceptDrop( const AcceptDropEvent& rEvt )
long ScTabControl::StartRenaming()
{
if ( pViewData->GetDocument()->IsDocEditable() )
- return TAB_RENAMING_YES;
+ return TABBAR_RENAMING_YES;
else
- return TAB_RENAMING_NO;
+ return TABBAR_RENAMING_NO;
}
long ScTabControl::AllowRenaming()
@@ -560,7 +565,7 @@ long ScTabControl::AllowRenaming()
ScTabViewShell* pViewSh = pViewData->GetViewShell();
DBG_ASSERT( pViewSh, "pViewData->GetViewShell()" );
- long nRet = TAB_RENAMING_CANCEL;
+ long nRet = TABBAR_RENAMING_CANCEL;
USHORT nId = GetEditPageId();
if ( nId )
{
@@ -568,27 +573,27 @@ long ScTabControl::AllowRenaming()
String aNewName = GetEditText();
BOOL bDone = pViewSh->RenameTable( aNewName, nTab );
if ( bDone )
- nRet = TAB_RENAMING_YES;
+ nRet = TABBAR_RENAMING_YES;
else if ( bErrorShown )
{
// if the error message from this TabControl is currently visible,
// don't end edit mode now, to avoid problems when returning to
// the other call (showing the error) - this should not happen
DBG_ERROR("ScTabControl::AllowRenaming: nested calls");
- nRet = TAB_RENAMING_NO;
+ nRet = TABBAR_RENAMING_NO;
}
else if ( Application::IsInModalMode() )
{
// #73472# don't show error message above any modal dialog
// instead cancel renaming without error message
- nRet = TAB_RENAMING_CANCEL;
+ nRet = TABBAR_RENAMING_CANCEL;
}
else
{
bErrorShown = TRUE;
pViewSh->ErrorMessage( STR_INVALIDTABNAME );
bErrorShown = FALSE;
- nRet = TAB_RENAMING_NO;
+ nRet = TABBAR_RENAMING_NO;
}
}
return nRet;
@@ -603,12 +608,12 @@ void ScTabControl::EndRenaming()
void ScTabControl::Mirror()
{
TabBar::Mirror();
- if( nSelPageIdByMouse != TAB_PAGE_NOTFOUND )
+ if( nSelPageIdByMouse != TABBAR_PAGE_NOTFOUND )
{
Rectangle aRect( GetPageRect( GetCurPageId() ) );
if( !aRect.IsEmpty() )
SetPointerPosPixel( aRect.Center() );
- nSelPageIdByMouse = TAB_PAGE_NOTFOUND; // only once after a Select()
+ nSelPageIdByMouse = TABBAR_PAGE_NOTFOUND; // only once after a Select()
}
}
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index b9ebe78e0a63..2caaae9146fb 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -587,10 +587,28 @@ void ScTabView::SelectAllTables()
// pDoc->ExtendMarksFromTable( nTab );
aViewData.GetDocShell()->PostPaintExtras();
- aViewData.GetBindings().Invalidate( FID_FILL_TAB );
+ SfxBindings& rBind = aViewData.GetBindings();
+ rBind.Invalidate( FID_FILL_TAB );
+ rBind.Invalidate( FID_TAB_DESELECTALL );
}
}
+void ScTabView::DeselectAllTables()
+{
+ ScDocument* pDoc = aViewData.GetDocument();
+ ScMarkData& rMark = aViewData.GetMarkData();
+ SCTAB nTab = aViewData.GetTabNo();
+ SCTAB nCount = pDoc->GetTableCount();
+
+ for (SCTAB i=0; i<nCount; i++)
+ rMark.SelectTable( i, ( i == nTab ) );
+
+ aViewData.GetDocShell()->PostPaintExtras();
+ SfxBindings& rBind = aViewData.GetBindings();
+ rBind.Invalidate( FID_FILL_TAB );
+ rBind.Invalidate( FID_TAB_DESELECTALL );
+}
+
BOOL lcl_FitsInWindow( double fScaleX, double fScaleY, USHORT nZoom,
long nWindowX, long nWindowY, ScDocument* pDoc, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 8f1f4370d752..608658024d2b 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -79,6 +79,7 @@
#include "AccessibilityHints.hxx"
#include "rangeutl.hxx"
#include "client.hxx"
+#include "tabprotection.hxx"
#include <com/sun/star/chart2/data/HighlightedRange.hpp>
@@ -946,6 +947,17 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
ScDocument* pDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
+ bool bSkipProtected = false, bSkipUnprotected = false;
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ if ( pProtect && pProtect->isProtected() )
+ {
+ bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+ }
+
+ if ( bSkipProtected && bSkipUnprotected )
+ return;
+
SCsCOL nOldX;
SCsROW nOldY;
SCsCOL nCurX;
@@ -965,7 +977,7 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
nCurY = (nMovY != 0) ? nOldY+nMovY : (SCsROW) aViewData.GetOldCurY();
}
- BOOL bHidden;
+ BOOL bSkipCell = FALSE;
aViewData.ResetOldCursor();
if (nMovX != 0 && VALIDCOLROW(nCurX,nCurY))
@@ -974,15 +986,20 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
do
{
BYTE nColFlags = pDoc->GetColFlags( nCurX, nTab );
- bHidden = (nColFlags & CR_HIDDEN) || pDoc->IsHorOverlapped( nCurX, nCurY, nTab );
- if (bHidden)
+ bSkipCell = (nColFlags & CR_HIDDEN) || pDoc->IsHorOverlapped( nCurX, nCurY, nTab );
+ if (bSkipProtected && !bSkipCell)
+ bSkipCell = pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
+ if (bSkipUnprotected && !bSkipCell)
+ bSkipCell = !pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
+
+ if (bSkipCell)
{
if ( nCurX<=0 || nCurX>=MAXCOL )
{
if (bHFlip)
{
nCurX = nOldX;
- bHidden = FALSE;
+ bSkipCell = FALSE;
}
else
{
@@ -995,7 +1012,8 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
if (nMovX > 0) ++nCurX; else --nCurX;
}
}
- while (bHidden);
+ while (bSkipCell);
+
if (pDoc->IsVerOverlapped( nCurX, nCurY, nTab ))
{
aViewData.SetOldCursor( nCurX,nCurY );
@@ -1010,15 +1028,20 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
do
{
BYTE nRowFlags = pDoc->GetRowFlags( nCurY, nTab );
- bHidden = (nRowFlags & CR_HIDDEN) || pDoc->IsVerOverlapped( nCurX, nCurY, nTab );
- if (bHidden)
+ bSkipCell = (nRowFlags & CR_HIDDEN) || pDoc->IsVerOverlapped( nCurX, nCurY, nTab );
+ if (bSkipProtected && !bSkipCell)
+ bSkipCell = pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
+ if (bSkipUnprotected && !bSkipCell)
+ bSkipCell = !pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
+
+ if (bSkipCell)
{
if ( nCurY<=0 || nCurY>=MAXROW )
{
if (bVFlip)
{
nCurY = nOldY;
- bHidden = FALSE;
+ bSkipCell = FALSE;
}
else
{
@@ -1031,7 +1054,8 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
if (nMovY > 0) ++nCurY; else --nCurY;
}
}
- while (bHidden);
+ while (bSkipCell);
+
if (pDoc->IsHorOverlapped( nCurX, nCurY, nTab ))
{
aViewData.SetOldCursor( nCurX,nCurY );
@@ -1571,6 +1595,10 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
ScDocument* pDoc = aViewData.GetDocument();
pDoc->MakeTable( nTab );
+ // Update pending row heights before switching the sheet, so Reschedule from the progress bar
+ // doesn't paint the new sheet with old heights
+ aViewData.GetDocShell()->UpdatePendingRowHeights( nTab );
+
SCTAB nTabCount = pDoc->GetTableCount();
SCTAB nOldPos = nTab;
while (!pDoc->IsVisible(nTab)) // naechste sichtbare suchen
@@ -1624,34 +1652,36 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
SfxBindings& rBindings = aViewData.GetBindings();
ScMarkData& rMark = aViewData.GetMarkData();
- BOOL bSelectOneTable = FALSE;
- if (bExtendSelection)
+ bool bAllSelected = true;
+ for (SCTAB nSelTab = 0; nSelTab < nTabCount; ++nSelTab)
{
- // #i6327# if all tables are selected, a selection event (#i6330#) will deselect all
- BOOL bAllSelected = TRUE;
- for( SCTAB nSelTab = 0; bAllSelected && (nSelTab < nTabCount); ++nSelTab )
- bAllSelected = !pDoc->IsVisible( nSelTab ) || rMark.GetTableSelect( nSelTab );
- if( bAllSelected )
+ if (!pDoc->IsVisible(nSelTab) || rMark.GetTableSelect(nSelTab))
{
- bExtendSelection = FALSE;
- bSelectOneTable = TRUE;
+ if (nTab == nSelTab)
+ // This tab is already in selection. Keep the current
+ // selection.
+ bExtendSelection = true;
+ }
+ else
+ {
+ bAllSelected = false;
+ if (bExtendSelection)
+ // We got what we need. No need to stay in the loop.
+ break;
}
}
- else
- {
- // move from multi-selection to unselected table
- bSelectOneTable = !rMark.GetTableSelect( nTab );
- }
+ if (bAllSelected && !bNew)
+ // #i6327# if all tables are selected, a selection event (#i6330#) will deselect all
+ // (not if called with bNew to update settings)
+ bExtendSelection = false;
if (bExtendSelection)
- {
- // #i6330# multi-selection with keyboard
rMark.SelectTable( nTab, TRUE );
- }
- else if (bSelectOneTable)
+ else
{
rMark.SelectOneTable( nTab );
rBindings.Invalidate( FID_FILL_TAB );
+ rBindings.Invalidate( FID_TAB_DESELECTALL );
}
bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index f0b6fb7565a1..525ea1f14578 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -75,6 +75,8 @@
#include "autofmt.hxx"
#include "dwfunctr.hxx"
#include "shtabdlg.hxx"
+#include "tabprotection.hxx"
+#include "protectiondlg.hxx"
#include <svtools/ilstitem.hxx>
#define _SVSTDARR_ULONGS
@@ -85,6 +87,10 @@
#include <svx/dialogs.hrc> //CHINA001
#include "scabstdlg.hxx" //CHINA001
+#include <memory>
+
+using ::std::auto_ptr;
+
#define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() )
#define IS_AVAILABLE(WhichId,ppItem) \
(pReqArgs->GetItemState((WhichId), TRUE, ppItem ) == SFX_ITEM_SET)
@@ -789,6 +795,11 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
rReq.Done();
break;
+ case FID_TAB_DESELECTALL:
+ DeselectAllTables();
+ rReq.Done();
+ break;
+
case SID_SELECT_TABLES:
{
ScViewData& rViewData = *GetViewData();
@@ -865,7 +876,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
rViewData.GetDocShell()->PostPaintExtras();
- rViewData.GetBindings().Invalidate( FID_FILL_TAB );
+ SfxBindings& rBind = rViewData.GetBindings();
+ rBind.Invalidate( FID_FILL_TAB );
+ rBind.Invalidate( FID_TAB_DESELECTALL );
}
rReq.Done();
@@ -978,14 +991,6 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
break;
- case SID_STATUS_DOCPOS:
- {
- //! Navigator an-/ausschalten (wie im Writer) ???
- //!GetViewData()->GetDispatcher().Execute( SID_NAVIGATOR,
- //! SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
- }
- break;
-
case FID_PROTECT_DOC:
{
ScDocument* pDoc = GetViewData()->GetDocument();
@@ -1002,12 +1007,13 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
}
- if (pDoc->IsDocProtected())
+ ScDocProtection* pProtect = pDoc->GetDocProtection();
+ if (pProtect && pProtect->isProtected())
{
BOOL bCancel = FALSE;
String aPassword;
- if (pDoc->GetDocPassword().getLength())
+ if (pProtect->isProtectedWithPass())
{
String aText( ScResId(SCSTR_PASSWORD) );
@@ -1057,89 +1063,164 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
case FID_PROTECT_TABLE:
+ {
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ SCTAB nTab = GetViewData()->GetTabNo();
+ bool bOldProtection = pDoc->IsTabProtected(nTab);
+
+#if ENABLE_SHEET_PROTECTION
+
+ if( pReqArgs )
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- SCTAB nTab = GetViewData()->GetTabNo();
- SfxPasswordDialog* pDlg;
- String aPassword;
- BOOL bCancel = FALSE;
- BOOL bOldProtection = pDoc->IsTabProtected(nTab);
- BOOL bNewProtection = ! bOldProtection;
+ const SfxPoolItem* pItem;
+ bool bNewProtection = !bOldProtection;
+ if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
+ bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
+ if( bNewProtection == bOldProtection )
+ {
+ rReq.Ignore();
+ break;
+ }
+ }
- if( pReqArgs )
+ if (bOldProtection)
+ {
+ // Unprotect a protected sheet.
+
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ if (pProtect && pProtect->isProtectedWithPass())
{
- const SfxPoolItem* pItem;
- if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
- bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
- if( bNewProtection == bOldProtection )
+ String aText( ScResId(SCSTR_PASSWORDOPT) );
+ auto_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(GetDialogParent(), &aText));
+ pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
+ pDlg->SetMinLen( 0 );
+ pDlg->SetHelpId( FID_PROTECT_TABLE );
+ pDlg->SetEditHelpId( HID_PASSWD_TABLE );
+
+ if (pDlg->Execute() == RET_OK)
{
- rReq.Ignore();
- break;
+ String aPassword = pDlg->GetPassword();
+ Unprotect(nTab, aPassword);
}
}
+ else
+ // this sheet is not password-protected.
+ Unprotect(nTab, String());
- if ( bOldProtection)
- {
- if (pDoc->GetTabPassword(nTab).getLength())
- {
- String aText( ScResId(SCSTR_PASSWORD) );
+ if (!pReqArgs)
+ {
+ rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
+ rReq.Done();
+ }
+ }
+ else
+ {
+ // Protect a current sheet.
- pDlg = new SfxPasswordDialog( GetDialogParent(), &aText );
- pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
- pDlg->SetMinLen( 0 );
- pDlg->SetHelpId( FID_PROTECT_TABLE );
- pDlg->SetEditHelpId( HID_PASSWD_TABLE );
+ auto_ptr<ScTableProtectionDlg> pDlg(new ScTableProtectionDlg(GetDialogParent()));
- if (pDlg->Execute() == RET_OK)
- aPassword = pDlg->GetPassword();
- else
- bCancel = TRUE;
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ if (pProtect)
+ pDlg->SetDialogData(*pProtect);
- delete pDlg;
- }
- }
- else
- {
- String aText( ScResId(SCSTR_PASSWORDOPT) );
+ if (pDlg->Execute() == RET_OK)
+ {
+ pScMod->InputEnterHandler();
- pDlg = new SfxPasswordDialog( GetDialogParent(), &aText );
- pDlg->SetText( ScResId(SCSTR_PROTECTTAB) );
- pDlg->SetMinLen( 0 );
- pDlg->SetHelpId( FID_PROTECT_TABLE );
- pDlg->SetEditHelpId( HID_PASSWD_TABLE );
- pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
+ ScTableProtection aNewProtect;
+ pDlg->WriteData(aNewProtect);
+ ProtectSheet(nTab, aNewProtect);
+ if (!pReqArgs)
+ {
+ rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, true) );
+ rReq.Done();
+ }
+ }
+ }
+#else
+ auto_ptr<SfxPasswordDialog> pDlg;
+ String aPassword;
+ BOOL bCancel = FALSE;
+ bool bNewProtection = ! bOldProtection;
- if (pDlg->Execute() == RET_OK)
- aPassword = pDlg->GetPassword();
- else
- bCancel = TRUE;
+ if( pReqArgs )
+ {
+ const SfxPoolItem* pItem;
+ if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
+ bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
+ if( bNewProtection == bOldProtection )
+ {
+ rReq.Ignore();
+ break;
+ }
+ }
- delete pDlg;
- }
+ if ( bOldProtection)
+ {
+ // Unprotect a protected sheet.
- if( !bCancel )
+ ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ if (pProtect && pProtect->isProtectedWithPass())
{
- if ( bOldProtection )
- Unprotect( nTab, aPassword );
+ String aText( ScResId(SCSTR_PASSWORDOPT) );
+ pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
+ pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
+ pDlg->SetMinLen( 0 );
+ pDlg->SetHelpId( FID_PROTECT_TABLE );
+ pDlg->SetEditHelpId( HID_PASSWD_TABLE );
+
+ if (pDlg->Execute() == RET_OK)
+ aPassword = pDlg->GetPassword();
else
- {
- pScMod->InputEnterHandler();
+ bCancel = TRUE;
+ }
- Protect( nTab, aPassword );
- }
+ if (!pReqArgs)
+ {
+ rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
+ rReq.Done();
+ }
+ }
+ else
+ {
+ String aText( ScResId(SCSTR_PASSWORDOPT) );
- if( !pReqArgs )
- {
- rReq.AppendItem( SfxBoolItem( FID_PROTECT_TABLE, bNewProtection ) );
- rReq.Done();
- }
+ pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
+ pDlg->SetText( ScResId(SCSTR_PROTECTTAB) );
+ pDlg->SetMinLen( 0 );
+ pDlg->SetHelpId( FID_PROTECT_TABLE );
+ pDlg->SetEditHelpId( HID_PASSWD_TABLE );
+ pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
+
+ if (pDlg->Execute() == RET_OK)
+ aPassword = pDlg->GetPassword();
+ else
+ bCancel = TRUE;
+ }
+
+ if( !bCancel )
+ {
+ if ( bOldProtection )
+ Unprotect( nTab, aPassword );
+ else
+ {
+ pScMod->InputEnterHandler();
+
+ Protect( nTab, aPassword );
}
- TabChanged();
- UpdateInputHandler(TRUE); // damit sofort wieder eingegeben werden kann
- SelectionChanged();
+ if( !pReqArgs )
+ {
+ rReq.AppendItem( SfxBoolItem( FID_PROTECT_TABLE, bNewProtection ) );
+ rReq.Done();
+ }
}
- break;
+#endif
+ TabChanged();
+ UpdateInputHandler(true); // damit sofort wieder eingegeben werden kann
+ SelectionChanged();
+ }
+ break;
case SID_OPT_LOCALE_CHANGED :
{ // locale changed, SYSTEM number formats changed => repaint cell contents
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index d32368c7ed86..d8449ebc3699 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1190,6 +1190,10 @@ PrintDialog* __EXPORT ScTabViewShell::CreatePrintDialog( Window *pParent )
bool bAllTabs = SC_MOD()->GetPrintOptions().GetAllSheets();
pDlg->CheckSheetRange( bAllTabs ? PRINTSHEETS_ALL : PRINTSHEETS_SELECTED_SHEETS );
+ // update all pending row heights with a single progress bar,
+ // instead of a separate progress for each sheet from ScPrintFunc
+ pDocShell->UpdatePendingRowHeights( MAXTAB, true );
+
for ( SCTAB i=0; i<nTabCount; i++ )
{
ScPrintFunc aPrintFunc( pDocShell, pPrinter, i );
@@ -1261,26 +1265,26 @@ ErrCode ScTabViewShell::DoPrint( SfxPrinter *pPrinter,
ScDocShell* pDocShell = GetViewData()->GetDocShell();
if ( pDocShell->CheckPrint( pPrintDialog, &GetViewData()->GetMarkData(), bPrintSelected, bIsAPI ) )
{
- // get the list of affected sheets before SfxViewShell::Print
- bool bAllTabs = ( pPrintDialog ? ( pPrintDialog->GetCheckedSheetRange() == PRINTSHEETS_ALL ) : SC_MOD()->GetPrintOptions().GetAllSheets() );
-
- uno::Sequence<sal_Int32> aSheets;
- SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
- USHORT nPrinted = 0;
- for ( SCTAB nTab=0; nTab<nTabCount; nTab++ )
- if ( bAllTabs || rMarkData.GetTableSelect(nTab) )
- {
- aSheets.realloc( nPrinted + 1 );
- aSheets[nPrinted] = nTab;
- ++nPrinted;
- }
-
- uno::Sequence < beans::PropertyValue > aProps(1);
- aProps[0].Name=::rtl::OUString::createFromAscii("PrintSheets");
- aProps[0].Value <<= aSheets;
- SetAdditionalPrintOptions( aProps );
-
- // SfxViewShell::DoPrint calls Print (after StartJob etc.)
+ // get the list of affected sheets before SfxViewShell::Print
+ bool bAllTabs = ( pPrintDialog ? ( pPrintDialog->GetCheckedSheetRange() == PRINTSHEETS_ALL ) : SC_MOD()->GetPrintOptions().GetAllSheets() );
+
+ uno::Sequence<sal_Int32> aSheets;
+ SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
+ USHORT nPrinted = 0;
+ for ( SCTAB nTab=0; nTab<nTabCount; nTab++ )
+ if ( bAllTabs || rMarkData.GetTableSelect(nTab) )
+ {
+ aSheets.realloc( nPrinted + 1 );
+ aSheets[nPrinted] = nTab;
+ ++nPrinted;
+ }
+
+ uno::Sequence < beans::PropertyValue > aProps(1);
+ aProps[0].Name=::rtl::OUString::createFromAscii("PrintSheets");
+ aProps[0].Value <<= aSheets;
+ SetAdditionalPrintOptions( aProps );
+
+ // SfxViewShell::DoPrint calls Print (after StartJob etc.)
nRet = SfxViewShell::DoPrint( pPrinter, pPrintDialog, bSilent, bIsAPI );
}
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 36c0c0694d18..92cf03cdf5d6 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -47,6 +47,7 @@
#include "tabvwsh.hxx"
#include "sc.hrc"
#include "global.hxx"
+#include "docsh.hxx"
#include "document.hxx"
#include "cell.hxx"
#include "globstr.hrc"
@@ -160,6 +161,10 @@ void __EXPORT ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
if (PaintExtras())
nParts = PAINT_ALL;
+ // if the current sheet has pending row height updates (sheet links refreshed),
+ // execute them before invalidating the window
+ GetViewData()->GetDocShell()->UpdatePendingRowHeights( GetViewData()->GetTabNo() );
+
if (nParts & PAINT_SIZE)
RepeatResize(); //! InvalidateBorder ???
if (nParts & PAINT_GRID)
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index cd28936afe98..766785d5ffc8 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: tabvwsha.cxx,v $
- * $Revision: 1.28 $
+ * $Revision: 1.28.14.1 $
*
* This file is part of OpenOffice.org.
*
@@ -452,6 +452,11 @@ void __EXPORT ScTabViewShell::GetState( SfxItemSet& rSet )
rSet.Put( SfxBoolItem( nWhich, GetViewData()->GetDocShell()->IsReadOnly() ) );
break;
+ case FID_TAB_DESELECTALL:
+ if ( nTabSelCount == 1 )
+ rSet.DisableItem( nWhich ); // enabled only if several sheets are selected
+ break;
+
} // switch ( nWitch )
nWhich = aIter.NextWhich();
} // while ( nWitch )
@@ -675,6 +680,12 @@ void ScTabViewShell::UpdateInputHandler( BOOL bForce /* = FALSE */, BOOL bStopEd
rBindings.Invalidate( SID_TABLE_CELL );
}
+void ScTabViewShell::UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust )
+{
+ if( ScInputHandler* pHdl = pInputHandler ? pInputHandler : SC_MOD()->GetInputHdl() )
+ pHdl->UpdateCellAdjust( eJust );
+}
+
//------------------------------------------------------------------
void __EXPORT ScTabViewShell::ExecuteSave( SfxRequest& rReq )
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 8c20d7f13a90..744481c4441c 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -38,6 +38,7 @@
#include "scitems.hxx"
#include <sfx2/request.hxx>
#include <basic/sbstar.hxx>
+#include <layout/layout.hxx>
#include <svtools/languageoptions.hxx>
#include <svtools/stritem.hxx>
#include <svtools/whiter.hxx>
@@ -55,7 +56,6 @@
//CHINA001 #include "mvtabdlg.hxx"
#include "docfunc.hxx"
-
#include "scabstdlg.hxx" //CHINA001
#define IS_AVAILABLE(WhichId,ppItem) \
@@ -621,11 +621,17 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
{
// wenn's nicht von Basic kommt, nochmal nachfragen:
- bDoIt = ( RET_YES ==
- QueryBox( GetDialogParent(),
- WinBits( WB_YES_NO | WB_DEF_YES ),
- ScGlobal::GetRscString(STR_QUERY_DELTAB)
- ).Execute() );
+#if ENABLE_LAYOUT
+// Using layout::QueryBox without client code modification is
+// deprecated, rather add HIG-complient buttons with verbs.
+#define QueryBox( parent, winbits, question ) layout::QueryBox (parent, question, ScGlobal::GetRscString (STR_UNDO_DELETE_TAB))
+#endif /* ENABLE_LAYOUT */
+
+ bDoIt = ( RET_YES ==
+ QueryBox( GetDialogParent(),
+ WinBits( WB_YES_NO | WB_DEF_YES ),
+ ScGlobal::GetRscString(STR_QUERY_DELTAB)
+ ).Execute() );
}
if( bDoIt )
{
diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx
index 5c6ca6843833..7526a3de19bd 100644
--- a/sc/source/ui/view/tabvwshh.cxx
+++ b/sc/source/ui/view/tabvwshh.cxx
@@ -43,6 +43,7 @@
#include <sfx2/request.hxx>
#include <basic/sbxcore.hxx>
#include <svtools/whiter.hxx>
+#include <vcl/msgbox.hxx>
#include "tabvwsh.hxx"
#include "client.hxx"
@@ -50,6 +51,10 @@
#include "docsh.hxx"
#include "sc.hrc"
#include "drwlayer.hxx" // GetVisibleName
+#include "retypepassdlg.hxx"
+#include "tabprotection.hxx"
+
+#include <memory>
using namespace com::sun::star;
@@ -270,6 +275,22 @@ BOOL ScTabViewShell::HasAccessibilityObjects()
return pAccessibilityBroadcaster != NULL;
}
+bool ScTabViewShell::ExecuteRetypePassDlg(ScPasswordHash eDesiredHash)
+{
+ using ::std::auto_ptr;
+
+ ScDocument* pDoc = GetViewData()->GetDocument();
+
+ auto_ptr<ScRetypePassDlg> pDlg(new ScRetypePassDlg(GetDialogParent()));
+ pDlg->SetDataFromDocument(*pDoc);
+ pDlg->SetDesiredHash(eDesiredHash);
+ if (pDlg->Execute() != RET_OK)
+ return false;
+
+ pDlg->WriteNewDataToDocument(*pDoc);
+ return true;
+}
+
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index a7b2f634bd6c..50ede74ab06b 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2197,7 +2197,7 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
pUndoDoc->SetVisible( nTab, pDoc->IsVisible( nTab ) );
if ( pDoc->IsTabProtected( nTab ) )
- pUndoDoc->SetTabProtection( nTab, TRUE, pDoc->GetTabPassword( nTab ) );
+ pUndoDoc->SetTabProtection(nTab, pDoc->GetTabProtection(nTab));
// Drawing-Layer muss sein Undo selbst in der Hand behalten !!!
// pUndoDoc->TransferDrawPage(pDoc, nTab,nTab);
@@ -2612,7 +2612,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy )
}
if ( nErrVal > 0 && pDoc->IsTabProtected( TheTabs[i] ) )
- pDestDoc->SetTabProtection( nDestTab1, TRUE, pDoc->GetTabPassword( TheTabs[i] ) );
+ pDestDoc->SetTabProtection(nDestTab1, pDoc->GetTabProtection(TheTabs[i]));
nDestTab1++;
}
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 0b43cfacbab3..9dda9a097395 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -185,6 +185,9 @@
#include <sot/exchange.hxx>
#include <memory>
+#include "attrib.hxx"
+#include "patattr.hxx"
+#include "dociter.hxx"
#include "viewfunc.hxx"
#include "tabvwsh.hxx"
#include "docsh.hxx"
@@ -1056,11 +1059,35 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
// pDoc->HasCommonAttr( StartCol,nStartRow, nUndoEndCol,nUndoEndRow, nStartTab,
// pClipDoc, nClipStartX, nClipStartY );
+ ScDocFunc& rDocFunc = pDocSh->GetDocFunc();
+ if ( bRecord )
+ {
+ String aUndo = ScGlobal::GetRscString( pClipDoc->IsCutMode() ? STR_UNDO_MOVE : STR_UNDO_COPY );
+ pUndoMgr->EnterListAction( aUndo, aUndo );
+ }
+
if (bClipOver)
if (lcl_SelHasAttrib( pDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HASATTR_OVERLAPPED ))
{ // "Cell merge not possible if cells already merged"
- ErrorMessage(STR_MSSG_PASTEFROMCLIP_1);
- return FALSE;
+ ScDocAttrIterator aIter( pDoc, nStartTab, nStartCol, nStartRow, nUndoEndCol, nUndoEndRow );
+ const ScPatternAttr* pPattern = NULL;
+ const ScMergeAttr* pMergeFlag = NULL;
+ const ScMergeFlagAttr* pMergeFlagAttr = NULL;
+ SCCOL nCol = -1;
+ SCROW nRow1 = -1;
+ SCROW nRow2 = -1;
+ while ( ( pPattern = aIter.GetNext( nCol, nRow1, nRow2 ) ) != NULL )
+ {
+ pMergeFlag = (const ScMergeAttr*) &pPattern->GetItem(ATTR_MERGE);
+ pMergeFlagAttr = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG);
+ if( ( pMergeFlag && pMergeFlag->IsMerged() ) || ( pMergeFlagAttr && pMergeFlagAttr->IsOverlapped() ) )
+ {
+ ScRange aRange(nCol, nRow1, nStartTab);
+ pDoc->ExtendOverlapped(aRange);
+ pDoc->ExtendMerge(aRange, TRUE, TRUE);
+ rDocFunc.UnmergeCells(aRange, bRecord, TRUE);
+ }
+ }
}
if ( !bCutMode )
@@ -1163,7 +1190,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
// skipped rows and merged cells don't mix
if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
- pDocSh->GetDocFunc().UnmergeCells( aUserRange, FALSE, TRUE );
+ rDocFunc.UnmergeCells( aUserRange, FALSE, TRUE );
pDoc->ExtendMergeSel( nStartCol, nStartRow, nEndCol, nEndRow, aFilteredMark, TRUE ); // Refresh
// und Bereich neu
@@ -1256,6 +1283,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
else
pUndoMgr->AddUndoAction( pUndo );
+ pUndoMgr->LeaveListAction();
}
USHORT nPaint = PAINT_GRID;
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 57fef68c5f83..0f3a1c812802 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -81,6 +81,9 @@
#include "impex.hxx"
#include "editutil.hxx"
#include "editable.hxx"
+#include "dociter.hxx"
+#include "reffind.hxx"
+#include "compiler.hxx"
using namespace com::sun::star;
@@ -187,7 +190,128 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
ShowAllCursors();
}
}
+void ScViewFunc::DoRefConversion( BOOL bRecord )
+{
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ ScMarkData& rMark = GetViewData()->GetMarkData();
+ SCTAB nTabCount = pDoc->GetTableCount();
+ if (bRecord && !pDoc->IsUndoEnabled())
+ bRecord = FALSE;
+ ScRange aMarkRange;
+ rMark.MarkToSimple();
+ BOOL bMulti = rMark.IsMultiMarked();
+ if (bMulti)
+ rMark.GetMultiMarkArea( aMarkRange );
+ else if (rMark.IsMarked())
+ rMark.GetMarkArea( aMarkRange );
+ else
+ {
+ aMarkRange = ScRange( GetViewData()->GetCurX(),
+ GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+ }
+ ScEditableTester aTester( pDoc, aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
+ aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(),rMark );
+ if (!aTester.IsEditable())
+ {
+ ErrorMessage(aTester.GetMessageId());
+ return;
+ }
+
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
+ BOOL bOk = FALSE;
+
+ ScDocument* pUndoDoc = NULL;
+ if (bRecord)
+ {
+ pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ SCTAB nTab = aMarkRange.aStart.Tab();
+ pUndoDoc->InitUndo( pDoc, nTab, nTab );
+
+ if ( rMark.GetSelectCount() > 1 )
+ {
+ for (SCTAB i=0; i<nTabCount; i++)
+ if ( rMark.GetTableSelect(i) && i != nTab )
+ pUndoDoc->AddUndoTab( i, i );
+ }
+ ScRange aCopyRange = aMarkRange;
+ aCopyRange.aStart.SetTab(0);
+ aCopyRange.aEnd.SetTab(nTabCount-1);
+ pDoc->CopyToDocument( aCopyRange, IDF_ALL, bMulti, pUndoDoc, &rMark );
+ }
+
+ ScRangeListRef xRanges;
+ GetViewData()->GetMultiArea( xRanges );
+ ULONG nCount = xRanges->Count();
+
+ for (SCTAB i=0; i<nTabCount; i++)
+ {
+ if (rMark.GetTableSelect(i))
+ {
+ for (ULONG j=0; j<nCount; j++)
+ {
+ ScRange aRange = *xRanges->GetObject(j);
+ aRange.aStart.SetTab(i);
+ aRange.aEnd.SetTab(i);
+ ScCellIterator aIter( pDoc, aRange );
+ ScBaseCell* pCell = aIter.GetFirst();
+ while ( pCell )
+ {
+ if (pCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+ String aOld;
+ ((ScFormulaCell*)pCell)->GetFormula(aOld);
+ xub_StrLen nLen = aOld.Len();
+ ScRefFinder aFinder( aOld, pDoc );
+ aFinder.ToggleRel( 0, nLen );
+ if (aFinder.GetFound())
+ {
+ ScAddress aPos = ((ScFormulaCell*)pCell)->aPos;
+ String aNew = aFinder.GetText();
+ ScCompiler aComp( pDoc, aPos);
+ aComp.SetGrammar(pDoc->GetGrammar());
+ ScTokenArray* pArr = aComp.CompileString( aNew );
+ ScFormulaCell* pNewCell = new ScFormulaCell( pDoc, aPos,
+ pArr,formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE );
+ pDoc->PutCell( aPos, pNewCell );
+ bOk = TRUE;
+ }
+ }
+ pCell = aIter.GetNext();
+ }
+ }
+ }
+ }
+ if (bRecord)
+ {
+ ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
+ SCTAB nTab = aMarkRange.aStart.Tab();
+ pRedoDoc->InitUndo( pDoc, nTab, nTab );
+
+ if ( rMark.GetSelectCount() > 1 )
+ {
+ for (SCTAB i=0; i<nTabCount; i++)
+ if ( rMark.GetTableSelect(i) && i != nTab )
+ pRedoDoc->AddUndoTab( i, i );
+ }
+ ScRange aCopyRange = aMarkRange;
+ aCopyRange.aStart.SetTab(0);
+ aCopyRange.aEnd.SetTab(nTabCount-1);
+ pDoc->CopyToDocument( aCopyRange, IDF_ALL, bMulti, pRedoDoc, &rMark );
+
+ pDocSh->GetUndoManager()->AddUndoAction(
+ new ScUndoRefConversion( pDocSh,
+ aMarkRange, rMark, pUndoDoc, pRedoDoc, bMulti, IDF_ALL) );
+ }
+
+ pDocSh->PostPaint( aMarkRange, PAINT_GRID );
+ pDocSh->UpdateOle(GetViewData());
+ pDocSh->SetDocumentModified();
+ CellContentChanged();
+
+ if (!bOk)
+ ErrorMessage(STR_ERR_NOREF);
+}
// Thesaurus - Undo ok
void ScViewFunc::DoThesaurus( BOOL bRecord )
{
@@ -537,11 +661,13 @@ BOOL ScViewFunc::PasteFile( const Point& rPos, const String& rFile, BOOL bLink )
SfxDispatcher &rDispatcher = GetViewData()->GetDispatcher();
SfxStringItem aFileNameItem( SID_FILE_NAME, aStrURL );
SfxStringItem aFilterItem( SID_FILTER_NAME, pFlt->GetName() );
+ // #i69524# add target, as in SfxApplication when the Open dialog is used
+ SfxStringItem aTargetItem( SID_TARGETNAME, String::CreateFromAscii("_default") );
// Asynchron oeffnen, kann naemlich auch aus D&D heraus passieren
// und das bekommt dem MAC nicht so gut ...
return BOOL( 0 != rDispatcher.Execute( SID_OPENDOC,
- SFX_CALLMODE_ASYNCHRON, &aFileNameItem, &aFilterItem, 0L) );
+ SFX_CALLMODE_ASYNCHRON, &aFileNameItem, &aFilterItem, &aTargetItem, 0L) );
}
}
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index cb9d4eb0da72..ceb852354c7e 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -175,9 +175,11 @@ void ScViewFunc::EditNote()
// hide temporary note caption
HideNoteMarker();
// show caption object without changing internal visibility state
- pNote->ShowCaptionTemp();
+ pNote->ShowCaptionTemp( aPos );
- // drawing object has been created in ScDocument::GetOrCreateNote
+ /* Drawing object has been created in ScDocument::GetOrCreateNote() or
+ in ScPostIt::ShowCaptionTemp(), so ScPostIt::GetCaption() should
+ return a caption object. */
if( SdrCaptionObj* pCaption = pNote->GetCaption() )
{
// #i33764# enable the resize handles before starting edit mode
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 41682a0c5211..79343c31f85b 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -599,6 +599,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rS
}
else
{
+ DELETEZ(pUndoData);
ScFormulaCell* pCell = new ScFormulaCell( aCell, *pDoc, aPos );
if ( nError )
{
@@ -751,12 +752,13 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextOb
ScPatternAttr* pCellAttrs = NULL;
EditTextObject* pNewData = NULL;
String aString;
+
+ const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
+ ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() );
+ aEngine.SetText(*pData);
+
if (bTestSimple) // Testen, ob einfacher String ohne Attribute
{
- const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
- ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool() );
- aEngine.SetText(*pData);
-
ScEditAttrTester aAttrTester( &aEngine );
bSimple = !aAttrTester.NeedsObject();
bCommon = aAttrTester.NeedsCellAttr();
@@ -777,11 +779,11 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextOb
pCellAttrs->GetFromEditItemSet( &aAttrTester.GetAttribs() );
//! remove common attributes from EditEngine?
}
-
- if (bSimple)
- aString = aEngine.GetText();
}
+ // #i97726# always get text for "repeat" of undo action
+ aString = ScEditUtil::GetSpaceDelimitedString(aEngine);
+
//
// Undo
//
@@ -838,7 +840,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextOb
{ // wg. ChangeTrack erst jetzt
pDocSh->GetUndoManager()->AddUndoAction(
new ScUndoEnterData( pDocSh, nCol, nRow, nTab, nPos, pTabs,
- ppOldCells, NULL, NULL, String(),
+ ppOldCells, NULL, NULL, aString,
pUndoData ) );
}
@@ -924,7 +926,7 @@ void ScViewFunc::EnterMatrix( const String& rString )
if (pData->GetSimpleArea(aRange) == SC_MARK_SIMPLE)
{
ScDocShell* pDocSh = pData->GetDocShell();
- BOOL bSuccess = pDocSh->GetDocFunc().EnterMatrix( aRange, &rMark, NULL, rString, FALSE, FALSE,formula::FormulaGrammar::GRAM_DEFAULT );
+ BOOL bSuccess = pDocSh->GetDocFunc().EnterMatrix( aRange, &rMark, NULL, rString, FALSE, FALSE, EMPTY_STRING, formula::FormulaGrammar::GRAM_DEFAULT );
if (bSuccess)
pDocSh->UpdateOle(GetViewData());
}
@@ -1179,103 +1181,69 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
const SvxBoxInfoItem* pNewInner, BOOL bRecord )
{
ScDocument* pDoc = GetViewData()->GetDocument();
- ScMarkData& rMark = GetViewData()->GetMarkData();
+ ScMarkData aFuncMark( GetViewData()->GetMarkData() ); // local copy for UnmarkFiltered
+ ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
- SCCOL nStartCol;
- SCROW nStartRow;
- SCTAB nStartTab;
- SCCOL nEndCol;
- SCROW nEndRow;
- SCTAB nEndTab;
-
- ScMarkType eMarkType = GetViewData()->GetSimpleArea( nStartCol, nStartRow,
- nStartTab, nEndCol, nEndRow, nEndTab);
- if (eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED)
+ ScRange aMarkRange;
+ aFuncMark.MarkToSimple();
+ BOOL bMulti = aFuncMark.IsMultiMarked();
+ if (bMulti)
+ aFuncMark.GetMultiMarkArea( aMarkRange );
+ else if (aFuncMark.IsMarked())
+ aFuncMark.GetMarkArea( aMarkRange );
+ else
{
- bool bChangeSelection = false;
- ScRange aMarkRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab );
- if ( eMarkType == SC_MARK_SIMPLE_FILTERED )
- {
- ScMarkData aVisibleMark( rMark );
- ScViewUtil::UnmarkFiltered( aVisibleMark, pDoc );
- ScRangeList aRangeList;
- aVisibleMark.FillRangeListWithMarks( &aRangeList, FALSE );
- if ( aRangeList.Count() > 0 )
- {
- // use the first range of visible cells
- // (might also show an error message instead, or, later, allow multiple ranges)
-
- aMarkRange = *aRangeList.GetObject(0);
- }
- else // all hidden -> cursor position
- {
- aMarkRange.aStart.SetCol(GetViewData()->GetCurX());
- aMarkRange.aStart.SetRow(GetViewData()->GetCurY());
- aMarkRange.aStart.SetTab(GetViewData()->GetTabNo());
- aMarkRange.aEnd = aMarkRange.aStart;
- }
- aMarkRange.GetVars( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab );
- bChangeSelection = true; // change the selection to only the affected cells
- }
-
- rMark.MarkToSimple(); // not done by GetSimpleArea anymore
+ aMarkRange = ScRange( GetViewData()->GetCurX(),
+ GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+ DoneBlockMode();
+ InitOwnBlockMode();
+ aFuncMark.SetMarkArea(aMarkRange);
+ MarkDataChanged();
+ }
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
- ScDocShellModificator aModificator( *pDocSh );
+ ScDocShellModificator aModificator( *pDocSh );
- if (!rMark.IsMarked() || bChangeSelection)
- {
- DoneBlockMode();
- InitOwnBlockMode();
- rMark.SetMarkArea( ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ) );
- MarkDataChanged();
- }
+ if (bRecord)
+ {
+ ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+ SCTAB nStartTab = aMarkRange.aStart.Tab();
+ SCTAB nTabCount = pDoc->GetTableCount();
+ pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ for (SCTAB i=0; i<nTabCount; i++)
+ if (i != nStartTab && aFuncMark.GetTableSelect(i))
+ pUndoDoc->AddUndoTab( i, i );
- if (bRecord)
- {
- SCTAB nTabCount = pDoc->GetTableCount();
- ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
- for (SCTAB i=0; i<nTabCount; i++)
- if (i != nStartTab && rMark.GetTableSelect(i))
- pUndoDoc->AddUndoTab( i, i );
- pDoc->CopyToDocument( nStartCol, nStartRow, 0, nEndCol, nEndRow, nTabCount-1,
- IDF_ATTRIB, FALSE, pUndoDoc );
+ ScRange aCopyRange = aMarkRange;
+ aCopyRange.aStart.SetTab(0);
+ aCopyRange.aEnd.SetTab(nTabCount-1);
+ pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &aFuncMark );
- pDocSh->GetUndoManager()->AddUndoAction(
- new ScUndoSelectionAttr( pDocSh, rMark,
- nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab,
- pUndoDoc, FALSE, &rAttr, pNewOuter, pNewInner ) );
- }
+ pDocSh->GetUndoManager()->AddUndoAction(
+ new ScUndoSelectionAttr(
+ pDocSh, aFuncMark,
+ aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), aMarkRange.aStart.Tab(),
+ aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), aMarkRange.aEnd.Tab(),
+ pUndoDoc, bMulti, &rAttr, pNewOuter, pNewInner ) );
+ }
- USHORT nExt = SC_PF_TESTMERGE;
- pDocSh->UpdatePaintExt( nExt, nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab ); // content before the change
+ USHORT nExt = SC_PF_TESTMERGE;
+ pDocSh->UpdatePaintExt( nExt, aMarkRange ); // content before the change
- pDoc->ApplySelectionFrame( rMark, pNewOuter, pNewInner );
+ pDoc->ApplySelectionFrame( aFuncMark, pNewOuter, pNewInner );
- pDocSh->UpdatePaintExt( nExt, nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab ); // content after the change
+ pDocSh->UpdatePaintExt( nExt, aMarkRange ); // content after the change
- rMark.MarkToMulti();
- pDoc->ApplySelectionPattern( rAttr, rMark );
+ aFuncMark.MarkToMulti();
+ pDoc->ApplySelectionPattern( rAttr, aFuncMark );
- pDocSh->PostPaint( nStartCol, nStartRow, nStartTab,
- nEndCol, nEndRow, nEndTab,
- PAINT_GRID, nExt );
- pDocSh->UpdateOle(GetViewData());
- aModificator.SetDocumentModified();
- CellContentChanged();
- rMark.MarkToSimple();
- }
- else
- { // "Rahmen nicht auf Mehrfachselektion"
- ErrorMessage(STR_MSSG_APPLYPATTLINES_0);
- }
+ pDocSh->PostPaint( aMarkRange, PAINT_GRID, nExt );
+ pDocSh->UpdateOle(GetViewData());
+ aModificator.SetDocumentModified();
+ CellContentChanged();
StartFormatArea();
}
@@ -1414,24 +1382,26 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
{
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aProperties;
sal_Int32 nCount = 0;
+ const SfxItemPropertyMap* pMap = ScCellObj::GetCellPropertyMap();
+ PropertyEntryVector_t aPropVector = pMap->getPropertyEntries();
for ( USHORT nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; ++nWhich )
{
const SfxPoolItem* pItem = 0;
if ( rNewSet.GetItemState( nWhich, TRUE, &pItem ) == SFX_ITEM_SET && pItem )
{
- const SfxItemPropertyMap* pMap = ScCellObj::GetCellPropertyMap();
- while ( pMap->pName )
+ PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
+ while ( aIt != aPropVector.end())
{
- if ( pMap->nWID == nWhich )
+ if ( aIt->nWID == nWhich )
{
::com::sun::star::uno::Any aVal;
- pItem->QueryValue( aVal, pMap->nMemberId );
+ pItem->QueryValue( aVal, aIt->nMemberId );
aProperties.realloc( nCount + 1 );
- aProperties[ nCount ].Name = ::rtl::OUString::createFromAscii( pMap->pName );
+ aProperties[ nCount ].Name = aIt->sName;
aProperties[ nCount ].Value <<= aVal;
++nCount;
}
- ++pMap;
+ ++aIt;
}
}
}
@@ -2213,6 +2183,7 @@ void ScViewFunc::SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pR
const SCCOLROW* pTabRanges = pRanges;
pDoc->IncSizeRecalcLevel( nTab ); // nicht fuer jede Spalte einzeln
+ pDoc->InitializeNoteCaptions( nTab );
for (SCCOLROW nRangeNo=0; nRangeNo<nRangeCnt; nRangeNo++)
{
SCCOLROW nStartNo = *(pTabRanges++);
@@ -2578,6 +2549,36 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, BOOL bOptimal )
ShowAllCursors();
}
+void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
+{
+ if (nTab == TABLEID_DOC)
+ return;
+
+ ScMarkData& rMark = GetViewData()->GetMarkData();
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
+ ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocFunc aFunc(*pDocSh);
+ bool bUndo(pDoc->IsUndoEnabled());
+
+ // modifying several tables is handled here
+
+ if (bUndo)
+ {
+ String aUndo = ScGlobal::GetRscString( STR_UNDO_PROTECT_TAB );
+ pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
+ }
+
+ SCTAB nCount = pDocSh->GetDocument()->GetTableCount();
+ for ( SCTAB i=0; i<nCount; i++ )
+ if ( rMark.GetTableSelect(i) )
+ aFunc.ProtectSheet(i, rProtect);
+
+ if (bUndo)
+ pDocSh->GetUndoManager()->LeaveListAction();
+
+ UpdateLayerLocks(); //! broadcast to all views
+}
+
void ScViewFunc::Protect( SCTAB nTab, const String& rPassword )
{
ScMarkData& rMark = GetViewData()->GetMarkData();
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 6436026613e4..83dd05c9d33c 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -37,6 +37,8 @@
#include <tools/list.hxx>
#include "scitems.hxx"
#include <sfx2/bindings.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/dispatch.hxx>
#include <svx/charmap.hxx>
#include <svx/fontitem.hxx>
#include <svx/langitem.hxx>
@@ -48,6 +50,10 @@
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/wrkwin.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/objsh.hxx>
+#include <svtools/stritem.hxx>
+#include <svtools/eitem.hxx>
#include <com/sun/star/i18n/TransliterationModules.hpp>
@@ -357,35 +363,26 @@ void ScViewUtil::HideDisabledSlot( SfxItemSet& rSet, SfxBindings& rBindings, USH
//==================================================================
BOOL ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont,
+ SfxViewFrame& rFrame,
SvxFontItem& rNewFont,
String& rString )
{
BOOL bRet = FALSE;
-
- Font aFont;
- aFont.SetName ( rOldFont.GetFamilyName() );
- aFont.SetStyleName( rOldFont.GetStyleName() );
- aFont.SetFamily ( rOldFont.GetFamily() );
- aFont.SetCharSet ( rOldFont.GetCharSet() );
- aFont.SetPitch ( rOldFont.GetPitch() );
-
- //CHINA001 SvxCharacterMap* pDlg = new SvxCharacterMap( NULL, FALSE );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- AbstractSvxCharacterMap* pDlg = pFact->CreateSvxCharacterMap( NULL, RID_SVXDLG_CHARMAP, FALSE );
- DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
-
- pDlg->SetCharFont( aFont );
-
+ SfxAllItemSet aSet( rFrame.GetObjectShell()->GetPool() );
+ aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+ aSet.Put( SvxFontItem( rOldFont.GetFamily(), rOldFont.GetFamilyName(), rOldFont.GetStyleName(), rOldFont.GetPitch(), rOldFont.GetCharSet(), aSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ) ) );
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( &rFrame.GetWindow(), aSet, rFrame.GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP );
if ( pDlg->Execute() == RET_OK )
{
- rString = pDlg->GetCharacters();
- aFont = pDlg->GetCharFont();
- rNewFont = SvxFontItem( aFont.GetFamily(), aFont.GetName(),
- aFont.GetStyleName(), aFont.GetPitch(),
- aFont.GetCharSet(), ATTR_FONT );
-
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, FALSE );
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
+ if ( pItem )
+ rString = pItem->GetValue();
+ if ( pFontItem )
+ rNewFont = SvxFontItem( pFontItem->GetFamily(), pFontItem->GetFamilyName(), pFontItem->GetStyleName(), pFontItem->GetPitch(), pFontItem->GetCharSet(), rNewFont.Which() );
bRet = TRUE;
}
delete pDlg;
@@ -393,6 +390,26 @@ BOOL ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont,
return bRet;
}
+bool ScViewUtil::IsFullScreen( SfxViewShell& rViewShell )
+{
+ SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings();
+ SfxPoolItem* pItem = 0;
+ bool bIsFullScreen = false;
+
+ if (rBindings.QueryState( SID_WIN_FULLSCREEN, pItem ) >= SFX_ITEM_DEFAULT)
+ bIsFullScreen = static_cast< SfxBoolItem* >( pItem )->GetValue();
+ return bIsFullScreen;
+}
+
+void ScViewUtil::SetFullScreen( SfxViewShell& rViewShell, bool bSet )
+{
+ if( IsFullScreen( rViewShell ) != bSet )
+ {
+ SfxBoolItem aItem( SID_WIN_FULLSCREEN, bSet );
+ rViewShell.GetDispatcher()->Execute( SID_WIN_FULLSCREEN, SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+}
+
//------------------------------------------------------------------
ScUpdateRect::ScUpdateRect( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 )
diff --git a/sc/uiconfig/layout/delzip b/sc/uiconfig/layout/delzip
new file mode 100644
index 000000000000..7b4d68d70fca
--- /dev/null
+++ b/sc/uiconfig/layout/delzip
@@ -0,0 +1 @@
+empty \ No newline at end of file
diff --git a/sc/uiconfig/layout/insert-sheet.xml b/sc/uiconfig/layout/insert-sheet.xml
new file mode 100644
index 000000000000..2350da9aec77
--- /dev/null
+++ b/sc/uiconfig/layout/insert-sheet.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="true" moveable="true" output-size="true" id="RID_SCDLG_INSERT_TABLE" sv-look="true" _title="Insert Sheet" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_POSITION" _text="Position"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-position" id="RB_BEFORE" tabstop="true" _label="B~efore current sheet"/>
+ <radiobutton radiogroup="insert-sheet-position" id="RB_BEHIND" tabstop="true" _label="~After current sheet"/>
+ </vbox>
+ </hbox>
+ <fixedline id="FL_TABLE" _text="Sheet"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-source" id="RB_NEW" _label="~New sheet"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5" cnt:fill="false" cnt:expand="false">
+ <fixedtext id="FT_COUNT" _label="N~o. of sheets"/>
+ <fixedtext id="FT_NAME" _label="Na~me"/>
+ </vbox>
+ <vbox>
+ <hbox>
+ <numericfield has_border="true" maximum="256" minimum="1" repeat="true" id="NF_COUNT" spin="true" spin-size="1" tabstop="true" value="1" cnt:fill="true" cnt:expand="false"/>
+ </hbox>
+ <edit has_border="true" id="ED_TABNAME" cnt:fill="true" cnt:expand="true"/>
+ </vbox>
+ </hbox>
+ </vbox>
+ </hbox>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-source" id="RB_FROMFILE" _label="~From file"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <hbox>
+ <multilistbox auto-hscroll="true" has_border="true" id="LB_TABLES" simple-mode="true" string-item-list=" : : : : " cnt:fill="true" cnt:expand="true"/>
+ <vbox cnt:fill="false" cnt:expand="false" spacing="5">
+ <pushbutton id="BTN_BROWSE" _label="~Browse..." cnt:expand="false"/>
+ <checkbox id="CB_LINK" _label="Lin~k" cnt:expand="false"/>
+ <flow/>
+ </vbox>
+ </hbox>
+ <fixedtext id="FT_PATH" label="FT-PATH"/>
+ </vbox>
+ </hbox>
+ </vbox>
+ </hbox>
+ <dialogbuttonhbox border="5" spacing="5">
+ <okbutton defbutton="true" id="BTN_OK"/>
+ <cancelbutton id="BTN_CANCEL"/>
+ <helpbutton id="BTN_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/sc/uiconfig/layout/makefile.mk b/sc/uiconfig/layout/makefile.mk
new file mode 100644
index 000000000000..f8cf8bdffce5
--- /dev/null
+++ b/sc/uiconfig/layout/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile$
+#
+# $Revision$
+#
+# last change: $Author$ $Date$
+#
+# The Contents of this file are made available subject to
+# the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2005 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston,
+# MA 02110-1301 USA
+#
+#*************************************************************************
+
+PRJ=../..
+PRJNAME=sc
+TARGET=layout
+
+.INCLUDE : settings.mk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+
+all: ALLTAR
+
+XML_FILES=\
+ insert-sheet.xml\
+ move-copy-sheet.xml\
+ sort-options.xml\
+ string-input.xml\
+
+#
+
+.INCLUDE : layout.mk
+
+.ELSE # ENABLE_LAYOUT != TRUE
+all .PHONY:
+.ENDIF # ENABLE_LAYOUT != TRUE
+
+.INCLUDE : target.mk
+
+localize.sdf: $(PRJ)/source/ui/miscdlgs/localize.sdf $(PRJ)/source/ui/src/localize.sdf
+ grep instbdlg.src $(PRJ)/source/ui/miscdlgs/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\insert-sheet.xml", $$3, "layout", $$5 $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\tRID_SCDLG_INSERT_TABLE/\t/' -e 's/\t_label/\tRID_SCDLG_INSERT_TABLE_title/' > insert-sheet-$@
+ grep -E 'miscdlgs.src.*(FT_DEST|FT_INSERT|STR_NEWDOC|RID_SCDLG_MOVETAB|BTN_COPY)' $(PRJ)/source/ui/src/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\move-copy-sheet.xml", $$3, "layout", $$5 $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\tRID_SCDLG_MOVETAB/\t/' -e 's/\t_label/\tRID_SCDLG_MOVETAB_title/'> move-copy-sheet-$@
+ grep sortdlg.src $(PRJ)/source/ui/src/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\sort-options.xml", $$3, "layout", $$5 $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\tRID_SCDLG_SORT/\t/' -e 's/\t_label/\tRID_SCDLG_SORT_title/' -e 's/\tRID_SCPAGE_SORT_OPTIONS/\t/' -e 's/\tRID_SCPAGE_SORT_FIELDS/\t/' > sort-options-$@
+ echo '#empty' | cat - insert-sheet-$@ move-copy-sheet-$@ sort-options-$@ > $@
+ rm -f *-$@
diff --git a/sc/uiconfig/layout/move-copy-sheet.xml b/sc/uiconfig/layout/move-copy-sheet.xml
new file mode 100644
index 000000000000..3d26db1aa73d
--- /dev/null
+++ b/sc/uiconfig/layout/move-copy-sheet.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="true" help-id="FID_TAB_MOVE" moveable="true" output-size="true" id="RID_SCDLG_MOVETAB" sv-look="true" _title="Move/Copy Sheet" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox spacing="5" border="5">
+ <string id="STR_NEWDOC" _text="- new document -"/>
+ <fixedtext id="FT_DEST" _label="To ~document"/>
+ <listbox has_border="true" dropdown="true" id="LB_DEST" tabstop="true"/>
+ <fixedtext id="FT_INSERT" _label="~Insert before"/>
+ <listbox has_border="true" id="LB_INSERT" tabstop="true" string-item-list=" : : : : " />
+ <checkbox id="BTN_COPY" tabstop="true" _label="~Copy"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <cancelbutton id="BTN_CANCEL" tabstop="true"/>
+ <helpbutton id="BTN_HELP" tabstop="true"/>
+ <okbutton defbutton="true" id="BTN_OK" tabstop="true"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/sc/uiconfig/layout/sort-options.xml b/sc/uiconfig/layout/sort-options.xml
new file mode 100644
index 000000000000..a409ac2d530a
--- /dev/null
+++ b/sc/uiconfig/layout/sort-options.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<tabpage help-id="HID_SCPAGE_SORT_OPTIONS"
+ id="RID_SCPAGE_SORT_OPTIONS"
+ sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"
+ optimumsize="true"
+ sizeable="true" moveable="true">
+ <vbox spacing="4" border="5">
+ <string id="STR_COL_LABEL" _text="Range contains column la~bels"/>
+ <string id="STR_ROW_LABEL" _text="Range contains ~row labels"/>
+ <string id="SCSTR_UNDEFINED" _text="- undefined -"/>
+ <vbox spacing="4" border="5">
+ <checkbox id="BTN_CASESENSITIVE" tabstop="true" _label="Case ~sensitive"/>
+ <checkbox id="BTN_LABEL" tabstop="true"/>
+ <checkbox id="BTN_FORMATS" tabstop="true" _label="Include ~formats"/>
+ <checkbox id="BTN_NATURALSORT" tabstop="true" _label="Enable ~natural sort"/>
+ <checkbox id="BTN_COPYRESULT" tabstop="true" _label="~Copy sort results to:"/>
+ <hbox>
+ <listbox has_border="true" dropdown="true" id="LB_OUTAREA" tabstop="true"/>
+ <edit has_border="true" disable="true" id="ED_OUTAREA" tabstop="true"/>
+ </hbox>
+ <checkbox id="BTN_SORT_USER" tabstop="true" _label="Custom sort ~order"/>
+ <listbox has_border="true" disable="true" dropdown="true" id="LB_SORT_USER" tabstop="true"/>
+ <hbox>
+ <fixedtext id="FT_LANGUAGE" _label="~Language"/>
+ <fixedtext id="FT_ALGORITHM" _label="O~ptions"/>
+ </hbox>
+ <hbox>
+ <svxlanguagebox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" tabstop="true" _string-item-list="Default"/>
+ <listbox has_border="true" dropdown="true" id="LB_ALGORITHM" tabstop="true"/>
+ </hbox>
+ <fixedline id="FL_DIRECTION" _text="Direction"/>
+ <radiobutton id="BTN_TOP_DOWN" radiogroup="sort-options" tabstop="true" _label="~Top to bottom (sort rows)"/>
+ <radiobutton id="BTN_LEFT_RIGHT" radiogroup="sort-options" tabstop="true" _label="L~eft to right (sort columns)"/>
+ </vbox>
+ </vbox>
+</tabpage>
diff --git a/sc/uiconfig/layout/string-input.xml b/sc/uiconfig/layout/string-input.xml
new file mode 100644
index 000000000000..b1aed5197c17
--- /dev/null
+++ b/sc/uiconfig/layout/string-input.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="false" moveable="true" output-size="true" id="RID_SCDLG_STRINPUT" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container" title="Insert String">
+ <vbox spacing="5" border="5">
+ <fixedtext id="FT_LABEL" label="FT-LABEL"/>
+ <edit has_border="true" id="ED_INPUT" tabstop="true"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <okbutton defbutton="true" id="BTN_OK" tabstop="true"/>
+ <cancelbutton id="BTN_CANCEL" tabstop="true"/>
+ <helpbutton id="BTN_HELP" tabstop="true"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk
index 63251c7d8f35..3fc0712cd996 100644
--- a/sc/util/makefile.mk
+++ b/sc/util/makefile.mk
@@ -85,6 +85,7 @@ SHL1STDLIBS= \
$(SVXLIB) \
$(GOODIESLIB) \
$(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
$(VCLLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
@@ -188,23 +189,18 @@ SHL6STDLIBS= \
$(SVTOOLLIB) \
$(SVLLIB) \
$(SVXLIB) \
- $(GOODIESLIB) \
$(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
$(VCLLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(COMPHELPERLIB) \
- $(UCBHELPERLIB) \
$(TKLIB) \
$(VOSLIB) \
$(SALLIB) \
$(TOOLSLIB) \
- $(I18NISOLANGLIB) \
$(UNOTOOLSLIB) \
$(SOTLIB) \
- $(XMLOFFLIB) \
- $(DBTOOLSLIB) \
- $(AVMEDIALIB) \
$(OOXLIB) \
$(SAXLIB) \
$(FORLIB)
@@ -232,6 +228,10 @@ SHL8STDLIBS= \
$(CPPULIB) \
$(SALLIB)
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+SHL8STDLIBS+=$(TKLIB)
+.ENDIF # ENABLE_LAYOUT == TRUE
+
SHL8LIBS= $(SLB)$/scui.lib
LIB8TARGET = $(SLB)$/scui.lib
diff --git a/scaddins/prj/build.lst b/scaddins/prj/build.lst
index fd2fc4e80ccc..c2ade63c0b5d 100644
--- a/scaddins/prj/build.lst
+++ b/scaddins/prj/build.lst
@@ -1,4 +1,4 @@
-ca scaddins : vcl NULL
+ca scaddins : l10n vcl NULL
ca scaddins usr1 - all sc_mkout NULL
ca scaddins\source\datefunc nmake - all sc_dfunc NULL
ca scaddins\source\analysis nmake - all sc_analysis NULL
diff --git a/scaddins/source/analysis/makefile.mk b/scaddins/source/analysis/makefile.mk
index 58c064e91a0f..e51d10825758 100644
--- a/scaddins/source/analysis/makefile.mk
+++ b/scaddins/source/analysis/makefile.mk
@@ -106,11 +106,9 @@ SRC1FILES = \
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
SHL1OBJS=$(SLOFILES)
SHL1STDLIBS= \
- $(VCLLIB) \
$(TOOLSLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
- $(VOSLIB) \
$(SALLIB)
SHL1DEPN=makefile.mk
diff --git a/scaddins/source/datefunc/makefile.mk b/scaddins/source/datefunc/makefile.mk
index 8aa8237089f0..a626956044e1 100644
--- a/scaddins/source/datefunc/makefile.mk
+++ b/scaddins/source/datefunc/makefile.mk
@@ -93,11 +93,9 @@ SRC1FILES =\
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
SHL1OBJS=$(SLOFILES)
SHL1STDLIBS= \
- $(VCLLIB) \
$(TOOLSLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
- $(VOSLIB) \
$(SALLIB)
SHL1DEPN=makefile.mk
diff --git a/sccomp/prj/build.lst b/sccomp/prj/build.lst
index e2b7202ce7bf..8e1e0d0181cb 100644
--- a/sccomp/prj/build.lst
+++ b/sccomp/prj/build.lst
@@ -1,4 +1,4 @@
-scc sccomp : offuh comphelper LPSOLVE:lpsolve tools transex3 rsc NULL
+scc sccomp : l10n offuh comphelper LPSOLVE:lpsolve tools rsc NULL
scc sccomp usr1 - all scc_mkout NULL
scc sccomp\prj get - all scc_prj NULL
scc sccomp\source\solver nmake - all scc_solver NULL
diff --git a/sccomp/source/solver/solver.cxx b/sccomp/source/solver/solver.cxx
index 96644ae79423..81c2934fa7a8 100644
--- a/sccomp/source/solver/solver.cxx
+++ b/sccomp/source/solver/solver.cxx
@@ -145,55 +145,6 @@ double lcl_GetValue( const uno::Reference<sheet::XSpreadsheetDocument>& xDoc,
return lcl_GetCell( xDoc, rPos )->getValue();
}
-OUString lcl_FormatCellRef( const uno::Reference<sheet::XSpreadsheetDocument>& xDoc, const table::CellAddress& rPos )
-{
- uno::Reference<lang::XMultiServiceFactory> xFact( xDoc, uno::UNO_QUERY );
- uno::Reference<beans::XPropertySet> xConv( xFact->createInstance(
- OUString::createFromAscii( "com.sun.star.table.CellAddressConversion" ) ), uno::UNO_QUERY );
- xConv->setPropertyValue( OUString::createFromAscii( "Address" ), uno::makeAny( rPos ) );
- OUString aRet;
- xConv->getPropertyValue( OUString::createFromAscii( "UserInterfaceRepresentation" ) ) >>= aRet;
- return aRet;
-}
-
-bool lcl_ParseCellRef( table::CellAddress& rPos,
- const uno::Reference<sheet::XSpreadsheetDocument>& xDoc,
- const OUString& rStr )
-{
- uno::Reference<lang::XMultiServiceFactory> xFact( xDoc, uno::UNO_QUERY );
- uno::Reference<beans::XPropertySet> xConv( xFact->createInstance(
- OUString::createFromAscii( "com.sun.star.table.CellAddressConversion" ) ), uno::UNO_QUERY );
- try
- {
- xConv->setPropertyValue( OUString::createFromAscii( "UserInterfaceRepresentation" ), uno::makeAny( rStr ) );
- }
- catch ( lang::IllegalArgumentException& )
- {
- return false; // no valid ref
- }
- xConv->getPropertyValue( OUString::createFromAscii( "Address" ) ) >>= rPos;
- return true;
-}
-
-bool lcl_ParseRangeRef( table::CellRangeAddress& rRange,
- const uno::Reference<sheet::XSpreadsheetDocument>& xDoc,
- const OUString& rStr )
-{
- uno::Reference<lang::XMultiServiceFactory> xFact( xDoc, uno::UNO_QUERY );
- uno::Reference<beans::XPropertySet> xConv( xFact->createInstance(
- OUString::createFromAscii( "com.sun.star.table.CellRangeAddressConversion" ) ), uno::UNO_QUERY );
- try
- {
- xConv->setPropertyValue( OUString::createFromAscii( "UserInterfaceRepresentation" ), uno::makeAny( rStr ) );
- }
- catch ( lang::IllegalArgumentException& )
- {
- return false; // no valid ref
- }
- xConv->getPropertyValue( OUString::createFromAscii( "Address" ) ) >>= rRange;
- return true;
-}
-
// -------------------------------------------------------------------------
SolverComponent::SolverComponent( const uno::Reference<uno::XComponentContext>& /* rSMgr */ ) :