summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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/ChartDocumentWrapper.cxx22
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx11
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.hrc32
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.src22
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.hrc30
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.src22
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx47
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.hxx13
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx11
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx38
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx2
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx9
-rw-r--r--chart2/source/controller/dialogs/Strings.src5
-rw-r--r--chart2/source/controller/dialogs/Strings_ChartTypes.src13
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.cxx13
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx13
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx4
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx23
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hxx7
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.cxx23
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hxx6
-rw-r--r--chart2/source/controller/inc/DataPointItemConverter.hxx1
-rw-r--r--chart2/source/controller/inc/dlg_DataSource.hxx3
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx11
-rw-r--r--chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx5
-rw-r--r--chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx4
-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/ChartWindow.cxx28
-rw-r--r--chart2/source/controller/main/ChartWindow.hxx6
-rw-r--r--chart2/source/controller/makefile.mk1
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx13
-rw-r--r--chart2/source/inc/CommonConverters.hxx4
-rw-r--r--chart2/source/inc/CommonFunctors.hxx5
-rw-r--r--chart2/source/inc/Strings.hrc7
-rw-r--r--chart2/source/inc/chartview/ChartSfxItemIds.hxx3
-rw-r--r--chart2/source/inc/chartview/ExplicitValueProvider.hxx7
-rw-r--r--chart2/source/inc/servicenames_charttypes.hxx2
-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/ChartTypeManager.cxx26
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx24
-rw-r--r--chart2/source/model/template/FilledNetChartType.cxx97
-rw-r--r--chart2/source/model/template/FilledNetChartType.hxx66
-rw-r--r--chart2/source/model/template/NetChartType.cxx120
-rw-r--r--chart2/source/model/template/NetChartType.hxx40
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx28
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/_serviceregistration_charttypes.cxx18
-rw-r--r--chart2/source/model/template/makefile.mk4
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx86
-rw-r--r--chart2/source/tools/CommonConverters.cxx23
-rw-r--r--chart2/source/tools/DiagramHelper.cxx20
-rw-r--r--chart2/source/tools/TitleHelper.cxx36
-rw-r--r--chart2/source/view/axes/VCoordinateSystem.cxx5
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx114
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx12
-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.cxx18
-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/ShapeFactory.hxx7
-rw-r--r--chart2/source/view/inc/Stripe.hxx2
-rw-r--r--chart2/source/view/inc/VCoordinateSystem.hxx4
-rw-r--r--chart2/source/view/inc/VDataSeries.hxx16
-rw-r--r--chart2/source/view/inc/VSeriesPlotter.hxx2
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx1
-rw-r--r--chart2/source/view/main/ChartView.cxx48
-rw-r--r--chart2/source/view/main/PlottingPositionHelper.cxx34
-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.cxx136
-rw-r--r--chart2/source/view/makefile.mk2
-rw-r--r--sc/inc/address.hxx8
-rw-r--r--sc/inc/attarray.hxx3
-rw-r--r--sc/inc/attrib.hxx4
-rw-r--r--sc/inc/cell.hxx18
-rw-r--r--sc/inc/cellsuno.hxx12
-rw-r--r--sc/inc/chartarr.hxx1
-rw-r--r--sc/inc/chartpos.hxx5
-rw-r--r--sc/inc/chgtrack.hxx62
-rw-r--r--sc/inc/collect.hxx6
-rw-r--r--sc/inc/column.hxx10
-rw-r--r--sc/inc/compiler.hxx12
-rw-r--r--sc/inc/conditio.hxx23
-rw-r--r--sc/inc/dapiuno.hxx3
-rw-r--r--sc/inc/datauno.hxx11
-rw-r--r--sc/inc/dbcolect.hxx2
-rw-r--r--sc/inc/document.hxx65
-rw-r--r--sc/inc/docuno.hxx3
-rw-r--r--sc/inc/dpcachetable.hxx6
-rw-r--r--sc/inc/dpobject.hxx6
-rw-r--r--sc/inc/dpsave.hxx1
-rw-r--r--sc/inc/dptabsrc.hxx4
-rw-r--r--sc/inc/drwlayer.hxx6
-rw-r--r--sc/inc/externalrefmgr.hxx37
-rw-r--r--sc/inc/fmtuno.hxx33
-rw-r--r--sc/inc/formulaparserpool.hxx70
-rw-r--r--sc/inc/global.hxx17
-rw-r--r--sc/inc/markarr.hxx2
-rw-r--r--sc/inc/olinetab.hxx2
-rw-r--r--sc/inc/pch/precompiled_sc.hxx3
-rw-r--r--sc/inc/pivot.hxx232
-rw-r--r--sc/inc/postit.hxx177
-rw-r--r--sc/inc/progress.hxx11
-rw-r--r--sc/inc/rangenam.hxx16
-rw-r--r--sc/inc/rechead.hxx27
-rw-r--r--sc/inc/refdata.hxx21
-rw-r--r--sc/inc/reftokenhelper.hxx3
-rw-r--r--sc/inc/sc.hrc7
-rw-r--r--sc/inc/scabstdlg.hxx1
-rw-r--r--sc/inc/scextopt.hxx2
-rw-r--r--sc/inc/scmatrix.hxx10
-rw-r--r--sc/inc/stlpool.hxx2
-rw-r--r--sc/inc/subtotal.hxx29
-rw-r--r--sc/inc/table.hxx71
-rw-r--r--sc/inc/tabprotection.hxx180
-rw-r--r--sc/inc/tokenuno.hxx20
-rw-r--r--sc/inc/unonames.hxx6
-rw-r--r--sc/inc/validat.hxx6
-rw-r--r--sc/source/core/data/attarray.cxx11
-rw-r--r--sc/source/core/data/attrib.cxx160
-rw-r--r--sc/source/core/data/cell.cxx29
-rw-r--r--sc/source/core/data/cell2.cxx274
-rw-r--r--sc/source/core/data/column.cxx25
-rw-r--r--sc/source/core/data/column2.cxx48
-rw-r--r--sc/source/core/data/column3.cxx6
-rw-r--r--sc/source/core/data/conditio.cxx55
-rw-r--r--sc/source/core/data/documen2.cxx79
-rw-r--r--sc/source/core/data/documen3.cxx99
-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/document.cxx83
-rw-r--r--sc/source/core/data/dpcachetable.cxx25
-rw-r--r--sc/source/core/data/dpobject.cxx67
-rw-r--r--sc/source/core/data/dpsave.cxx25
-rw-r--r--sc/source/core/data/dpsdbtab.cxx9
-rw-r--r--sc/source/core/data/dpshttab.cxx6
-rw-r--r--sc/source/core/data/dptabsrc.cxx34
-rw-r--r--sc/source/core/data/drwlayer.cxx22
-rw-r--r--sc/source/core/data/global2.cxx42
-rw-r--r--sc/source/core/data/makefile.mk3
-rw-r--r--sc/source/core/data/markarr.cxx8
-rw-r--r--sc/source/core/data/patattr.cxx15
-rw-r--r--sc/source/core/data/pivot.cxx1991
-rw-r--r--sc/source/core/data/pivot2.cxx426
-rw-r--r--sc/source/core/data/postit.cxx645
-rw-r--r--sc/source/core/data/stlpool.cxx8
-rw-r--r--sc/source/core/data/table1.cxx30
-rw-r--r--sc/source/core/data/table2.cxx100
-rw-r--r--sc/source/core/data/table3.cxx105
-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.cxx12
-rw-r--r--sc/source/core/inc/interpre.hxx26
-rw-r--r--sc/source/core/inc/refupdat.hxx7
-rw-r--r--sc/source/core/tool/address.cxx67
-rw-r--r--sc/source/core/tool/chartpos.cxx62
-rw-r--r--sc/source/core/tool/chgtrack.cxx514
-rw-r--r--sc/source/core/tool/collect.cxx32
-rw-r--r--sc/source/core/tool/compiler.cxx322
-rw-r--r--sc/source/core/tool/detfunc.cxx2
-rw-r--r--sc/source/core/tool/editutil.cxx4
-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/rangenam.cxx88
-rw-r--r--sc/source/core/tool/rechead.cxx56
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx59
-rw-r--r--sc/source/core/tool/refupdat.cxx43
-rw-r--r--sc/source/core/tool/scmatrix.cxx84
-rw-r--r--sc/source/core/tool/subtotal.cxx182
-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.cxx7
-rw-r--r--sc/source/filter/excel/excimp8.cxx57
-rw-r--r--sc/source/filter/excel/excrecds.cxx69
-rw-r--r--sc/source/filter/excel/impop.cxx48
-rw-r--r--sc/source/filter/excel/namebuff.cxx3
-rw-r--r--sc/source/filter/excel/read.cxx11
-rw-r--r--sc/source/filter/excel/tokstack.cxx50
-rw-r--r--sc/source/filter/excel/xechart.cxx19
-rw-r--r--sc/source/filter/excel/xeescher.cxx5
-rw-r--r--sc/source/filter/excel/xeformula.cxx2
-rw-r--r--sc/source/filter/excel/xelink.cxx10
-rw-r--r--sc/source/filter/excel/xename.cxx8
-rw-r--r--sc/source/filter/excel/xepivot.cxx16
-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/xetable.cxx60
-rw-r--r--sc/source/filter/excel/xichart.cxx104
-rw-r--r--sc/source/filter/excel/xicontent.cxx192
-rw-r--r--sc/source/filter/excel/xiescher.cxx40
-rw-r--r--sc/source/filter/excel/xihelper.cxx38
-rw-r--r--sc/source/filter/excel/xilink.cxx67
-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.cxx48
-rw-r--r--sc/source/filter/excel/xlroot.cxx14
-rw-r--r--sc/source/filter/excel/xlstyle.cxx12
-rw-r--r--sc/source/filter/html/htmlpars.cxx333
-rw-r--r--sc/source/filter/inc/excimp8.hxx2
-rw-r--r--sc/source/filter/inc/excrecds.hxx18
-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/op.h2
-rw-r--r--sc/source/filter/inc/qpro.hxx1
-rw-r--r--sc/source/filter/inc/tokstack.hxx2
-rw-r--r--sc/source/filter/inc/xcl97rec.hxx196
-rw-r--r--sc/source/filter/inc/xelink.hxx4
-rw-r--r--sc/source/filter/inc/xename.hxx4
-rw-r--r--sc/source/filter/inc/xepivot.hxx8
-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/xetable.hxx36
-rw-r--r--sc/source/filter/inc/xichart.hxx8
-rw-r--r--sc/source/filter/inc/xicontent.hxx61
-rw-r--r--sc/source/filter/inc/xiescher.hxx4
-rw-r--r--sc/source/filter/inc/xihelper.hxx40
-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.hxx1
-rw-r--r--sc/source/filter/inc/xlroot.hxx4
-rw-r--r--sc/source/filter/inc/xlstyle.hxx4
-rw-r--r--sc/source/filter/lotus/op.cxx30
-rw-r--r--sc/source/filter/qpro/qpro.cxx6
-rw-r--r--sc/source/filter/starcalc/scflt.cxx18
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx1
-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/XMLExportDatabaseRanges.cxx50
-rw-r--r--sc/source/filter/xml/XMLExportDatabaseRanges.hxx12
-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.cxx14
-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/ui/Accessibility/AccessibleCell.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx25
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx74
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx140
-rw-r--r--sc/source/ui/app/inputhdl.cxx50
-rw-r--r--sc/source/ui/app/inputwin.cxx2
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx18
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx4
-rw-r--r--sc/source/ui/dbgui/csvtablebox.cxx56
-rw-r--r--sc/source/ui/dbgui/sortdlg.cxx41
-rw-r--r--sc/source/ui/docshell/docfunc.cxx329
-rw-r--r--sc/source/ui/docshell/docsh.cxx54
-rw-r--r--sc/source/ui/docshell/docsh3.cxx4
-rw-r--r--sc/source/ui/docshell/docsh4.cxx14
-rw-r--r--sc/source/ui/docshell/docsh5.cxx45
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx101
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx2
-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/formdlg/privsplt.cxx18
-rw-r--r--sc/source/ui/inc/AccessibleDocumentPagePreview.hxx6
-rw-r--r--sc/source/ui/inc/AccessibleText.hxx4
-rw-r--r--sc/source/ui/inc/anyrefdg.hxx1
-rw-r--r--sc/source/ui/inc/csvtablebox.hxx10
-rw-r--r--sc/source/ui/inc/docfunc.hxx11
-rw-r--r--sc/source/ui/inc/docsh.hxx10
-rw-r--r--sc/source/ui/inc/drawview.hxx2
-rw-r--r--sc/source/ui/inc/formula.hxx1
-rw-r--r--sc/source/ui/inc/gridwin.hxx56
-rw-r--r--sc/source/ui/inc/output.hxx2
-rw-r--r--sc/source/ui/inc/privsplt.hxx1
-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/refundo.hxx6
-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.hxx18
-rw-r--r--sc/source/ui/inc/tabview.hxx8
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx3
-rw-r--r--sc/source/ui/inc/undoblk.hxx30
-rw-r--r--sc/source/ui/inc/undotab.hxx86
-rw-r--r--sc/source/ui/inc/viewfunc.hxx4
-rw-r--r--sc/source/ui/inc/viewutil.hxx2
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx5
-rw-r--r--sc/source/ui/miscdlgs/makefile.mk16
-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/src/filter.src64
-rw-r--r--sc/source/ui/src/sortdlg.src44
-rw-r--r--sc/source/ui/undo/refundo.cxx21
-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.cxx398
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx43
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx63
-rw-r--r--sc/source/ui/unoobj/datauno.cxx158
-rw-r--r--sc/source/ui/unoobj/docuno.cxx42
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx3
-rw-r--r--sc/source/ui/unoobj/fmtuno.cxx145
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx6
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx51
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx5
-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.cxx28
-rw-r--r--sc/source/ui/view/cellsh2.cxx374
-rw-r--r--sc/source/ui/view/cellsh3.cxx10
-rw-r--r--sc/source/ui/view/drawview.cxx50
-rw-r--r--sc/source/ui/view/gridwin.cxx430
-rw-r--r--sc/source/ui/view/gridwin2.cxx444
-rw-r--r--sc/source/ui/view/gridwin4.cxx2
-rw-r--r--sc/source/ui/view/gridwin5.cxx4
-rw-r--r--sc/source/ui/view/makefile.mk4
-rw-r--r--sc/source/ui/view/output.cxx14
-rw-r--r--sc/source/ui/view/preview.cxx4
-rw-r--r--sc/source/ui/view/printfun.cxx1
-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/tabview.cxx35
-rw-r--r--sc/source/ui/view/tabview3.cxx56
-rw-r--r--sc/source/ui/view/tabview5.cxx10
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx218
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx4
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx5
-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/viewfun4.cxx128
-rw-r--r--sc/source/ui/view/viewfun6.cxx6
-rw-r--r--sc/source/ui/view/viewfunc.cxx51
-rw-r--r--sc/source/ui/view/viewutil.cxx34
-rw-r--r--sc/util/makefile.mk8
371 files changed, 13822 insertions, 9006 deletions
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/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 3e3b7254f578..397527f3ea9d 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -95,9 +95,11 @@ enum eServiceType
SERVICE_NAME_DONUT_DIAGRAM,
SERVICE_NAME_LINE_DIAGRAM,
SERVICE_NAME_NET_DIAGRAM,
+ SERVICE_NAME_FILLED_NET_DIAGRAM,
SERVICE_NAME_PIE_DIAGRAM,
SERVICE_NAME_STOCK_DIAGRAM,
SERVICE_NAME_XY_DIAGRAM,
+ SERVICE_NAME_BUBBLE_DIAGRAM,
SERVICE_NAME_DASH_TABLE,
SERVICE_NAME_GARDIENT_TABLE,
@@ -123,9 +125,11 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
( C2U( "com.sun.star.chart.DonutDiagram" ), SERVICE_NAME_DONUT_DIAGRAM )
( C2U( "com.sun.star.chart.LineDiagram" ), SERVICE_NAME_LINE_DIAGRAM )
( C2U( "com.sun.star.chart.NetDiagram" ), SERVICE_NAME_NET_DIAGRAM )
+ ( C2U( "com.sun.star.chart.FilledNetDiagram" ), SERVICE_NAME_FILLED_NET_DIAGRAM )
( C2U( "com.sun.star.chart.PieDiagram" ), SERVICE_NAME_PIE_DIAGRAM )
( C2U( "com.sun.star.chart.StockDiagram" ), SERVICE_NAME_STOCK_DIAGRAM )
( C2U( "com.sun.star.chart.XYDiagram" ), SERVICE_NAME_XY_DIAGRAM )
+ ( C2U( "com.sun.star.chart.BubbleDiagram" ), SERVICE_NAME_BUBBLE_DIAGRAM )
( C2U( "com.sun.star.drawing.DashTable" ), SERVICE_NAME_DASH_TABLE )
( C2U( "com.sun.star.drawing.GradientTable" ), SERVICE_NAME_GARDIENT_TABLE )
@@ -1339,6 +1343,14 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
bCreateDiagram = true;
}
break;
+ case SERVICE_NAME_FILLED_NET_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.FilledNet" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
case SERVICE_NAME_PIE_DIAGRAM:
if( xManagerFact.is())
{
@@ -1367,6 +1379,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:
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index a6c18f9475dc..ce417155dc4f 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -50,6 +50,7 @@
#include "WrappedDataCaptionProperties.hxx"
#include "WrappedSeriesAreaOrLineProperty.hxx"
#include "WrappedScaleTextProperties.hxx"
+#include "WrappedNumberFormatProperty.hxx"
#include "WrappedTextRotationProperty.hxx"
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
@@ -88,6 +89,7 @@ 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
@@ -165,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 )
@@ -713,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 );
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 5bd12775fbcd..4a02d9aa99e5 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -538,6 +538,10 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
if( aName.indexOf( C2U("Scatter") ) != -1 )
return C2U( "com.sun.star.chart.XYDiagram" );
+ // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet"
+ if( aName.indexOf( C2U("FilledNet") ) != -1 )
+ return C2U( "com.sun.star.chart.FilledNetDiagram" );
+
// "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol"
// "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol"
// "PercentStackedNetLine"
@@ -549,6 +553,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"
@@ -588,12 +595,18 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" ) )
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" ) )
+
( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" ) )
( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" ) )
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" ) )
+
;
return g_aChartTypeNameMap;
}
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/dialogs/Bitmaps.hrc b/chart2/source/controller/dialogs/Bitmaps.hrc
index 58b1d540cc1a..8823b582a28e 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
@@ -168,8 +173,8 @@
#define BMP_NET_SYMB_STACK (RID_APP_START + 77)
#define BMP_NET_LINESYMB (RID_APP_START + 78)
#define BMP_NET_LINESYMB_STACK (RID_APP_START + 79)
-#define BMP_NET_FILLED (RID_APP_START + 80)
-#define BMP_NET_FILLED_STACKED (RID_APP_START + 81)
+#define BMP_NET_FILL (RID_APP_START + 80)
+#define BMP_NET_FILL_STACK (RID_APP_START + 81)
//----------------------
// Stock 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..67d8588897d8 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" ;
@@ -345,13 +359,13 @@ Bitmap BMP_NET_LINESYMB_STACK
{
File = "netlinepointstack_52x60.png" ;
};
-Bitmap BMP_NET_FILLED
+Bitmap BMP_NET_FILL
{
- File = "net_52x60.png" ;
+ File = "netfill_52x60.png" ;
};
-Bitmap BMP_NET_FILLED_STACKED
+Bitmap BMP_NET_FILL_STACK
{
- File = "netstack_52x60.png" ;
+ File = "netstackfill_52x60.png" ;
};
//---------------------
Bitmap BMP_PYRAMIDQ_3D_1
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.hrc b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
index 0b65579973c5..8dd4acaffd15 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
@@ -166,8 +173,8 @@
#define BMP_NET_SYMB_STACK_HC (RID_SCH_START + 77)
#define BMP_NET_LINESYMB_HC (RID_SCH_START + 78)
#define BMP_NET_LINESYMB_STACK_HC (RID_SCH_START + 79)
-#define BMP_NET_FILLED_HC (RID_SCH_START + 80)
-#define BMP_NET_FILLED_STACKED_HC (RID_SCH_START + 81)
+#define BMP_NET_FILL_HC (RID_SCH_START + 80)
+#define BMP_NET_FILL_STACK_HC (RID_SCH_START + 81)
//----------------------
// Stock 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..a82893273ae2 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" ;
@@ -345,13 +359,13 @@ Bitmap BMP_NET_LINESYMB_STACK_HC
{
File = "netlinepointstack_52x60_h.png" ;
};
-Bitmap BMP_NET_FILLED_HC
+Bitmap BMP_NET_FILL_HC
{
- File = "net_52x60_h.png" ;
+ File = "netfill_52x60_h.png" ;
};
-Bitmap BMP_NET_FILLED_STACKED_HC
+Bitmap BMP_NET_FILL_STACK_HC
{
- File = "netstack_52x60_h.png" ;
+ File = "netstackfill_52x60_h.png" ;
};
//---------------------
Bitmap BMP_PYRAMIDQ_3D_1_HC
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 79efe0b04919..fa51d17a03d8 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
{
@@ -1000,6 +1000,10 @@ const tTemplateServiceChartTypeParameterMap& NetChartDialogController::getTempla
( C2U( "com.sun.star.chart2.template.NetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) )
( C2U( "com.sun.star.chart2.template.StackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) )
( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) )
+
+ ( C2U( "com.sun.star.chart2.template.FilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_NONE,false,false) )
+ ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y,false,false) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ),ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT,false,false) )
;
return m_aTemplateMap;
}
@@ -1012,17 +1016,20 @@ void NetChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIs
rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB ) );
rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB ) );
rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL ) );
}
else
{
rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB_STACK ) );
rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB_STACK ) );
rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET_STACK ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL_STACK ) );
}
rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) );
rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) );
rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_FILLED )) );
}
void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
{
@@ -1040,6 +1047,10 @@ void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rPa
rParameter.bSymbols = false;
rParameter.bLines = true;
break;
+ case 4:
+ rParameter.bSymbols = false;
+ rParameter.bLines = false;
+ break;
default:
rParameter.bSymbols = true;
rParameter.bLines = false;
@@ -1238,6 +1249,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 cf61b88a63ac..56ef98b159ba 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -407,14 +407,14 @@ 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 ))
{
aResult = SELECT_IMAGE( IMG_TYPE_PIE, bHC );
}
- else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET ))
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET )
+ || aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) )
{
aResult = SELECT_IMAGE( IMG_TYPE_NET, bHC );
}
@@ -423,6 +423,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;
}
@@ -1068,6 +1072,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;
}
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index e612edc0901b..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>
@@ -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();
}
}
@@ -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 1a7e8675f5bc..69e693911c22 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -108,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 )
@@ -155,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
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 b08fe754513f..3b384915f2d0 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -471,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..f2731b2971c2 100644
--- a/chart2/source/controller/dialogs/Strings_ChartTypes.src
+++ b/chart2/source/controller/dialogs/Strings_ChartTypes.src
@@ -139,5 +139,18 @@ String STR_DEEP
{
Text [ en-US ] = "Deep" ;
};
+String STR_FILLED
+{
+ Text [ en-US ] = "Filled" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_BUBBLE
+{
+ Text [ en-US ] = "Bubble" ;
+};
+String STR_BUBBLE_1
+{
+ Text [ en-US ] = "Bubble Chart" ;
+};
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index 1d76a106d72b..1aa7db1f0f17 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -202,6 +202,19 @@ DataSourceDialog::~DataSourceDialog()
delete m_pTabControl;
}
+short DataSourceDialog::Execute()
+{
+ short nResult = TabDialog::Execute();
+ if( nResult == RET_OK )
+ {
+ if( m_pRangeChooserTabePage )
+ m_pRangeChooserTabePage->commitPage();
+ if( m_pDataSourceTabPage )
+ m_pDataSourceTabPage->commitPage();
+ }
+ return nResult;
+}
+
void DataSourceDialog::setInvalidPage( TabPage * pTabPage )
{
if( pTabPage == m_pRangeChooserTabePage )
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index a93711151ac1..c6129629a51a 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -215,6 +215,13 @@ 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 );
}
@@ -286,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;
@@ -307,7 +314,7 @@ 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 );
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index f60637af4c44..c35f11546d36 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() );
@@ -994,7 +995,8 @@ IMPL_LINK( ChartTypeTabPage, SelectMainTypeHdl, void *, EMPTYARG )
aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
this->fillAllControls( aParameter );
- m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel);
+ uno::Reference< beans::XPropertySet > xTemplateProps( this->getCurrentTemplate(), uno::UNO_QUERY );
+ m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps);
}
return 0;
}
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index f499e2acc23a..ff858c5bfdf5 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -377,6 +377,29 @@ void DataSourceTabPage::initializePage()
{
}
+void DataSourceTabPage::DeactivatePage()
+{
+ commitPage();
+ svt::OWizardPage::DeactivatePage();
+}
+
+void DataSourceTabPage::commitPage()
+{
+ commitPage(eFinish);
+}
+
+sal_Bool DataSourceTabPage::commitPage( CommitPageReason /*eReason*/ )
+{
+ //ranges may have been edited in the meanwhile (dirty is true in that case here)
+ if( isValid() )
+ {
+ updateModelFromControl( 0 /*update all*/ );
+ return sal_True;//return false if this page should not be left
+ }
+ else
+ return sal_False;
+}
+
bool DataSourceTabPage::isRangeFieldContentValid( Edit & rEdit )
{
OUString aRange( rEdit.GetText());
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
index 2703836d5d1d..6c42f1cb98e2 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -87,8 +87,15 @@ public:
bool bHideDescription = false );
virtual ~DataSourceTabPage();
+ void commitPage();
+
+protected:
// OWizardPage
virtual void ActivatePage();
+ virtual sal_Bool commitPage( CommitPageReason eReason );
+
+ //TabPage
+ virtual void DeactivatePage();
virtual void initializePage();
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
index 2c2bc3fc6892..8ba4d61a8057 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -216,6 +216,29 @@ void RangeChooserTabPage::initControlsFromModel()
m_nChangingControlCalls--;
}
+void RangeChooserTabPage::DeactivatePage()
+{
+ commitPage();
+ svt::OWizardPage::DeactivatePage();
+}
+
+void RangeChooserTabPage::commitPage()
+{
+ commitPage(eFinish);
+}
+
+sal_Bool RangeChooserTabPage::commitPage( CommitPageReason /*eReason*/ )
+{
+ //ranges may have been edited in the meanwhile (dirty is true in that case here)
+ if( isValid() )
+ {
+ changeDialogModelAccordingToControls();
+ return sal_True;//return false if this page should not be left
+ }
+ else
+ return sal_False;
+}
+
void RangeChooserTabPage::changeDialogModelAccordingToControls()
{
if(m_nChangingControlCalls>0)
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
index 01062ba4c0f1..bb508da8d9a1 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
@@ -70,10 +70,16 @@ virtual ~RangeChooserTabPage();
virtual void listeningFinished( const ::rtl::OUString & rNewRange );
virtual void disposingRangeSelection();
+ void commitPage();
+
protected: //methods
//OWizardPage
virtual void ActivatePage();
+ virtual sal_Bool commitPage( CommitPageReason eReason );
+
+ //TabPage
+ virtual void DeactivatePage();
void initControlsFromModel();
void changeDialogModelAccordingToControls();
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/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx
index cfbe7aa561e8..331136607e75 100644
--- a/chart2/source/controller/inc/dlg_DataSource.hxx
+++ b/chart2/source/controller/inc/dlg_DataSource.hxx
@@ -68,6 +68,9 @@ public:
::com::sun::star::uno::XComponentContext > & xContext );
virtual ~DataSourceDialog();
+ // from Dialog (base of TabDialog)
+ virtual short Execute();
+
// TabPageNotifiable
virtual void setInvalidPage( TabPage * pTabPage );
virtual void setValidPage( TabPage * pTabPage );
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 0c0ea2d0dbdd..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()
@@ -648,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;
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 0321df6035f2..dbefb0e7f025 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -128,8 +128,6 @@ 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
@@ -145,8 +143,6 @@ 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*/ \
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/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/makefile.mk b/chart2/source/controller/makefile.mk
index d2d399d22cff..45060a60d297 100644
--- a/chart2/source/controller/makefile.mk
+++ b/chart2/source/controller/makefile.mk
@@ -90,6 +90,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \
$(SALLIB) \
$(SVLLIB) \
$(SVTOOLLIB) \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(TKLIB) \
$(TOOLSLIB) \
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
index efa4758c4ccd..9c5cdafe49f2 100644
--- a/chart2/source/inc/ChartTypeHelper.hxx
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -83,9 +83,22 @@ public:
static sal_Int32 getNumberOfDisplayedSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries );
SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ static bool isSeriesInFrontOfAxisLine( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+
static sal_Int32 //one of ::com::sun::star::chart2::AxisType
getAxisType( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
, sal_Int32 nDimensionIndex );
+
+ static rtl::OUString getRoleOfSequenceForYAxisNumberFormatDetection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static rtl::OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static bool shouldLabelNumberFormatKeyBeDetectedFromYAxis( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static bool isSupportingOnlyDeepStackingFor3D( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
};
//.............................................................................
diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx
index 102ffde71918..493c4d2096e2 100644
--- a/chart2/source/inc/CommonConverters.hxx
+++ b/chart2/source/inc/CommonConverters.hxx
@@ -121,6 +121,10 @@ OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::drawing::Position3D getPointFromPoly(
, sal_Int32 nPointIndex, sal_Int32 nPolyIndex=0 );
//-----------------------------------------------------------------------------
+OOO_DLLPUBLIC_CHARTTOOLS
+void addPolygon( com::sun::star::drawing::PolyPolygonShape3D& rRet
+ , const com::sun::star::drawing::PolyPolygonShape3D& rAdd );
+//-----------------------------------------------------------------------------
/** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D
*/
OOO_DLLPUBLIC_CHARTTOOLS
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/Strings.hrc b/chart2/source/inc/Strings.hrc
index 0af8f7e1ae04..1092efe6e900 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -33,8 +33,8 @@
// this includes no link dependency
#include <svtools/solar.hrc>
+//next free is 286
//single free is: 134
-//next free is 282
//#define RID_APP_START 30000
////#define STR_NULL (RID_APP_START + 1)
@@ -100,6 +100,7 @@
#define STR_STACKED (RID_APP_START + 11)
#define STR_PERCENT (RID_APP_START + 12)
#define STR_DEEP (RID_APP_START + 13)
+#define STR_FILLED (RID_APP_START + 285)
#define STR_DONUT (RID_APP_START + 8)
#define STR_TYPE_PIE (RID_APP_START + 187)
@@ -129,6 +130,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:
@@ -181,6 +185,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)
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
index d1a738d84e94..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
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
index 2f96bed91fa5..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>
@@ -94,13 +95,13 @@ public:
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/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx
index 461483b46e0d..1e824798fa66 100644
--- a/chart2/source/inc/servicenames_charttypes.hxx
+++ b/chart2/source/inc/servicenames_charttypes.hxx
@@ -42,7 +42,9 @@ namespace chart
#define CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ::rtl::OUString::createFromAscii("com.sun.star.chart2.ScatterChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_PIE ::rtl::OUString::createFromAscii("com.sun.star.chart2.PieChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.NetChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.FilledNetChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ::rtl::OUString::createFromAscii("com.sun.star.chart2.BubbleChartType")
//.............................................................................
} //namespace chart
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/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index 6365c08f4403..bb419a10f1ac 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -45,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>
@@ -127,10 +128,14 @@ enum TemplateId
TEMPLATE_PERCENTSTACKEDNET,
TEMPLATE_PERCENTSTACKEDNETSYMBOL,
TEMPLATE_PERCENTSTACKEDNETLINE,
+ TEMPLATE_FILLEDNET,
+ TEMPLATE_STACKEDFILLEDNET,
+ TEMPLATE_PERCENTSTACKEDFILLEDNET,
TEMPLATE_STOCKLOWHIGHCLOSE,
TEMPLATE_STOCKOPENLOWHIGHCLOSE,
TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
+ TEMPLATE_BUBBLE,
// TEMPLATE_SURFACE,
// TEMPLATE_ADDIN,
TEMPLATE_NOT_FOUND = 0xffff
@@ -198,10 +203,14 @@ const tTemplateMapType & lcl_DefaultChartTypeMap()
( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), TEMPLATE_PERCENTSTACKEDNET )
( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ), TEMPLATE_PERCENTSTACKEDNETSYMBOL )
( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), TEMPLATE_PERCENTSTACKEDNETLINE )
+ ( C2U( "com.sun.star.chart2.template.FilledNet" ), TEMPLATE_FILLEDNET )
+ ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), TEMPLATE_STACKEDFILLEDNET )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ), TEMPLATE_PERCENTSTACKEDFILLEDNET )
( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), TEMPLATE_STOCKLOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ), TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE )
+ ( C2U( "com.sun.star.chart2.template.Bubble" ), TEMPLATE_BUBBLE )
// ( C2U( "com.sun.star.chart2.template.Surface" ), TEMPLATE_SURFACE )
// ( C2U( "com.sun.star.chart2.template.Addin" ), TEMPLATE_ADDIN )
);
@@ -500,6 +509,18 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
StackMode_Y_STACKED_PERCENT, false, true ));
break;
+ case TEMPLATE_FILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_NONE, false, false, true ));
+ break;
+ case TEMPLATE_STACKEDFILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED, false, false, true ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDFILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, false, false, true ));
+ break;
case TEMPLATE_STOCKLOWHIGHCLOSE:
xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
@@ -518,6 +539,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 b5791baf6c0f..1996cc12830e 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -68,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,
@@ -347,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/FilledNetChartType.cxx b/chart2/source/model/template/FilledNetChartType.cxx
new file mode 100644
index 000000000000..ce96488270a4
--- /dev/null
+++ b/chart2/source/model/template/FilledNetChartType.cxx
@@ -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: FilledNetChartType.cxx,v $
+ * $Revision: 1.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_chart2.hxx"
+#include "FilledNetChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "Scaling.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace chart
+{
+
+FilledNetChartType::FilledNetChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ NetChartType_Base( xContext )
+{}
+
+FilledNetChartType::FilledNetChartType( const FilledNetChartType & rOther ) :
+ NetChartType_Base( rOther )
+{
+}
+
+FilledNetChartType::~FilledNetChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL FilledNetChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new FilledNetChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL FilledNetChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET;
+}
+
+uno::Sequence< ::rtl::OUString > FilledNetChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( FilledNetChartType,
+ C2U( "com.sun.star.comp.chart.FilledNetChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/FilledNetChartType.hxx b/chart2/source/model/template/FilledNetChartType.hxx
new file mode 100644
index 000000000000..3e694c12b0dd
--- /dev/null
+++ b/chart2/source/model/template/FilledNetChartType.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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: FilledNetChartType.hxx,v $
+ * $Revision: 1.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 CHART_FILLEDNETCHARTTYPE_HXX
+#define CHART_FILLEDNETCHARTTYPE_HXX
+
+#include "NetChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class FilledNetChartType : public NetChartType_Base
+{
+public:
+ FilledNetChartType( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~FilledNetChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( FilledNetChartType )
+
+protected:
+ explicit FilledNetChartType( const FilledNetChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_FILLEDNETCHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx
index 9de315679223..757d2dc07122 100644
--- a/chart2/source/model/template/NetChartType.cxx
+++ b/chart2/source/model/template/NetChartType.cxx
@@ -52,76 +52,24 @@ 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
{
-NetChartType::NetChartType(
+NetChartType_Base::NetChartType_Base(
const uno::Reference< uno::XComponentContext > & xContext ) :
ChartType( xContext )
{}
-NetChartType::NetChartType( const NetChartType & rOther ) :
+NetChartType_Base::NetChartType_Base( const NetChartType_Base & rOther ) :
ChartType( rOther )
{
}
-NetChartType::~NetChartType()
+NetChartType_Base::~NetChartType_Base()
{}
-// ____ XCloneable ____
-uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone()
- throw (uno::RuntimeException)
-{
- return uno::Reference< util::XCloneable >( new NetChartType( *this ));
-}
-
-// ____ XChartType ____
-::rtl::OUString SAL_CALL NetChartType::getChartType()
- throw (uno::RuntimeException)
-{
- return CHART2_SERVICE_NAME_CHARTTYPE_NET;
-}
-
Reference< XCoordinateSystem > SAL_CALL
- NetChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount )
throw (lang::IllegalArgumentException,
uno::RuntimeException)
{
@@ -157,42 +105,23 @@ Reference< XCoordinateSystem > SAL_CALL
}
// ____ OPropertySet ____
-uno::Any NetChartType::GetDefaultValue( sal_Int32 nHandle ) const
+uno::Any NetChartType_Base::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;
- // \--
+ return uno::Any();
}
// ____ OPropertySet ____
-::cppu::IPropertyArrayHelper & SAL_CALL NetChartType::getInfoHelper()
+::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
+ uno::Sequence< beans::Property > aProps;
+ static ::cppu::OPropertyArrayHelper aArrayHelper(aProps);
return aArrayHelper;
}
-
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL
- NetChartType::getPropertySetInfo()
+ NetChartType_Base::getPropertySetInfo()
throw (uno::RuntimeException)
{
static uno::Reference< beans::XPropertySetInfo > xInfo;
@@ -209,6 +138,35 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL
// \--
}
+//-----------------------------------------------------------------------------
+
+NetChartType::NetChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ NetChartType_Base( xContext )
+{}
+
+NetChartType::NetChartType( const NetChartType & rOther ) :
+ NetChartType_Base( rOther )
+{
+}
+
+NetChartType::~NetChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new NetChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL NetChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_NET;
+}
+
uno::Sequence< ::rtl::OUString > NetChartType::getSupportedServiceNames_Static()
{
uno::Sequence< ::rtl::OUString > aServices( 3 );
diff --git a/chart2/source/model/template/NetChartType.hxx b/chart2/source/model/template/NetChartType.hxx
index f38d110a60ba..97afeeaeea13 100644
--- a/chart2/source/model/template/NetChartType.hxx
+++ b/chart2/source/model/template/NetChartType.hxx
@@ -6,7 +6,7 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NetChartType.hxx,v $
+ * $RCSfile: NetChartType_Base.hxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
@@ -36,24 +36,17 @@
namespace chart
{
-class NetChartType : public ChartType
+class NetChartType_Base : public ChartType
{
public:
- NetChartType( ::com::sun::star::uno::Reference<
+ NetChartType_Base( ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > const & xContext );
- virtual ~NetChartType();
-
- APPHELPER_XSERVICEINFO_DECL()
-
- /// establish methods for factory instatiation
- APPHELPER_SERVICE_FACTORY_HELPER( NetChartType )
+ virtual ~NetChartType_Base();
protected:
- explicit NetChartType( const NetChartType & rOther );
+ explicit NetChartType_Base( const NetChartType_Base & rOther );
// ____ XChartType ____
- virtual ::rtl::OUString SAL_CALL getChartType()
- throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
createCoordinateSystem( ::sal_Int32 DimensionCount )
throw (::com::sun::star::lang::IllegalArgumentException,
@@ -63,13 +56,34 @@ protected:
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);
+};
+
+//-------------------------------------------------------------------------------------
+
+class NetChartType : public NetChartType_Base
+{
+public:
+ NetChartType( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~NetChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( NetChartType )
+
+protected:
+ explicit NetChartType( const NetChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
// ____ XCloneable ____
virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
index e348b32b7bc6..9b2c089b7298 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.cxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -64,11 +64,13 @@ NetChartTypeTemplate::NetChartTypeTemplate(
const ::rtl::OUString & rServiceName,
StackMode eStackMode,
bool bSymbols,
- bool bHasLines ) :
+ bool bHasLines ,
+ bool bHasFilledArea ) :
ChartTypeTemplate( xContext, rServiceName ),
m_eStackMode( eStackMode ),
m_bHasSymbols( bSymbols ),
- m_bHasLines( bHasLines )
+ m_bHasLines( bHasLines ),
+ m_bHasFilledArea( bHasFilledArea )
{}
NetChartTypeTemplate::~NetChartTypeTemplate()
@@ -110,11 +112,18 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
{
sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
- // check symbol-style
- // for a template with symbols it is ok, if there is at least one series
- // with symbols, otherwise an unknown template is too easy to achieve
+ uno::Reference< beans::XPropertySet > xChartTypeProp(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), uno::UNO_QUERY_THROW );
+
if( bResult )
{
+ //filled net chart?:
+ if( m_bHasFilledArea )
+ return sal_True;
+
+ // check symbol-style
+ // for a template with symbols it is ok, if there is at least one series
+ // with symbols, otherwise an unknown template is too easy to achieve
bool bSymbolFound = false;
bool bLineFound = false;
@@ -182,8 +191,13 @@ Reference< chart2::XChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_
{
Reference< lang::XMultiServiceFactory > xFact(
GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW );
+
+ if( m_bHasFilledArea )
+ xResult.set( xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ), uno::UNO_QUERY_THROW );
+ else
+ xResult.set( xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW );
}
catch( uno::Exception & ex )
{
diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx
index 0e963b8d4500..9c17e6639497 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.hxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.hxx
@@ -45,7 +45,8 @@ public:
const ::rtl::OUString & rServiceName,
StackMode eStackMode,
bool bSymbols,
- bool bHasLines = true
+ bool bHasLines = true,
+ bool bHasFilledArea = false
);
virtual ~NetChartTypeTemplate();
@@ -80,6 +81,7 @@ private:
StackMode m_eStackMode;
bool m_bHasSymbols;
bool m_bHasLines;
+ bool m_bHasFilledArea;
};
} // namespace chart
diff --git a/chart2/source/model/template/_serviceregistration_charttypes.cxx b/chart2/source/model/template/_serviceregistration_charttypes.cxx
index b059eb24957a..7b739ca73830 100644
--- a/chart2/source/model/template/_serviceregistration_charttypes.cxx
+++ b/chart2/source/model/template/_serviceregistration_charttypes.cxx
@@ -39,8 +39,10 @@
#include "ColumnChartType.hxx"
#include "LineChartType.hxx"
#include "NetChartType.hxx"
+#include "FilledNetChartType.hxx"
#include "PieChartType.hxx"
#include "ScatterChartType.hxx"
+#include "BubbleChartType.hxx"
namespace
{
@@ -95,6 +97,14 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_charttypes[] =
, 0
}
,{
+ ::chart::FilledNetChartType::create
+ , ::chart::FilledNetChartType::getImplementationName_Static
+ , ::chart::FilledNetChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
::chart::PieChartType::create
, ::chart::PieChartType::getImplementationName_Static
, ::chart::PieChartType::getSupportedServiceNames_Static
@@ -110,6 +120,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..63367014ed6b 100644
--- a/chart2/source/model/template/makefile.mk
+++ b/chart2/source/model/template/makefile.mk
@@ -63,6 +63,7 @@ SLOFILES= \
$(SLO)$/ColumnChartType.obj \
$(SLO)$/ColumnLineChartTypeTemplate.obj \
$(SLO)$/DataInterpreter.obj \
+ $(SLO)$/FilledNetChartType.obj \
$(SLO)$/LineChartType.obj \
$(SLO)$/LineChartTypeTemplate.obj \
$(SLO)$/NetChartType.obj \
@@ -71,6 +72,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/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index d7bb3a15bdf6..9e521fa76dae 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -106,8 +106,12 @@ sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference<
return sal_False;
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return sal_False;
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) //todo: BubbleChart support error bars and trend lines
+ return sal_False;
}
return sal_True;
}
@@ -195,6 +199,8 @@ sal_Bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChar
return sal_False;
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return sal_False;
}
return sal_True;
}
@@ -281,6 +287,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);
@@ -332,14 +339,21 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
}
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
{
- aRet.realloc(5);
+ aRet.realloc(6);
sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::TOP;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::LEFT;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER;
}
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ {
+ aRet.realloc(1);
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+ }
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
{
aRet.realloc( 1 );
@@ -396,6 +410,8 @@ bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2:
rtl::OUString aChartTypeName = xChartType->getChartType();
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return false;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return false;
}
if( nDimensionCount==3 )
return nDimensionIndex<2;
@@ -509,7 +525,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 +575,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();
@@ -574,7 +592,8 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
*pSeq++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE;
}
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ||
- aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET))
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
{
aRet.realloc( bStacked ? 2 : 3 );
sal_Int32* pSeq = aRet.getArray();
@@ -604,6 +623,65 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
return aRet;
}
+bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference< XChartType >& xChartType )
+{
+ if( xChartType.is() )
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) )
+ return false;
+ }
+ return true;
+}
+
+rtl::OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+{
+ rtl::OUString aRet( C2U( "values-y" ) );
+ if( !xChartType.is() )
+ return aRet;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ aRet = xChartType->getRoleOfSequenceForSeriesLabel();
+ return aRet;
+}
+
+rtl::OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+{
+ rtl::OUString aRet( C2U( "values-y" ) );
+ if( !xChartType.is() )
+ return aRet;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ aRet = xChartType->getRoleOfSequenceForSeriesLabel();
+ return aRet;
+}
+
+bool ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( const uno::Reference< XChartType >& xChartType )
+{
+ bool bRet = true;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ bRet = false;
+ return bRet;
+}
+
+bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const uno::Reference< XChartType >& xChartType )
+{
+ bool bRet = false;
+ if( !xChartType.is() )
+ return bRet;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) )
+ {
+ bRet = true;
+ }
+ return bRet;
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx
index 692f6ee54a1b..9452763153a5 100644
--- a/chart2/source/tools/CommonConverters.cxx
+++ b/chart2/source/tools/CommonConverters.cxx
@@ -223,6 +223,29 @@ drawing::Position3D getPointFromPoly( const drawing::PolyPolygonShape3D& rPolygo
return aRet;
}
+void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
+{
+ sal_Int32 nAddOuterCount = rAdd.SequenceX.getLength();
+ sal_Int32 nOuterCount = rRet.SequenceX.getLength() + nAddOuterCount;
+ rRet.SequenceX.realloc( nOuterCount );
+ rRet.SequenceY.realloc( nOuterCount );
+ rRet.SequenceZ.realloc( nOuterCount );
+
+ sal_Int32 nIndex = 0;
+ sal_Int32 nOuter = nOuterCount - nAddOuterCount;
+ for( ; nOuter < nOuterCount; nOuter++ )
+ {
+ if( nIndex >= nAddOuterCount )
+ break;
+
+ rRet.SequenceX[nOuter] = rAdd.SequenceX[nIndex];
+ rRet.SequenceY[nOuter] = rAdd.SequenceY[nIndex];
+ rRet.SequenceZ[nOuter] = rAdd.SequenceZ[nIndex];
+
+ nIndex++;
+ }
+}
+
void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
{
sal_Int32 nOuterCount = Max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() );
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 8af5b412c5c1..fbc8042af27b 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 )
{
@@ -1304,6 +1320,8 @@ bool DiagramHelper::isSupportingFloorAndWall( const Reference<
return false;
if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return false;
+ if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return false;
}
return true;
}
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
index 43006920951a..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
@@ -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/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
index 6e43ebc75b67..47cc6de405f7 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -112,7 +112,8 @@ VCoordinateSystem::~VCoordinateSystem()
void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget
, const Reference< drawing::XShapes >& xFinalTarget
- , const Reference< lang::XMultiServiceFactory >& xShapeFactory )
+ , const Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
throw (uno::RuntimeException)
{
DBG_ASSERT(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
@@ -125,12 +126,14 @@ void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing:
{
//create and add to target
m_xLogicTargetForGrids = aShapeFactory.createGroup2D( xLogicTarget );
+ xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup2D( xLogicTarget );
m_xLogicTargetForAxes = aShapeFactory.createGroup2D( xLogicTarget );
}
else
{
//create and added to target
m_xLogicTargetForGrids = aShapeFactory.createGroup3D( xLogicTarget );
+ xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup3D( xLogicTarget );
m_xLogicTargetForAxes = aShapeFactory.createGroup3D( xLogicTarget );
}
m_xFinalTarget = xFinalTarget;
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 1401ab43a159..406e5d119cd6 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -45,6 +45,7 @@
#include "LabelPositionHelper.hxx"
#include "Clipping.hxx"
#include "Stripe.hxx"
+#include "PolarLabelPositionHelper.hxx"
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
@@ -84,12 +85,12 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
, m_bArea(!bNoArea)
, m_bLine(bNoArea)
, m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) )
+ , m_bIsPolarCooSys( bConnectLastToFirstPoint )
, m_bConnectLastToFirstPoint( bConnectLastToFirstPoint )
, m_bAddOneToXMax(bAddOneToXMax)
, 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 +104,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 +232,12 @@ bool AreaChart::keepAspectRatio() const
void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
{
+ if( m_bArea && !m_bIsPolarCooSys && pSeries )
+ {
+ sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
+ if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
+ pSeries->setMissingValueTreatment( ::com::sun::star::chart::MissingValueTreatment::USE_ZERO );
+ }
if( m_nDimension == 3 && !m_bCategoryXAxis )
{
//3D xy always deep
@@ -351,9 +355,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() );
@@ -429,7 +434,12 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
//add second part to the polygon (grounding points or previous series points)
- if(!pPreviousSeriesPoly)
+ if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
+ {
+ if( pPreviousSeriesPoly )
+ addPolygon( aPoly, *pPreviousSeriesPoly );
+ }
+ else if(!pPreviousSeriesPoly)
{
double fMinX = pSeries->m_fLogicMinX;
double fMaxX = pSeries->m_fLogicMaxX;
@@ -573,13 +583,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 +679,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 +711,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 +730,24 @@ 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_bIsPolarCooSys && m_bArea &&
+ ( ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) ) )
+ {
+ if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
+ {
+ if( pSeriesList->size() == 1 || nSeriesIndex == 0 )
+ {
+ fLogicY = pPosHelper->getLogicMinY();
+ if( !pPosHelper->isMathematicalOrientationY() )
+ fLogicY = pPosHelper->getLogicMaxY();
+ }
+ else
+ fLogicY = 0.0;
+ }
+ }
if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
fLogicY = fabs( fLogicY );
@@ -762,7 +761,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;
@@ -821,8 +820,22 @@ void AreaChart::createShapes()
//store point information for series polygon
//for area and/or line (symbols only do not need this)
if( isValidPosition(aScaledLogicPosition) )
+ {
AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
+ //prepare clipping for filled net charts
+ if( !bIsVisible && m_bIsPolarCooSys && m_bArea )
+ {
+ drawing::Position3D aClippedPos(aScaledLogicPosition);
+ pPosHelper->clipScaledLogicValues( 0, &aClippedPos.PositionY, 0 );
+ if( pPosHelper->isLogicVisible( aClippedPos.PositionX, aClippedPos.PositionY, aClippedPos.PositionZ ) )
+ {
+ AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aClippedPos, (*aSeriesIter)->m_nPolygonIndex );
+ AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
+ }
+ }
+ }
+
//create a single datapoint if point is visible
//apply clipping:
if( !bIsVisible )
@@ -933,12 +946,29 @@ void AreaChart::createShapes()
break;
}
+ awt::Point aScreenPosition2D;//get the screen position for the labels
+ sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent
+ if( m_bIsPolarCooSys && nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE )
+ {
+ PolarPlottingPositionHelper* pPolarPosHelper = dynamic_cast<PolarPlottingPositionHelper*>(pPosHelper);
+ if( pPolarPosHelper )
+ {
+ PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
+ aScreenPosition2D = awt::Point( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
+ eAlignment, fLogicX, fLogicY, fLogicZ, nOffset ));
+ }
+ }
+ else
+ {
+ if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 )
+ nOffset = 0;
+ aScreenPosition2D = awt::Point( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ .transformSceneToScreenPosition( aScenePosition3D ) );
+ }
- awt::Point aScreenPosition2D( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
- .transformSceneToScreenPosition( aScenePosition3D ) );
this->createDataLabel( m_xTextTarget, **aSeriesIter, nIndex
, fLogicValueForLabeDisplay
- , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment );
+ , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset );
}
}
diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx
index 89790912893d..ec90e92ba1a4 100644
--- a/chart2/source/view/charttypes/AreaChart.hxx
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -104,28 +104,20 @@ private: //methods
, ::com::sun::star::drawing::PolyPolygonShape3D* pSeriesPoly
, PlottingPositionHelper* pPosHelper );
- void impl_maybeReplaceNanWithZero( double& rfValue );
-
private: //member
PlottingPositionHelper* m_pMainPosHelper;
bool m_bArea;//false -> line or symbol only
bool m_bLine;
bool m_bSymbol;
+ bool m_bIsPolarCooSys;//used e.g. for net chart (the data labels need to be placed different)
bool m_bConnectLastToFirstPoint;//used e.g. for net chart
bool m_bAddOneToXMax;//used e.g. for net chart (the angle axis needs a different autoscaling)
bool m_bExpandIfValuesCloseToBorder; // e.g. false for net charts
+
sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic
::com::sun::star::drawing::Direction3D m_aGivenAspectRatio; //only used if nKeepAspectRatio==1
- 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..6069189ff0ac
--- /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 = fabs(fSize);
+ if( fSize > fMaxSize )
+ fMaxSize = fSize;
+ }
+ }
+ }
+ }
+
+ m_fMaxLogicBubbleSize = fMaxSize;
+}
+
+void BubbleChart::calculateBubbleSizeScalingFactor()
+{
+ double fLogicZ=0.5;
+ drawing::Position3D aSceneMinPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMinX(),m_pMainPosHelper->getLogicMinY(),fLogicZ, false ) );
+ drawing::Position3D aSceneMaxPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMaxX(),m_pMainPosHelper->getLogicMaxY(),fLogicZ, false ) );
+
+ awt::Point aScreenMinPos( LabelPositionHelper(m_pMainPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMinPos ) );
+ awt::Point aScreenMaxPos( LabelPositionHelper(m_pMainPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMaxPos ) );
+
+ sal_Int32 nWidth = abs( aScreenMaxPos.X - aScreenMinPos.X );
+ sal_Int32 nHeight = abs( aScreenMaxPos.Y - aScreenMinPos.Y );
+
+ sal_Int32 nMinExtend = std::min( nWidth, nHeight );
+ m_fBubbleSizeFactorToScreen = nMinExtend * 0.25;//max bubble size is 25 percent of diagram size
+}
+
+drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize )
+{
+ drawing::Direction3D aRet(0,0,0);
+
+ if( ::rtl::math::isNan(fLogicSize) || ::rtl::math::isInf(fLogicSize) )
+ return aRet;
+
+ if( m_bShowNegativeValues )
+ fLogicSize = fabs(fLogicSize);
+
+ double fMaxSize = m_fMaxLogicBubbleSize;
+
+ double fMaxRadius = fMaxSize;
+ double fRaduis = fLogicSize;
+ if( m_bBubbleSizeAsArea )
+ {
+ fMaxRadius = sqrt( fMaxSize / F_PI );
+ fRaduis = sqrt( fLogicSize / F_PI );
+ }
+
+ aRet.DirectionX = m_fBubbleSizeScaling * m_fBubbleSizeFactorToScreen * fRaduis / fMaxRadius;
+ aRet.DirectionY = aRet.DirectionX;
+
+ return aRet;
+}
+
+bool BubbleChart::isExpandIfValuesCloseToBorder( sal_Int32 /*nDimensionIndex*/ )
+{
+ return true;
+}
+
+bool BubbleChart::isSeperateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ )
+{
+ return false;
+}
+
+//-----------------------------------------------------------------
+
+LegendSymbolStyle BubbleChart::getLegendSymbolStyle()
+{
+ return chart2::LegendSymbolStyle_CIRCLE;
+}
+
+drawing::Direction3D BubbleChart::getPreferredDiagramAspectRatio() const
+{
+ return drawing::Direction3D(-1,-1,-1);
+}
+
+void BubbleChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
+{
+ VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
+}
+
+//better performance for big data
+struct FormerPoint
+{
+ FormerPoint( double fX, double fY, double fZ )
+ : m_fX(fX), m_fY(fY), m_fZ(fZ)
+ {}
+ FormerPoint()
+ {
+ ::rtl::math::setNan( &m_fX );
+ ::rtl::math::setNan( &m_fY );
+ ::rtl::math::setNan( &m_fZ );
+ }
+
+ double m_fX;
+ double m_fY;
+ double m_fZ;
+};
+
+void BubbleChart::createShapes()
+{
+ if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ return;
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"BubbleChart is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return;
+
+ //therefore create an own group for the texts and the error bars to move them to front
+ //(because the text group is created after the series group the texts are displayed on top)
+ uno::Reference< drawing::XShapes > xSeriesTarget(
+ createGroupShape( m_xLogicTarget,rtl::OUString() ));
+ uno::Reference< drawing::XShapes > xTextTarget(
+ m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
+
+ //update/create information for current group
+ double fLogicZ = 0.5;//as defined
+
+ sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ if(nEndIndex<=0)
+ nEndIndex=1;
+
+ //better performance for big data
+ std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
+ m_bPointsWereSkipped = false;
+ sal_Int32 nSkippedPoints = 0;
+ sal_Int32 nCreatedPoints = 0;
+ //
+
+ calculateMaximumLogicBubbleSize();
+ calculateBubbleSizeScalingFactor();
+ if( m_fMaxLogicBubbleSize <= 0 || m_fBubbleSizeFactorToScreen <= 0 )
+ return;
+
+//=============================================================================
+ //iterate through all x values per indices
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+
+ aZSlotIter = m_aZSlots.begin();
+ for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ aXSlotIter = aZSlotIter->begin();
+ for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; aXSlotIter++, nX++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ //=============================================================================
+ //iterate through all series
+ for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; aSeriesIter++, nSeriesIndex++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(*aSeriesIter, xSeriesTarget);
+
+ sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
+ PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ if(m_nDimension==3)
+ fLogicZ = nZ+0.5;
+
+ //collect data point information (logic coordinates, style ):
+ double fLogicX = pSeries->getXValue(nIndex);
+ double fLogicY = pSeries->getYValue(nIndex);
+ double fBubbleSize = pSeries->getBubble_Size( nIndex );
+
+ if( !m_bShowNegativeValues && fBubbleSize<0.0 )
+ continue;
+
+ if( ::rtl::math::approxEqual( fBubbleSize, 0.0 ) || ::rtl::math::isNan(fBubbleSize) )
+ continue;
+
+ if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
+ || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) )
+ continue;
+
+ bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
+
+ drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
+ drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
+ pPosHelper->doLogicScaling( aScaledLogicPosition );
+
+ //transformation 3) -> 4)
+ drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
+
+ //better performance for big data
+ FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
+ pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
+ if( !pSeries->isAttributedDataPoint(nIndex)
+ &&
+ pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
+ , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
+ {
+ nSkippedPoints++;
+ m_bPointsWereSkipped = true;
+ continue;
+ }
+ aSeriesFormerPointMap[pSeries] = FormerPoint(aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ);
+
+ //create a single datapoint if point is visible
+ if( !bIsVisible )
+ continue;
+
+ //create a group shape for this point and add to the series shape:
+ rtl::OUString aPointCID = ObjectIdentifier::createPointCID(
+ pSeries->getPointCID_Stub(), nIndex );
+ uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
+ createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
+ uno::Reference<drawing::XShape> xPointGroupShape_Shape =
+ uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
+
+ {
+ nCreatedPoints++;
+
+ //create data point
+ drawing::Direction3D aSymbolSize = transformToScreenBubbleSize( fBubbleSize );
+ if(m_nDimension!=3)
+ {
+ uno::Reference<drawing::XShape> xShape;
+ xShape = m_pShapeFactory->createCircle2D( xPointGroupShape_Shapes
+ , aScenePosition, aSymbolSize );
+
+ this->setMappedProperties( xShape
+ , pSeries->getPropertiesOfPoint( nIndex )
+ , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+
+ //create data point label
+ if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
+ {
+ LabelAlignment eAlignment = LABEL_ALIGN_TOP;
+ drawing::Position3D aScenePosition3D( aScenePosition.PositionX
+ , aScenePosition.PositionY
+ , aScenePosition.PositionZ+this->getTransformedDepth() );
+
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
+
+ switch(nLabelPlacement)
+ {
+ case ::com::sun::star::chart::DataLabelPlacement::TOP:
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
+ aScenePosition3D.PositionY += (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_BOTTOM;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::LEFT:
+ aScenePosition3D.PositionX -= (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_LEFT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
+ aScenePosition3D.PositionX += (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_RIGHT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::CENTER:
+ eAlignment = LABEL_ALIGN_CENTER;
+ break;
+ default:
+ DBG_ERROR("this label alignment is not implemented yet");
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ }
+
+
+ awt::Point aScreenPosition2D( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ .transformSceneToScreenPosition( aScenePosition3D ) );
+ sal_Int32 nOffset = 0;
+ if(LABEL_ALIGN_CENTER!=eAlignment)
+ nOffset = 100;//add some spacing //@todo maybe get more intelligent values
+ this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
+ , fBubbleSize, fBubbleSize, aScreenPosition2D, eAlignment, nOffset );
+ }
+ }
+
+ //remove PointGroupShape if empty
+ if(!xPointGroupShape_Shapes->getCount())
+ xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
+
+ }//next series in x slot (next y slot)
+ }//next x slot
+ }//next z slot
+ }//next category
+//=============================================================================
+//=============================================================================
+//=============================================================================
+ OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< area chart :: createShapes():: skipped points: %d created points: %d", nSkippedPoints, nCreatedPoints );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/BubbleChart.hxx b/chart2/source/view/charttypes/BubbleChart.hxx
new file mode 100644
index 000000000000..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 71f753afa5c6..c8f473d226d0 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>
@@ -389,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 );
@@ -1409,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)
@@ -1441,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)
@@ -1725,6 +1726,11 @@ bool VSeriesPlotter::PointsWereSkipped() const
return m_bPointsWereSkipped;
}
+bool VSeriesPlotter::WantToPlotInFrontOfAxisLine()
+{
+ return ChartTypeHelper::isSeriesInFrontOfAxisLine( m_xChartTypeModel );
+}
+
Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries(
LegendExpansion eLegendExpansion
, const Reference< beans::XPropertySet >& xTextProperties
@@ -2063,10 +2069,14 @@ 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) )
pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) );
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,false,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) );
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
pRet = new CandleStickChart(xChartTypeModel,nDimensionCount);
else
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/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/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx
index f9a575be0123..111b1cb02f99 100644
--- a/chart2/source/view/inc/VCoordinateSystem.hxx
+++ b/chart2/source/view/inc/VCoordinateSystem.hxx
@@ -74,7 +74,9 @@ public:
, const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xFinalTarget
, const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
+ ::com::sun::star::lang::XMultiServiceFactory >& xFactory
+ , ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
throw (::com::sun::star::uno::RuntimeException);
void setParticle( const rtl::OUString& rCooSysParticle );
diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx
index 61c0a15bc402..9426c1e9256c 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -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;
@@ -207,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;
@@ -248,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 eeb561b13f02..e94ef6c68687 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -296,6 +296,8 @@ public:
virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize );
+ bool WantToPlotInFrontOfAxisLine();
+
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 63c5656a83e0..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;
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index fd08defe1869..dfd57f9bce92 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>
@@ -725,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 ) )
@@ -1375,12 +1377,13 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo
drawing::Direction3D aPreferredAspectRatio(
rSeriesPlotterContainer.getPreferredAspectRatio() );
- uno::Reference< drawing::XShapes > xCoordinateRegionTarget(0);
+ uno::Reference< drawing::XShapes > xSeriesTargetInFrontOfAxis(0);
+ uno::Reference< drawing::XShapes > xSeriesTargetBehindAxis(0);
VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount);
{//create diagram
aVDiagram.init(xDiagramPlusAxes_Shapes,xDiagramPlusAxes_Shapes,m_xShapeFactory);
aVDiagram.createShapes(rAvailablePos,rAvailableSize);
- xCoordinateRegionTarget = aVDiagram.getCoordinateRegion();
+ xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion();
aVDiagram.reduceToMimimumSize();
}
@@ -1392,7 +1395,7 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo
for( nC=0; nC < rVCooSysList.size(); nC++)
{
VCoordinateSystem* pVCooSys = rVCooSysList[nC];
- pVCooSys->initPlottingTargets(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory);
+ pVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis,xTextTargetShapes,m_xShapeFactory,xSeriesTargetBehindAxis);
pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) ));
@@ -1467,7 +1470,15 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo
//------------ set transformation to plotter / create series
VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
rtl::OUString aCID; //III
- pSeriesPlotter->initPlotter(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory,aCID);
+ uno::Reference< drawing::XShapes > xSeriesTarget(0);
+ if( pSeriesPlotter->WantToPlotInFrontOfAxisLine() )
+ xSeriesTarget = xSeriesTargetInFrontOfAxis;
+ else
+ {
+ xSeriesTarget = xSeriesTargetBehindAxis;
+ DBG_ASSERT( !lcl_resizeAfterCompleteCreation(xDiagram), "not implemented yet! - during a complete recreation this shape is destroyed so no series can be created anymore" );
+ }
+ pSeriesPlotter->initPlotter( xSeriesTarget,xTextTargetShapes,m_xShapeFactory,aCID );
pSeriesPlotter->setPageReferenceSize( rPageSize );
VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, pSeriesPlotter );
if(2==nDimensionCount)
@@ -1501,7 +1512,8 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo
}
//clear and recreate
- ShapeFactory::removeSubShapes( xCoordinateRegionTarget );
+ ShapeFactory::removeSubShapes( xSeriesTargetInFrontOfAxis ); //xSeriesTargetBehindAxis is a sub shape of xSeriesTargetInFrontOfAxis and will be removed here
+ xSeriesTargetBehindAxis.clear();
ShapeFactory::removeSubShapes( xTextTargetShapes );
//set new transformation
@@ -1742,7 +1754,7 @@ sal_Int32 lcl_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 )
@@ -1855,24 +1867,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() );
@@ -1886,7 +1910,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/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
index 2d58a25f3808..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;
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 f3e8f4a19739..abe8fad1a942 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -124,20 +124,35 @@ 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;
}
}
@@ -163,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)
@@ -193,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 );
@@ -218,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 );
@@ -230,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 )
{
@@ -242,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();
}
@@ -331,6 +352,7 @@ void VDataSeries::releaseShapes()
void VDataSeries::setCategoryXAxis()
{
m_aValues_X.clear();
+ m_bAllowPercentValueInDataLabel = true;
}
void VDataSeries::setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex )
@@ -445,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
@@ -484,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
{
@@ -504,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
@@ -545,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 );
@@ -572,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 );
@@ -612,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;
}
@@ -806,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 58229edf1217..8ab947b9cedc 100644
--- a/chart2/source/view/makefile.mk
+++ b/chart2/source/view/makefile.mk
@@ -82,7 +82,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \
$(SALLIB) \
$(SVLLIB) \
$(SVTOOLLIB) \
- $(SVXLIB) \
+ $(SVXCORELIB) \
$(TOOLSLIB) \
$(UNOTOOLSLIB) \
$(BASEGFXLIB) \
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 7ba5aa9c1f32..728f011c3cbc 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -276,7 +276,7 @@ public:
{}
/* Use the formula::FormulaGrammar::AddressConvention associated with rAddr::Tab() */
Details( const ScDocument* pDoc, const ScAddress & rAddr );
- void SetPos( const ScDocument* pDoc, const ScAddress & rAddr );
+//UNUSED2009-05 void SetPos( const ScDocument* pDoc, const ScAddress & rAddr );
};
SC_DLLPUBLIC static const Details detailsOOOa1;
@@ -791,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/attarray.hxx b/sc/inc/attarray.hxx
index 1f6c02c2d74f..5cbe1bafd290 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -110,8 +110,9 @@ public:
void SetTab(SCTAB nNewTab) { nTab = nNewTab; }
void SetCol(SCCOL nNewCol) { nCol = nNewCol; }
-
+#ifdef DBG_UTIL
void TestData() const;
+#endif
void Reset( const ScPatternAttr* pPattern, BOOL bAlloc = TRUE );
BOOL Concat(SCSIZE nPos);
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index cae72cf30cf5..8dd77cf68c3f 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -244,8 +244,8 @@ public:
const IntlWrapper* pIntl = 0 ) const;
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- BOOL GetTableList( List& aList ) const;
- void SetTableList( const List& aList );
+//UNUSED2009-05 BOOL GetTableList( List& aList ) const;
+//UNUSED2009-05 void SetTableList( const List& aList );
public:
USHORT nCount;
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 431284537a13..1e9a8618800e 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -59,9 +59,6 @@ class ScCodeArray;
class ScProgress;
class ScPostIt;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
-
// ============================================================================
/** Default cell clone flags: do not start listening, do not adjust 3D refs to
@@ -102,7 +99,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. */
@@ -196,10 +193,6 @@ public:
~ScNoteCell();
#endif
- ScNoteCell( SvStream& rStream, USHORT nVer );
-
- void Save( SvStream& rStream ) const;
-
private:
ScNoteCell( const ScNoteCell& );
};
@@ -387,6 +380,15 @@ 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;
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index e73869489ebc..2dd0bd6cc16e 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -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);
@@ -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
diff --git a/sc/inc/chartarr.hxx b/sc/inc/chartarr.hxx
index e2650c5652c1..b04c70eb01b3 100644
--- a/sc/inc/chartarr.hxx
+++ b/sc/inc/chartarr.hxx
@@ -40,7 +40,6 @@
class ScAddress;
class Table;
class ScDocument;
-class ScMultipleReadHeader;
// ScMemChart is a stripped-down SchMemChart from old chart,
diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx
index b3b6e8763eb1..cd0bd47f2a32 100644
--- a/sc/inc/chartpos.hxx
+++ b/sc/inc/chartpos.hxx
@@ -100,8 +100,8 @@ public:
return ppRowHeader[ nChartRow ];
return NULL;
}
- ScRangeListRef GetColRanges( SCCOL nChartCol ) const;
- ScRangeListRef GetRowRanges( SCROW nChartRow ) const;
+//UNUSED2009-05 ScRangeListRef GetColRanges( SCCOL nChartCol ) const;
+//UNUSED2009-05 ScRangeListRef GetRowRanges( SCROW nChartRow ) const;
};
@@ -114,7 +114,6 @@ enum ScChartGlue {
};
class ScDocument;
-class ScMultipleReadHeader;
class ScChartPositioner // nur noch Parameter-Struct
{
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 54a6570c0f1d..6707473f5610 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -89,8 +89,6 @@ enum ScChangeActionClipMode
};
class SvStream;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
// --- ScChangeActionLinkEntry ---------------------------------------------
@@ -278,28 +276,8 @@ protected:
const ScBigRange&,
const ULONG nAction);
- ScChangeAction( SvStream&,
- ScMultipleReadHeader&, ScChangeTrack* );
virtual ~ScChangeAction();
- static void StoreCell( ScBaseCell*, SvStream&,
- ScMultipleWriteHeader& );
- static ScBaseCell* LoadCell( SvStream&, ScMultipleReadHeader&,
- ScDocument*, USHORT nVer );
-
- static BOOL StoreLinkChain( ScChangeActionLinkEntry*,
- SvStream& );
- static BOOL LoadLinkChain( ScChangeAction*,
- ScChangeActionLinkEntry**,
- SvStream&, ScChangeTrack*,
- BOOL bLinkDeleted );
-
- static BOOL StoreCellList( ScChangeActionCellListEntry*,
- SvStream& );
- static BOOL LoadCellList( ScChangeAction* pOfAction,
- ScChangeActionCellListEntry*&, SvStream&,
- ScChangeTrack* );
-
String GetRefString( const ScBigRange&,
ScDocument*, BOOL bFlag3D = FALSE ) const;
@@ -367,10 +345,6 @@ protected:
// used in Reject() instead of IsRejectable()
BOOL IsInternalRejectable() const;
- virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const;
- virtual BOOL StoreLinks( SvStream& ) const;
- virtual BOOL LoadLinks( SvStream&, ScChangeTrack* );
-
// Derived classes that hold a pointer to the
// ChangeTrack must return that. Otherwise NULL.
virtual const ScChangeTrack* GetChangeTrack() const = 0;
@@ -491,8 +465,6 @@ class ScChangeActionIns : public ScChangeAction
friend class ScChangeTrack;
ScChangeActionIns( const ScRange& rRange );
- ScChangeActionIns( SvStream&,
- ScMultipleReadHeader&, ScChangeTrack* );
virtual ~ScChangeActionIns();
virtual void AddContent( ScChangeActionContent* ) {}
@@ -500,8 +472,6 @@ class ScChangeActionIns : public ScChangeAction
virtual BOOL Reject( ScDocument* );
- virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const;
-
virtual const ScChangeTrack* GetChangeTrack() const { return 0; }
public:
@@ -586,9 +556,6 @@ class ScChangeActionDel : public ScChangeAction
ScChangeActionDel( const ScRange& rRange,
SCsCOL nDx, SCsROW nDy, ScChangeTrack* );
- ScChangeActionDel( SvStream&,
- ScMultipleReadHeader&, ScDocument*,
- USHORT nVer, ScChangeTrack* );
virtual ~ScChangeActionDel();
ScChangeActionIns* GetCutOffInsert() { return pCutOff; }
@@ -607,9 +574,6 @@ class ScChangeActionDel : public ScChangeAction
virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; }
- virtual BOOL StoreLinks( SvStream& ) const;
- virtual BOOL LoadLinks( SvStream&, ScChangeTrack* );
-
public:
ScChangeActionDel(const ULONG nActionNumber,
const ScChangeActionState eState,
@@ -687,8 +651,6 @@ class ScChangeActionMove : public ScChangeAction
nStartLastCut(0),
nEndLastCut(0)
{}
- ScChangeActionMove( SvStream&,
- ScMultipleReadHeader&, ScChangeTrack* );
virtual ~ScChangeActionMove();
virtual void AddContent( ScChangeActionContent* );
@@ -709,10 +671,6 @@ class ScChangeActionMove : public ScChangeAction
virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; }
- virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const;
- virtual BOOL StoreLinks( SvStream& ) const;
- virtual BOOL LoadLinks( SvStream&, ScChangeTrack* );
-
protected:
using ScChangeAction::GetRefString;
@@ -765,10 +723,6 @@ class ScChangeActionContent : public ScChangeAction
ScChangeActionContent* pNextInSlot; // in gleichem Slot
ScChangeActionContent** ppPrevInSlot;
- ScChangeActionContent( SvStream&,
- ScMultipleReadHeader&, ScDocument*,
- USHORT nVer, ScChangeTrack* );
-
void InsertInSlot( ScChangeActionContent** pp )
{
if ( !ppPrevInSlot )
@@ -849,10 +803,6 @@ class ScChangeActionContent : public ScChangeAction
void PutValueToDoc( ScBaseCell*, const String&,
ScDocument*, SCsCOL nDx, SCsROW nDy ) const;
- virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const;
- virtual BOOL StoreLinks( SvStream& ) const;
- virtual BOOL LoadLinks( SvStream&, ScChangeTrack* );
-
protected:
using ScChangeAction::GetRefString;
@@ -983,8 +933,6 @@ class ScChangeActionReject : public ScChangeAction
SetRejectAction( nReject );
SetState( SC_CAS_ACCEPTED );
}
- ScChangeActionReject( SvStream&,
- ScMultipleReadHeader&, ScChangeTrack* );
virtual void AddContent( ScChangeActionContent* ) {}
virtual void DeleteCellEntries() {}
@@ -993,8 +941,6 @@ class ScChangeActionReject : public ScChangeAction
virtual const ScChangeTrack* GetChangeTrack() const { return 0; }
- virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const;
-
public:
ScChangeActionReject(const ULONG nActionNumber,
const ScChangeActionState eState,
@@ -1282,11 +1228,6 @@ public:
// alter Wert aus pOldCell, Format aus Doc
void AppendContent( const ScAddress& rPos,
const ScBaseCell* pOldCell );
- // nachdem neuer Wert im Dokument gesetzt wurde,
- // alter Wert aus pOldCell, Format aus RefDoc
- void AppendContent( const ScAddress& rPos,
- const ScBaseCell* pOldCell,
- ScDocument* pRefDoc );
// nachdem neue Werte im Dokument gesetzt wurden,
// alte Werte aus RefDoc/UndoDoc.
// Alle Contents, wo im RefDoc eine Zelle steht.
@@ -1313,9 +1254,6 @@ public:
// bevor neuer Wert im Dokument gesetzt wird
void AppendContent( const ScAddress& rPos,
- const String& rNewValue );
- // bevor neuer Wert im Dokument gesetzt wird
- void AppendContent( const ScAddress& rPos,
const String& rNewValue,
ScBaseCell* pOldCell );
diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx
index de6539b08311..8f6388a86040 100644
--- a/sc/inc/collect.hxx
+++ b/sc/inc/collect.hxx
@@ -143,9 +143,6 @@ public:
virtual ScDataObject* Clone() const;
StrData* operator[]( const USHORT nIndex) const {return (StrData*)At(nIndex);}
virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
-
- void Load( SvStream& );
- void Store( SvStream& ) const;
};
//------------------------------------------------------------------------
@@ -178,9 +175,6 @@ public:
private:
friend class TypedScStrCollection;
-#if OLD_PIVOT_IMPLEMENTATION
- friend class PivotScStrCollection;
-#endif
String aStrValue;
double nValue;
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index c66ecb960e7d..816a8ade4628 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -58,8 +58,6 @@ class ScBaseCell;
class ScDocument;
class ScFormulaCell;
class ScMarkData;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
class ScPatternAttr;
class ScStyleSheet;
class SvtBroadcaster;
@@ -146,8 +144,8 @@ public:
void SwapRow( SCROW nRow1, SCROW nRow2 );
void SwapCell( SCROW nRow, ScColumn& rCol);
- BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
- BOOL bLeft, BOOL bRight ) const;
+//UNUSED2009-05 BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
+//UNUSED2009-05 BOOL bLeft, BOOL bRight ) const;
BOOL HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const;
BOOL ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
@@ -164,7 +162,7 @@ public:
SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const;
BOOL HasDataAt(SCROW nRow) const;
BOOL HasVisibleDataAt(SCROW nRow) const;
- SCROW GetFirstDataPos() const;
+//UNUSED2009-05 SCROW GetFirstDataPos() const;
SCROW GetLastDataPos() const;
SCROW GetLastVisDataPos(BOOL bNotes) const; // ohne Broadcaster
SCROW GetFirstVisDataPos(BOOL bNotes) const;
@@ -258,7 +256,7 @@ public:
BOOL HasStringData( SCROW nRow ) const;
BOOL HasValueData( SCROW nRow ) const;
- USHORT GetErrorData( SCROW nRow) const;
+//UNUSED2009-05 USHORT GetErrorData( SCROW nRow) const;
BOOL HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
/** Returns the pointer to a cell note object at the passed row. */
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 1c27041599ad..76293479660c 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,6 +354,7 @@ 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
@@ -393,6 +396,8 @@ public:
maExternalLinks = rLinks;
}
+ void CreateStringFromXMLTokenArray( String& rFormula, String& rFormulaNmsp );
+
void SetExtendedErrorDetection( bool bVal ) { mbExtendedErrorDetection = bVal; }
BOOL IsCorrected() { return bCorrected; }
@@ -400,12 +405,13 @@ 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; }
- void MoveRelWrap();
- static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc,
- const ScAddress& rPos );
+ void MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow );
+ static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
+ SCCOL nMaxCol, SCROW nMaxRow );
BOOL UpdateNameReference( UpdateRefMode eUpdateRefMode,
const ScRange&,
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 42a030b8e809..141cb5706515 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -40,8 +40,6 @@
class ScBaseCell;
class ScFormulaCell;
class ScTokenArray;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
class ScRangeList;
@@ -84,7 +82,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 +102,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 +115,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 +180,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,
@@ -274,8 +283,6 @@ public:
ScConditionalFormat* GetFormat( sal_uInt32 nKey );
-//UNUSED2008-05 void ResetUsed();
-
void CompileAll();
void CompileXML();
void UpdateReference( UpdateRefMode eUpdateRefMode,
diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index 341300228869..c3d5db0bc72b 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -72,9 +72,6 @@ namespace com { namespace sun { namespace star { namespace sheet {
}}}}
class ScDocShell;
-#if OLD_PIVOT_IMPLEMENTATION
-class ScPivot;
-#endif
class ScDPSaveDimension;
class ScDPSaveGroupDimension;
class ScDPSaveNumGroupDimension;
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/dbcolect.hxx b/sc/inc/dbcolect.hxx
index 2056bcb331f1..3d9d357b512b 100644
--- a/sc/inc/dbcolect.hxx
+++ b/sc/inc/dbcolect.hxx
@@ -42,8 +42,6 @@
//------------------------------------------------------------------------
class ScDocument;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
//------------------------------------------------------------------------
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 246a60a4b9d9..69c3d6140431 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;
@@ -98,16 +99,13 @@ class ScFormulaCell;
class ScMarkData;
class ScOutlineTable;
class ScPatternAttr;
-#if OLD_PIVOT_IMPLEMENTATION
-class ScPivot;
-class ScPivotCollection;
-#endif
class ScPrintRangeSaver;
class ScRangeData;
class ScRangeName;
class ScStyleSheet;
class ScStyleSheetPool;
class ScTable;
+class ScTableProtection;
class ScTokenArray;
class ScValidationData;
class ScValidationDataList;
@@ -137,6 +135,7 @@ class ScTemporaryChartLock;
class ScLookupCache;
struct ScLookupCacheMapImpl;
class SfxUndoManager;
+class ScFormulaParserPool;
namespace com { namespace sun { namespace star {
namespace lang {
@@ -234,9 +233,6 @@ friend class ScHorizontalAttrIterator;
friend class ScDocAttrIterator;
friend class ScAttrRectIterator;
friend class ScDocShell;
-#if OLD_PIVOT_IMPLEMENTATION
-friend class ScPivot;
-#endif
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager;
@@ -258,9 +254,6 @@ private:
ScTable* pTab[MAXTABCOUNT];
ScRangeName* pRangeName;
ScDBCollection* pDBCollection;
-#if OLD_PIVOT_IMPLEMENTATION
- ScPivotCollection* pPivotCollection;
-#endif
ScDPCollection* pDPCollection;
ScChartCollection* pChartCollection;
std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock;
@@ -286,9 +279,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
ScRangePairListRef xColNameRanges;
ScRangePairListRef xRowNameRanges;
@@ -350,7 +348,6 @@ private:
ScLkUpdMode eLinkMode;
- BOOL bProtected;
BOOL bAutoCalc; // Automatisch Berechnen
BOOL bAutoCalcShellDisabled; // in/von/fuer ScDocShell disabled
// ob noch ForcedFormulas berechnet werden muessen,
@@ -490,11 +487,6 @@ public:
SC_DLLPUBLIC ScDPCollection* GetDPCollection();
ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const;
-#if OLD_PIVOT_IMPLEMENTATION
- ScPivotCollection* GetPivotCollection() const;
- void SetPivotCollection(ScPivotCollection* pNewPivotCollection);
- ScPivot* GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
-#endif
SC_DLLPUBLIC ScChartCollection* GetChartCollection() const;
void StopTemporaryChartLock();
@@ -530,13 +522,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);
@@ -578,6 +571,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;
@@ -591,7 +586,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;
@@ -615,6 +610,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();
@@ -710,8 +709,8 @@ public:
BOOL HasSubTotalCells( const ScRange& rRange );
SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, BOOL bForceTab = FALSE );
- SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell,
- ULONG nFormatIndex, BOOL bForceTab = FALSE);
+//UNUSED2009-05 SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell,
+//UNUSED2009-05 ULONG nFormatIndex, BOOL bForceTab = FALSE);
SC_DLLPUBLIC void PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
BOOL bForceTab = FALSE );
SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
@@ -772,6 +771,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,
@@ -1238,7 +1243,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,
@@ -1324,8 +1330,8 @@ public:
SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab );
/** Adds a new print ranges. */
SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew );
- /** Removes all old print ranges and sets the passed print ranges. */
- void SetPrintRange( SCTAB nTab, const ScRange& rNew );
+//UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
+//UNUSED2009-05 void SetPrintRange( SCTAB nTab, const ScRange& rNew );
/** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab );
SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew );
@@ -1475,7 +1481,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;
@@ -1661,7 +1668,7 @@ public:
SC_DLLPUBLIC SfxItemPool* GetEnginePool() const;
SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine();
SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine();
- SfxItemPool& GetNoteItemPool();
+//UNUSED2009-05 SfxItemPool& GetNoteItemPool();
ScRefreshTimerControl* GetRefreshTimerControl() const
{ return pRefreshTimerControl; }
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 3f960e446611..c4b6413c7d58 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -125,9 +125,8 @@ public:
ScDocument* GetDocument() const;
SfxObjectShell* GetEmbeddedObject() const;
- void UpdateAllRowHeights();
+ void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL );
- ScDrawLayer* MakeDrawLayer();
void BeforeXMLLoading();
void AfterXMLLoading(sal_Bool bRet);
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 93cd12c4c937..2115eab7cc42 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -176,11 +176,6 @@ public:
const String* getFieldName(sal_Int32 nIndex) const;
- /** Get the field index (i.e. column ID in the original data source) based
- on the string value that corresponds with the column title. It returns
- -1 if no field matching the string value exists. */
- sal_Int32 getFieldIndex(const String& rStr) const;
-
/** Get the unique entries for a field specified by index. The caller must
make sure that the table is filled before calling function, or it will
get an empty collection. */
@@ -194,7 +189,6 @@ public:
const ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims);
void clear();
- void swap(ScDPCacheTable& rOther);
bool empty() const;
private:
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index cffe735f287a..2dc8829485c8 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -55,8 +55,6 @@ class Rectangle;
class SvStream;
class ScDPSaveData;
class ScDPOutput;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
class ScPivot;
class ScPivotCollection;
struct ScPivotParam;
@@ -281,9 +279,7 @@ public:
virtual ScDataObject* Clone() const;
ScDPObject* operator[](USHORT nIndex) const {return (ScDPObject*)At(nIndex);}
-#if OLD_PIVOT_IMPLEMENTATION
- void ConvertOldTables( ScPivotCollection& rOldColl );
-#endif
+
void DeleteOnTab( SCTAB nTab );
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index 44689bcf0772..d3d8d4354145 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -128,7 +128,6 @@ public:
void SetName( const String& rNew ); // used if the source dim was renamed (groups)
SC_DLLPUBLIC void SetOrientation(USHORT nNew);
- void SetSubTotals(BOOL bSet); // to be removed!
SC_DLLPUBLIC void SetSubTotals(long nCount, const USHORT* pFuncs);
long GetSubTotalsCount() const { return nSubTotalCount; }
USHORT GetSubTotalFunc(long nIndex) const { return pSubTotalFuncs[nIndex]; }
diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx
index 59996d08b8aa..3b1d8e0e206e 100644
--- a/sc/inc/dptabsrc.hxx
+++ b/sc/inc/dptabsrc.hxx
@@ -185,7 +185,7 @@ public:
ScDPDimensions* GetDimensionsObject();
- void DumpState( ScDocument* pDoc, const ScAddress& rPos );
+//UNUSED2009-05 void DumpState( ScDocument* pDoc, const ScAddress& rPos );
// XDimensionsSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
@@ -428,7 +428,7 @@ public:
const ::com::sun::star::sheet::DataPilotFieldReference& GetReferenceValue() const;
- BOOL IsValidPage( const ScDPItemData& rData );
+//UNUSED2009-05 BOOL IsValidPage( const ScDPItemData& rData );
};
class ScDPHierarchies : public cppu::WeakImplHelper2<
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/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 07c8a6a6697f..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;
@@ -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/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/global.hxx b/sc/inc/global.hxx
index 76f5fd665033..7bdff1d0592e 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -86,13 +86,6 @@ extern "C" {
#define SC_TRANSLITERATION_CASESENSE 0
#endif
-// Remove the old pivot table implementation that the current data pilot
-// implementation has effectively replaced. The old pivot code was still
-// around to handle loading of the old binary format. Now that the old
-// binary filter is handled by binfilter, we can safely remove the old pivot
-// handling code.
-#define OLD_PIVOT_IMPLEMENTATION 0
-
//------------------------------------------------------------------------
struct LabelData;
//------------------------------------------------------------------------
@@ -467,7 +460,7 @@ struct ScImportParam
ScImportParam& operator= ( const ScImportParam& r );
BOOL operator== ( const ScImportParam& r ) const;
- void Clear ();
+//UNUSED2009-05 void Clear ();
};
struct ScStringHashCode
@@ -728,7 +721,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/markarr.hxx b/sc/inc/markarr.hxx
index 83a218887508..84d7a9d88a1a 100644
--- a/sc/inc/markarr.hxx
+++ b/sc/inc/markarr.hxx
@@ -65,7 +65,7 @@ public:
void CopyMarksTo( ScMarkArray& rDestMarkArray ) const;
BOOL Search( SCROW nRow, SCSIZE& nIndex ) const;
- void DeleteArea(SCROW nStartRow, SCROW nEndRow);
+//UNUSED2009-05 void DeleteArea(SCROW nStartRow, SCROW nEndRow);
/// Including current row, may return -1 if bUp and not found
SCsROW GetNextMarked( SCsROW nRow, BOOL bUp ) const;
diff --git a/sc/inc/olinetab.hxx b/sc/inc/olinetab.hxx
index 59846d7717a0..4d42accdf729 100644
--- a/sc/inc/olinetab.hxx
+++ b/sc/inc/olinetab.hxx
@@ -39,8 +39,6 @@
#define SC_OL_MAXDEPTH 7
class SvStream;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
class ScOutlineEntry : public ScDataObject
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/pivot.hxx b/sc/inc/pivot.hxx
index 66e87facfd9a..e77dd60f18bb 100644
--- a/sc/inc/pivot.hxx
+++ b/sc/inc/pivot.hxx
@@ -65,20 +65,9 @@ class SubTotal;
#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
-#if OLD_PIVOT_IMPLEMENTATION
-#define PIVOT_STYLE_INNER 0
-#define PIVOT_STYLE_RESULT 1
-#define PIVOT_STYLE_CATEGORY 2
-#define PIVOT_STYLE_TITLE 3
-#define PIVOT_STYLE_FIELDNAME 4
-#define PIVOT_STYLE_TOP 5
-#endif
-
class SvStream;
class ScDocument;
class ScUserListData;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
class ScProgress;
struct LabelData;
@@ -125,7 +114,7 @@ struct ScPivotParam
ScPivotParam& operator= ( const ScPivotParam& r );
BOOL operator== ( const ScPivotParam& r ) const;
- void Clear ();
+//UNUSED2009-05 void Clear ();
void ClearLabelData ();
void ClearPivotArrays();
void SetLabelData ( LabelData** ppLabArr,
@@ -142,228 +131,9 @@ struct ScPivotParam
// -----------------------------------------------------------------------
-#if OLD_PIVOT_IMPLEMENTATION
-struct PivotColRef
-{
- SCSIZE nDataIndex;
- SCSIZE nRecCount;
- USHORT nFuncMask;
- SCSIZE nIndex;
-
- PivotColRef()
- {
- nDataIndex = nRecCount = nIndex = 0;
- nFuncMask = PIVOT_FUNC_NONE;
- }
-};
-#endif
-
typedef PivotField PivotFieldArr[PIVOT_MAXFIELD];
typedef PivotField PivotPageFieldArr[PIVOT_MAXPAGEFIELD];
-#if OLD_PIVOT_IMPLEMENTATION
-class PivotScStrCollection : public ScStrCollection
-{
- ScUserListData* pUserData;
-public:
- PivotScStrCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE) :
- ScStrCollection ( nLim, nDel, bDup ),
- pUserData (NULL) { }
- PivotScStrCollection(const PivotScStrCollection& rPivotScStrCollection) :
- ScStrCollection ( rPivotScStrCollection ),
- pUserData ( rPivotScStrCollection.pUserData) {}
-
- virtual ScDataObject* Clone() const;
- virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
-
- TypedStrData* operator[]( const USHORT nIndex) const
- { return (TypedStrData*)At(nIndex); }
- void SetUserData(ScUserListData* pData)
- { pUserData = pData; }
- const String& GetString(USHORT nIndex)
- { return ((TypedStrData*)At(nIndex))->GetString(); }
- USHORT GetIndex(TypedStrData* pData) const;
-};
-
-class ScPivot : public ScDataObject
-{
- ScDocument* pDoc;
- ScQueryParam aQuery;
- BOOL bHasHeader;
-
- BOOL bIgnoreEmpty; // Flags aus Dialog
- BOOL bDetectCat;
- BOOL bMakeTotalCol;
- BOOL bMakeTotalRow;
-
- String aName;
- String aTag;
- SCSIZE nColNameCount;
- String* pColNames; // Array
-
- SCCOL nSrcCol1;
- SCROW nSrcRow1;
- SCCOL nSrcCol2;
- SCROW nSrcRow2;
- SCTAB nSrcTab;
-
- SCCOL nDestCol1;
- SCROW nDestRow1;
- SCCOL nDestCol2;
- SCROW nDestRow2;
- SCTAB nDestTab;
-
- SCCOL nDataStartCol;
- SCROW nDataStartRow;
-
- SCSIZE nColCount;
- SCSIZE nRowCount;
- SCSIZE nDataCount;
-
- PivotFieldArr aColArr;
- PivotFieldArr aRowArr;
- PivotFieldArr aDataArr;
-
- PivotScStrCollection* pColList[PIVOT_MAXFIELD]; // pro Zeile alle Eintraege
- PivotScStrCollection* pRowList[PIVOT_MAXFIELD];
- PivotScStrCollection* pDataList; // Shortcut auf Col/RowList mit Daten
-
- SubTotal** ppDataArr;
- SCSIZE nDataColCount;
- SCSIZE nDataRowCount;
- SCSIZE nRowIndex;
- SCSIZE nColIndex;
- SCSIZE nDataIndex;
- SCSIZE nRecCount;
-
- PivotColRef* pColRef;
-
- BOOL bValidArea;
- BOOL bDataAtCol;
-
-public:
- ScPivot(ScDocument* pDocument);
- ScPivot(const ScPivot& rPivot);
- ~ScPivot();
-
- virtual ScDataObject* Clone() const;
-
- ScPivot* CreateNew() const;
-
- BOOL Load(SvStream& rStream, ScMultipleReadHeader& rHdr );
- BOOL Store(SvStream& rStream, ScMultipleWriteHeader& rHdr ) const;
-
- void SetQuery(const ScQueryParam& rQuery);
- void GetQuery(ScQueryParam& rQuery) const;
-
- void SetHeader(BOOL bHeader);
- BOOL GetHeader() const;
- void SetIgnoreEmpty(BOOL bIgnore);
- BOOL GetIgnoreEmpty() const;
- void SetDetectCat(BOOL bDetect);
- BOOL GetDetectCat() const;
- void SetMakeTotalCol(BOOL bSet);
- BOOL GetMakeTotalCol() const;
- void SetMakeTotalRow(BOOL bSet);
- BOOL GetMakeTotalRow() const;
-
- void SetName(const String& rNew);
- const String& GetName() const;
- void SetTag(const String& rNew);
- const String& GetTag() const;
-
- void SetSrcArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab);
- void GetSrcArea(SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2, SCTAB& rTab) const;
- ScRange GetSrcArea() const;
-
- void SetDestPos(SCCOL nCol, SCROW nRow, SCTAB nTab);
- void GetDestArea(SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2, SCTAB& rTab) const;
- ScRange GetDestArea() const;
-
- void SetColFields(const PivotField* pFieldArr, SCSIZE nCount);
- void GetColFields(PivotField* pFieldArr, SCSIZE& rCount) const;
- SCSIZE GetColFieldCount() const { return nColCount; }
-
- void SetRowFields(const PivotField* pFieldArr, SCSIZE nCount);
- void GetRowFields(PivotField* pFieldArr, SCSIZE& rCount) const;
- SCSIZE GetRowFieldCount() const { return nRowCount; }
-
- void SetDataFields(const PivotField* pFieldArr, SCSIZE nCount);
- void GetDataFields(PivotField* pFieldArr, SCSIZE& rCount) const;
-
- void GetParam( ScPivotParam& rParam, ScQueryParam& rQuery, ScArea& rSrcArea ) const;
- void SetParam( const ScPivotParam& rParam, const ScQueryParam& rQuery,
- const ScArea& rSrcArea );
-
- BOOL CreateData(BOOL bKeepDest = FALSE);
- void DrawData();
- void ReleaseData();
-
- BOOL IsPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
- BOOL IsFilterAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
- BOOL GetColFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const;
- BOOL GetRowFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const;
-
- // Referenz-Anpassung:
-
- void MoveSrcArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab );
- void MoveDestArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab );
- void ExtendSrcArea( SCCOL nNewEndCol, SCROW nNewEndRow );
-
-private:
- BOOL CreateFields();
- void CreateFieldData();
- void CalcArea();
-
- void SetDataLine(SCCOL nCol, SCROW nRow, SCTAB nTab, SCSIZE nRIndex);
- void SetFuncLine(SCCOL nCol, SCROW nRow, SCTAB nTab, USHORT nFunc, SCSIZE nIndex, SCSIZE nStartRIndex, SCSIZE nEndRIndex);
- void ColToTable(SCSIZE nField, SCROW& nRow, ScProgress& rProgress);
- void RowToTable(SCSIZE nField, SCCOL& nCol);
- void SetFrame(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nWidth = 20);
- void SetFrameHor(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
- void SetFrameVer(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
- void SetFontBold(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
- void SetJustifyLeft(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
- void SetJustifyRight(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
- void SetStyle(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nId);
- void SetButton(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
- void SetValue(SCCOL nCol, SCROW nRow, const SubTotal& rTotal, USHORT nFunc);
- SCROW GetCategoryRow( SCCOL nCol, SCROW nRow );
-};
-
-//------------------------------------------------------------------------
-class ScPivotCollection : public ScCollection
-{
-
-private:
- ScDocument* pDoc;
-public:
- ScPivotCollection(USHORT nLim = 4, USHORT nDel = 4, ScDocument* pDocument = NULL) :
- ScCollection ( nLim, nDel),
- pDoc ( pDocument ) {}
- ScPivotCollection(const ScPivotCollection& rScPivotCollection) :
- ScCollection ( rScPivotCollection ),
- pDoc ( rScPivotCollection.pDoc ) {}
-
- virtual ScDataObject* Clone() const;
- ScPivot* operator[]( const USHORT nIndex) const {return (ScPivot*)At(nIndex);}
- ScPivot* GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
-
- BOOL Load( SvStream& rStream );
- BOOL Store( SvStream& rStream ) const;
-
- void UpdateReference(UpdateRefMode eUpdateRefMode,
- SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
- SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
- void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
-
- BOOL operator==(const ScPivotCollection& rCmp) const;
-
- String CreateNewName( USHORT nMin = 1 ) const;
-};
-#endif
-
//------------------------------------------------------------------------
struct LabelData
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/rangenam.hxx b/sc/inc/rangenam.hxx
index 962aff918e7b..2c6f706ff403 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -40,8 +40,6 @@
//------------------------------------------------------------------------
class ScDocument;
-class ScMultipleReadHeader;
-class ScMultipleWriteHeader;
namespace rtl {
class OUStringBuffer;
@@ -81,6 +79,11 @@ private:
USHORT nIndex;
BOOL bModified; // wird bei UpdateReference gesetzt/geloescht
+ // max row and column to use for wrapping of references. If -1 use the
+ // application's default.
+ SCROW mnMaxRow;
+ SCCOL mnMaxCol;
+
friend class ScRangeName;
ScRangeData( USHORT nIndex );
public:
@@ -141,7 +144,7 @@ public:
BOOL IsReference( ScRange& rRef, const ScAddress& rPos ) const;
BOOL IsValidReference( ScRange& rRef ) const;
- BOOL IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const;
+//UNUSED2009-05 BOOL IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const;
BOOL IsRangeAtBlock( const ScRange& ) const;
void UpdateTabRef(SCTAB nOldTable, USHORT nFlag, SCTAB nNewTable);
@@ -153,6 +156,11 @@ public:
static void MakeValidName( String& rName );
SC_DLLPUBLIC static BOOL IsNameValid( const String& rName, ScDocument* pDoc );
+
+ SC_DLLPUBLIC void SetMaxRow(SCROW nRow);
+ SCROW GetMaxRow() const;
+ SC_DLLPUBLIC void SetMaxCol(SCCOL nCol);
+ SCCOL GetMaxCol() const;
};
inline BOOL ScRangeData::HasType( RangeType nType ) const
@@ -193,7 +201,7 @@ public:
virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
virtual BOOL IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const;
- ScRangeData* GetRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const;
+//UNUSED2009-05 ScRangeData* GetRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const;
SC_DLLPUBLIC ScRangeData* GetRangeAtBlock( const ScRange& ) const;
SC_DLLPUBLIC BOOL SearchName( const String& rName, USHORT& rPos ) const;
diff --git a/sc/inc/rechead.hxx b/sc/inc/rechead.hxx
index 14be3ddcb325..a9e8a5cacd53 100644
--- a/sc/inc/rechead.hxx
+++ b/sc/inc/rechead.hxx
@@ -130,33 +130,6 @@ class SvStream;
// -----------------------------------------------------------------------
-// "Automatischer" Record-Header mit Groessenangabe
-
-class ScReadHeader
-{
-private:
- SvStream& rStream;
- ULONG nDataEnd;
-
-public:
- ScReadHeader(SvStream& rNewStream);
- ~ScReadHeader();
-
- ULONG BytesLeft() const;
-};
-
-class ScWriteHeader
-{
-private:
- SvStream& rStream;
- ULONG nDataPos;
- sal_uInt32 nDataSize;
-
-public:
- ScWriteHeader(SvStream& rNewStream, sal_uInt32 nDefault = 0);
- ~ScWriteHeader();
-};
-
// Header mit Groessenangaben fuer mehrere Objekte
class ScMultipleReadHeader
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 35b6a403816d..8fb6b929337b 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1630,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 4b3f763b4e8c..fdf05430cc69 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/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 140d3dfe4c4a..7f3b5443d9d9 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -401,11 +401,11 @@ public:
void MatTrans( ScMatrix& mRes) const;
void MatCopy ( ScMatrix& mRes) const;
- /** Copy upper left of this matrix to mRes matrix.
- This matrix's dimensions must be greater or equal to the mRes matrix
- dimensions.
- */
- void MatCopyUpperLeft( ScMatrix& mRes) const;
+//UNUSED2009-05 /** Copy upper left of this matrix to mRes matrix.
+//UNUSED2009-05 This matrix's dimensions must be greater or equal to the mRes matrix
+//UNUSED2009-05 dimensions.
+//UNUSED2009-05 */
+//UNUSED2009-05 void MatCopyUpperLeft( ScMatrix& mRes) const;
// Convert ScInterpreter::CompareMat values (-1,0,1) to boolean values
void CompareEqual();
diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx
index 86db2815a0d8..1028bb5f7673 100644
--- a/sc/inc/stlpool.hxx
+++ b/sc/inc/stlpool.hxx
@@ -63,7 +63,7 @@ public:
ScStyleSheet* FindCaseIns( const String& rName, SfxStyleFamily eFam );
- void SetForceStdName( const String* pSet );
+//UNUSED2009-05 void SetForceStdName( const String* pSet );
const String* GetForceStdName() const { return pForceStdName; }
virtual SfxStyleSheetBase& Make( const String&, SfxStyleFamily eFam,
diff --git a/sc/inc/subtotal.hxx b/sc/inc/subtotal.hxx
index adc604151f35..92e03e140288 100644
--- a/sc/inc/subtotal.hxx
+++ b/sc/inc/subtotal.hxx
@@ -35,35 +35,6 @@
class SubTotal
{
-#if OLD_PIVOT_IMPLEMENTATION
-private:
- long nCount;
- long nCount2;
- double nSum;
- double nSumSqr;
- double nMax;
- double nMin;
- double nProduct;
- BOOL bSumOk;
- BOOL bSumSqrOk;
- BOOL bProductOk;
- USHORT nProgress;
-
-public:
- SCSIZE nIndex; // Test
-
-public:
- SubTotal();
- ~SubTotal();
-
- void UpdateNoVal();
- void Update( double nVal );
- void Update( const SubTotal& rVal );
-
- short Valid( USHORT nFunction ) const;
- // return 0 => Fehler, -1 => kein Wert, 1 => ok
- double Result( USHORT nFunction ) const;
-#endif
public:
static BOOL SafePlus( double& fVal1, double fVal2);
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index e738ff5fbdb8..bacd4d207cca 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];
@@ -102,8 +111,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;
@@ -119,6 +127,7 @@ private:
// interne Verwaltung ------------------
BOOL bVisible;
+ BOOL bPendingRowHeights;
SCTAB nTab;
USHORT nRecalcLvl; // Rekursionslevel Size-Recalc
@@ -128,6 +137,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;
@@ -182,6 +193,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 );
@@ -218,10 +232,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 );
@@ -243,7 +256,7 @@ public:
BOOL IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const;
void PutCell( const ScAddress&, ScBaseCell* pCell );
- void PutCell( const ScAddress&, ULONG nFormatIndex, ScBaseCell* pCell);
+//UNUSED2009-05 void PutCell( const ScAddress&, ULONG nFormatIndex, ScBaseCell* pCell);
void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
void PutCell(SCCOL nCol, SCROW nRow, ULONG nFormatIndex, ScBaseCell* pCell);
// TRUE = Zahlformat gesetzt
@@ -254,16 +267,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;
@@ -276,6 +301,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 );
@@ -362,7 +390,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 );
@@ -427,7 +459,7 @@ public:
const SvxBorderLine** ppLeft, const SvxBorderLine** ppTop,
const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
- BOOL HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
+//UNUSED2009-05 BOOL HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const;
BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const;
BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
@@ -438,7 +470,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;
@@ -457,7 +493,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 );
@@ -503,8 +542,8 @@ public:
void ClearPrintRanges();
/** Adds a new print ranges. */
void AddPrintRange( const ScRange& rNew );
- /** Removes all old print ranges and sets the passed print ranges. */
- void SetPrintRange( const ScRange& rNew );
+//UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
+//UNUSED2009-05 void SetPrintRange( const ScRange& rNew );
/** Marks the specified sheet to be printed completely. Deletes old print ranges! */
void SetPrintEntireSheet();
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 367e7d7cfe35..010e420feb42 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -318,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
@@ -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"
diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index d3588c366a7c..e41d81990378 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 );
@@ -198,8 +200,6 @@ public:
ScValidationData* GetData( sal_uInt32 nKey );
- void ResetUsed();
-
void CompileXML();
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index fc33c75306cc..c00cc111a7cd 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -103,10 +103,10 @@ ScAttrArray::~ScAttrArray()
}
//------------------------------------------------------------------------
-
+#ifdef DBG_UTIL
void ScAttrArray::TestData() const
{
-#ifdef DBG_UTIL
+
USHORT nErr = 0;
if (pData)
{
@@ -129,8 +129,8 @@ void ScAttrArray::TestData() const
aMsg += ByteString::CreateFromInt32(nCol);
DBG_ERROR( aMsg.GetBuffer() );
}
-#endif
}
+#endif
//------------------------------------------------------------------------
@@ -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/attrib.cxx b/sc/source/core/data/attrib.cxx
index a5f38c813d8c..dcc6418445fa 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -636,32 +636,32 @@ SfxItemPresentation ScTableListItem::GetPresentation
// -----------------------------------------------------------------------
-BOOL ScTableListItem::GetTableList( List& aList ) const
-{
- for ( USHORT i=0; i<nCount; i++ )
- aList.Insert( new SCTAB( pTabArr[i] ) );
-
- return ( nCount > 0 );
-}
+//UNUSED2009-05 BOOL ScTableListItem::GetTableList( List& aList ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 for ( USHORT i=0; i<nCount; i++ )
+//UNUSED2009-05 aList.Insert( new SCTAB( pTabArr[i] ) );
+//UNUSED2009-05
+//UNUSED2009-05 return ( nCount > 0 );
+//UNUSED2009-05 }
// -----------------------------------------------------------------------
-void ScTableListItem::SetTableList( const List& rList )
-{
- nCount = (USHORT)rList.Count();
-
- delete [] pTabArr;
-
- if ( nCount > 0 )
- {
- pTabArr = new SCTAB [nCount];
-
- for ( USHORT i=0; i<nCount; i++ )
- pTabArr[i] = *( (SCTAB*)rList.GetObject( i ) );
- }
- else
- pTabArr = NULL;
-}
+//UNUSED2009-05 void ScTableListItem::SetTableList( const List& rList )
+//UNUSED2009-05 {
+//UNUSED2009-05 nCount = (USHORT)rList.Count();
+//UNUSED2009-05
+//UNUSED2009-05 delete [] pTabArr;
+//UNUSED2009-05
+//UNUSED2009-05 if ( nCount > 0 )
+//UNUSED2009-05 {
+//UNUSED2009-05 pTabArr = new SCTAB [nCount];
+//UNUSED2009-05
+//UNUSED2009-05 for ( USHORT i=0; i<nCount; i++ )
+//UNUSED2009-05 pTabArr[i] = *( (SCTAB*)rList.GetObject( i ) );
+//UNUSED2009-05 }
+//UNUSED2009-05 else
+//UNUSED2009-05 pTabArr = NULL;
+//UNUSED2009-05 }
// -----------------------------------------------------------------------
@@ -934,63 +934,63 @@ SfxPoolItem* ScPageHFItem::Create( SvStream& rStream, USHORT nVer ) const
//------------------------------------------------------------------------
-class ScFieldChangerEditEngine : public ScEditEngineDefaulter
-{
- TypeId aExtFileId;
- USHORT nConvPara;
- xub_StrLen nConvPos;
- BOOL bConvert;
-
-public:
- ScFieldChangerEditEngine( SfxItemPool* pEnginePool, BOOL bDeleteEnginePool );
- virtual ~ScFieldChangerEditEngine() {}
-
- virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara,
- USHORT nPos, Color*& rTxtColor,
- Color*& rFldColor );
-
-//UNUSED2008-05 BOOL ConvertFields();
-};
-
-ScFieldChangerEditEngine::ScFieldChangerEditEngine( SfxItemPool* pEnginePoolP,
- BOOL bDeleteEnginePoolP ) :
- ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ),
- aExtFileId( TYPE( SvxExtFileField ) ),
- nConvPara( 0 ),
- nConvPos( 0 ),
- bConvert( FALSE )
-{
-}
-
-String ScFieldChangerEditEngine::CalcFieldValue( const SvxFieldItem& rField,
- USHORT nPara, USHORT nPos, Color*& /* rTxtColor */, Color*& /* rFldColor */ )
-{
- const SvxFieldData* pFieldData = rField.GetField();
- if ( pFieldData && pFieldData->Type() == aExtFileId )
- {
- bConvert = TRUE;
- nConvPara = nPara;
- nConvPos = nPos;
- }
- return EMPTY_STRING;
-}
-
-//UNUSED2008-05 BOOL ScFieldChangerEditEngine::ConvertFields()
-//UNUSED2008-05 {
-//UNUSED2008-05 BOOL bConverted = FALSE;
-//UNUSED2008-05 do
-//UNUSED2008-05 {
-//UNUSED2008-05 bConvert = FALSE;
-//UNUSED2008-05 UpdateFields();
-//UNUSED2008-05 if ( bConvert )
-//UNUSED2008-05 {
-//UNUSED2008-05 ESelection aSel( nConvPara, nConvPos, nConvPara, nConvPos+1 );
-//UNUSED2008-05 QuickInsertField( SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD), aSel );
-//UNUSED2008-05 bConverted = TRUE;
-//UNUSED2008-05 }
-//UNUSED2008-05 } while ( bConvert );
-//UNUSED2008-05 return bConverted;
-//UNUSED2008-05 }
+//UNUSED2009-05 class ScFieldChangerEditEngine : public ScEditEngineDefaulter
+//UNUSED2009-05 {
+//UNUSED2009-05 TypeId aExtFileId;
+//UNUSED2009-05 USHORT nConvPara;
+//UNUSED2009-05 xub_StrLen nConvPos;
+//UNUSED2009-05 BOOL bConvert;
+//UNUSED2009-05
+//UNUSED2009-05 public:
+//UNUSED2009-05 ScFieldChangerEditEngine( SfxItemPool* pEnginePool, BOOL bDeleteEnginePool );
+//UNUSED2009-05 virtual ~ScFieldChangerEditEngine() {}
+//UNUSED2009-05
+//UNUSED2009-05 virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara,
+//UNUSED2009-05 USHORT nPos, Color*& rTxtColor,
+//UNUSED2009-05 Color*& rFldColor );
+//UNUSED2009-05
+//UNUSED2009-05 BOOL ConvertFields();
+//UNUSED2009-05 };
+//UNUSED2009-05
+//UNUSED2009-05 ScFieldChangerEditEngine::ScFieldChangerEditEngine( SfxItemPool* pEnginePoolP,
+//UNUSED2009-05 BOOL bDeleteEnginePoolP ) :
+//UNUSED2009-05 ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ),
+//UNUSED2009-05 aExtFileId( TYPE( SvxExtFileField ) ),
+//UNUSED2009-05 nConvPara( 0 ),
+//UNUSED2009-05 nConvPos( 0 ),
+//UNUSED2009-05 bConvert( FALSE )
+//UNUSED2009-05 {
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 String ScFieldChangerEditEngine::CalcFieldValue( const SvxFieldItem& rField,
+//UNUSED2009-05 USHORT nPara, USHORT nPos, Color*& /* rTxtColor */, Color*& /* rFldColor */ )
+//UNUSED2009-05 {
+//UNUSED2009-05 const SvxFieldData* pFieldData = rField.GetField();
+//UNUSED2009-05 if ( pFieldData && pFieldData->Type() == aExtFileId )
+//UNUSED2009-05 {
+//UNUSED2009-05 bConvert = TRUE;
+//UNUSED2009-05 nConvPara = nPara;
+//UNUSED2009-05 nConvPos = nPos;
+//UNUSED2009-05 }
+//UNUSED2009-05 return EMPTY_STRING;
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 BOOL ScFieldChangerEditEngine::ConvertFields()
+//UNUSED2009-05 {
+//UNUSED2009-05 BOOL bConverted = FALSE;
+//UNUSED2009-05 do
+//UNUSED2009-05 {
+//UNUSED2009-05 bConvert = FALSE;
+//UNUSED2009-05 UpdateFields();
+//UNUSED2009-05 if ( bConvert )
+//UNUSED2009-05 {
+//UNUSED2009-05 ESelection aSel( nConvPara, nConvPos, nConvPara, nConvPos+1 );
+//UNUSED2009-05 QuickInsertField( SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD), aSel );
+//UNUSED2009-05 bConverted = TRUE;
+//UNUSED2009-05 }
+//UNUSED2009-05 } while ( bConvert );
+//UNUSED2009-05 return bConverted;
+//UNUSED2009-05 }
void ScPageHFItem::SetLeftArea( const EditTextObject& rNew )
{
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index c43e1eebc6cd..364d8b1b3c52 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;
}
@@ -582,23 +582,6 @@ ScNoteCell::~ScNoteCell()
}
#endif
-ScNoteCell::ScNoteCell( SvStream& rStream, USHORT nVer ) :
- ScBaseCell( CELLTYPE_NOTE )
-{
- if( nVer >= SC_DATABYTES2 )
- {
- BYTE cData;
- rStream >> cData;
- if( cData & 0x0F )
- rStream.SeekRel( cData & 0x0F );
- }
-}
-
-void ScNoteCell::Save( SvStream& rStream ) const
-{
- rStream << (BYTE) 0x00;
-}
-
// ============================================================================
ScValueCell::ScValueCell() :
@@ -1016,15 +999,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 +1684,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
{
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index adacaf622d94..038d57e11409 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>
@@ -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();
@@ -799,7 +1067,7 @@ void ScFormulaCell::UpdateInsertTab(SCTAB nTable)
pCode = new ScTokenArray( *pRangeData->GetCode() );
ScCompiler aComp2(pDocument, aPos, *pCode);
aComp2.SetGrammar(pDocument->GetGrammar());
- aComp2.MoveRelWrap();
+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
aComp2.UpdateInsertTab( nTable, FALSE );
// If the shared formula contained a named range/formula containing
// an absolute reference to a sheet, those have to be readjusted.
@@ -835,7 +1103,7 @@ BOOL ScFormulaCell::UpdateDeleteTab(SCTAB nTable, BOOL bIsMove)
ScCompiler aComp2(pDocument, aPos, *pCode);
aComp2.SetGrammar(pDocument->GetGrammar());
aComp2.CompileTokenArray();
- aComp2.MoveRelWrap();
+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
aComp2.UpdateDeleteTab( nTable, FALSE, FALSE, bRefChanged );
// If the shared formula contained a named range/formula containing
// an absolute reference to a sheet, those have to be readjusted.
@@ -872,7 +1140,7 @@ void ScFormulaCell::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo )
ScCompiler aComp2(pDocument, aPos, *pCode);
aComp2.SetGrammar(pDocument->GetGrammar());
aComp2.CompileTokenArray();
- aComp2.MoveRelWrap();
+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
aComp2.UpdateMoveTab( nOldPos, nNewPos, TRUE );
bCompile = TRUE;
}
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 7bb72225f16f..33b3404faec6 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -240,11 +240,11 @@ BOOL ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
}
-BOOL ScColumn::HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
- BOOL bLeft, BOOL bRight ) const
-{
- return pAttrArray->HasLines( nRow1, nRow2, rSizes, bLeft, bRight );
-}
+//UNUSED2009-05 BOOL ScColumn::HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
+//UNUSED2009-05 BOOL bLeft, BOOL bRight ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 return pAttrArray->HasLines( nRow1, nRow2, rSizes, bLeft, bRight );
+//UNUSED2009-05 }
BOOL ScColumn::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
@@ -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 );
}
}
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index a7a5ba39fc6a..01c72ab4e0c4 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1191,23 +1191,23 @@ BOOL ScMarkedDataIter::Next( SCSIZE& rIndex )
return TRUE;
}
-USHORT ScColumn::GetErrorData( SCROW nRow ) const
-{
- SCSIZE nIndex;
- if (Search(nRow, nIndex))
- {
- ScBaseCell* pCell = pItems[nIndex].pCell;
- switch (pCell->GetCellType())
- {
- case CELLTYPE_FORMULA :
- return ((ScFormulaCell*)pCell)->GetErrCode();
-// break;
- default:
- return 0;
- }
- }
- return 0;
-}
+//UNUSED2009-05 USHORT ScColumn::GetErrorData( SCROW nRow ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 SCSIZE nIndex;
+//UNUSED2009-05 if (Search(nRow, nIndex))
+//UNUSED2009-05 {
+//UNUSED2009-05 ScBaseCell* pCell = pItems[nIndex].pCell;
+//UNUSED2009-05 switch (pCell->GetCellType())
+//UNUSED2009-05 {
+//UNUSED2009-05 case CELLTYPE_FORMULA :
+//UNUSED2009-05 return ((ScFormulaCell*)pCell)->GetErrCode();
+//UNUSED2009-05 // break;
+//UNUSED2009-05 default:
+//UNUSED2009-05 return 0;
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return 0;
+//UNUSED2009-05 }
//------------
@@ -1376,13 +1376,13 @@ SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirecti
return nLines;
}
-SCROW ScColumn::GetFirstDataPos() const
-{
- if (nCount)
- return pItems[0].nRow;
- else
- return 0;
-}
+//UNUSED2009-05 SCROW ScColumn::GetFirstDataPos() const
+//UNUSED2009-05 {
+//UNUSED2009-05 if (nCount)
+//UNUSED2009-05 return pItems[0].nRow;
+//UNUSED2009-05 else
+//UNUSED2009-05 return 0;
+//UNUSED2009-05 }
SCROW ScColumn::GetLastDataPos() const
{
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 65602f3d5bbc..5726862366cf 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -782,7 +782,8 @@ void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
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
- ScPostIt* pNewNote = ScNoteUtil::CloneNote( *pDocument, aDestPos, *pSourceNote, bCloneCaption );
+ ScAddress aSourcePos( rColumn.nCol, rColumn.pItems[i].nRow, rColumn.nTab );
+ ScPostIt* pNewNote = pSourceNote->Clone( aSourcePos, *pDocument, aDestPos, bCloneCaption );
pAddNoteCell->TakeNote( pNewNote );
}
}
@@ -907,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 12dbf77e88e6..b4d8a5972211 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 )
{
@@ -1539,13 +1553,6 @@ ScConditionalFormat* ScConditionalFormatList::GetFormat( sal_uInt32 nKey )
return NULL;
}
-//UNUSED2008-05 void ScConditionalFormatList::ResetUsed()
-//UNUSED2008-05 {
-//UNUSED2008-05 USHORT nCount = Count();
-//UNUSED2008-05 for (USHORT i=0; i<nCount; i++)
-//UNUSED2008-05 (*this)[i]->SetUsed(FALSE);
-//UNUSED2008-05 }
-
void ScConditionalFormatList::CompileAll()
{
USHORT nCount = Count();
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index f5dbb14e9ff9..482aedbc7940 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.
@@ -152,7 +154,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
pChangeViewSettings( NULL ),
pScriptTypeData( NULL ),
pCacheFieldEditEngine( NULL ),
- pExternalRefMgr( NULL ),
+ pDocProtection( NULL ),
pViewOptions( NULL ),
pDocOptions( NULL ),
pExtDocOptions( NULL ),
@@ -175,7 +177,6 @@ ScDocument::ScDocument( ScDocumentMode eMode,
nHardRecalcState(0),
nVisibleTab( 0 ),
eLinkMode(LM_UNKNOWN),
- bProtected( FALSE ),
bAutoCalc( eMode == SCDOCMODE_DOCUMENT ),
bAutoCalcShellDisabled( FALSE ),
bForcedFormulaPending( FALSE ),
@@ -247,9 +248,6 @@ ScDocument::ScDocument( ScDocumentMode eMode,
pRangeName = new ScRangeName( 4, 4, FALSE, this );
pDBCollection = new ScDBCollection( 4, 4, FALSE, this );
-#if OLD_PIVOT_IMPLEMENTATION
- pPivotCollection = new ScPivotCollection(4, 4, this );
-#endif
pSelectionAttr = NULL;
pChartCollection = new ScChartCollection;
apTemporaryChartLock = std::auto_ptr< ScTemporaryChartLock >( new ScTemporaryChartLock(this) );
@@ -383,15 +381,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
@@ -421,9 +418,6 @@ ScDocument::~ScDocument()
}
delete pRangeName;
delete pDBCollection;
-#if OLD_PIVOT_IMPLEMENTATION
- delete pPivotCollection;
-#endif
delete pSelectionAttr;
apTemporaryChartLock.reset();
delete pChartCollection;
@@ -548,12 +542,12 @@ ScNoteEditEngine& ScDocument::GetNoteEngine()
return *pNoteEngine;
}
-SfxItemPool& ScDocument::GetNoteItemPool()
-{
- if ( !pNoteItemPool )
- pNoteItemPool = new SfxItemPool(SdrObject::GetGlobalDrawObjectItemPool());
- return *pNoteItemPool;
-}
+//UNUSED2009-05 SfxItemPool& ScDocument::GetNoteItemPool()
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( !pNoteItemPool )
+//UNUSED2009-05 pNoteItemPool = new SfxItemPool(SdrObject::GetGlobalDrawObjectItemPool());
+//UNUSED2009-05 return *pNoteItemPool;
+//UNUSED2009-05 }
void ScDocument::ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks )
{
@@ -623,22 +617,22 @@ void ScDocument::PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
}
}
-void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell,
- ULONG nFormatIndex, BOOL bForceTab )
-{
- SCTAB nTab = rPos.Tab();
- if ( bForceTab && !pTab[nTab] )
- {
- BOOL bExtras = !bIsUndo; // Spaltenbreiten, Zeilenhoehen, Flags
-
- pTab[nTab] = new ScTable(this, nTab,
- String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("temp")),
- bExtras, bExtras);
- }
-
- if (pTab[nTab])
- pTab[nTab]->PutCell( rPos, nFormatIndex, pCell );
-}
+//UNUSED2009-05 void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell,
+//UNUSED2009-05 ULONG nFormatIndex, BOOL bForceTab )
+//UNUSED2009-05 {
+//UNUSED2009-05 SCTAB nTab = rPos.Tab();
+//UNUSED2009-05 if ( bForceTab && !pTab[nTab] )
+//UNUSED2009-05 {
+//UNUSED2009-05 BOOL bExtras = !bIsUndo; // Spaltenbreiten, Zeilenhoehen, Flags
+//UNUSED2009-05
+//UNUSED2009-05 pTab[nTab] = new ScTable(this, nTab,
+//UNUSED2009-05 String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("temp")),
+//UNUSED2009-05 bExtras, bExtras);
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 if (pTab[nTab])
+//UNUSED2009-05 pTab[nTab]->PutCell( rPos, nFormatIndex, pCell );
+//UNUSED2009-05 }
BOOL ScDocument::GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
BOOL bNotes ) const
@@ -759,11 +753,6 @@ BOOL ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos )
pDBCollection->UpdateMoveTab( nOldPos, nNewPos );
xColNameRanges->UpdateReference( URM_REORDER, this, aSourceRange, 0,0,nDz );
xRowNameRanges->UpdateReference( URM_REORDER, this, aSourceRange, 0,0,nDz );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference( URM_REORDER,
- 0,0,nOldPos, MAXCOL,MAXROW,nOldPos, 0,0,nDz );
-#endif
if (pDPCollection)
pDPCollection->UpdateReference( URM_REORDER, aSourceRange, 0,0,nDz );
if (pDetOpList)
@@ -858,11 +847,6 @@ BOOL ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
pRangeName->UpdateTabRef(nNewPos, 1);
pDBCollection->UpdateReference(
URM_INSDEL, 0,0,nNewPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference(
- URM_INSDEL, 0,0,nNewPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
-#endif
if (pDPCollection)
pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
if (pDetOpList)
@@ -931,6 +915,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())
@@ -1109,6 +1094,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..dba29553462e 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>
@@ -227,46 +230,6 @@ ScDPObject* ScDocument::GetDPAtBlock( const ScRange & rBlock ) const
return NULL;
}
-#if OLD_PIVOT_IMPLEMENTATION
-ScPivotCollection* ScDocument::GetPivotCollection() const
-{
- return pPivotCollection;
-}
-
-void ScDocument::SetPivotCollection(ScPivotCollection* pNewPivotCollection)
-{
- if ( pPivotCollection && pNewPivotCollection &&
- *pPivotCollection == *pNewPivotCollection )
- {
- delete pNewPivotCollection;
- return;
- }
-
- if (pPivotCollection)
- delete pPivotCollection;
- pPivotCollection = pNewPivotCollection;
-
- if (pPivotCollection)
- {
- USHORT nCount = pPivotCollection->GetCount();
- for (USHORT i=0; i<nCount; i++)
- {
- ScPivot* pPivot = (*pPivotCollection)[i];
- if (pPivot->CreateData())
- pPivot->ReleaseData();
- }
- }
-}
-
-ScPivot* ScDocument::GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
- if (pPivotCollection)
- return pPivotCollection->GetPivotAtCursor(nCol, nRow, nTab);
- else
- return NULL;
-}
-#endif
-
ScChartCollection* ScDocument::GetChartCollection() const
{
return pChartCollection;
@@ -507,6 +470,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;
@@ -835,10 +805,6 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode,
xRowNameRanges->UpdateReference( eUpdateRefMode, this, aRange, nDx, nDy, nDz );
pDBCollection->UpdateReference( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz );
pRangeName->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz );
-#endif
if ( pDPCollection )
pDPCollection->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
UpdateChartRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz );
@@ -928,9 +894,6 @@ void ScDocument::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
//! UpdateChartRef
pRangeName->UpdateGrow( rArea, nGrowX, nGrowY );
-#if OLD_PIVOT_IMPLEMENTATION
- pPivotCollection->UpdateGrow( rArea, nGrowX, nGrowY );
-#endif
for (SCTAB i=0; i<=MAXTAB && pTab[i]; i++)
pTab[i]->UpdateGrow( rArea, nGrowX, nGrowY );
@@ -1701,28 +1664,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 +1697,28 @@ BOOL ScDocument::IsTabProtected( SCTAB nTab ) const
return FALSE;
}
-const uno::Sequence<sal_Int8>& ScDocument::GetDocPassword() const
+ScTableProtection* ScDocument::GetTabProtection( SCTAB nTab ) const
+{
+ if (VALIDTAB(nTab) && pTab[nTab])
+ return pTab[nTab]->GetProtection();
+
+ return NULL;
+}
+
+void ScDocument::SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect)
{
- return aProtectPass;
+ if (!ValidTab(nTab))
+ return;
+
+ pTab[nTab]->SetProtection(pProtect);
}
-const uno::Sequence<sal_Int8>& ScDocument::GetTabPassword( SCTAB nTab ) const
+void ScDocument::CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest)
{
- if (VALIDTAB(nTab) && pTab[nTab])
- return pTab[nTab]->GetPassword();
+ if (!ValidTab(nTabSrc) || !ValidTab(nTabDest))
+ return;
- DBG_ERROR("Falsche Tabellennummer");
- return aProtectPass;
+ 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/document.cxx b/sc/source/core/data/document.cxx
index 0dd6a5db10e2..b1d19d4b3dae 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;
@@ -303,11 +304,6 @@ BOOL ScDocument::InsertTab( SCTAB nPos, const String& rName,
pRangeName->UpdateTabRef( nPos, 1 );
pDBCollection->UpdateReference(
URM_INSDEL, 0,0,nPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference(
- URM_INSDEL, 0,0,nPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
-#endif
if (pDPCollection)
pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
if (pDetOpList)
@@ -395,11 +391,6 @@ BOOL ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc )
pRangeName->UpdateTabRef( nTab, 2 );
pDBCollection->UpdateReference(
URM_INSDEL, 0,0,nTab, MAXCOL,MAXROW,MAXTAB, 0,0,-1 );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference(
- URM_INSDEL, 0,0,nTab, MAXCOL,MAXROW,MAXTAB, 0,0,-1 );
-#endif
if (pDPCollection)
pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,-1 );
if (pDetOpList)
@@ -506,6 +497,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] )
@@ -2467,7 +2474,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");
@@ -2567,6 +2574,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();
@@ -2932,14 +2951,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 );
@@ -4104,24 +4129,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*)
@@ -4531,11 +4538,11 @@ void ScDocument::AddPrintRange( SCTAB nTab, const ScRange& rNew )
}
-void ScDocument::SetPrintRange( SCTAB nTab, const ScRange& rNew )
-{
- if (ValidTab(nTab) && pTab[nTab])
- pTab[nTab]->SetPrintRange( rNew );
-}
+//UNUSED2009-05 void ScDocument::SetPrintRange( SCTAB nTab, const ScRange& rNew )
+//UNUSED2009-05 {
+//UNUSED2009-05 if (ValidTab(nTab) && pTab[nTab])
+//UNUSED2009-05 pTab[nTab]->SetPrintRange( rNew );
+//UNUSED2009-05 }
void ScDocument::SetPrintEntireSheet( SCTAB nTab )
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 2a1b4481ccaa..dc9b6450ac75 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -522,23 +522,6 @@ const String* ScDPCacheTable::getFieldName(sal_Int32 nIndex) const
return mrSharedString.getString(maHeader[nIndex]);
}
-sal_Int32 ScDPCacheTable::getFieldIndex(const String& rStr) const
-{
- sal_Int32 nStrId = mrSharedString.getStringId(rStr);
- if (nStrId < 0)
- // string not found.
- return nStrId;
-
- sal_Int32 n = maHeader.size();
- for (sal_Int32 i = 0; i < n; ++i)
- {
- if (maHeader[i] == nStrId)
- return i;
- }
-
- return -1;
-}
-
const TypedScStrCollection& ScDPCacheTable::getFieldEntries(sal_Int32 nIndex) const
{
if (nIndex < 0 || static_cast<size_t>(nIndex) >= maFieldEntries.size())
@@ -638,14 +621,6 @@ void ScDPCacheTable::clear()
maRowsVisible.clear();
}
-void ScDPCacheTable::swap(ScDPCacheTable& rOther)
-{
- maTable.swap(rOther.maTable);
- maHeader.swap(rOther.maHeader);
- maFieldEntries.swap(rOther.maFieldEntries);
- maRowsVisible.swap(rOther.maRowsVisible);
-}
-
bool ScDPCacheTable::empty() const
{
return maTable.empty();
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 813a3381c901..1f1ebbc45d18 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2122,50 +2122,6 @@ void ScDPObject::ConvertOrientation( ScDPSaveData& rSaveData,
}
}
-#if OLD_PIVOT_IMPLEMENTATION
-void ScDPObject::InitFromOldPivot( const ScPivot& rOld, ScDocument* pDocP, BOOL bSetSource )
-{
- ScDPSaveData aSaveData;
-
- ScPivotParam aParam;
- ScQueryParam aQuery;
- ScArea aArea;
- rOld.GetParam( aParam, aQuery, aArea );
-
- ConvertOrientation( aSaveData, aParam.aPageArr, aParam.nPageCount,
- sheet::DataPilotFieldOrientation_PAGE, pDocP, aArea.nRowStart, aArea.nTab,
- uno::Reference<sheet::XDimensionsSupplier>(), TRUE );
- ConvertOrientation( aSaveData, aParam.aColArr, aParam.nColCount,
- sheet::DataPilotFieldOrientation_COLUMN, pDocP, aArea.nRowStart, aArea.nTab,
- uno::Reference<sheet::XDimensionsSupplier>(), TRUE );
- ConvertOrientation( aSaveData, aParam.aRowArr, aParam.nRowCount,
- sheet::DataPilotFieldOrientation_ROW, pDocP, aArea.nRowStart, aArea.nTab,
- uno::Reference<sheet::XDimensionsSupplier>(), TRUE );
- ConvertOrientation( aSaveData, aParam.aDataArr, aParam.nDataCount,
- sheet::DataPilotFieldOrientation_DATA, pDocP, aArea.nRowStart, aArea.nTab,
- uno::Reference<sheet::XDimensionsSupplier>(), TRUE,
- aParam.aColArr, aParam.nColCount, aParam.aRowArr, aParam.nRowCount );
-
- aSaveData.SetIgnoreEmptyRows( rOld.GetIgnoreEmpty() );
- aSaveData.SetRepeatIfEmpty( rOld.GetDetectCat() );
- aSaveData.SetColumnGrand( rOld.GetMakeTotalCol() );
- aSaveData.SetRowGrand( rOld.GetMakeTotalRow() );
-
- SetSaveData( aSaveData );
- if (bSetSource)
- {
- ScSheetSourceDesc aDesc;
- aDesc.aSourceRange = rOld.GetSrcArea();
- rOld.GetQuery( aDesc.aQueryParam );
- SetSheetDesc( aDesc );
- }
- SetOutRange( rOld.GetDestArea() );
-
- aTableName = rOld.GetName();
- aTableTag = rOld.GetTag();
-}
-#endif
-
// -----------------------------------------------------------------------
// static
@@ -2506,26 +2462,3 @@ void ScDPCollection::clearCacheCellPool()
for_each(ps.begin(), ps.end(), DeleteCacheCells());
}
-//------------------------------------------------------------------------
-// convert old pivot tables into new datapilot tables
-
-#if OLD_PIVOT_IMPLEMENTATION
-void ScDPCollection::ConvertOldTables( ScPivotCollection& rOldColl )
-{
- // convert old pivot tables into new datapilot tables
-
- USHORT nOldCount = rOldColl.GetCount();
- for (USHORT i=0; i<nOldCount; i++)
- {
- ScDPObject* pNewObj = new ScDPObject(pDoc);
- pNewObj->InitFromOldPivot( *(rOldColl)[i], pDoc, TRUE );
- pNewObj->SetAlive( TRUE );
- Insert( pNewObj );
- }
- rOldColl.FreeAll();
-}
-#endif
-
-
-
-
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index f4180312ce0d..62798076afb9 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -97,20 +97,6 @@ void lcl_SetBoolProperty( const uno::Reference<beans::XPropertySet>& xProp,
// -----------------------------------------------------------------------
-void lcl_SkipExtra( SvStream& rStream )
-{
- USHORT nExtra;
- rStream >> nExtra;
- if ( nExtra )
- {
- rStream.SeekRel( nExtra );
- if ( rStream.GetError() == SVSTREAM_OK )
- rStream.SetError( SCWARN_IMPORT_INFOLOST );
- }
-}
-
-// -----------------------------------------------------------------------
-
ScDPSaveMember::ScDPSaveMember(const String& rName) :
aName( rName ),
nVisibleMode( SC_DPSAVEMODE_DONTKNOW ),
@@ -352,17 +338,6 @@ void ScDPSaveDimension::SetOrientation(USHORT nNew)
nOrientation = nNew;
}
-void ScDPSaveDimension::SetSubTotals(BOOL bSet)
-{
- if (bSet)
- {
- USHORT nFunc = sheet::GeneralFunction_AUTO;
- SetSubTotals( 1, &nFunc );
- }
- else
- SetSubTotals( 0, NULL );
-}
-
void ScDPSaveDimension::SetSubTotals(long nCount, const USHORT* pFuncs)
{
if (pSubTotalFuncs)
diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx
index 777ea3f38935..cfc98af5af99 100644
--- a/sc/source/core/data/dpsdbtab.cxx
+++ b/sc/source/core/data/dpsdbtab.cxx
@@ -231,15 +231,6 @@ long ScDatabaseDPData::GetColumnCount()
return pImpl->nColCount;
}
-void lcl_Reset( const uno::Reference<sdbc::XRowSet>& xRowSet )
- throw(sdbc::SQLException, uno::RuntimeException)
-{
- // isBeforeFirst / beforeFirst is not always available
- //! query if it is allowed
-
- xRowSet->execute(); // restart
-}
-
const TypedScStrCollection& ScDatabaseDPData::GetColumnEntries(long nColumn)
{
CreateCacheTable();
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index 1e8c5627ee19..7956b68ad03f 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -140,12 +140,6 @@ long ScSheetDPData::GetColumnCount()
return pImpl->aCacheTable.getColSize();
}
-BOOL lcl_HasQuery( const ScQueryParam& rParam )
-{
- return rParam.GetEntryCount() > 0 &&
- rParam.GetEntry(0).bDoQuery;
-}
-
const TypedScStrCollection& ScSheetDPData::GetColumnEntries(long nColumn)
{
DBG_ASSERT(nColumn>=0 && nColumn < pImpl->aCacheTable.getColSize(), "ScSheetDPData: wrong column");
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 5fa5c393df37..959e0342fe38 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -991,16 +991,16 @@ void ScDPSource::CreateRes_Impl()
}
}
-void ScDPSource::DumpState( ScDocument* pDoc, const ScAddress& rPos )
-{
- CreateRes_Impl();
-
- ScAddress aDocPos( rPos );
-
- if (pColResRoot->GetChildDimension())
- pColResRoot->GetChildDimension()->DumpState( NULL, pDoc, aDocPos );
- pRowResRoot->DumpState( pColResRoot, pDoc, aDocPos );
-}
+//UNUSED2009-05 void ScDPSource::DumpState( ScDocument* pDoc, const ScAddress& rPos )
+//UNUSED2009-05 {
+//UNUSED2009-05 CreateRes_Impl();
+//UNUSED2009-05
+//UNUSED2009-05 ScAddress aDocPos( rPos );
+//UNUSED2009-05
+//UNUSED2009-05 if (pColResRoot->GetChildDimension())
+//UNUSED2009-05 pColResRoot->GetChildDimension()->DumpState( NULL, pDoc, aDocPos );
+//UNUSED2009-05 pRowResRoot->DumpState( pColResRoot, pDoc, aDocPos );
+//UNUSED2009-05 }
void ScDPSource::FillLevelList( USHORT nOrientation, List& rList )
{
@@ -1497,13 +1497,13 @@ const ScDPItemData& ScDPDimension::GetSelectedData()
return *pSelectedData;
}
-BOOL ScDPDimension::IsValidPage( const ScDPItemData& rData )
-{
- if ( bHasSelectedPage )
- return rData.IsCaseInsEqual( GetSelectedData() );
-
- return TRUE; // no selection -> all data
-}
+//UNUSED2009-05 BOOL ScDPDimension::IsValidPage( const ScDPItemData& rData )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( bHasSelectedPage )
+//UNUSED2009-05 return rData.IsCaseInsEqual( GetSelectedData() );
+//UNUSED2009-05
+//UNUSED2009-05 return TRUE; // no selection -> all data
+//UNUSED2009-05 }
// XPropertySet
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 6d1e1eb70674..a5c571026e96 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -493,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 );
}
}
}
@@ -522,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;
}
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index c352dbb550d6..6af662119f12 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -96,17 +96,17 @@ ScImportParam::~ScImportParam()
{
}
-void ScImportParam::Clear()
-{
- nCol1 = nCol2 = 0;
- nRow1 = nRow2 = 0;
- bImport = FALSE;
- bNative = FALSE;
- bSql = TRUE;
- nType = ScDbTable;
- aDBName.Erase();
- aStatement.Erase();
-}
+//UNUSED2009-05 void ScImportParam::Clear()
+//UNUSED2009-05 {
+//UNUSED2009-05 nCol1 = nCol2 = 0;
+//UNUSED2009-05 nRow1 = nRow2 = 0;
+//UNUSED2009-05 bImport = FALSE;
+//UNUSED2009-05 bNative = FALSE;
+//UNUSED2009-05 bSql = TRUE;
+//UNUSED2009-05 nType = ScDbTable;
+//UNUSED2009-05 aDBName.Erase();
+//UNUSED2009-05 aStatement.Erase();
+//UNUSED2009-05 }
ScImportParam& ScImportParam::operator=( const ScImportParam& r )
{
@@ -849,16 +849,16 @@ __EXPORT ScPivotParam::~ScPivotParam()
//------------------------------------------------------------------------
-void __EXPORT ScPivotParam::Clear()
-{
- nCol = 0;
- nRow = 0;
- nTab = 0;
- bIgnoreEmptyRows = bDetectCategories = FALSE;
- bMakeTotalCol = bMakeTotalRow = TRUE;
- ClearLabelData();
- ClearPivotArrays();
-}
+//UNUSED2009-05 void __EXPORT ScPivotParam::Clear()
+//UNUSED2009-05 {
+//UNUSED2009-05 nCol = 0;
+//UNUSED2009-05 nRow = 0;
+//UNUSED2009-05 nTab = 0;
+//UNUSED2009-05 bIgnoreEmptyRows = bDetectCategories = FALSE;
+//UNUSED2009-05 bMakeTotalCol = bMakeTotalRow = TRUE;
+//UNUSED2009-05 ClearLabelData();
+//UNUSED2009-05 ClearPivotArrays();
+//UNUSED2009-05 }
//------------------------------------------------------------------------
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/markarr.cxx b/sc/source/core/data/markarr.cxx
index f5855cb4424b..362c7e769b7a 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -254,10 +254,10 @@ void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW nEndRow, BOOL bMarked )
// InfoBox(0, String(nCount) + String(" Eintraege") ).Execute();
}
-void ScMarkArray::DeleteArea(SCROW nStartRow, SCROW nEndRow)
-{
- SetMarkArea(nStartRow, nEndRow, FALSE);
-}
+//UNUSED2009-05 void ScMarkArray::DeleteArea(SCROW nStartRow, SCROW nEndRow)
+//UNUSED2009-05 {
+//UNUSED2009-05 SetMarkArea(nStartRow, nEndRow, FALSE);
+//UNUSED2009-05 }
BOOL ScMarkArray::IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const
{
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 5f2f3c1a4f6e..ee74a66bcc3b 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -258,14 +258,16 @@ void ScPatternAttr::GetFont(
FontEmphasisMark eEmphasis;
FontRelief eRelief;
Color aColor;
+ LanguageType eLang;
- USHORT nFontId, nHeightId, nWeightId, nPostureId;
+ USHORT nFontId, nHeightId, nWeightId, nPostureId, nLangId;
if ( nScript == SCRIPTTYPE_ASIAN )
{
nFontId = ATTR_CJK_FONT;
nHeightId = ATTR_CJK_FONT_HEIGHT;
nWeightId = ATTR_CJK_FONT_WEIGHT;
nPostureId = ATTR_CJK_FONT_POSTURE;
+ nLangId = ATTR_CJK_FONT_LANGUAGE;
}
else if ( nScript == SCRIPTTYPE_COMPLEX )
{
@@ -273,6 +275,7 @@ void ScPatternAttr::GetFont(
nHeightId = ATTR_CTL_FONT_HEIGHT;
nWeightId = ATTR_CTL_FONT_WEIGHT;
nPostureId = ATTR_CTL_FONT_POSTURE;
+ nLangId = ATTR_CTL_FONT_LANGUAGE;
}
else
{
@@ -280,6 +283,7 @@ void ScPatternAttr::GetFont(
nHeightId = ATTR_FONT_HEIGHT;
nWeightId = ATTR_FONT_WEIGHT;
nPostureId = ATTR_FONT_POSTURE;
+ nLangId = ATTR_FONT_LANGUAGE;
}
if ( pCondSet )
@@ -337,6 +341,10 @@ void ScPatternAttr::GetFont(
if ( pCondSet->GetItemState( ATTR_FONT_COLOR, TRUE, &pItem ) != SFX_ITEM_SET )
pItem = &rItemSet.Get( ATTR_FONT_COLOR );
aColor = ((const SvxColorItem*)pItem)->GetValue();
+
+ if ( pCondSet->GetItemState( nLangId, TRUE, &pItem ) != SFX_ITEM_SET )
+ pItem = &rItemSet.Get( nLangId );
+ eLang = ((const SvxLanguageItem*)pItem)->GetLanguage();
}
else // alles aus rItemSet
{
@@ -365,6 +373,9 @@ void ScPatternAttr::GetFont(
rItemSet.Get( ATTR_FONT_RELIEF )).GetValue();
aColor = ((const SvxColorItem&)
rItemSet.Get( ATTR_FONT_COLOR )).GetValue();
+ // for graphite language features
+ eLang =
+ ((const SvxLanguageItem&)rItemSet.Get( nLangId )).GetLanguage();
}
DBG_ASSERT(pFontAttr,"nanu?");
@@ -381,6 +392,8 @@ void ScPatternAttr::GetFont(
rFont.SetCharSet( pFontAttr->GetCharSet() );
rFont.SetPitch( pFontAttr->GetPitch() );
+ rFont.SetLanguage(eLang);
+
// Groesse
if ( pOutDev != NULL )
diff --git a/sc/source/core/data/pivot.cxx b/sc/source/core/data/pivot.cxx
index 30bacf79989a..00cdf2a84eac 100644
--- a/sc/source/core/data/pivot.cxx
+++ b/sc/source/core/data/pivot.cxx
@@ -34,1995 +34,4 @@
// -----------------------------------------------------------------------
-#if OLD_PIVOT_IMPLEMENTATION
-#ifdef _MSC_VER
-#pragma optimize("",off)
-#endif
-
-// INCLUDE ---------------------------------------------------------------
-
-#include <svtools/zforlist.hxx>
-#include <tools/solar.h>
-
-#include "globstr.hrc"
-#include "global.hxx"
-#include "subtotal.hxx"
-#include "scitems.hxx"
-#include "attrib.hxx"
-#include "patattr.hxx"
-#include "docpool.hxx"
-#include "document.hxx"
-#include "userlist.hxx"
-#include "pivot.hxx"
-#include "cell.hxx"
-#include "rechead.hxx"
-#include "compiler.hxx" // fuer errNoValue
-#include "progress.hxx"
-
-#include <string.h>
-#include <math.h>
-
-// STATIC DATA -----------------------------------------------------------
-
-//! bei Gelegenheit...
-
-static short nStaticStrRefCount = 0;
-static String* pLabel[PIVOT_MAXFUNC+1]; // incl. "auto"
-static String* pLabelTotal;
-static String* pLabelData;
-
-static SCSIZE nDataMult = 1;
-
-#define nFirstLine 2
-
-static const USHORT nFuncMaskArr[PIVOT_MAXFUNC+1] =
- { PIVOT_FUNC_SUM,
- PIVOT_FUNC_COUNT,
- PIVOT_FUNC_AVERAGE,
- PIVOT_FUNC_MAX,
- PIVOT_FUNC_MIN,
- PIVOT_FUNC_PRODUCT,
- PIVOT_FUNC_COUNT_NUM,
- PIVOT_FUNC_STD_DEV,
- PIVOT_FUNC_STD_DEVP,
- PIVOT_FUNC_STD_VAR,
- PIVOT_FUNC_STD_VARP,
- PIVOT_FUNC_AUTO }; // automatisch
-
-// -----------------------------------------------------------------------
-
-// 1 Filter-Knopf
-// 2 Feldnamen links
-// 3 "Daten" links
-// 4 Feldnamen oben
-// 5 "Daten" oben
-// 6 einzelne "Gesamt" oben rechts
-// 7 "Gesamt" oben rechts
-// 8 einzelne "Gesamt" unten links
-// 9 "Gesamt" unten links
-// 10 innere Kategorie links
-// 11 Teilergebnis Label einzeln links
-// 12 Teilergebnis Label gesamt links
-// 13 letzte Kategorie links
-// 14 innere Kategorie oben
-// 15 Teilergebnis Label einzeln oben
-// 16 Teilergebnis Label gesamt oben
-// 17 letzte Kategorie oben
-// 18 Werte innen
-// 19 Werte in Teilergebnisspalte
-// 20 Werte in Gesamt-Spalte
-// 21 Werte in einzelnen Gesamt-Spalten
-// 22 Werte in Ergebnis-Zeile Teilergebnis oder Gesamt
-// 23 Kreuzung von Spalte/Zeile (Teilergebnis-Spalte)
-// 24 Kreuzung von Spalte/Zeile (Gesamt-Spalte)
-// 25 wie 24 bei einzelnen "Gesamt"
-
-SCSIZE lcl_MaskToIndex( USHORT nFuncMask )
-{
- SCSIZE i;
- for (i=0; i<=PIVOT_MAXFUNC; i++)
- if (nFuncMask == nFuncMaskArr[i])
- return i;
-
- DBG_ERROR("Falsche Maske in MaskToIndex");
- return 0;
-}
-
-BOOL lcl_IsEmptyLine( ScDocument* pDoc, const ScAddress& rPos, SCCOL nCol2 )
-{
- //! ans Document verschieben !!!
-
- ScAddress aAdr( rPos );
- for (SCCOL nCol=aAdr.Col(); nCol<=nCol2; nCol++)
- {
- aAdr.SetCol( nCol );
- if ( pDoc->GetCell( aAdr ) )
- return FALSE;
- }
- return TRUE;
-}
-
-ScPivot::ScPivot(ScDocument* pDocument) :
- pDoc (pDocument),
- aQuery (),
- bHasHeader (FALSE),
- bIgnoreEmpty (FALSE),
- bDetectCat (FALSE),
- bMakeTotalCol (TRUE),
- bMakeTotalRow (TRUE),
- nColNameCount (0),
- pColNames (NULL),
- nSrcCol1 (0),
- nSrcRow1 (0),
- nSrcCol2 (0),
- nSrcRow2 (0),
- nSrcTab (0),
- nDestCol1 (0),
- nDestRow1 (0),
- nDestCol2 (0),
- nDestRow2 (0),
- nDestTab (0),
- nDataStartCol (0),
- nDataStartRow (0),
- nColCount (0),
- nRowCount (0),
- nDataCount (0),
- bValidArea (FALSE),
- bDataAtCol (FALSE)
-{
- for (SCSIZE i=0; i<PIVOT_MAXFIELD; i++)
- {
- pColList[i] = new PivotScStrCollection();
- pRowList[i] = new PivotScStrCollection();
- }
- pDataList = pColList[0];
- ppDataArr = NULL;
- nDataColCount = 0;
- nDataRowCount = 0;
- nRecCount = 0;
- pColRef = NULL;
-
- // Initialisierung der statischen Strings, wenn noetig
- nStaticStrRefCount += 1;
- if ( nStaticStrRefCount < 2 )
- {
- pLabelTotal = new String( ScGlobal::GetRscString(STR_PIVOT_TOTAL) );
- pLabelData = new String( ScGlobal::GetRscString(STR_PIVOT_DATA) );
-
- for (SCSIZE i=0; i<=PIVOT_MAXFUNC; i++ ) // incl. "auto"
- pLabel[i] = new String; // kein Leerzeichen
-
- *pLabel[ 0] = ScGlobal::GetRscString(STR_FUN_TEXT_SUM);
- *pLabel[ 1] = ScGlobal::GetRscString(STR_FUN_TEXT_COUNT);
- *pLabel[ 2] = ScGlobal::GetRscString(STR_FUN_TEXT_AVG);
- *pLabel[ 3] = ScGlobal::GetRscString(STR_FUN_TEXT_MAX);
- *pLabel[ 4] = ScGlobal::GetRscString(STR_FUN_TEXT_MIN);
- *pLabel[ 5] = ScGlobal::GetRscString(STR_FUN_TEXT_PRODUCT);
- *pLabel[ 6] = ScGlobal::GetRscString(STR_FUN_TEXT_COUNT); // Count2
- *pLabel[ 7] = ScGlobal::GetRscString(STR_FUN_TEXT_STDDEV);
- *pLabel[ 8] = ScGlobal::GetRscString(STR_FUN_TEXT_STDDEV); // Stddev2
- *pLabel[ 9] = ScGlobal::GetRscString(STR_FUN_TEXT_VAR);
- *pLabel[10] = ScGlobal::GetRscString(STR_FUN_TEXT_VAR); // Var2
- *pLabel[11] = ScGlobal::GetRscString(STR_TABLE_ERGEBNIS);
- }
-}
-
-ScPivot::ScPivot(const ScPivot& rPivot):
- ScDataObject(),
- pDoc (rPivot.pDoc),
- aQuery (rPivot.aQuery),
- bHasHeader (rPivot.bHasHeader),
- bIgnoreEmpty (rPivot.bIgnoreEmpty),
- bDetectCat (rPivot.bDetectCat),
- bMakeTotalCol (rPivot.bMakeTotalCol),
- bMakeTotalRow (rPivot.bMakeTotalRow),
- aName (rPivot.aName),
- aTag (rPivot.aTag),
- nColNameCount (0),
- pColNames (NULL),
- nSrcCol1 (rPivot.nSrcCol1),
- nSrcRow1 (rPivot.nSrcRow1),
- nSrcCol2 (rPivot.nSrcCol2),
- nSrcRow2 (rPivot.nSrcRow2),
- nSrcTab (rPivot.nSrcTab),
- nDestCol1 (rPivot.nDestCol1),
- nDestRow1 (rPivot.nDestRow1),
- nDestCol2 (rPivot.nDestCol2),
- nDestRow2 (rPivot.nDestRow2),
- nDestTab (rPivot.nDestTab),
- nDataStartCol (0),
- nDataStartRow (0),
- nColCount (0),
- nRowCount (0),
- nDataCount (0),
- bValidArea (FALSE),
- bDataAtCol (FALSE)
-{
- if (rPivot.nColNameCount>0 && rPivot.pColNames)
- {
- nColNameCount = rPivot.nColNameCount;
- pColNames = new String[nColNameCount];
- for (SCSIZE nCol=0; nCol<nColNameCount; nCol++)
- pColNames[nCol] = rPivot.pColNames[nCol];
- }
-
- for (SCSIZE i=0; i<PIVOT_MAXFIELD; i++)
- {
- pColList[i] = new PivotScStrCollection();
- pRowList[i] = new PivotScStrCollection();
- }
- pDataList = pColList[0];
- ppDataArr = NULL;
- nRecCount = 0;
- pColRef = NULL;
-
- SetColFields( rPivot.aColArr, rPivot.nColCount );
- SetRowFields( rPivot.aRowArr, rPivot.nRowCount );
- SetDataFields( rPivot.aDataArr, rPivot.nDataCount );
-
- nStaticStrRefCount += 1;
-}
-
-ScPivot::~ScPivot()
-{
- for (SCSIZE i=0; i<PIVOT_MAXFIELD; i++)
- {
- delete pColList[i];
- delete pRowList[i];
- }
- if (ppDataArr)
- {
- for (SCSIZE j=0; j<nDataRowCount; j++)
- delete[] ppDataArr[j];
- delete[] ppDataArr;
- ppDataArr = NULL;
- }
- delete[] pColRef;
-
- delete[] pColNames;
-
- // statische Strings ggF. wieder abraeumen
- nStaticStrRefCount -= 1;
- if ( nStaticStrRefCount == 0 )
- {
- delete pLabelTotal;
- delete pLabelData;
-
- for ( SCSIZE k=0; k<=PIVOT_MAXFUNC; k++ ) // incl. "auto"
- delete pLabel[k];
- }
-}
-
-ScPivot* ScPivot::CreateNew() const
-{
- ScPivot* pNewPivot = new ScPivot( pDoc );
-
- pNewPivot->SetQuery(aQuery);
- pNewPivot->SetHeader(bHasHeader);
- pNewPivot->SetIgnoreEmpty(bIgnoreEmpty);
- pNewPivot->SetDetectCat(bDetectCat);
- pNewPivot->SetMakeTotalCol(bMakeTotalCol);
- pNewPivot->SetMakeTotalRow(bMakeTotalRow);
-
- pNewPivot->SetSrcArea( nSrcCol1, nSrcRow1, nSrcCol2, nSrcRow2, nSrcTab );
- pNewPivot->SetDestPos( nDestCol1, nDestRow1, nDestTab );
-
- return pNewPivot;
-}
-
-void lcl_LoadFieldArr30( SvStream& /* rStream */, PivotField* /* pField */, USHORT /* nCount */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- USHORT i;
-
- for (i=0; i<nCount; i++)
- {
- rStream >> pField[i].nCol
- >> pField[i].nFuncMask
- >> pField[i].nFuncCount;
- }
-#endif
-}
-
-void lcl_LoadFieldArr( SvStream& /* rStream */, PivotField* /* pField */, USHORT /* nCount */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- USHORT i;
-
- for (i=0; i<nCount; i++)
- {
- BYTE cData;
- rStream >> cData;
- if( cData & 0x0F )
- rStream.SeekRel( cData & 0x0F );
- rStream >> pField[i].nCol
- >> pField[i].nFuncMask
- >> pField[i].nFuncCount;
- }
-#endif
-}
-
-void lcl_SaveFieldArr( SvStream& /* rStream */, const PivotField* /* pField */, USHORT /* nCount */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- USHORT i;
-
- for (i=0; i<nCount; i++)
- {
- rStream << (BYTE) 0x00
- << pField[i].nCol
- << pField[i].nFuncMask
- << pField[i].nFuncCount;
- }
-#endif
-}
-
-// nach Load muessen Daten neu berechnet werden !
-
-BOOL ScPivot::Load( SvStream& /* rStream */, ScMultipleReadHeader& rHdr )
-{
- rHdr.StartEntry();
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
-
- rStream >> bHasHeader
-
- >> nSrcCol1
- >> nSrcRow1
- >> nSrcCol2
- >> nSrcRow2
- >> nSrcTab
-
- >> nDestCol1
- >> nDestRow1
- >> nDestCol2
- >> nDestRow2
- >> nDestTab;
-
- // Arrays immer ueber Set...Fields initalisieren!
-
- short nCount;
- PivotFieldArr aFieldArr;
-
- if( pDoc->GetSrcVersion() >= SC_DATABYTES2 )
- {
- rStream >> nCount;
- lcl_LoadFieldArr( rStream, aFieldArr, nCount );
- SetColFields(aFieldArr, nCount);
-
- rStream >> nCount;
- lcl_LoadFieldArr( rStream, aFieldArr, nCount );
- SetRowFields(aFieldArr, nCount);
-
- rStream >> nCount;
- lcl_LoadFieldArr( rStream, aFieldArr, nCount );
- SetDataFields(aFieldArr, nCount);
- }
- else
- {
- rStream >> nCount;
- lcl_LoadFieldArr30( rStream, aFieldArr, nCount );
- SetColFields(aFieldArr, nCount);
-
- rStream >> nCount;
- lcl_LoadFieldArr30( rStream, aFieldArr, nCount );
- SetRowFields(aFieldArr, nCount);
-
- rStream >> nCount;
- lcl_LoadFieldArr30( rStream, aFieldArr, nCount );
- SetDataFields(aFieldArr, nCount);
- }
-
- aQuery.Load( rStream );
-
- rStream >> bIgnoreEmpty;
- rStream >> bDetectCat;
-
- if (rHdr.BytesLeft())
- {
- rStream >> bMakeTotalCol; // ab 355i
- rStream >> bMakeTotalRow;
- }
-
- if (rHdr.BytesLeft()) // ab 500a
- {
- rStream.ReadByteString( aName, rStream.GetStreamCharSet() );
- rStream.ReadByteString( aTag, rStream.GetStreamCharSet() );
-
- DBG_ASSERT(!pColNames, "Spaltennamen schon gesetzt?");
- rStream >> nColNameCount;
- if (nColNameCount)
- {
- pColNames = new String[nColNameCount];
- for (SCCOL nCol=0; nCol<nColNameCount; nCol++)
- rStream.ReadByteString( pColNames[nCol], rStream.GetStreamCharSet() );
- }
- }
- // sonst wird hinterher aus ScPivotCollection::Load ein Name vergeben
-
- rHdr.EndEntry();
-#endif
- return TRUE;
-}
-
-BOOL ScPivot::Store( SvStream& /* rStream */, ScMultipleWriteHeader& rHdr ) const
-{
- rHdr.StartEntry();
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
-
- rStream << bHasHeader
-
- << nSrcCol1
- << nSrcRow1
- << nSrcCol2
- << nSrcRow2
- << nSrcTab
-
- << nDestCol1
- << nDestRow1
- << nDestCol2
- << nDestRow2
- << nDestTab
-
- << nColCount;
- lcl_SaveFieldArr( rStream, aColArr, nColCount );
- rStream << nRowCount;
- lcl_SaveFieldArr( rStream, aRowArr, nRowCount );
- rStream << nDataCount;
- lcl_SaveFieldArr( rStream, aDataArr, nDataCount );
-
- aQuery.Store( rStream );
-
- rStream << bIgnoreEmpty;
- rStream << bDetectCat;
-
- rStream << bMakeTotalCol; // ab 355i
- rStream << bMakeTotalRow;
-
- if( rStream.GetVersion() > SOFFICE_FILEFORMAT_40 ) // Name/Tag/Spalten ab 5.0
- {
- rStream.WriteByteString( aName, rStream.GetStreamCharSet() );
- rStream.WriteByteString( aTag, rStream.GetStreamCharSet() );
-
- if (!pColNames) ((ScPivot*)this)->nColNameCount = 0; // soll nicht sein
- rStream << nColNameCount;
- for (SCCOL nCol=0; nCol<nColNameCount; nCol++)
- rStream.WriteByteString( pColNames[nCol], rStream.GetStreamCharSet() );
- }
-
- rHdr.EndEntry();
-#endif
- return TRUE;
-}
-
-void ScPivot::SetQuery(const ScQueryParam& rQuery)
-{
- aQuery = rQuery;
-
- bValidArea = FALSE;
-}
-
-void ScPivot::GetQuery(ScQueryParam& rQuery) const
-{
- rQuery = aQuery;
-}
-
-void ScPivot::SetHeader(BOOL bHeader)
-{
- bHasHeader = bHeader;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetHeader() const
-{
- return bHasHeader;
-}
-
-void ScPivot::SetIgnoreEmpty(BOOL bIgnore)
-{
- bIgnoreEmpty = bIgnore;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetIgnoreEmpty() const
-{
- return bIgnoreEmpty;
-}
-
-void ScPivot::SetDetectCat(BOOL bDetect)
-{
- bDetectCat = bDetect;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetDetectCat() const
-{
- return bDetectCat;
-}
-
-void ScPivot::SetMakeTotalCol(BOOL bSet)
-{
- bMakeTotalCol = bSet;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetMakeTotalCol() const
-{
- return bMakeTotalCol;
-}
-
-void ScPivot::SetMakeTotalRow(BOOL bSet)
-{
- bMakeTotalRow = bSet;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetMakeTotalRow() const
-{
- return bMakeTotalRow;
-}
-
-void ScPivot::SetName(const String& rNew)
-{
- aName = rNew;
-}
-
-const String& ScPivot::GetName() const
-{
- return aName;
-}
-
-void ScPivot::SetTag(const String& rNew)
-{
- aTag = rNew;
-}
-
-const String& ScPivot::GetTag() const
-{
- return aTag;
-}
-
-void ScPivot::SetSrcArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab)
-{
- nSrcCol1 = Min(nCol1, (SCCOL)MAXCOL);
- nSrcRow1 = Min(nRow1, (SCROW)MAXROW);
- nSrcCol2 = Min(nCol2, (SCCOL)MAXCOL);
- nSrcRow2 = Min(nRow2, (SCROW)MAXROW);
- nSrcTab = nTab;
- bValidArea = FALSE;
-}
-
-void ScPivot::GetSrcArea(SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2, SCTAB& rTab) const
-{
- rCol1 = nSrcCol1;
- rRow1 = nSrcRow1;
- rCol2 = nSrcCol2;
- rRow2 = nSrcRow2;
- rTab = nSrcTab;
-}
-
-ScRange ScPivot::GetSrcArea() const
-{
- return ScRange( nSrcCol1,nSrcRow1,nSrcTab, nSrcCol2,nSrcRow2,nSrcTab );
-}
-
-void ScPivot::SetDestPos(SCCOL nCol, SCROW nRow, SCTAB nTab)
-{
- nDestCol1 = nCol;
- nDestRow1 = nRow;
- nDestTab = nTab;
- bValidArea = FALSE;
-}
-
-void ScPivot::GetDestArea(SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2, SCTAB& rTab) const
-{
- rCol1 = nDestCol1;
- rRow1 = nDestRow1;
- rTab = nDestTab;
- if (bValidArea)
- {
- rCol2 = nDestCol2;
- rRow2 = nDestRow2;
- }
- else
- {
- rCol2 = nDestCol1;
- rRow2 = nDestRow1;
- }
-}
-
-ScRange ScPivot::GetDestArea() const
-{
- ScAddress aStart( nDestCol1, nDestRow1, nDestTab );
- ScAddress aEnd = aStart;
- if ( bValidArea )
- aEnd = ScAddress( nDestCol2, nDestRow2, nDestTab );
- return ScRange( aStart, aEnd );
-}
-
-void ScPivot::MoveSrcArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab )
-{
- if ( nNewCol != nSrcCol1 || nNewRow != nSrcRow1 || nNewTab != nSrcTab )
- {
- SCsCOL nDiffX = nNewCol - (SCsCOL) nSrcCol1;
- SCsROW nDiffY = nNewRow - (SCsROW) nSrcRow1;
-
- nSrcTab = nNewTab;
- nSrcCol1 = sal::static_int_cast<SCCOL>( nSrcCol1 + nDiffX );
- nSrcCol2 = sal::static_int_cast<SCCOL>( nSrcCol2 + nDiffX );
- nSrcRow1 = sal::static_int_cast<SCROW>( nSrcRow1 + nDiffY );
- nSrcRow2 = sal::static_int_cast<SCROW>( nSrcRow2 + nDiffY );
-
- aQuery.nCol1 = sal::static_int_cast<SCCOL>( aQuery.nCol1 + nDiffX );
- aQuery.nCol2 = sal::static_int_cast<SCCOL>( aQuery.nCol2 + nDiffX );
- aQuery.nRow1 = sal::static_int_cast<SCROW>( aQuery.nRow1 + nDiffY );
- aQuery.nRow2 = sal::static_int_cast<SCROW>( aQuery.nRow2 + nDiffY );
-
- SCSIZE nEC = aQuery.GetEntryCount();
- for (SCSIZE i=0; i<nEC; i++)
- if (aQuery.GetEntry(i).bDoQuery)
- aQuery.GetEntry(i).nField += nDiffX;
-
- if (bValidArea)
- {
- SCSIZE nC;
- SCSIZE nR;
- for (nC=0; nC<nColCount; nC++)
- if (aColArr[nC].nCol != PIVOT_DATA_FIELD)
- aColArr[nC].nCol = sal::static_int_cast<SCsCOL>( aColArr[nC].nCol + nDiffX );
- for (nR=0; nR<nRowCount; nR++)
- if (aRowArr[nR].nCol != PIVOT_DATA_FIELD)
- aRowArr[nR].nCol = sal::static_int_cast<SCsCOL>( aRowArr[nR].nCol + nDiffX );
- for (nC=0; nC<nDataCount; nC++)
- if (aDataArr[nC].nCol != PIVOT_DATA_FIELD)
- aDataArr[nC].nCol = sal::static_int_cast<SCsCOL>( aDataArr[nC].nCol + nDiffX );
- }
- }
-}
-
-void ScPivot::ExtendSrcArea( SCCOL nNewEndCol, SCROW nNewEndRow )
-{
- DBG_ASSERT( nNewEndCol >= nSrcCol2 && nNewEndRow >= nSrcRow2, "ExtendSrcArea: zu klein" );
-
- nSrcCol2 = nNewEndCol;
- nSrcRow2 = nNewEndRow;
-
- // alles andere bleibt erhalten
-}
-
-void ScPivot::MoveDestArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab )
-{
- if ( nNewCol != nDestCol1 || nNewRow != nDestRow1 || nNewTab != nDestTab )
- {
- SCsCOL nDiffX = nNewCol - (SCsCOL) nDestCol1;
- SCsROW nDiffY = nNewRow - (SCsROW) nDestRow1;
-
- nDestTab = nNewTab;
- nDestCol1 = sal::static_int_cast<SCCOL>( nDestCol1 + nDiffX );
- nDestRow1 = sal::static_int_cast<SCROW>( nDestRow1 + nDiffY );
-
- if (bValidArea)
- {
- nDestCol2 = sal::static_int_cast<SCCOL>( nDestCol2 + nDiffX );
- nDestRow2 = sal::static_int_cast<SCROW>( nDestRow2 + nDiffY );
-
- nDataStartCol = sal::static_int_cast<SCCOL>( nDataStartCol + nDiffX );
- nDataStartRow = sal::static_int_cast<SCROW>( nDataStartRow + nDiffY );
- }
- }
-}
-
-void ScPivot::SetColFields(const PivotField* pFieldArr, SCSIZE nCount)
-{
- nColCount = Max(static_cast<SCSIZE>(0), Min(nCount, PIVOT_MAXFIELD));
- for (SCSIZE i = 0; i < nColCount; i++)
- {
- aColArr[i] = pFieldArr[i];
- aColArr[i].nFuncCount = 0;
- if (aColArr[i].nCol == PIVOT_DATA_FIELD)
- {
- aColArr[i].nFuncMask = PIVOT_FUNC_NONE;
- pDataList = pColList[i];
- bDataAtCol = TRUE;
- }
- else
- {
- for (SCsCOL j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto"
- if (aColArr[i].nFuncMask & nFuncMaskArr[j])
- aColArr[i].nFuncCount++;
- }
- }
- bValidArea = FALSE;
-}
-
-void ScPivot::GetColFields(PivotField* pFieldArr, SCSIZE& rCount) const
-{
- for (SCSIZE i=0; i<nColCount; i++)
- pFieldArr[i] = aColArr[i];
- rCount = nColCount;
-}
-
-void ScPivot::SetRowFields(const PivotField* pFieldArr, SCSIZE nCount)
-{
- nRowCount = Max(static_cast<SCSIZE>(0), Min(nCount, PIVOT_MAXFIELD));
- for (SCSIZE i = 0; i < nRowCount; i++)
- {
- aRowArr[i] = pFieldArr[i];
- aRowArr[i].nFuncCount = 0;
- if (aRowArr[i].nCol == PIVOT_DATA_FIELD)
- {
- aRowArr[i].nFuncMask = PIVOT_FUNC_NONE;
- pDataList = pRowList[i];
- bDataAtCol = FALSE;
- }
- else
- {
- for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto"
- if (aRowArr[i].nFuncMask & nFuncMaskArr[j])
- aRowArr[i].nFuncCount++;
- }
- }
- bValidArea = FALSE;
-}
-
-void ScPivot::GetRowFields(PivotField* pFieldArr, SCSIZE& rCount) const
-{
- for (SCSIZE i=0; i<nRowCount; i++)
- pFieldArr[i] = aRowArr[i];
- rCount = nRowCount;
-}
-
-void ScPivot::SetDataFields(const PivotField* pFieldArr, SCSIZE nCount)
-{
- USHORT nFuncNo;
- SCSIZE i;
-
- //
- // nDataCount vorausberechnen (wie unten)
- //
-
- nDataCount = 0;
- for (i = 0; i < nCount; i++)
- for (nFuncNo=0; nFuncNo<PIVOT_MAXFUNC; nFuncNo++)
- if (pFieldArr[i].nFuncMask & nFuncMaskArr[nFuncNo])
- if (nDataCount+1 < PIVOT_MAXFIELD)
- ++nDataCount;
-
- //
- // Eintraege anpassen
- //
-
- if ((nRowCount == 1) && (aRowArr[0].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- {
- aColArr[nColCount] = aRowArr[0];
- pDataList = pColList[nColCount];
- nColCount++;
- nRowCount--;
- bDataAtCol = TRUE;
- }
- if ((nColCount == 1) && (aColArr[0].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- {
- aRowArr[nRowCount] = aColArr[0];
- pDataList = pRowList[nRowCount];
- nRowCount++;
- nColCount--;
- bDataAtCol = FALSE;
- }
-
- if ((nDataCount == 1)
- && (aColArr[nColCount-1].nCol != PIVOT_DATA_FIELD)
- && (aColArr[nRowCount-1].nCol != PIVOT_DATA_FIELD))
- {
- if (bDataAtCol)
- {
- PivotField aField;
- SCSIZE nIndex = PIVOT_MAXFIELD;
- for (i=0; i<nColCount; i++)
- {
- if (aColArr[i].nCol == PIVOT_DATA_FIELD)
- {
- aField = aColArr[i];
- nIndex = i;
- }
- }
- DBG_ASSERT(nIndex < PIVOT_MAXFIELD, "no data field (GPF in old versions!)");
- if ( nIndex < PIVOT_MAXFIELD )
- {
- memcpy(&aColArr[nIndex], &aColArr[nIndex+1], (PIVOT_MAXFIELD - nIndex - 1) * sizeof(PivotField));
- aColArr[nColCount-1] = aField;
- pDataList = pColList[nColCount-1];
- }
- }
- else
- {
- PivotField aField;
- SCSIZE nIndex = PIVOT_MAXFIELD;
- for (i=0; i<nRowCount; i++)
- {
- if (aRowArr[i].nCol == PIVOT_DATA_FIELD)
- {
- aField = aRowArr[i];
- nIndex = i;
- }
- }
- DBG_ASSERT(nIndex < PIVOT_MAXFIELD, "no data field (GPF in old versions!)");
- if ( nIndex < PIVOT_MAXFIELD )
- {
- memcpy(&aRowArr[nIndex], &aRowArr[nIndex+1], (PIVOT_MAXFIELD - nIndex - 1) * sizeof(PivotField));
- aRowArr[nRowCount-1] = aField;
- pDataList = pRowList[nRowCount-1];
- }
- }
- }
-
- //
- // Datenfelder in Eintraege mit nur einer Funktion aufteilen
- //
-
- pDataList->FreeAll();
- nDataCount = 0;
- for (i = 0; i < nCount; i++)
- {
- for (nFuncNo=0; nFuncNo<PIVOT_MAXFUNC; nFuncNo++)
- if (pFieldArr[i].nFuncMask & nFuncMaskArr[nFuncNo])
- if (nDataCount+1 < PIVOT_MAXFIELD)
- {
- aDataArr[nDataCount] = pFieldArr[i];
- aDataArr[nDataCount].nFuncCount = 0;
- aDataArr[nDataCount].nFuncMask = nFuncMaskArr[nFuncNo];
-
- String aStr;
- pDoc->GetString(aDataArr[nDataCount].nCol, nSrcRow1, nSrcTab, aStr);
- if (aStr.Len() == 0)
- aStr = ScColToAlpha( aDataArr[nDataCount].nCol );
- TypedStrData* pStrData = new TypedStrData(aStr);
- if (!(pDataList->AtInsert(pDataList->GetCount(), pStrData)))
- {
- delete pStrData;
- DBG_ERROR("Fehler bei pDataList->AtInsert");
- }
-
- ++nDataCount;
- }
- }
-
- //
- //
- //
-
- bValidArea = FALSE;
-}
-
-void ScPivot::GetDataFields(PivotField* pFieldArr, SCSIZE& rCount) const
-{
-/* for (SCSIZE i=0; i<nDataCount; i++)
- pFieldArr[i] = aDataArr[i];
- rCount = nDataCount;
-*/
-
- rCount = 0;
- for (SCSIZE i=0; i<nDataCount; i++)
- {
- BOOL bFound = FALSE;
- for (SCSIZE j=0; j<rCount && !bFound; j++)
- if (pFieldArr[j].nCol == aDataArr[i].nCol)
- {
- // add to previous column only if new bits aren't already set there
- if ( ( pFieldArr[j].nFuncMask & aDataArr[i].nFuncMask ) == 0 )
- {
- pFieldArr[j].nFuncMask |= aDataArr[i].nFuncMask;
- pFieldArr[j].nFuncCount++;
- bFound = TRUE;
- }
- }
- if (!bFound)
- {
- pFieldArr[rCount] = aDataArr[i];
- ++rCount;
- }
- }
-}
-
-BOOL ScPivot::CreateData(BOOL bKeepDest)
-{
- //
- //
- //
-
- SCCOL nOldCol2 = nDestCol2;
- SCROW nOldRow2 = nDestRow2;
-
- pColRef = new PivotColRef[MAXCOL];
- aQuery.nCol1 = nSrcCol1;
- aQuery.nRow1 = nSrcRow1;
- aQuery.nCol2 = nSrcCol2;
- aQuery.nRow2 = nSrcRow2;
- aQuery.bHasHeader = bHasHeader;
- BOOL bRet = CreateFields();
- if (bRet)
- {
- SCSIZE i=0; // nDataMult berechnen - nach CreateFields, vor CreateFieldData !!!
- nDataMult = 1;
- if (nDataCount > 1)
- {
- if (bDataAtCol)
- {
- while (i<nColCount && aColArr[i].nCol != PIVOT_DATA_FIELD) i++;
- i++;
- while (i<nColCount)
- nDataMult *= pColList[i++]->GetCount();
- }
- else
- {
- while (i<nRowCount && aRowArr[i].nCol != PIVOT_DATA_FIELD) i++;
- i++;
- while (i<nRowCount)
- nDataMult *= pRowList[i++]->GetCount();
- }
- }
- DBG_ASSERT(nDataMult,"nDataMult==0");
-
- CalcArea();
- if ((ValidCol(nDestCol2)) && (ValidRow(nDestRow2)))
- {
- CreateFieldData();
- bValidArea = TRUE;
- }
- else
- bRet = FALSE;
- }
-
- if ( bKeepDest )
- {
- bValidArea = TRUE; //! ???
- nDestCol2 = nOldCol2;
- nDestRow2 = nOldRow2;
- }
-
- return bRet;
-}
-
-void ScPivot::DrawData()
-{
- ScProgress aProgress( pDoc->GetDocumentShell(), ScGlobal::GetRscString(STR_PIVOT_PROGRESS), nDestRow2-nDestRow1 );
-
- SCSIZE i;
-
- SCCOL nCol;
- SCROW nRow;
- String aStr;
- pDoc->pTab[nDestTab]->DeleteArea(nDestCol1, nDestRow1, nDestCol2, nDestRow2, IDF_ALL);
-
- if ( nDataStartRow > nDestRow1+nFirstLine )
- SetStyle(nDestCol1, nDestRow1+nFirstLine, nDestCol2, nDataStartRow-1, PIVOT_STYLE_TOP);
- SetStyle(nDataStartCol, nDataStartRow, nDestCol2, nDestRow2, PIVOT_STYLE_INNER);
-
- pDoc->SetString(nDestCol1, nDestRow1, nDestTab, ScGlobal::GetRscString(STR_CELL_FILTER));
- // Kategorie 1
- SetButton(nDestCol1, nDestRow1, nDestCol1, nDestRow1);
-
- if (bHasHeader) // Spalten / Zeilennamen ausgeben
- {
- if (nColCount != 0)
- {
- nCol = nDestCol1;
- nRow = nDataStartRow - 1;
- for (i=0; i<nColCount; i++)
- {
- if (aColArr[i].nCol != PIVOT_DATA_FIELD)
- {
- pDoc->GetString(aColArr[i].nCol, nSrcRow1, nSrcTab, aStr);
- if ( !aStr.Len() )
- aStr = ScColToAlpha( aColArr[i].nCol );
- pDoc->SetString(nCol, nRow, nDestTab, aStr);
- // Kategorie 2
- nCol++;
- }
- else if (nDataCount > 1)
- {
- pDoc->SetString(nCol, nRow, nDestTab, *pLabelData);
- // Kategorie 3
- nCol++;
- }
- }
- SetButton(nDestCol1, nRow, nCol-1, nRow);
- SetStyle(nDestCol1, nRow, nCol-1, nRow, PIVOT_STYLE_FIELDNAME);
- }
- if (nRowCount != 0)
- {
- nCol = nDataStartCol;
- nRow = nDestRow1 + nFirstLine;
- for (i=0; i<nRowCount; i++)
- {
- if (aRowArr[i].nCol != PIVOT_DATA_FIELD)
- {
- pDoc->GetString(aRowArr[i].nCol, nSrcRow1, nSrcTab, aStr);
- if ( !aStr.Len() )
- aStr = ScColToAlpha( aRowArr[i].nCol );
- pDoc->SetString(nCol, nRow, nDestTab, aStr);
- // Kategorie 4
- nCol++;
- }
- else if (nDataCount > 1)
- {
- pDoc->SetString(nCol, nRow, nDestTab, *pLabelData);
- // Kategorie 5
- nCol++;
- }
- }
- SetButton(nDataStartCol, nRow, nCol-1, nRow);
- SetStyle(nDataStartCol, nRow, nCol-1, nRow, PIVOT_STYLE_FIELDNAME);
- }
- }
-
- BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD );
- BOOL bNoCols = (nColCount == 0) || ( nColCount == 1 && aColArr[0].nCol == PIVOT_DATA_FIELD );
- if (!bMakeTotalCol) bNoRows = TRUE;
- if (!bMakeTotalRow) bNoCols = TRUE;
-
- SCCOL nTotalCol = nDestCol2;
- SCROW nTotalRow = nDestRow2;
- if (bDataAtCol)
- nTotalRow = sal::static_int_cast<SCROW>( nTotalRow - ( nDataCount - 1 ) );
- else
- nTotalCol = sal::static_int_cast<SCCOL>( nTotalCol - ( nDataCount - 1 ) );
-
- // Spaltenkoepfe ausgeben und ColRef initialisieren
- // (String-Collections sind initialisiert)
- nDataIndex = 0;
- nColIndex = 0;
- nCol = nDataStartCol;
- nRecCount = 0;
- RowToTable(0, nCol);
-
- // Zeilenkoepfe und Daten ausgeben
- // (ruft SetDataLine/SetFuncLine auf)
- nRowIndex = 0;
- nRow = nDataStartRow;
- ColToTable(0, nRow, aProgress);
-
- // Gesamtergebnis-Zeilen
-
- if (!bNoCols)
- {
- if (bDataAtCol)
- for (SCSIZE nTotCnt = 0; nTotCnt<nDataCount; nTotCnt++)
- SetFuncLine(nDataStartCol, nRow+nTotCnt, nDestTab,
- aDataArr[nTotCnt].nFuncMask, nTotCnt, 0, nDataRowCount);
- else
- SetFuncLine(nDataStartCol, nRow, nDestTab, PIVOT_FUNC_AUTO, SCSIZE_MAX, 0, nDataRowCount);
- }
-
-
- // Rahmen Spaltenergebnis
-
- if (!bNoRows)
- {
- if (!bDataAtCol)
- {
- for (i=0; i<nDataCount; i++)
- {
- String aLab = *pLabelTotal;
- aLab += ' ';
- aLab += *pLabel[lcl_MaskToIndex( aDataArr[i].nFuncMask )];
- aLab += ' ';
- aLab += pDataList->GetString(sal::static_int_cast<USHORT>(i));
- pDoc->SetString(sal::static_int_cast<SCCOL>(nTotalCol+i),
- sal::static_int_cast<SCROW>(nDestRow1 + nFirstLine), nDestTab, aLab);
- // Kategorie 6
- }
- }
- else
- {
- pDoc->SetString(nTotalCol, nDestRow1 + nFirstLine, nDestTab, *pLabelTotal);
- // Kategorie 7
- }
-
- if ( nDataStartRow > 0 )
- SetStyle(nTotalCol, nDestRow1+nFirstLine, nDestCol2, nDataStartRow-1, PIVOT_STYLE_TITLE);
- SetStyle(nTotalCol, nDataStartRow, nDestCol2, nDestRow2, PIVOT_STYLE_RESULT);
- SetFrame(nTotalCol, nDestRow1 + nFirstLine, nDestCol2, nDestRow2);
- }
-
- // Rahmen Zeilenergebnis
-
- if (!bNoCols)
- {
- if (bDataAtCol)
- {
- for (i=0; i<nDataCount; i++)
- {
- String aLab = *pLabelTotal;
- aLab += ' ';
- aLab += *pLabel[lcl_MaskToIndex( aDataArr[i].nFuncMask )];
- aLab += ' ';
- aLab += pDataList->GetString(sal::static_int_cast<USHORT>(i));
- pDoc->SetString(nDestCol1, nTotalRow+i, nDestTab, aLab);
- // Kategorie 8
- }
- }
- else
- {
- pDoc->SetString(nDestCol1, nTotalRow, nDestTab, *pLabelTotal);
- // Kategorie 9
- }
-
- if ( nDataStartCol > 0 )
- SetStyle(nDestCol1, nTotalRow, nDataStartCol-1, nDestRow2, PIVOT_STYLE_TITLE);
- SetStyle(nDataStartCol, nTotalRow, nDestCol2, nDestRow2, PIVOT_STYLE_RESULT);
- SetFrame(nDestCol1, nTotalRow, nDestCol2, nDestRow2);
- }
-
- // Rahmen gesamt
- SetFrame(nDestCol1, nDestRow1 + nFirstLine, nDestCol2, nDestRow2, 40);
-}
-
-void ScPivot::ReleaseData()
-{
- for (SCSIZE i = 0; i < PIVOT_MAXFIELD; i++)
- {
- pColList[i]->FreeAll();
- pRowList[i]->FreeAll();
- }
- if (ppDataArr)
- {
- for (SCSIZE i=0; i<nDataRowCount; i++)
- delete[] ppDataArr[i];
- delete[] ppDataArr;
- ppDataArr = NULL;
- }
- nDataColCount = 0;
- nDataRowCount = 0;
- delete[] pColRef;
- pColRef = NULL;
-}
-
-BOOL ScPivot::IsPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
- if (bValidArea)
- return ( nTab == nDestTab
- && nCol >= nDestCol1 && nCol <= nDestCol2
- && nRow >= nDestRow1 && nRow <= nDestRow2 );
- else
- return FALSE;
-}
-
-BOOL ScPivot::IsFilterAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
- if (bValidArea)
- return (nCol == nDestCol1 && nRow == nDestRow1 && nTab == nDestTab);
- else
- return FALSE;
-}
-
-BOOL ScPivot::GetColFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const
-{
- rField = 0;
- BOOL bRet = FALSE;
- if (bValidArea)
- {
- bRet = ( nCol >= nDestCol1 && nCol < nDataStartCol
- && nRow == nDataStartRow - 1
- && nTab == nDestTab );
- if (bRet)
- {
- rField = aColArr[nCol - nDestCol1].nCol;
- if (rField == PIVOT_DATA_FIELD)
- bRet = (nDataCount > 1);
- }
- }
- return bRet;
-}
-
-BOOL ScPivot::GetRowFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const
-{
- rField = 0;
- BOOL bRet = FALSE;
- if (bValidArea)
- {
- bRet = ( nCol >= nDataStartCol && nCol < sal::static_int_cast<SCCOL>(nDataStartCol + nRowCount)
- && nRow == nDestRow1 + nFirstLine
- && nTab == nDestTab );
- if (bRet)
- {
- rField = aRowArr[nCol - nDataStartCol].nCol;
- if (rField == PIVOT_DATA_FIELD)
- bRet = (nDataCount > 1);
- }
- }
- return bRet;
-}
-
-
-//--------------------------------------------------------------------------------------------------
-// Private Methoden
-//--------------------------------------------------------------------------------------------------
-
-BOOL ScPivot::CreateFields()
-{
- SCSIZE i;
- SCROW nRow;
- SCROW nHeader;
- String aStr;
- TypedStrData* pStrData;
- if (bHasHeader)
- nHeader = 1;
- else
- nHeader = 0;
-
- // Sortieren nach Benutzerdefinierte Listen ??
- for (i = 0; i < nColCount; i++)
- {
- if (aColArr[i].nCol != PIVOT_DATA_FIELD)
- {
- pDoc->GetString(aColArr[i].nCol, nSrcRow1 + nHeader, nSrcTab, aStr);
- pColList[i]->SetUserData(ScGlobal::GetUserList()->GetData(aStr));
- }
- else
- pColList[i]->SetUserData(NULL);
- }
- for (i = 0; i < nRowCount; i++)
- {
- if (aRowArr[i].nCol != PIVOT_DATA_FIELD)
- {
- pDoc->GetString(aRowArr[i].nCol, nSrcRow1 + nHeader, nSrcTab, aStr);
- pRowList[i]->SetUserData(ScGlobal::GetUserList()->GetData(aStr));
- }
- else
- pRowList[i]->SetUserData(NULL);
- }
-
- ScAddress aSrcAdr( nSrcCol1, 0, nSrcTab );
- for (nRow = nSrcRow1 + nHeader; nRow <= nSrcRow2; nRow++)
- {
- BOOL bValidLine = TRUE;
- if (bIgnoreEmpty)
- {
- aSrcAdr.SetRow( nRow );
- bValidLine = !lcl_IsEmptyLine( pDoc, aSrcAdr, nSrcCol2 );
- }
- if (bValidLine)
- bValidLine = pDoc->pTab[nSrcTab]->ValidQuery(nRow, aQuery);
- if (bValidLine)
- {
- // Sortierte Liste der Felder erzeugen
- //! statt GetCategoryString leere weglassen !
-
- for (i = 0; i < nColCount; i++)
- {
- if (aColArr[i].nCol != PIVOT_DATA_FIELD)
- {
- SCROW nCatRow = bDetectCat ? GetCategoryRow( aColArr[i].nCol, nRow ) : nRow;
- pStrData = new TypedStrData( pDoc, aColArr[i].nCol, nCatRow, nSrcTab, TRUE );
- if (!(pColList[i]->Insert(pStrData)))
- delete pStrData;
- }
- }
- for (i = 0; i < nRowCount; i++)
- {
- if (aRowArr[i].nCol != PIVOT_DATA_FIELD)
- {
- SCROW nCatRow = bDetectCat ? GetCategoryRow( aRowArr[i].nCol, nRow ) : nRow;
- pStrData = new TypedStrData( pDoc, aRowArr[i].nCol, nCatRow, nSrcTab, TRUE );
- if (!(pRowList[i]->Insert(pStrData)))
- delete pStrData;
- }
- }
- }
- }
- return TRUE;
-}
-
-void ScPivot::CreateFieldData()
-{
- SCSIZE* pRowListIndex = nRowCount ? new SCSIZE[nRowCount] : NULL;
- SCSIZE* pColListIndex = nColCount ? new SCSIZE[nColCount] : NULL;
-
- SCSIZE i,j,k;
-
- ppDataArr = new SubTotal*[nDataRowCount];
- for (i=0; i<nDataRowCount; i++)
- ppDataArr[i] = new SubTotal[nDataColCount];
-
- if (bDataAtCol)
- for (j=0; j<nDataRowCount; j++)
- for (i=0; i<nDataColCount; i++)
- ppDataArr[j][i].nIndex = j/nDataMult%nDataCount;
- else
- for (j=0; j<nDataRowCount; j++)
- for (i=0; i<nDataColCount; i++)
- ppDataArr[j][i].nIndex = i/nDataMult%nDataCount;
-
- SCROW nHeader;
- if (bHasHeader)
- nHeader = 1;
- else
- nHeader = 0;
- ScAddress aSrcAdr( nSrcCol1, 0, nSrcTab );
- for (SCROW nRow = nSrcRow1 + nHeader; nRow <= nSrcRow2; nRow++)
- {
- BOOL bValidLine = TRUE;
- if (bIgnoreEmpty)
- {
- aSrcAdr.SetRow( nRow );
- bValidLine = !lcl_IsEmptyLine( pDoc, aSrcAdr, nSrcCol2 );
- }
- if (bValidLine)
- bValidLine = pDoc->pTab[nSrcTab]->ValidQuery(nRow, aQuery);
- if (bValidLine)
- {
- // Indizes der Kategorien nur einmal ausserhalb nDataCount
- for (j=0; j<nRowCount; j++)
- if (aRowArr[j].nCol != PIVOT_DATA_FIELD)
- {
- SCROW nCatRow = bDetectCat ? GetCategoryRow( aRowArr[j].nCol, nRow ) : nRow;
- TypedStrData aStrData( pDoc, aRowArr[j].nCol, nCatRow, nSrcTab, TRUE );
- pRowListIndex[j] = pRowList[j]->GetIndex(&aStrData);
- }
- for (j=0; j<nColCount; j++)
- if (aColArr[j].nCol != PIVOT_DATA_FIELD)
- {
- SCROW nCatRow = bDetectCat ? GetCategoryRow( aColArr[j].nCol, nRow ) : nRow;
- TypedStrData aStrData( pDoc, aColArr[j].nCol, nCatRow, nSrcTab, TRUE );
- pColListIndex[j] = pColList[j]->GetIndex(&aStrData);
- }
-
- String aStr;
- SCSIZE nCIndex;
- SCSIZE nRIndex;
- SCSIZE nIndex;
- ScAddress aAdr( 0, nRow, nSrcTab );
-
- for (i=0; i<nDataCount; i++)
- {
- // ColIndex Berechnen
- nCIndex = 0;
- for (j=0; j<nRowCount; j++)
- {
- if (aRowArr[j].nCol == PIVOT_DATA_FIELD)
- nIndex = i;
- else
- nIndex = pRowListIndex[j];
- if (nIndex)
- {
- for (k=j+1; k<nRowCount; k++)
- nIndex *= pRowList[k]->GetCount();
- nCIndex += nIndex;
- }
- }
- // RowIndex Berechnen
- nRIndex = 0;
- for (j=0; j<nColCount; j++)
- {
- if (aColArr[j].nCol == PIVOT_DATA_FIELD)
- nIndex = i;
- else
- nIndex = pColListIndex[j];
- if (nIndex)
- {
- for (k=j+1; k<nColCount; k++)
- nIndex *= pColList[k]->GetCount();
- nRIndex += nIndex;
- }
- }
- // Daten eintragen
- if ((nCIndex < nDataColCount) && (nRIndex < nDataRowCount))
- {
- DBG_ASSERT(ppDataArr[nRIndex][nCIndex].nIndex == i, "falsch init.");
-
- ppDataArr[nRIndex][nCIndex].nIndex = i;
- aAdr.SetCol( aDataArr[i].nCol );
- CellType eCellType = pDoc->GetCellType( aAdr );
- if ((eCellType != CELLTYPE_NONE) && (eCellType != CELLTYPE_NOTE))
- {
- BOOL bValue = (eCellType == CELLTYPE_VALUE);
- if (eCellType == CELLTYPE_FORMULA)
- {
- ScBaseCell* pCell = pDoc->GetCell( aAdr );
- bValue = ((ScFormulaCell*)pCell)->IsValue();
- }
-
- if (bValue)
- {
- double nVal = pDoc->GetValue( aAdr );
- ppDataArr[nRIndex][nCIndex].Update(nVal);
- }
- else
- ppDataArr[nRIndex][nCIndex].UpdateNoVal(); // nur nCount
- }
- }
- }
- }
- }
-
- delete pColListIndex;
- delete pRowListIndex;
-}
-
-void ScPivot::CalcArea()
-{
- BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD );
- BOOL bNoCols = (nColCount == 0) || ( nColCount == 1 && aColArr[0].nCol == PIVOT_DATA_FIELD );
- if (!bMakeTotalCol) bNoRows = TRUE;
- if (!bMakeTotalRow) bNoCols = TRUE;
-
- // StartSpalte/StartZeile des Datenbereichs berechnen
- if (bDataAtCol)
- {
- if (nDataCount > 1)
- nDataStartCol = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount);
- else
- nDataStartCol = sal::static_int_cast<SCCOL>(nDestCol1 + Max(static_cast<SCSIZE>(0), nColCount - 1));
- }
- else
- nDataStartCol = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount);
- if (!bDataAtCol)
- {
- if (nDataCount > 1)
- nDataStartRow = nDestRow1 + nRowCount + nFirstLine + 1;
- else
- nDataStartRow = nDestRow1 + Max(static_cast<SCSIZE>(0), nRowCount - 1) + nFirstLine + 1;
- }
- else
- nDataStartRow = nDestRow1 + nRowCount + nFirstLine + 1;
-
- //
- // Groesse der PivotTabelle berechnen
- //
-
- if (nRowCount == 0 || (nRowCount==1 && aRowArr[0].nCol==PIVOT_DATA_FIELD && nDataCount==1))
- {
- nDataColCount = 1;
- if (nDataCount == 1)
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount - 1);
- else
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount);
- }
- else
- {
- SCSIZE nDx;
- // Anzahl Spalten
- if ((aRowArr[nRowCount-1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- nDx = 2;
- else
- nDx = 1;
- SCSIZE nColLines = pRowList[nRowCount-nDx]->GetCount(); // SCSIZE to recognize overflow
- nDataColCount = pRowList[nRowCount-nDx]->GetCount();
- for (SCSIZE i=nRowCount-nDx; i-- > 0; )
- {
- nColLines *= pRowList[i]->GetCount();
- nDataColCount *= pRowList[i]->GetCount();
- if (!bDataAtCol)
- nColLines += (pRowList[i]->GetCount() * aRowArr[i].nFuncCount * nDataCount);
- else
- nColLines += (pRowList[i]->GetCount() * aRowArr[i].nFuncCount);
- }
- /*
- // Ergebnisspalten des letzten Elements
- if (aRowArr[nRowCount-1].nCol != PIVOT_DATA_FIELD)
- nColLines += (pRowList[nRowCount-1]->GetCount() * aRowArr[nRowCount-1].nFuncCount);
- */
- if (nColLines > static_cast<SCSIZE>(MAXCOL))
- nDestCol2 = MAXCOL+2; // ungueltig, 1 wird unten abgezogen
- else if (bDataAtCol)
- {
- if (nDataCount > 1)
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount + nColLines);
- else
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + (nColCount - 1) + nColLines);
- if (!bMakeTotalCol)
- --nDestCol2;
- }
- else
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount + nColLines);
- }
-
- if (nColCount == 0 || (nColCount==1 && aColArr[0].nCol==PIVOT_DATA_FIELD && nDataCount==1))
- {
- nDataRowCount = 1;
- if (nDataCount == 1)
- nDestRow2 = nDestRow1 + (nRowCount - 1) + nFirstLine + 1;
- else
- nDestRow2 = nDestRow1 + nRowCount + nFirstLine + 1;
- }
- else
- {
- SCSIZE nDx;
- // Anzahl Zeilen
- if ((aColArr[nColCount-1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- nDx = 2;
- else
- nDx = 1;
- SCSIZE nRowLines = pColList[nColCount-nDx]->GetCount(); // SCSIZE to recognize overflow
- nDataRowCount = pColList[nColCount-nDx]->GetCount();
- for (SCSIZE i=nColCount-nDx; i-- > 0; )
- {
- nRowLines *= pColList[i]->GetCount();
- nDataRowCount *= pColList[i]->GetCount();
- if (bDataAtCol)
- nRowLines += (pColList[i]->GetCount() * aColArr[i].nFuncCount * nDataCount);
- else
- nRowLines += (pColList[i]->GetCount() * aColArr[i].nFuncCount);
- }
- /*
- // Ergebniszeilen des letzten Elements
- if (aColArr[nColCount-1].nCol != PIVOT_DATA_FIELD)
- nRowLines += (pColList[nColCount-1]->GetCount() * aColArr[nColCount-1].nFuncCount);
- */
- if (nRowLines > static_cast<SCSIZE>(MAXROW))
- nDestRow2 = MAXROW+2; // ungueltig, 1 wird unten abgezogen
- else if (!bDataAtCol)
- {
- if (nDataCount > 1)
- nDestRow2 = nDestRow1 + nRowCount + nRowLines + nFirstLine + 1;
- else
- nDestRow2 = nDestRow1 + (nRowCount - 1) + nRowLines + nFirstLine + 1;
- if (!bMakeTotalRow)
- --nDestRow2;
- }
- else
- nDestRow2 = nDestRow1 + nRowCount + nRowLines + nFirstLine + 1;
- }
-
- if (bDataAtCol)
- {
- if (!bNoCols)
- nDestRow2 += nDataCount;
- nDestRow2 --;
- }
- else
- {
- if (!bNoRows)
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol2 + nDataCount);
- nDestCol2 --;
- }
-}
-
-void ScPivot::SetDataLine(SCCOL nCol, SCROW nRow, SCTAB /* nTab */, SCSIZE nRIndex)
-{
- SCSIZE nCIndex2;
-
- SubTotal aGrandTotal[PIVOT_MAXFIELD]; // pro Daten-Feld
-
- for (SCSIZE i=0; i < nColIndex; i++)
- {
- SCSIZE nCIndex = pColRef[i].nDataIndex;
- if (nCIndex != sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF))
- {
-// if ( ppDataArr[nRIndex][nCIndex].GetCount() )
- {
- SCSIZE nDIndex = ppDataArr[nRIndex][nCIndex].nIndex;
- SetValue( sal::static_int_cast<SCCOL>(nCol+i), nRow, ppDataArr[nRIndex][nCIndex], aDataArr[nDIndex].nFuncMask );
- // Kategorie 18
-
- if (bDataAtCol)
- aGrandTotal[0].Update(ppDataArr[nRIndex][nCIndex]);
- else
- aGrandTotal[nDIndex].Update(ppDataArr[nRIndex][nCIndex]);
- }
- }
- else
- {
- SubTotal aTotal;
- SCSIZE k = i-1;
- while ((pColRef[k].nDataIndex == sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF)) && (k > 0))
- k--;
- for (SCSIZE j=k+1; (j-- > 0) && (pColRef[j].nRecCount > pColRef[i].nRecCount); )
- {
- nCIndex2 = pColRef[j].nDataIndex;
- if (nCIndex2 != sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF))
- {
- if ((pColRef[i].nIndex == ppDataArr[nRIndex][nCIndex2].nIndex) ||
- (pColRef[i].nIndex == SCSIZE_MAX))
- {
- aTotal.Update( ppDataArr[nRIndex][nCIndex2] );
- }
- }
- }
-
- USHORT nFunc = pColRef[i].nFuncMask;
- if (nFunc == PIVOT_FUNC_AUTO)
- nFunc = aDataArr[nRIndex/nDataMult%nDataCount].nFuncMask;
- SetValue( sal::static_int_cast<SCCOL>(nCol+i), nRow, aTotal, nFunc );
- // Kategorie 19
- }
- }
-
- BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD );
- if (!bMakeTotalCol) bNoRows = TRUE;
-
- if (!bNoRows)
- {
- if (bDataAtCol)
- {
- SetValue( nDestCol2, nRow, aGrandTotal[0], aDataArr[nRIndex/nDataMult%nDataCount].nFuncMask );
- // Kategorie 20
- }
- else
- {
- SCCOL nTotalCol = sal::static_int_cast<SCCOL>(nDestCol2 - nDataCount + 1);
- for (SCSIZE nTotCnt = 0; nTotCnt<nDataCount; nTotCnt++)
- {
- SetValue( sal::static_int_cast<SCCOL>(nTotalCol+nTotCnt), nRow, aGrandTotal[nTotCnt], aDataArr[nTotCnt].nFuncMask );
- // Kategorie 21
- }
- }
- }
-}
-
-void ScPivot::SetFuncLine(SCCOL nCol, SCROW nRow, SCTAB /* nTab */, USHORT nFunc, SCSIZE nIndex, SCSIZE nStartRIndex, SCSIZE nEndRIndex)
-{
- SCSIZE nSubtCount = 0;
- SubTotal aGrandTotal[PIVOT_MAXFIELD];
- USHORT nThisFunc = nFunc;
-
- for (SCSIZE i=0; i<nColIndex; i++)
- {
- SCSIZE nCIndex = pColRef[i].nDataIndex;
- if (nCIndex != sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF))
- {
- SubTotal aTotal;
- for (SCSIZE j = nStartRIndex; j < nEndRIndex; j++)
- {
- SCSIZE nDIndex = ppDataArr[j][nCIndex].nIndex;
- if ((nIndex == nDIndex) || (nIndex == SCSIZE_MAX))
- {
- aTotal.Update( ppDataArr[j][nCIndex] );
- }
- }
-
- if (bDataAtCol)
- aGrandTotal[0].Update( aTotal );
- else
- aGrandTotal[nCIndex/nDataMult%nDataCount].Update( aTotal ); //! immer ?
-
- if (nFunc == PIVOT_FUNC_AUTO)
- {
- if (bDataAtCol)
- {
- if (nIndex<nDataCount)
- nThisFunc = aDataArr[nIndex].nFuncMask;
- else
- {
- DBG_ERROR("wat fuer'n Index ???");
- }
- }
- else
- nThisFunc = aDataArr[nCIndex/nDataMult%nDataCount].nFuncMask;
- }
- SetValue( sal::static_int_cast<SCCOL>(nCol+i), nRow, aTotal, nThisFunc );
- // Kategorie 22
- }
- else
- { // Kreuzungspunkte kompatibel ?
-
- if ( nFunc == pColRef[i].nFuncMask )
- {
- SCSIZE nEffIndex = nIndex;
- if (nEffIndex == SCSIZE_MAX)
- {
- nEffIndex = nSubtCount % nDataCount;
- ++nSubtCount;
- }
- SubTotal aTotal;
-
- SCSIZE k = i-1;
- while ((pColRef[k].nDataIndex == sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF)) && (k > 0))
- k--;
- for (SCSIZE j=k+1; (j-- > 0) && (pColRef[j].nRecCount > pColRef[i].nRecCount); )
- {
- nCIndex = pColRef[j].nDataIndex;
- if (nCIndex != sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF))
- {
- for (SCSIZE nRIndex = nStartRIndex; nRIndex < nEndRIndex; nRIndex++)
- {
- SCSIZE nDIndex = ppDataArr[nRIndex][nCIndex].nIndex;
- if (nEffIndex == nDIndex)
- {
- aTotal.Update( ppDataArr[nRIndex][nCIndex] );
- }
- }
- }
- }
-
- if (nFunc == PIVOT_FUNC_AUTO)
- {
- if (nEffIndex<nDataCount)
- nThisFunc = aDataArr[nEffIndex].nFuncMask;
- else
- {
- DBG_ERROR("wat fuer'n Index ???");
- }
- }
- SetValue( sal::static_int_cast<SCCOL>(nCol+i), nRow, aTotal, nThisFunc );
- // Kategorie 23
- }
- }
- }
-
- BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD );
- if (!bMakeTotalCol) bNoRows = TRUE;
-
- if (!bNoRows)
- {
- if (bDataAtCol)
- {
- if (nFunc == PIVOT_FUNC_AUTO)
- {
- if (nIndex<nDataCount)
- nThisFunc = aDataArr[nIndex].nFuncMask;
- else
- {
- DBG_ERROR("wat fuer'n Index ???");
- }
- }
- SetValue( nDestCol2, nRow, aGrandTotal[0], nThisFunc );
- // Kategorie 24
- }
- else
- {
- SCCOL nTotalCol = sal::static_int_cast<SCCOL>(nDestCol2 - nDataCount + 1);
- for (SCSIZE nTotCnt = 0; nTotCnt<nDataCount; nTotCnt++)
- {
- if (nFunc == PIVOT_FUNC_AUTO)
- nThisFunc = aDataArr[nTotCnt%nDataCount].nFuncMask;
- SetValue( sal::static_int_cast<SCCOL>(nTotalCol+nTotCnt), nRow, aGrandTotal[nTotCnt], nThisFunc );
- // Kategorie 25
- }
- }
- }
-}
-
-void ScPivot::ColToTable(SCSIZE nField, SCROW& nRow, ScProgress& rProgress)
-{
- SCCOL nCol = sal::static_int_cast<SCCOL>(nDestCol1 + nField);
- if (nColCount == 0)
- {
-// SetDataLine(nCol + 1, nRow, nDestTab, nRowIndex);
- SetDataLine(nCol, nRow, nDestTab, nRowIndex);
- nRowIndex++;
- return;
- }
-
- SCSIZE nDx;
- if ((aColArr[nColCount -1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- nDx = 2;
- else
- nDx = 1;
- if (nField < nColCount - nDx)
- {
- for (USHORT i = 0; i < pColList[nField]->GetCount(); i++)
- {
- SCSIZE nSaveIndex = nRowIndex;
- String aStr = pColList[nField]->GetString(i);
- if (!aStr.Len()) aStr = ScGlobal::GetRscString(STR_EMPTYDATA);
- pDoc->SetString(nCol, nRow, nDestTab, aStr);
- // Kategorie 10
- SCROW nSaveRow = nRow;
- ColToTable(nField + 1, nRow, rProgress);
- SetStyle(nCol, nSaveRow, nCol, nRow - 1, PIVOT_STYLE_CATEGORY);
- SetFrame(nCol, nSaveRow, nCol, nRow - 1);
- if (aColArr[nField].nFuncCount > 0) // Zwischenergebnisse eingestellt?
- {
- nSaveRow = nRow;
- for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto"
- {
- if (aColArr[nField].nFuncMask & nFuncMaskArr[j])
- {
- String aLab;
- if (bDataAtCol)
- {
- for (SCSIZE k=0; k < nDataCount; k++)
- {
- String aDataStr = pDataList->GetString(sal::static_int_cast<USHORT>(k)); // always String
- aLab = aStr;
- SCSIZE nFuncType;
- if ( j==PIVOT_MAXFUNC )
- nFuncType = lcl_MaskToIndex( aDataArr[k].nFuncMask );
- else
- nFuncType = j;
- aLab += ' ';
- aLab += *pLabel[nFuncType];
- aLab += ' ';
- aLab += aDataStr;
- pDoc->SetString(nCol, nRow, nDestTab, aLab);
- // Kategorie 11
- SetFuncLine(nDataStartCol, nRow, nDestTab, nFuncMaskArr[j], k, nSaveIndex, nRowIndex);
- nRow++;
- }
- }
- else
- {
- aLab = aStr;
- aLab += ' ';
- aLab += *pLabel[j];
- pDoc->SetString(nCol, nRow, nDestTab, aLab);
- // Kategorie 12
- SetFuncLine(nDataStartCol, nRow, nDestTab, nFuncMaskArr[j], SCSIZE_MAX, nSaveIndex, nRowIndex);
- nRow++;
- }
- }
- }
- if ( nDataStartCol > 0 )
- SetStyle(nCol, nSaveRow, nDataStartCol-1, nRow-1, PIVOT_STYLE_TITLE);
- SetStyle(nDataStartCol, nSaveRow, nDestCol2, nRow-1, PIVOT_STYLE_RESULT);
- SetFrameHor(nCol, nSaveRow, nDestCol2, nRow-1);
- }
- nSaveIndex = nRowIndex;
- }
- }
- else if (nField < nColCount)
- {
- SCSIZE nCatCount = pColList[nField]->GetCount();
- SetStyle(nCol, nRow, nCol, nRow+nCatCount-1, PIVOT_STYLE_CATEGORY);
- SetFrame(nCol, nRow, nDestCol2, nRow+nCatCount-1);
- for (SCSIZE i = 0; i < nCatCount; i++)
- {
- String aTmpStr = pColList[nField]->GetString(sal::static_int_cast<USHORT>(i));
- if (!aTmpStr.Len()) aTmpStr = ScGlobal::GetRscString(STR_EMPTYDATA);
-
- String aPutStr;
- if (pColList[nField] == pDataList)
- {
- SCSIZE nFuncType = lcl_MaskToIndex( aDataArr[i].nFuncMask );
- aPutStr = *pLabel[nFuncType];
- aPutStr += ' ';
- aPutStr += aTmpStr;
- }
- else
- aPutStr += aTmpStr;
-
- pDoc->SetString(nCol, nRow, nDestTab, aPutStr);
- // Kategorie 13
- SetDataLine(nCol + 1, nRow, nDestTab, nRowIndex);
- nRowIndex++;
- nRow++;
-
- rProgress.SetState( nRow - nDestRow1 );
- }
- }
-}
-
-void ScPivot::RowToTable(SCSIZE nField, SCCOL& nCol)
-{
- nRecCount++;
- SCROW nRow = nDestRow1 + nFirstLine + nField + 1;
- if (nRowCount == 0)
- {
- pColRef[nColIndex].nDataIndex = nDataIndex;
- nColIndex++;
- nDataIndex++;
- return;
- }
-
- SCSIZE nDx;
- if ((aRowArr[nRowCount -1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- nDx = 2;
- else
- nDx = 1;
-
- if (nField < nRowCount - nDx)
- {
- for (USHORT i = 0; i < pRowList[nField]->GetCount(); i++)
- {
- String aStr = pRowList[nField]->GetString(i);
- if (!aStr.Len()) aStr = ScGlobal::GetRscString(STR_EMPTYDATA);
- pDoc->SetString(nCol, nRow, nDestTab, aStr);
- // Kategorie 14
- SCCOL nSaveCol = nCol;
- RowToTable(nField + 1, nCol);
- SetStyle(nSaveCol, nRow, nCol - 1, nRow, PIVOT_STYLE_CATEGORY);
- SetFrame(nSaveCol, nRow, nCol - 1, nRow);
- if (aRowArr[nField].nFuncCount > 0)
- {
- nSaveCol = nCol;
- for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto"
- {
- if (aRowArr[nField].nFuncMask & nFuncMaskArr[j])
- {
- String aLab;
- if (!bDataAtCol)
- {
- for (SCSIZE k=0; k < nDataCount; k++)
- {
- aLab = aStr;
- SCSIZE nFuncType;
- if ( j==PIVOT_MAXFUNC )
- nFuncType = lcl_MaskToIndex( aDataArr[k].nFuncMask );
- else
- nFuncType = j;
- aLab += ' ';
- aLab += *pLabel[nFuncType];
- aLab += ' ';
- aLab += pDataList->GetString(sal::static_int_cast<USHORT>(k));
- pDoc->SetString(nCol, nRow, nDestTab, aLab);
- // Kategorie 15
- pColRef[nColIndex].nDataIndex = PIVOT_FUNC_REF;
- pColRef[nColIndex].nRecCount = nRecCount;
- pColRef[nColIndex].nIndex = k;
- pColRef[nColIndex].nFuncMask = nFuncMaskArr[j];
- nColIndex++;
- nCol++;
- }
- }
- else
- {
- aLab = aStr;
- aLab += ' ';
- aLab += *pLabel[j];
- pDoc->SetString(nCol, nRow, nDestTab, aLab);
- // Kategorie 16
- pColRef[nColIndex].nDataIndex = PIVOT_FUNC_REF;
- pColRef[nColIndex].nRecCount = nRecCount;
- pColRef[nColIndex].nIndex = SCSIZE_MAX;
- pColRef[nColIndex].nFuncMask = nFuncMaskArr[j];
- nColIndex++;
- nCol++;
- }
- }
- }
- if ( nDataStartRow > 0 )
- SetStyle(nSaveCol, nRow,
- nCol-1, nDataStartRow-1, PIVOT_STYLE_TITLE);
- SetStyle(nSaveCol, nDataStartRow, nCol-1, nDestRow2, PIVOT_STYLE_RESULT);
- SetFrameVer(nSaveCol, nRow, nCol-1, nDestRow2);
- }
- }
- }
- else if (nField < nRowCount)
- {
- SCSIZE nCatCount = pRowList[nField]->GetCount();
- SetStyle(nCol, nRow, sal::static_int_cast<SCCOL>(nCol+nCatCount-1), nRow, PIVOT_STYLE_CATEGORY);
- SetFrame(nCol, nRow, sal::static_int_cast<SCCOL>(nCol+nCatCount-1), nDestRow2);
- for (SCSIZE i = 0; i < nCatCount; i++)
- {
- String aTmpStr = pRowList[nField]->GetString(sal::static_int_cast<USHORT>(i));
- if (!aTmpStr.Len()) aTmpStr = ScGlobal::GetRscString(STR_EMPTYDATA);
-
- String aPutStr;
- if (pRowList[nField] == pDataList)
- {
- SCSIZE nFuncType = lcl_MaskToIndex( aDataArr[i].nFuncMask );
- aPutStr = *pLabel[nFuncType];
- aPutStr += ' ';
- aPutStr += aTmpStr;
- }
- else
- aPutStr = aTmpStr;
-
- pDoc->SetString(nCol, nRow, nDestTab, aPutStr);
- // Kategorie 17
- pColRef[nColIndex].nDataIndex = nDataIndex;
- pColRef[nColIndex].nRecCount = nRecCount;
- pColRef[nColIndex].nIndex = SCSIZE_MAX;
- pColRef[nColIndex].nFuncMask = PIVOT_FUNC_NONE;
- nColIndex++;
- nDataIndex++;
- nCol++;
- }
- }
- nRecCount--;
-}
-
-SCROW ScPivot::GetCategoryRow( SCCOL nCol, SCROW nRow )
-{
- SCROW nMinRow = nSrcRow1;
- if (bHasHeader) ++nMinRow;
- BOOL bFound = FALSE;
- do
- {
- if ( !pDoc->HasData( nCol, nRow, nSrcTab ) && nRow>nMinRow )
- --nRow;
- else
- bFound = TRUE;
- }
- while (!bFound);
- return nRow;
-}
-
-#endif
diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx
index 20303f848b72..db02c921be98 100644
--- a/sc/source/core/data/pivot2.cxx
+++ b/sc/source/core/data/pivot2.cxx
@@ -64,432 +64,6 @@ using ::com::sun::star::sheet::DataPilotFieldReference;
// STATIC DATA -----------------------------------------------------------
-#if OLD_PIVOT_IMPLEMENTATION
-//--------------------------------------------------------------------------------------------------
-// Hilfsmethoden von ScPivot
-//--------------------------------------------------------------------------------------------------
-
-void ScPivot::SetFrame(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nWidth)
-{
- if (pDoc->pTab[nDestTab])
- {
- SvxBorderLine aLine;
- aLine.SetOutWidth(nWidth);
- SvxBoxItem aBox( ATTR_BORDER );
- aBox.SetLine(&aLine, BOX_LINE_LEFT);
- aBox.SetLine(&aLine, BOX_LINE_TOP);
- aBox.SetLine(&aLine, BOX_LINE_RIGHT);
- aBox.SetLine(&aLine, BOX_LINE_BOTTOM);
- SvxBoxInfoItem aBoxInfo( ATTR_BORDER_INNER );
- aBoxInfo.SetValid(VALID_HORI,FALSE);
- aBoxInfo.SetValid(VALID_VERT,FALSE);
- aBoxInfo.SetValid(VALID_DISTANCE,FALSE);
- pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2);
- }
-}
-
-void ScPivot::SetFrameHor(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- SvxBorderLine aLine;
- aLine.SetOutWidth(20);
- SvxBoxItem aBox( ATTR_BORDER );
- aBox.SetLine(&aLine, BOX_LINE_LEFT);
- aBox.SetLine(&aLine, BOX_LINE_TOP);
- aBox.SetLine(&aLine, BOX_LINE_RIGHT);
- aBox.SetLine(&aLine, BOX_LINE_BOTTOM);
- SvxBoxInfoItem aBoxInfo(ATTR_BORDER_INNER);
- aBoxInfo.SetValid(VALID_VERT,FALSE);
- aBoxInfo.SetValid(VALID_DISTANCE,FALSE);
- aBoxInfo.SetLine(&aLine, BOXINFO_LINE_HORI);
- pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2);
- }
-}
-
-void ScPivot::SetFrameVer(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- SvxBorderLine aLine;
- aLine.SetOutWidth(20);
- SvxBoxItem aBox( ATTR_BORDER );
- aBox.SetLine(&aLine, BOX_LINE_LEFT);
- aBox.SetLine(&aLine, BOX_LINE_TOP);
- aBox.SetLine(&aLine, BOX_LINE_RIGHT);
- aBox.SetLine(&aLine, BOX_LINE_BOTTOM);
- SvxBoxInfoItem aBoxInfo( ATTR_BORDER_INNER );
- aBoxInfo.SetValid(VALID_HORI,FALSE);
- aBoxInfo.SetValid(VALID_DISTANCE,FALSE);
- aBoxInfo.SetLine(&aLine, BOXINFO_LINE_VERT);
- pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2);
- }
-}
-
-void ScPivot::SetFontBold(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
- pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern);
- }
-}
-
-void ScPivot::SetJustifyLeft(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) );
- pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern);
- }
-}
-
-void ScPivot::SetJustifyRight(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY ) );
- pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern);
- }
-}
-
-void ScPivot::SetButton(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( ScMergeFlagAttr(SC_MF_BUTTON) );
- pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern);
- }
-}
-
-void ScPivot::SetStyle(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nId)
-{
- if ( nCol1 > nCol2 || nRow1 > nRow2 )
- return; // Falls Bereiche leer sind
-
- USHORT nStringId = 0;
- switch (nId)
- {
- case PIVOT_STYLE_INNER: nStringId = STR_PIVOT_STYLE_INNER; break;
- case PIVOT_STYLE_RESULT: nStringId = STR_PIVOT_STYLE_RESULT; break;
- case PIVOT_STYLE_CATEGORY: nStringId = STR_PIVOT_STYLE_CATEGORY; break;
- case PIVOT_STYLE_TITLE: nStringId = STR_PIVOT_STYLE_TITLE; break;
- case PIVOT_STYLE_FIELDNAME: nStringId = STR_PIVOT_STYLE_FIELDNAME; break;
- case PIVOT_STYLE_TOP: nStringId = STR_PIVOT_STYLE_TOP; break;
- default:
- DBG_ERROR("falsche ID bei ScPivot::SetStyle");
- return;
- }
- String aStyleName = ScGlobal::GetRscString(nStringId);
-
- ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool();
- ScStyleSheet* pStyle = (ScStyleSheet*) pStlPool->Find( aStyleName, SFX_STYLE_FAMILY_PARA );
- if (!pStyle)
- {
- // neu anlegen
-
- pStyle = (ScStyleSheet*) &pStlPool->Make( aStyleName, SFX_STYLE_FAMILY_PARA,
- SFXSTYLEBIT_USERDEF );
- pStyle->SetParent( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
- SfxItemSet& rSet = pStyle->GetItemSet();
- if ( nId==PIVOT_STYLE_RESULT || nId==PIVOT_STYLE_TITLE )
- rSet.Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
- if ( nId==PIVOT_STYLE_CATEGORY || nId==PIVOT_STYLE_TITLE )
- rSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) );
- }
-
- pDoc->pTab[nDestTab]->ApplyStyleArea( nCol1, nRow1, nCol2, nRow2, *pStyle );
-}
-
-void ScPivot::SetValue(SCCOL nCol, SCROW nRow, const SubTotal& rTotal, USHORT nFunc)
-{
- if ( rTotal.Valid( nFunc ) == 1)
- pDoc->SetValue(nCol, nRow, nDestTab, rTotal.Result( nFunc ));
- else if ( rTotal.Valid( nFunc ) == 0)
- pDoc->SetError(nCol, nRow, nDestTab, errNoValue);
-}
-
-//--------------------------------------------------------------------------------------------------
-
-void ScPivot::GetParam( ScPivotParam& rParam, ScQueryParam& rQuery, ScArea& rSrcArea ) const
-{
- SCSIZE nCount;
- SCCOL nDummyCol;
- SCROW nDummyRow;
- GetDestArea( rParam.nCol,rParam.nRow, nDummyCol,nDummyRow, rParam.nTab );
-
- // Row und Col in der Bedeutung vertauscht:
- GetRowFields( rParam.aColArr, nCount );
- rParam.nColCount = nCount;
- GetColFields( rParam.aRowArr, nCount );
- rParam.nRowCount = nCount;
- GetDataFields( rParam.aDataArr, nCount );
- rParam.nDataCount = nCount;
-
- rParam.bIgnoreEmptyRows = GetIgnoreEmpty();
- rParam.bDetectCategories = GetDetectCat();
- rParam.bMakeTotalCol = GetMakeTotalCol();
- rParam.bMakeTotalRow = GetMakeTotalRow();
-
- GetQuery(rQuery);
- GetSrcArea( rSrcArea.nColStart, rSrcArea.nRowStart,
- rSrcArea.nColEnd, rSrcArea.nRowEnd, rSrcArea.nTab );
-}
-
-void ScPivot::SetParam( const ScPivotParam& rParam, const ScQueryParam& rQuery,
- const ScArea& rSrcArea )
-{
- SetQuery( rQuery );
- SetHeader( TRUE );
- SetSrcArea( rSrcArea.nColStart, rSrcArea.nRowStart,
- rSrcArea.nColEnd, rSrcArea.nRowEnd, rSrcArea.nTab );
- SetDestPos( rParam.nCol, rParam.nRow, rParam.nTab );
- SetIgnoreEmpty( rParam.bIgnoreEmptyRows );
- SetDetectCat( rParam.bDetectCategories );
- SetMakeTotalCol( rParam.bMakeTotalCol );
- SetMakeTotalRow( rParam.bMakeTotalRow );
-
- // Row und Col in der Bedeutung vertauscht:
- SetRowFields( rParam.aColArr, rParam.nColCount );
- SetColFields( rParam.aRowArr, rParam.nRowCount );
- SetDataFields( rParam.aDataArr, rParam.nDataCount );
-}
-
-ScDataObject* ScPivot::Clone() const
-{
- return new ScPivot(*this);
-}
-
-//--------------------------------------------------------------------------------------------------
-// PivotScStrCollection
-//--------------------------------------------------------------------------------------------------
-
-ScDataObject* PivotScStrCollection::Clone() const
-{
- return new PivotScStrCollection(*this);
-}
-
-short PivotScStrCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
-{
- DBG_ASSERT(pKey1&&pKey2,"0-Zeiger bei PivotScStrCollection::Compare");
-
- short nResult = 0;
-
- TypedStrData& rData1 = (TypedStrData&)*pKey1;
- TypedStrData& rData2 = (TypedStrData&)*pKey2;
-
- if ( rData1.nStrType > rData2.nStrType )
- nResult = 1;
- else if ( rData1.nStrType < rData2.nStrType )
- nResult = -1;
- else if ( !rData1.nStrType /* && !rData2.nStrType */ )
- {
- // Zahlen vergleichen:
-
- if ( rData1.nValue == rData2.nValue )
- nResult = 0;
- else if ( rData1.nValue < rData2.nValue )
- nResult = -1;
- else
- nResult = 1;
- }
- else /* if ( rData1.nStrType && rData2.nStrType ) */
- {
- // Strings vergleichen:
-
- if (pUserData)
- nResult = sal::static_int_cast<short>(pUserData->ICompare(rData1.aStrValue, rData2.aStrValue));
- else
- {
- nResult = (short) ScGlobal::pTransliteration->compareString(
- rData1.aStrValue, rData2.aStrValue );
- }
- }
-
- return nResult;
-}
-
-USHORT PivotScStrCollection::GetIndex(TypedStrData* pData) const
-{
- USHORT nIndex = 0;
- if (!Search(pData, nIndex))
- nIndex = 0;
- return nIndex;
-}
-
-//--------------------------------------------------------------------------------------------------
-// PivotCollection
-//--------------------------------------------------------------------------------------------------
-
-String ScPivotCollection::CreateNewName( USHORT nMin ) const
-{
- String aBase( RTL_CONSTASCII_USTRINGPARAM("DataPilot") );
- //! from Resource?
-
- for (USHORT nAdd=0; nAdd<=nCount; nAdd++) // nCount+1 Versuche
- {
- String aNewName = aBase;
- aNewName += String::CreateFromInt32( nMin + nAdd );
- BOOL bFound = FALSE;
- for (USHORT i=0; i<nCount && !bFound; i++)
- if (((ScPivot*)pItems[i])->GetName() == aNewName)
- bFound = TRUE;
- if (!bFound)
- return aNewName; // freien Namen gefunden
- }
- return String(); // sollte nicht vorkommen
-}
-
-ScPivot* ScPivotCollection::GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
- if (pItems)
- {
- for (USHORT i = 0; i < nCount; i++)
- if (((ScPivot*)pItems[i])->IsPivotAtCursor(nCol, nRow, nTab))
- {
- return (ScPivot*)pItems[i];
- }
- }
- return NULL;
-}
-
-BOOL ScPivotCollection::Load(SvStream& rStream)
-{
- BOOL bSuccess = TRUE;
- USHORT nNewCount, i;
- FreeAll();
-
- ScMultipleReadHeader aHdr( rStream );
-
- rStream >> nNewCount;
- for (i=0; i<nNewCount && bSuccess; i++)
- {
- ScPivot* pPivot = new ScPivot( pDoc );
- if (pPivot)
- {
- bSuccess = pPivot->Load(rStream, aHdr);
- Insert( pPivot );
- }
- else
- bSuccess = FALSE;
- }
-
- // fuer alte Dateien: eindeutige Namen vergeben
-
- if (bSuccess)
- for (i=0; i<nCount; i++)
- if (!((const ScPivot*)At(i))->GetName().Len())
- ((ScPivot*)At(i))->SetName( CreateNewName() );
-
- return bSuccess;
-}
-
-BOOL ScPivotCollection::Store(SvStream& rStream) const
-{
- BOOL bSuccess = TRUE;
-
- ScMultipleWriteHeader aHdr( rStream );
-
- rStream << nCount;
-
- for (USHORT i=0; i<nCount && bSuccess; i++)
- bSuccess = ((const ScPivot*)At(i))->Store( rStream, aHdr );
-
- return bSuccess;
-}
-
-void ScPivotCollection::UpdateReference(UpdateRefMode eUpdateRefMode,
- SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
- SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
-{
- for (USHORT i=0; i<nCount; i++)
- {
- SCCOL theCol1;
- SCROW theRow1;
- SCTAB theTab1;
- SCCOL theCol2;
- SCROW theRow2;
- SCTAB theTab2;
- ScRefUpdateRes eRes;
- ScPivot* pPivot = (ScPivot*)pItems[i];
-
- // Source
-
- pPivot->GetSrcArea( theCol1, theRow1, theCol2, theRow2, theTab1 );
- theTab2 = theTab1;
-
- eRes = ScRefUpdate::Update( pDoc, eUpdateRefMode,
- nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz,
- theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 );
-
- if (eRes != UR_NOTHING)
- pPivot->MoveSrcArea( theCol1, theRow1, theTab1 );
-
- // Dest
-
- pPivot->GetDestArea( theCol1, theRow1, theCol2, theRow2, theTab1 );
- theTab2 = theTab1;
-
- eRes = ScRefUpdate::Update( pDoc, eUpdateRefMode,
- nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz,
- theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 );
-
- if (eRes != UR_NOTHING)
- pPivot->MoveDestArea( theCol1, theRow1, theTab1 );
- }
-}
-
-void ScPivotCollection::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
-{
- // nur Quell-Bereich
-
- for (USHORT i=0; i<nCount; i++)
- {
- ScPivot* pPivot = (ScPivot*)pItems[i];
- ScRange aSrc = pPivot->GetSrcArea();
- ScRefUpdateRes eRes = ScRefUpdate::DoGrow( rArea, nGrowX, nGrowY, aSrc );
- if (eRes != UR_NOTHING)
- pPivot->ExtendSrcArea( aSrc.aEnd.Col(), aSrc.aEnd.Row() );
- }
-}
-
-BOOL ScPivotCollection::operator==(const ScPivotCollection& rCmp) const
-{
- if (nCount != rCmp.nCount)
- return FALSE;
-
- if (!nCount)
- return TRUE; // beide leer - nicht erst die Param's anlegen!
-
- ScPivotParam aMyParam, aCmpParam;
- ScQueryParam aMyQuery, aCmpQuery;
- ScArea aMyArea, aCmpArea;
-
- for (USHORT i=0; i<nCount; i++)
- {
- ScPivot* pMyPivot = (ScPivot*)pItems[i];
- pMyPivot->GetParam( aMyParam, aMyQuery, aMyArea );
- ScPivot* pCmpPivot = (ScPivot*)rCmp.pItems[i];
- pCmpPivot->GetParam( aCmpParam, aCmpQuery, aCmpArea );
- if (!( aMyArea==aCmpArea && aMyParam==aCmpParam && aMyQuery==aCmpQuery ))
- return FALSE;
- }
-
- return TRUE;
-}
-
-ScDataObject* ScPivotCollection::Clone() const
-{
- return new ScPivotCollection(*this);
-}
-
-#endif
-
// ============================================================================
LabelData::LabelData( const String& rName, short nCol, bool bIsValue ) :
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/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 22926f31d003..ca78acc8a1e0 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -95,10 +95,10 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument )
//------------------------------------------------------------------------
-void ScStyleSheetPool::SetForceStdName( const String* pSet )
-{
- pForceStdName = pSet;
-}
+//UNUSED2009-05 void ScStyleSheetPool::SetForceStdName( const String* pSet )
+//UNUSED2009-05 {
+//UNUSED2009-05 pForceStdName = pSet;
+//UNUSED2009-05 }
//------------------------------------------------------------------------
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 03b9fc9d90be..ff6caa2da1bd 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 -----------------------------------------------------------
@@ -132,7 +133,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 ),
@@ -140,6 +141,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
pOutlineTable( NULL ),
bTableAreaValid( FALSE ),
bVisible( TRUE ),
+ bPendingRowHeights( FALSE ),
nTab( nNewTab ),
nRecalcLvl( 0 ),
pDocument( pDoc ),
@@ -249,6 +251,11 @@ void ScTable::SetVisible( BOOL bVis )
bVisible = bVis;
}
+void ScTable::SetPendingRowHeights( BOOL bSet )
+{
+ bPendingRowHeights = bSet;
+}
+
void ScTable::SetLayoutRTL( BOOL bSet )
{
bLayoutRTL = bSet;
@@ -863,6 +870,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;
@@ -905,7 +916,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;
@@ -934,7 +946,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;
@@ -1095,6 +1108,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 )
{
@@ -1444,11 +1458,11 @@ void ScTable::AddPrintRange( const ScRange& rNew )
aPrintRanges.push_back( rNew );
}
-void ScTable::SetPrintRange( const ScRange& rNew )
-{
- ClearPrintRanges();
- AddPrintRange( rNew );
-}
+//UNUSED2009-05 void ScTable::SetPrintRange( const ScRange& rNew )
+//UNUSED2009-05 {
+//UNUSED2009-05 ClearPrintRanges();
+//UNUSED2009-05 AddPrintRange( rNew );
+//UNUSED2009-05 }
void ScTable::SetPrintEntireSheet()
{
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 5b726467c3ba..daaf2d56b193 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 );
}
@@ -830,13 +837,13 @@ void ScTable::PutCell( const ScAddress& rPos, ScBaseCell* pCell )
}
-void ScTable::PutCell( const ScAddress& rPos, ULONG nFormatIndex, ScBaseCell* pCell )
-{
- if (pCell)
- aCol[rPos.Col()].Insert( rPos.Row(), nFormatIndex, pCell );
- else
- aCol[rPos.Col()].Delete( rPos.Row() );
-}
+//UNUSED2009-05 void ScTable::PutCell( const ScAddress& rPos, ULONG nFormatIndex, ScBaseCell* pCell )
+//UNUSED2009-05 {
+//UNUSED2009-05 if (pCell)
+//UNUSED2009-05 aCol[rPos.Col()].Insert( rPos.Row(), nFormatIndex, pCell );
+//UNUSED2009-05 else
+//UNUSED2009-05 aCol[rPos.Col()].Delete( rPos.Row() );
+//UNUSED2009-05 }
BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString )
@@ -900,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 );
}
@@ -919,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 ))
@@ -1156,22 +1182,22 @@ BOOL ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USH
}
-BOOL ScTable::HasLines( const ScRange& rRange, Rectangle& rSizes ) const
-{
- SCCOL nCol1 = rRange.aStart.Col();
- SCROW nRow1 = rRange.aStart.Row();
- SCCOL nCol2 = rRange.aEnd.Col();
- SCROW nRow2 = rRange.aEnd.Row();
- PutInOrder( nCol1, nCol2 );
- PutInOrder( nRow1, nRow2 );
-
- BOOL bFound = FALSE;
- for (SCCOL i=nCol1; i<=nCol2; i++)
- if (aCol[i].HasLines( nRow1, nRow2, rSizes, (i==nCol1), (i==nCol2) ))
- bFound = TRUE;
-
- return bFound;
-}
+//UNUSED2009-05 BOOL ScTable::HasLines( const ScRange& rRange, Rectangle& rSizes ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 SCCOL nCol1 = rRange.aStart.Col();
+//UNUSED2009-05 SCROW nRow1 = rRange.aStart.Row();
+//UNUSED2009-05 SCCOL nCol2 = rRange.aEnd.Col();
+//UNUSED2009-05 SCROW nRow2 = rRange.aEnd.Row();
+//UNUSED2009-05 PutInOrder( nCol1, nCol2 );
+//UNUSED2009-05 PutInOrder( nRow1, nRow2 );
+//UNUSED2009-05
+//UNUSED2009-05 BOOL bFound = FALSE;
+//UNUSED2009-05 for (SCCOL i=nCol1; i<=nCol2; i++)
+//UNUSED2009-05 if (aCol[i].HasLines( nRow1, nRow2, rSizes, (i==nCol1), (i==nCol2) ))
+//UNUSED2009-05 bFound = TRUE;
+//UNUSED2009-05
+//UNUSED2009-05 return bFound;
+//UNUSED2009-05 }
BOOL ScTable::HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const
@@ -1457,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)
{
@@ -1524,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)
{
@@ -1918,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] );
@@ -1947,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 );
@@ -1969,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");
@@ -2235,6 +2264,7 @@ void ScTable::ShowCol(SCCOL nCol, BOOL bShow)
if (bWasVis != bShow)
{
nRecalcLvl++;
+ InitializeNoteCaptions();
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
{
@@ -2272,6 +2302,7 @@ void ScTable::ShowRow(SCROW nRow, BOOL bShow)
if (bWasVis != bShow)
{
nRecalcLvl++;
+ InitializeNoteCaptions();
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
{
@@ -2307,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();
@@ -2348,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;
@@ -2400,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;
@@ -2667,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 ) ==
@@ -2698,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/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 0a33ab111f50..443474060c3e 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 ),
@@ -952,13 +953,6 @@ ScValidationData* ScValidationDataList::GetData( sal_uInt32 nKey )
return NULL;
}
-void ScValidationDataList::ResetUsed()
-{
- USHORT nCount = Count();
- for (USHORT i=0; i<nCount; i++)
- (*this)[i]->SetUsed(FALSE);
-}
-
void ScValidationDataList::CompileXML()
{
USHORT nCount = Count();
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/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx
index 0461578db0a6..6ecc67259463 100644
--- a/sc/source/core/inc/refupdat.hxx
+++ b/sc/source/core/inc/refupdat.hxx
@@ -82,7 +82,7 @@ public:
ScComplexRefData& rRef, BOOL bWrap, BOOL bAbsolute );
static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
- ScComplexRefData& rRef );
+ SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef );
/// Before calling, the absolute references must be up-to-date!
static ScRefUpdateRes UpdateTranspose( ScDocument* pDoc,
@@ -96,11 +96,6 @@ public:
static ScRefUpdateRes UpdateGrow(
const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY,
ScComplexRefData& rRef );
-
-#if OLD_PIVOT_IMPLEMENTATION
- static ScRefUpdateRes DoGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY,
- ScRange& rRef );
-#endif
};
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 8b13374fe501..8bfeaaa72289 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -59,13 +59,13 @@ ScAddress::Details::Details ( const ScDocument* pDoc,
{
}
-void ScAddress::Details::SetPos ( const ScDocument* pDoc,
- const ScAddress & rAddr )
-{
- nRow = rAddr.Row();
- nCol = rAddr.Col();
- eConv = pDoc->GetAddressConvention();
-}
+//UNUSED2009-05 void ScAddress::Details::SetPos ( const ScDocument* pDoc,
+//UNUSED2009-05 const ScAddress & rAddr )
+//UNUSED2009-05 {
+//UNUSED2009-05 nRow = rAddr.Row();
+//UNUSED2009-05 nCol = rAddr.Col();
+//UNUSED2009-05 eConv = pDoc->GetAddressConvention();
+//UNUSED2009-05 }
////////////////////////////////////////////////////////////////////////////
@@ -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/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index fff3122052bd..9873ea42ff13 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -616,34 +616,34 @@ ScChartPositionMap::~ScChartPositionMap()
}
-ScRangeListRef ScChartPositionMap::GetColRanges( SCCOL nChartCol ) const
-{
- ScRangeListRef xRangeList = new ScRangeList;
- if ( nChartCol < nColCount )
- {
- ULONG nStop = GetIndex( nChartCol, nRowCount );
- for ( ULONG nIndex = GetIndex( nChartCol, 0 ); nIndex < nStop; nIndex++ )
- {
- if ( ppData[ nIndex ] )
- xRangeList->Join( *ppData[ nIndex ] );
- }
- }
- return xRangeList;
-}
-
-
-ScRangeListRef ScChartPositionMap::GetRowRanges( SCROW nChartRow ) const
-{
- ScRangeListRef xRangeList = new ScRangeList;
- if ( nChartRow < nRowCount )
- {
- ULONG nStop = GetIndex( nColCount, nChartRow );
- for ( ULONG nIndex = GetIndex( 0, nChartRow ); nIndex < nStop;
- nIndex += nRowCount )
- {
- if ( ppData[ nIndex ] )
- xRangeList->Join( *ppData[ nIndex ] );
- }
- }
- return xRangeList;
-}
+//UNUSED2009-05 ScRangeListRef ScChartPositionMap::GetColRanges( SCCOL nChartCol ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 ScRangeListRef xRangeList = new ScRangeList;
+//UNUSED2009-05 if ( nChartCol < nColCount )
+//UNUSED2009-05 {
+//UNUSED2009-05 ULONG nStop = GetIndex( nChartCol, nRowCount );
+//UNUSED2009-05 for ( ULONG nIndex = GetIndex( nChartCol, 0 ); nIndex < nStop; nIndex++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( ppData[ nIndex ] )
+//UNUSED2009-05 xRangeList->Join( *ppData[ nIndex ] );
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return xRangeList;
+//UNUSED2009-05 }
+
+
+//UNUSED2009-05 ScRangeListRef ScChartPositionMap::GetRowRanges( SCROW nChartRow ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 ScRangeListRef xRangeList = new ScRangeList;
+//UNUSED2009-05 if ( nChartRow < nRowCount )
+//UNUSED2009-05 {
+//UNUSED2009-05 ULONG nStop = GetIndex( nColCount, nChartRow );
+//UNUSED2009-05 for ( ULONG nIndex = GetIndex( 0, nChartRow ); nIndex < nStop;
+//UNUSED2009-05 nIndex += nRowCount )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( ppData[ nIndex ] )
+//UNUSED2009-05 xRangeList->Join( *ppData[ nIndex ] );
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return xRangeList;
+//UNUSED2009-05 }
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 5f1213e79b35..22d996dd701f 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -157,29 +157,6 @@ ScChangeAction::ScChangeAction( ScChangeActionType eTypeP, const ScBigRange& rRa
aDateTime.ConvertToUTC();
}
-ScChangeAction::ScChangeAction( SvStream& rStrm, ScMultipleReadHeader& /* rHdr */,
- ScChangeTrack* /* pTrack */ )
- :
- pNext( NULL ),
- pPrev( NULL ),
- pLinkAny( NULL ),
- pLinkDeletedIn( NULL ),
- pLinkDeleted( NULL ),
- pLinkDependent( NULL )
-{
- // ScChangeTrack speichert aUser als Index auf Collection und eType selber
- UINT32 n32;
- UINT16 n16;
- rStrm >> aBigRange;
- rStrm >> n32; aDateTime.SetDate( n32 );
- rStrm >> n32; aDateTime.SetTime( n32 );
- rStrm >> n32; nAction = n32;
- rStrm >> n32; nRejectAction = n32;
- rStrm >> n16; eState = (ScChangeActionState) n16;
- rStrm.ReadByteString( aComment, rStrm.GetStreamCharSet() );
- // LinkEntries in zweiter Runde
-}
-
ScChangeAction::~ScChangeAction()
{
@@ -187,40 +164,6 @@ ScChangeAction::~ScChangeAction()
}
-BOOL ScChangeAction::Store( SvStream& rStrm, ScMultipleWriteHeader& /* rHdr */ ) const
-{
- // ScChangeTrack speichert aUser als Index auf Collection und eType selber
- rStrm << aBigRange;
- rStrm << (UINT32) aDateTime.GetDate();
- rStrm << (UINT32) aDateTime.GetTime();
- rStrm << (UINT32) nAction;
- rStrm << (UINT32) nRejectAction;
- rStrm << (UINT16) eState;
- rStrm.WriteByteString( aComment, rStrm.GetStreamCharSet() );
- // LinkEntries in zweiter Runde
-
- return TRUE;
-}
-
-
-BOOL ScChangeAction::StoreLinks( SvStream& rStrm ) const
-{
- BOOL bOk = ScChangeAction::StoreLinkChain( pLinkDeleted, rStrm );
- bOk &= ScChangeAction::StoreLinkChain( pLinkDependent, rStrm );
- return bOk;
-}
-
-
-BOOL ScChangeAction::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrack )
-{
- BOOL bOk = ScChangeAction::LoadLinkChain( this, &pLinkDeleted, rStrm,
- pTrack, TRUE );
- bOk &= ScChangeAction::LoadLinkChain( this, &pLinkDependent, rStrm,
- pTrack, FALSE );
- return bOk;
-}
-
-
BOOL ScChangeAction::IsVisible() const
{
//! sequence order of execution is significant
@@ -682,159 +625,6 @@ void ScChangeAction::RejectRestoreContents( ScChangeTrack* pTrack,
}
-// static
-void ScChangeAction::StoreCell( ScBaseCell* /* pCell */, SvStream& /* rStrm */,
- ScMultipleWriteHeader& /* rHdr */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- if ( pCell )
- {
- CellType eCellType = pCell->GetCellType();
- switch( eCellType )
- {
- case CELLTYPE_VALUE:
- rStrm << (BYTE) eCellType;
- ((ScValueCell*)pCell)->Save( rStrm );
- break;
- case CELLTYPE_STRING:
- rStrm << (BYTE) eCellType;
- ((ScStringCell*)pCell)->Save( rStrm );
- break;
- case CELLTYPE_EDIT:
- rStrm << (BYTE) eCellType;
- ((ScEditCell*)pCell)->Save( rStrm );
- break;
- case CELLTYPE_FORMULA:
- rStrm << (BYTE) eCellType;
- rStrm << ((ScFormulaCell*)pCell)->aPos;
- ((ScFormulaCell*)pCell)->Save( rStrm, rHdr );
- break;
- default:
- DBG_ERROR( "ScChangeAction::StoreCell: unknown CellType" );
- rStrm << (BYTE) CELLTYPE_NONE;
- }
- }
- else
- rStrm << (BYTE) CELLTYPE_NONE;
-#endif // SC_ROWLIMIT_STREAM_ACCESS
-}
-
-
-// static
-ScBaseCell* ScChangeAction::LoadCell( SvStream& /* rStrm */,
- ScMultipleReadHeader& /* rHdr */, ScDocument* /* pDoc */, USHORT /* nVer */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- ScBaseCell* pCell;
- BYTE nByte;
- rStrm >> nByte;
- switch ( (CellType) nByte )
- {
- case CELLTYPE_VALUE:
- {
- pCell = new ScValueCell( rStrm, nVer );
- }
- break;
- case CELLTYPE_STRING:
- {
- pCell = new ScStringCell( rStrm, nVer );
- }
- break;
- case CELLTYPE_EDIT:
- {
- pCell = new ScEditCell( rStrm, nVer, pDoc );
- }
- break;
- case CELLTYPE_FORMULA:
- {
- ScAddress aPos;
- rStrm >> aPos;
- pCell = new ScFormulaCell( pDoc, aPos, rStrm, rHdr );
- ((ScFormulaCell*)pCell)->SetInChangeTrack( TRUE );
- }
- break;
- case CELLTYPE_NONE :
- pCell = NULL;
- break;
- default:
- DBG_ERROR( "ScChangeAction::LoadCell: unknown CellType" );
- rStrm.SetError( SVSTREAM_FILEFORMAT_ERROR );
- pCell = NULL;
- }
- return pCell;
-#else
- return 0;
-#endif // SC_ROWLIMIT_STREAM_ACCESS
-}
-
-
-// static
-BOOL ScChangeAction::StoreLinkChain( ScChangeActionLinkEntry* pLinkFirst,
- SvStream& rStrm )
-{
- BOOL bOk = TRUE;
- UINT32 nCount = 0;
- if ( pLinkFirst )
- {
- // rueckwaerts speichern, damit onLoad mit Insert die Reihenfolge wieder stimmt
- Stack* pStack = new Stack;
- for ( ScChangeActionLinkEntry* pL = pLinkFirst; pL; pL = pL->GetNext() )
- {
- ++nCount;
- pStack->Push( pL );
- }
- rStrm << nCount;
- ScChangeActionLinkEntry* pHere;
- while ( ( pHere = (ScChangeActionLinkEntry*) pStack->Pop() ) != NULL )
- {
- ScChangeAction* p = pHere->GetAction();
- rStrm << (UINT32) ( p ? p->GetActionNumber() : 0 );
- }
- delete pStack;
- }
- else
- rStrm << nCount;
- return bOk;
-}
-
-
-// static
-BOOL ScChangeAction::LoadLinkChain( ScChangeAction* pOfAction,
- ScChangeActionLinkEntry** ppLinkFirst, SvStream& rStrm,
- ScChangeTrack* pTrack, BOOL bLinkDeleted )
-{
- BOOL bOk = TRUE;
- UINT32 nCount;
- rStrm >> nCount;
- for ( UINT32 j = 0; j < nCount; j++ )
- {
- ScChangeAction* pAct = NULL;
- UINT32 nAct;
- rStrm >> nAct;
- if ( nAct )
- {
- pAct = pTrack->GetActionOrGenerated( nAct );
- DBG_ASSERT( pAct, "ScChangeAction::LoadLinkChain: missing Action" );
- }
- if ( bLinkDeleted )
- {
- if ( pAct )
- pAct->SetDeletedIn( pOfAction );
- }
- else
- {
- ScChangeActionLinkEntry* pLink = new ScChangeActionLinkEntry(
- ppLinkFirst, pAct );
- if ( pAct )
- pAct->AddLink( pOfAction, pLink );
- }
- }
- return bOk;
-}
-
-
void ScChangeAction::SetDeletedInThis( ULONG nActionNumber,
const ScChangeTrack* pTrack )
{
@@ -863,52 +653,6 @@ void ScChangeAction::AddDependent( ULONG nActionNumber,
}
}
-// static
-BOOL ScChangeAction::StoreCellList( ScChangeActionCellListEntry* pFirstCell,
- SvStream& rStrm )
-{
- UINT32 nCount = 0;
- for ( const ScChangeActionCellListEntry* pE = pFirstCell; pE;
- pE = pE->pNext )
- ++nCount;
- rStrm << nCount;
-
- if ( nCount )
- {
- for ( const ScChangeActionCellListEntry* pE = pFirstCell; pE;
- pE = pE->pNext )
- { // Store/Load vertauscht die Reihenfolge, aber das ist hierbei egal
- rStrm << (UINT32) pE->pContent->GetActionNumber();
- }
- }
- return TRUE;
-}
-
-
-BOOL ScChangeAction::LoadCellList( ScChangeAction* pOfAction,
- ScChangeActionCellListEntry*& /* pFirstCell */, SvStream& rStrm,
- ScChangeTrack* pTrack )
-{
- UINT32 nCount;
- rStrm >> nCount;
- if ( nCount )
- {
- for ( UINT32 j = 0; j < nCount; j++ )
- {
- ScChangeActionContent* pContent;
- UINT32 nContent;
- rStrm >> nContent;
- pContent = (ScChangeActionContent*) pTrack->GetActionOrGenerated( nContent );
- if ( pContent )
- pOfAction->AddContent( pContent );
- else
- {
- DBG_ERROR( "ScChangeActionDel::LoadLinks: missing Content" );
- }
- }
- }
- return TRUE;
-}
#if DEBUG_CHANGETRACK
String ScChangeAction::ToString( ScDocument* pDoc ) const
@@ -1082,13 +826,6 @@ ScChangeActionIns::ScChangeActionIns( const ScRange& rRange )
}
-ScChangeActionIns::ScChangeActionIns( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScChangeTrack* pTrack )
- :
- ScChangeAction( rStrm, rHdr, pTrack )
-{
-}
-
ScChangeActionIns::ScChangeActionIns(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String& sComment,
const ScChangeActionType eTypeP)
@@ -1102,13 +839,6 @@ ScChangeActionIns::~ScChangeActionIns()
}
-BOOL ScChangeActionIns::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const
-{
- BOOL bOk = ScChangeAction::Store( rStrm, rHdr );
- return bOk;
-}
-
-
void ScChangeActionIns::GetDescription( String& rStr, ScDocument* pDoc,
BOOL bSplitRange, bool bWarning ) const
{
@@ -1209,26 +939,6 @@ ScChangeActionDel::ScChangeActionDel( const ScRange& rRange,
}
-ScChangeActionDel::ScChangeActionDel( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScDocument* /* pDoc */, USHORT /* nVer */,
- ScChangeTrack* pTrackP )
- :
- ScChangeAction( rStrm, rHdr, pTrackP ),
- pTrack( pTrackP ),
- pFirstCell( NULL ),
- pLinkMove( NULL )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- UINT32 n32;
- INT16 n16s;
- rStrm >> n32; pCutOff = (ScChangeActionIns*)(ULONG) n32;
- rStrm >> n16s; nCutOff = n16s;
- rStrm >> n16s; nDx = n16s;
- rStrm >> n16s; nDy = n16s;
-#endif // SC_ROWLIMIT_STREAM_ACCESS
-}
-
ScChangeActionDel::ScChangeActionDel(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String &sComment,
const ScChangeActionType eTypeP, const SCsCOLROW nD, ScChangeTrack* pTrackP) // wich of nDx and nDy is set is depend on the type
@@ -1255,72 +965,6 @@ ScChangeActionDel::~ScChangeActionDel()
delete pLinkMove;
}
-BOOL ScChangeActionDel::StoreLinks( SvStream& rStrm ) const
-{
- BOOL bOk = ScChangeAction::StoreLinks( rStrm );
- UINT32 nCount = 0;
- if ( pLinkMove )
- {
- // rueckwaerts speichern, damit onLoad mit Insert die Reihenfolge wieder stimmt
- Stack* pStack = new Stack;
- for ( ScChangeActionDelMoveEntry* pL = pLinkMove; pL; pL = pL->GetNext() )
- {
- ++nCount;
- pStack->Push( pL );
- }
- rStrm << nCount;
- ScChangeActionDelMoveEntry* pHere;
- while ( ( pHere = (ScChangeActionDelMoveEntry*) pStack->Pop() ) != NULL )
- {
- ScChangeAction* p = pHere->GetAction();
- rStrm << (UINT32) ( p ? p->GetActionNumber() : 0 );
- rStrm << (INT16) pHere->GetCutOffFrom();
- rStrm << (INT16) pHere->GetCutOffTo();
- }
- delete pStack;
- }
- else
- rStrm << nCount;
-
- bOk &= ScChangeAction::StoreCellList( pFirstCell, rStrm );
-
- return bOk;
-}
-
-
-BOOL ScChangeActionDel::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrackP )
-{
- BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrackP );
- UINT32 nCount;
- rStrm >> nCount;
- for ( UINT32 j = 0; j < nCount; j++ )
- {
- ScChangeActionMove* pAct = NULL;
- UINT32 nAct;
- rStrm >> nAct;
- if ( nAct )
- {
- pAct = (ScChangeActionMove*) pTrackP->GetAction( nAct );
- DBG_ASSERT( pAct, "ScChangeActionDel::LoadLinks: missing Move" );
- }
- INT16 nFrom, nTo;
- rStrm >> nFrom >> nTo;
- ScChangeActionDelMoveEntry* pLink = new ScChangeActionDelMoveEntry(
- &pLinkMove, pAct, nFrom, nTo );
- if ( pAct )
- pAct->AddLink( this, pLink );
- }
- if ( pCutOff )
- {
- pCutOff = (ScChangeActionIns*) pTrackP->GetAction( (ULONG) pCutOff );
- DBG_ASSERT( pCutOff, "ScChangeActionDel::LoadLinks: missing Insert" );
- }
-
- bOk &= ScChangeAction::LoadCellList( this, pFirstCell, rStrm, pTrackP );
-
- return bOk;
-}
-
void ScChangeActionDel::AddContent( ScChangeActionContent* pContent )
{
ScChangeActionCellListEntry* pE = new ScChangeActionCellListEntry(
@@ -1623,18 +1267,6 @@ void ScChangeActionDel::UndoCutOffInsert()
// --- ScChangeActionMove --------------------------------------------------
-ScChangeActionMove::ScChangeActionMove( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScChangeTrack* pTrackP )
- :
- ScChangeAction( rStrm, rHdr, pTrackP ),
- pTrack( pTrackP ),
- pFirstCell( NULL ),
- nStartLastCut(0),
- nEndLastCut(0)
-{
- rStrm >> aFromRange;
-}
-
ScChangeActionMove::ScChangeActionMove(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aToBigRange, const String& aUserP, const DateTime& aDateTimeP, const String &sComment,
const ScBigRange& aFromBigRange, ScChangeTrack* pTrackP) // wich of nDx and nDy is set is depend on the type
@@ -1654,30 +1286,6 @@ ScChangeActionMove::~ScChangeActionMove()
}
-BOOL ScChangeActionMove::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const
-{
- BOOL bOk = ScChangeAction::Store( rStrm, rHdr );
- rStrm << aFromRange;
- return bOk;
-}
-
-
-BOOL ScChangeActionMove::StoreLinks( SvStream& rStrm ) const
-{
- BOOL bOk = ScChangeAction::StoreLinks( rStrm );
- bOk &= ScChangeAction::StoreCellList( pFirstCell, rStrm );
- return bOk;
-}
-
-
-BOOL ScChangeActionMove::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrackP )
-{
- BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrackP );
- bOk &= ScChangeAction::LoadCellList( this, pFirstCell, rStrm, pTrackP );
- return bOk;
-}
-
-
void ScChangeActionMove::AddContent( ScChangeActionContent* pContent )
{
ScChangeActionCellListEntry* pE = new ScChangeActionCellListEntry(
@@ -1816,28 +1424,6 @@ BOOL ScChangeActionMove::Reject( ScDocument* pDoc )
const USHORT nMemPoolChangeActionContent = (0x8000 - 64) / sizeof(ScChangeActionContent);
IMPL_FIXEDMEMPOOL_NEWDEL( ScChangeActionContent, nMemPoolChangeActionContent, nMemPoolChangeActionContent )
-
-ScChangeActionContent::ScChangeActionContent( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScDocument* pDoc, USHORT nVer,
- ScChangeTrack* pTrack )
- :
- ScChangeAction( rStrm, rHdr, pTrack ),
- pNextInSlot( NULL ),
- ppPrevInSlot( NULL )
-{
- UINT32 n32;
- rStrm.ReadByteString( aOldValue, rStrm.GetStreamCharSet() );
- rStrm.ReadByteString( aNewValue, rStrm.GetStreamCharSet() );
- rStrm >> n32; pNextContent = (ScChangeActionContent*)(ULONG) n32;
- rStrm >> n32; pPrevContent = (ScChangeActionContent*)(ULONG) n32;
-
- {
- ScMultipleReadHeader aDataHdr( rStrm );
- pOldCell = ScChangeAction::LoadCell( rStrm, aDataHdr, pDoc, nVer );
- pNewCell = ScChangeAction::LoadCell( rStrm, aDataHdr, pDoc, nVer );
- }
-}
-
ScChangeActionContent::ScChangeActionContent( const ULONG nActionNumber,
const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aBigRangeP, const String& aUserP,
@@ -1895,52 +1481,6 @@ void ScChangeActionContent::ClearTrack()
}
-BOOL ScChangeActionContent::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const
-{
- BOOL bOk = ScChangeAction::Store( rStrm, rHdr );
- rStrm.WriteByteString( aOldValue, rStrm.GetStreamCharSet() );
- rStrm.WriteByteString( aNewValue, rStrm.GetStreamCharSet() );
- rStrm << (UINT32) ( pNextContent ? pNextContent->GetActionNumber() : 0 );
- rStrm << (UINT32) ( pPrevContent ? pPrevContent->GetActionNumber() : 0 );
-
- {
- ScMultipleWriteHeader aDataHdr( rStrm );
- ScChangeAction::StoreCell( pOldCell, rStrm, aDataHdr );
- ScChangeAction::StoreCell( pNewCell, rStrm, aDataHdr );
- }
-
- return bOk;
-}
-
-
-BOOL ScChangeActionContent::StoreLinks( SvStream& rStrm ) const
-{
- BOOL bOk = ScChangeAction::StoreLinks( rStrm );
- return bOk;
-}
-
-
-BOOL ScChangeActionContent::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrack )
-{
- BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrack );
- if ( pNextContent )
- {
- pNextContent = (ScChangeActionContent*) pTrack->GetAction(
- (ULONG) pNextContent );
- DBG_ASSERT( pNextContent,
- "ScChangeActionContent::LoadLinks: missing NextContent" );
- }
- if ( pPrevContent )
- {
- pPrevContent = (ScChangeActionContent*) pTrack->GetAction(
- (ULONG) pPrevContent );
- DBG_ASSERT( pPrevContent,
- "ScChangeActionContent::LoadLinks: missing PrevContent" );
- }
- return bOk;
-}
-
-
ScChangeActionContent* ScChangeActionContent::GetTopContent() const
{
if ( pNextContent )
@@ -2658,13 +2198,6 @@ void ScChangeActionContent::UpdateReference( const ScChangeTrack* pTrack,
// --- ScChangeActionReject ------------------------------------------------
-ScChangeActionReject::ScChangeActionReject( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScChangeTrack* pTrack )
- :
- ScChangeAction( rStrm, rHdr, pTrack )
-{
-}
-
ScChangeActionReject::ScChangeActionReject(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String& sComment)
:
@@ -2672,12 +2205,6 @@ ScChangeActionReject::ScChangeActionReject(const ULONG nActionNumber, const ScCh
{
}
-BOOL ScChangeActionReject::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const
-{
- (void)ScChangeAction::Store( rStrm, rHdr );
- return TRUE;
-}
-
// --- ScChangeTrack -------------------------------------------------------
@@ -2915,29 +2442,6 @@ void ScChangeTrack::NotifyModified( ScChangeTrackMsgType eMsgType,
}
-void lcl_EnsureSorting( ScStrCollection& rCollection )
-{
- BOOL bSorted = TRUE;
- USHORT nCount = rCollection.GetCount();
- USHORT i;
- for (i=0; i+1<nCount; i++)
- if ( rCollection.Compare( rCollection[i], rCollection[i+1] ) != -1 )
- bSorted = FALSE;
-
- if ( !bSorted )
- {
- // if not sorted, rebuild collection
- ScStrCollection aNewColl;
- for (i=0; i<nCount; i++)
- {
- ScDataObject* pNewObj = rCollection[i]->Clone();
- if (!aNewColl.Insert(pNewObj))
- delete pNewObj;
- }
- rCollection = aNewColl;
- }
-}
-
void ScChangeTrack::MasterLinks( ScChangeAction* pAppend )
{
ScChangeActionType eType = pAppend->GetType();
@@ -3244,14 +2748,6 @@ BOOL ScChangeTrack::IsMatrixFormulaRangeDifferent( const ScBaseCell* pOldCell,
void ScChangeTrack::AppendContent( const ScAddress& rPos,
- const String& rNewValue )
-{
- ScBaseCell* pCell = pDoc->GetCell( rPos );
- AppendContent( rPos, rNewValue, pCell );
-}
-
-
-void ScChangeTrack::AppendContent( const ScAddress& rPos,
const String& rNewValue, ScBaseCell* pOldCell )
{
String aOldValue;
@@ -3321,16 +2817,6 @@ void ScChangeTrack::AppendContent( const ScAddress& rPos,
}
-void ScChangeTrack::AppendContent( const ScAddress& rPos,
- const ScBaseCell* pOldCell, ScDocument* pRefDoc )
-{
- if ( ScChangeActionContent::NeedsNumberFormat( pOldCell ) )
- AppendContent( rPos, pOldCell, pRefDoc->GetNumberFormat( rPos ), pRefDoc );
- else
- AppendContent( rPos, pOldCell, 0, pRefDoc );
-}
-
-
void ScChangeTrack::SetLastCutMoveRange( const ScRange& rRange,
ScDocument* pRefDoc )
{
diff --git a/sc/source/core/tool/collect.cxx b/sc/source/core/tool/collect.cxx
index 04343bb65a41..c5d4df22ccea 100644
--- a/sc/source/core/tool/collect.cxx
+++ b/sc/source/core/tool/collect.cxx
@@ -334,38 +334,6 @@ ScDataObject* ScStrCollection::Clone() const
}
//------------------------------------------------------------------------
-
-void ScStrCollection::Load( SvStream& rStream )
-{
- ScReadHeader aHdr( rStream );
- lcl_DeleteScDataObjects( pItems, nCount );
- BOOL bDups;
- rStream >> bDups;
- SetDups( bDups );
- rStream >> nCount >> nLimit >> nDelta;
- pItems = new ScDataObject*[nLimit];
- String aStr;
- rtl_TextEncoding eSet = rStream.GetStreamCharSet();
- for ( USHORT i=0; i<nCount; i++ )
- {
- rStream.ReadByteString( aStr, eSet );
- pItems[i] = new StrData( aStr );
- }
-}
-
-void ScStrCollection::Store( SvStream& rStream ) const
-{
- ScWriteHeader aHdr( rStream );
- BOOL bDups = IsDups();
- rStream << bDups << nCount << nLimit << nDelta;
- rtl_TextEncoding eSet = rStream.GetStreamCharSet();
- for ( USHORT i=0; i<nCount; i++ )
- {
- rStream.WriteByteString( ((StrData*)pItems[i])->GetString(), eSet );
- }
-}
-
-//------------------------------------------------------------------------
// TypedScStrCollection
//------------------------------------------------------------------------
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e148f3ab8516..599d7c63d68b 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;
@@ -124,77 +127,6 @@ enum ScanState
static const sal_Char* pInternal[ 5 ] = { "GAME", "SPEW", "TTT", "STARCALCTEAM", "ANTWORT" };
using namespace ::com::sun::star::i18n;
-/////////////////////////////////////////////////////////////////////////
-
-short lcl_GetRetFormat( OpCode eOpCode )
-{
- switch (eOpCode)
- {
- case ocEqual:
- case ocNotEqual:
- case ocLess:
- case ocGreater:
- case ocLessEqual:
- case ocGreaterEqual:
- case ocAnd:
- case ocOr:
- case ocNot:
- case ocTrue:
- case ocFalse:
- case ocIsEmpty:
- case ocIsString:
- case ocIsNonString:
- case ocIsLogical:
- case ocIsRef:
- case ocIsValue:
- case ocIsFormula:
- case ocIsNA:
- case ocIsErr:
- case ocIsError:
- case ocIsEven:
- case ocIsOdd:
- case ocExact:
- return NUMBERFORMAT_LOGICAL;
- case ocGetActDate:
- case ocGetDate:
- case ocEasterSunday :
- return NUMBERFORMAT_DATE;
- case ocGetActTime:
- return NUMBERFORMAT_DATETIME;
- case ocGetTime:
- return NUMBERFORMAT_TIME;
- case ocNPV:
- case ocBW:
- case ocDIA:
- case ocGDA:
- case ocGDA2:
- case ocVBD:
- case ocLIA:
- case ocRMZ:
- case ocZW:
- case ocZinsZ:
- case ocKapz:
- case ocKumZinsZ:
- case ocKumKapZ:
- return NUMBERFORMAT_CURRENCY;
- case ocZins:
- case ocIRR:
- case ocMIRR:
- case ocZGZ:
- case ocEffektiv:
- case ocNominal:
- case ocPercentSign:
- return NUMBERFORMAT_PERCENT;
-// case ocSum:
-// case ocSumSQ:
-// case ocProduct:
-// case ocAverage:
-// return -1;
- default:
- return NUMBERFORMAT_NUMBER;
- }
- return NUMBERFORMAT_NUMBER;
-}
/////////////////////////////////////////////////////////////////////////
@@ -408,28 +340,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 +1751,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 +1766,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 +1906,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 +2054,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 +2353,7 @@ Label_MaskStateMachine:
{
nSrcPos = sal::static_int_cast<xub_StrLen>( nSrcPos + nSpaces );
String aSymbol;
- bRangeOp = false;
+ mnRangeOpPosInSymbol = -1;
USHORT nErr = 0;
do
{
@@ -2438,9 +2382,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 +2404,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 +2787,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;
}
@@ -3551,54 +3516,65 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
// #42016# Italian ARCTAN.2 resulted in #REF! => IsOpcode() before
// IsReference().
- const String aOrg( cSymbol );
-
- if (bAsciiNonAlnum && IsOpCode( aOrg, bInArray ))
- return true;
-
String aUpper;
- bool bAsciiUpper = false;
- if (bMayBeFuncName)
+
+ do
{
- bAsciiUpper = lcl_UpperAsciiOrI18n( aUpper, aOrg, meGrammar);
- if (IsOpCode( aUpper, bInArray ))
+ mbRewind = false;
+ const String aOrg( cSymbol );
+
+ if (bAsciiNonAlnum && IsOpCode( aOrg, bInArray ))
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 ))
- return true;
+ aUpper.Erase();
+ bool bAsciiUpper = false;
+ if (bMayBeFuncName)
+ {
+ bAsciiUpper = lcl_UpperAsciiOrI18n( aUpper, aOrg, meGrammar);
+ if (IsOpCode( aUpper, bInArray ))
+ return true;
+ }
- if (!aUpper.Len())
- bAsciiUpper = lcl_UpperAsciiOrI18n( aUpper, aOrg, meGrammar);
+ // 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;
+ }
- // IsBoolean() before IsValue() to catch inline bools without the kludge
- // for inline arrays.
- if (bAllowBooleans && IsBoolean( aUpper ))
- return true;
+ if (!aUpper.Len())
+ bAsciiUpper = lcl_UpperAsciiOrI18n( aUpper, aOrg, meGrammar);
- if (IsValue( aUpper ))
- return true;
+ // IsBoolean() before IsValue() to catch inline bools without the kludge
+ // for inline arrays.
+ if (bAllowBooleans && IsBoolean( aUpper ))
+ return true;
- // User defined names and such do need i18n upper also in ODF.
- if (bAsciiUpper)
- aUpper = ScGlobal::pCharClass->upper( aOrg );
+ if (IsValue( aUpper ))
+ return true;
- 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;
+ // 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 )
{
@@ -3620,6 +3596,21 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
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();
+ }
+}
+
ScTokenArray* ScCompiler::CompileString( const String& rFormula )
{
#if 0
@@ -3627,6 +3618,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;
@@ -3829,6 +3824,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() );
@@ -3865,7 +3888,7 @@ BOOL ScCompiler::HandleRange()
if( pRangeData->HasReferences() )
{
SetRelNameReference();
- MoveRelWrap();
+ MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
}
pNew->Reset();
if ( bAddPair )
@@ -3917,7 +3940,7 @@ BOOL ScCompiler::HandleExternalReference(const FormulaToken& _aToken)
if (pNew->GetNextReference() != NULL)
{
SetRelNameReference();
- MoveRelWrap();
+ MoveRelWrap(MAXCOL, MAXROW);
}
pNew->Reset();
return GetToken();
@@ -4012,33 +4035,33 @@ void ScCompiler::SetRelNameReference()
// Wrap-adjust relative references of a RangeName to current position,
// don't call for other token arrays!
-void ScCompiler::MoveRelWrap()
+void ScCompiler::MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow )
{
pArr->Reset();
for( ScToken* t = static_cast<ScToken*>(pArr->GetNextReference()); t;
t = static_cast<ScToken*>(pArr->GetNextReference()) )
{
if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef )
- ScRefUpdate::MoveRelWrap( pDoc, aPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
+ ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
else
- ScRefUpdate::MoveRelWrap( pDoc, aPos, t->GetDoubleRef() );
+ ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, t->GetDoubleRef() );
}
}
// static
// Wrap-adjust relative references of a RangeName to current position,
// don't call for other token arrays!
-void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc,
- const ScAddress& rPos )
+void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
+ SCCOL nMaxCol, SCROW nMaxRow )
{
rArr.Reset();
for( ScToken* t = static_cast<ScToken*>(rArr.GetNextReference()); t;
t = static_cast<ScToken*>(rArr.GetNextReference()) )
{
if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef )
- ScRefUpdate::MoveRelWrap( pDoc, rPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
+ ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
else
- ScRefUpdate::MoveRelWrap( pDoc, rPos, t->GetDoubleRef() );
+ ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, t->GetDoubleRef() );
}
}
@@ -4213,7 +4236,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
SingleDoubleRefModifier aMod( rRef );
if ( rRef.IsRelName() )
{
- ScRefUpdate::MoveRelWrap( pDoc, aPos, aMod.Ref() );
+ ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, aMod.Ref() );
rChanged = TRUE;
}
else
@@ -4243,7 +4266,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
SCTAB nTabs = rRef.Ref2.nTab - rRef.Ref1.nTab;
if ( rRef.Ref1.IsRelName() || rRef.Ref2.IsRelName() )
{
- ScRefUpdate::MoveRelWrap( pDoc, aPos, rRef );
+ ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, rRef );
rChanged = TRUE;
}
else
@@ -5060,6 +5083,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 d08f593aaf21..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,6 +80,7 @@ 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;
}
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/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 704c3255486e..24ed502e33b1 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -60,7 +60,7 @@ using namespace formula;
// Interner ctor fuer das Suchen nach einem Index
ScRangeData::ScRangeData( USHORT n )
- : pCode( NULL ), nIndex( n ), bModified( FALSE )
+ : pCode( NULL ), nIndex( n ), bModified( FALSE ), mnMaxRow(-1), mnMaxCol(-1)
{}
ScRangeData::ScRangeData( ScDocument* pDok,
@@ -76,7 +76,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
eType ( nType ),
pDoc ( pDok ),
nIndex ( 0 ),
- bModified ( FALSE )
+ bModified ( FALSE ),
+ mnMaxRow (-1),
+ mnMaxCol (-1)
{
if (rSymbol.Len() > 0)
{
@@ -122,7 +124,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
eType ( nType ),
pDoc ( pDok ),
nIndex ( 0 ),
- bModified ( FALSE )
+ bModified ( FALSE ),
+ mnMaxRow (-1),
+ mnMaxCol (-1)
{
if( !pCode->GetCodeError() )
{
@@ -157,7 +161,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
eType ( RT_NAME ),
pDoc ( pDok ),
nIndex ( 0 ),
- bModified ( FALSE )
+ bModified ( FALSE ),
+ mnMaxRow (-1),
+ mnMaxCol (-1)
{
ScSingleRefData aRefData;
aRefData.InitAddress( rTarget );
@@ -179,7 +185,9 @@ ScRangeData::ScRangeData(const ScRangeData& rScRangeData) :
eType (rScRangeData.eType),
pDoc (rScRangeData.pDoc),
nIndex (rScRangeData.nIndex),
- bModified (rScRangeData.bModified)
+ bModified (rScRangeData.bModified),
+ mnMaxRow (rScRangeData.mnMaxRow),
+ mnMaxCol (rScRangeData.mnMaxCol)
{}
ScRangeData::~ScRangeData()
@@ -247,7 +255,7 @@ void ScRangeData::UpdateSymbol( rtl::OUStringBuffer& rBuffer, const ScAddress& r
::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
ScCompiler aComp( pDoc, rPos, *pTemp.get());
aComp.SetGrammar(eGrammar);
- aComp.MoveRelWrap();
+ aComp.MoveRelWrap(GetMaxCol(), GetMaxRow());
aComp.CreateStringFromTokenArray( rBuffer );
}
@@ -355,19 +363,19 @@ BOOL ScRangeData::operator== (const ScRangeData& rData) const // fuer Undo
return TRUE;
}
-BOOL ScRangeData::IsRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const
-{
- BOOL bRet = FALSE;
- ScRange aRange;
- if ( IsReference(aRange) )
- {
- if ( bStartOnly )
- bRet = ( rPos == aRange.aStart );
- else
- bRet = ( aRange.In( rPos ) );
- }
- return bRet;
-}
+//UNUSED2009-05 BOOL ScRangeData::IsRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 BOOL bRet = FALSE;
+//UNUSED2009-05 ScRange aRange;
+//UNUSED2009-05 if ( IsReference(aRange) )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( bStartOnly )
+//UNUSED2009-05 bRet = ( rPos == aRange.aStart );
+//UNUSED2009-05 else
+//UNUSED2009-05 bRet = ( aRange.In( rPos ) );
+//UNUSED2009-05 }
+//UNUSED2009-05 return bRet;
+//UNUSED2009-05 }
BOOL ScRangeData::IsRangeAtBlock( const ScRange& rBlock ) const
{
@@ -393,7 +401,7 @@ BOOL ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
ScCompiler aComp( pDoc, rPos, *pTemp);
aComp.SetGrammar(pDoc->GetGrammar());
- aComp.MoveRelWrap();
+ aComp.MoveRelWrap(MAXCOL, MAXROW);
return pTemp->IsReference( rRange );
}
@@ -520,6 +528,26 @@ BOOL ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc )
return TRUE;
}
+void ScRangeData::SetMaxRow(SCROW nRow)
+{
+ mnMaxRow = nRow;
+}
+
+SCROW ScRangeData::GetMaxRow() const
+{
+ return mnMaxRow >= 0 ? mnMaxRow : MAXROW;
+}
+
+void ScRangeData::SetMaxCol(SCCOL nCol)
+{
+ mnMaxCol = nCol;
+}
+
+SCCOL ScRangeData::GetMaxCol() const
+{
+ return mnMaxCol >= 0 ? mnMaxCol : MAXCOL;
+}
+
USHORT ScRangeData::GetErrCode()
{
@@ -771,16 +799,16 @@ ScRangeData* ScRangeName::FindIndex( USHORT nIndex )
return NULL;
}
-ScRangeData* ScRangeName::GetRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const
-{
- if ( pItems )
- {
- for ( USHORT i = 0; i < nCount; i++ )
- if ( ((ScRangeData*)pItems[i])->IsRangeAtCursor( rPos, bStartOnly ) )
- return (ScRangeData*)pItems[i];
- }
- return NULL;
-}
+//UNUSED2009-05 ScRangeData* ScRangeName::GetRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( pItems )
+//UNUSED2009-05 {
+//UNUSED2009-05 for ( USHORT i = 0; i < nCount; i++ )
+//UNUSED2009-05 if ( ((ScRangeData*)pItems[i])->IsRangeAtCursor( rPos, bStartOnly ) )
+//UNUSED2009-05 return (ScRangeData*)pItems[i];
+//UNUSED2009-05 }
+//UNUSED2009-05 return NULL;
+//UNUSED2009-05 }
ScRangeData* ScRangeName::GetRangeAtBlock( const ScRange& rBlock ) const
{
diff --git a/sc/source/core/tool/rechead.cxx b/sc/source/core/tool/rechead.cxx
index 7e8a271470e4..517759524c92 100644
--- a/sc/source/core/tool/rechead.cxx
+++ b/sc/source/core/tool/rechead.cxx
@@ -44,62 +44,6 @@
// =======================================================================
-ScReadHeader::ScReadHeader(SvStream& rNewStream) :
- rStream( rNewStream )
-{
- sal_uInt32 nDataSize;
- rStream >> nDataSize;
- nDataEnd = rStream.Tell() + nDataSize;
-}
-
-ScReadHeader::~ScReadHeader()
-{
- ULONG nReadEnd = rStream.Tell();
- DBG_ASSERT( nReadEnd <= nDataEnd, "zuviele Bytes gelesen" );
- if ( nReadEnd != nDataEnd )
- {
- if ( rStream.GetError() == SVSTREAM_OK )
- rStream.SetError( SCWARN_IMPORT_INFOLOST );
- rStream.Seek(nDataEnd); // Rest ueberspringen
- }
-}
-
-ULONG ScReadHeader::BytesLeft() const
-{
- ULONG nReadEnd = rStream.Tell();
- if (nReadEnd <= nDataEnd)
- return nDataEnd-nReadEnd;
-
- DBG_ERROR("Fehler bei ScReadHeader::BytesLeft");
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-ScWriteHeader::ScWriteHeader(SvStream& rNewStream, sal_uInt32 nDefault) :
- rStream( rNewStream )
-{
- nDataSize = nDefault;
- rStream << nDataSize;
-
- nDataPos = rStream.Tell();
-}
-
-ScWriteHeader::~ScWriteHeader()
-{
- ULONG nPos = rStream.Tell();
-
- if ( nPos - nDataPos != nDataSize ) // Default getroffen?
- {
- nDataSize = nPos - nDataPos;
- rStream.Seek(nDataPos - sizeof(sal_uInt32));
- rStream << nDataSize; // Groesse am Anfang eintragen
- rStream.Seek(nPos);
- }
-}
-
-// =======================================================================
-
ScMultipleReadHeader::ScMultipleReadHeader(SvStream& rNewStream) :
rStream( rNewStream )
{
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/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index d019a6082583..1f70ef80963c 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -821,27 +821,27 @@ ScRefUpdateRes ScRefUpdate::Move( ScDocument* pDoc, const ScAddress& rPos,
}
void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
- ScComplexRefData& rRef )
+ SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef )
{
if( rRef.Ref1.IsColRel() )
{
rRef.Ref1.nCol = rRef.Ref1.nRelCol + rPos.Col();
- lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), MAXCOL );
+ lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), nMaxCol );
}
if( rRef.Ref2.IsColRel() )
{
rRef.Ref2.nCol = rRef.Ref2.nRelCol + rPos.Col();
- lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), MAXCOL );
+ lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), nMaxCol );
}
if( rRef.Ref1.IsRowRel() )
{
rRef.Ref1.nRow = rRef.Ref1.nRelRow + rPos.Row();
- lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), MAXROW );
+ lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), nMaxRow );
}
if( rRef.Ref2.IsRowRel() )
{
rRef.Ref2.nRow = rRef.Ref2.nRelRow + rPos.Row();
- lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), MAXROW );
+ lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), nMaxRow );
}
SCsTAB nMaxTab = (SCsTAB) pDoc->GetTableCount() - 1;
if( rRef.Ref1.IsTabRel() )
@@ -939,37 +939,4 @@ ScRefUpdateRes ScRefUpdate::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCRO
return eRet;
}
-#if OLD_PIVOT_IMPLEMENTATION
-ScRefUpdateRes ScRefUpdate::DoGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY,
- ScRange& rRef )
-{
- // wie UpdateGrow, nur mit Range statt RefData
-
- ScRefUpdateRes eRet = UR_NOTHING;
-
- BOOL bUpdateX = ( nGrowX &&
- rRef.aStart.Col() == rArea.aStart.Col() && rRef.aEnd.Col() == rArea.aEnd.Col() &&
- rRef.aStart.Row() >= rArea.aStart.Row() && rRef.aEnd.Row() <= rArea.aEnd.Row() &&
- rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() );
- BOOL bUpdateY = ( nGrowY &&
- rRef.aStart.Col() >= rArea.aStart.Col() && rRef.aEnd.Col() <= rArea.aEnd.Col() &&
- ( rRef.aStart.Row() == rArea.aStart.Row() || rRef.aStart.Row() == rArea.aStart.Row()+1 ) &&
- rRef.aEnd.Row() == rArea.aEnd.Row() &&
- rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() );
-
- if ( bUpdateX )
- {
- rRef.aEnd.SetCol( rRef.aEnd.Col() + nGrowX );
- eRet = UR_UPDATED;
- }
- if ( bUpdateY )
- {
- rRef.aEnd.SetRow( rRef.aEnd.Row() + nGrowY );
- eRet = UR_UPDATED;
- }
-
- return eRet;
-}
-#endif
-
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index af22bf7e43a3..ad7147ccb14d 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -608,48 +608,48 @@ void ScMatrix::MatTrans(ScMatrix& mRes) const
}
}
-void ScMatrix::MatCopyUpperLeft(ScMatrix& mRes) const
-{
- if (nColCount < mRes.nColCount || nRowCount < mRes.nRowCount)
- {
- DBG_ERRORFILE("ScMatrix::MatCopyUpperLeft: dimension error");
- }
- else
- {
- if (mnValType)
- {
- ScMatValType nType;
- mRes.ResetIsString();
- for ( SCSIZE i = 0; i < mRes.nColCount; i++ )
- {
- SCSIZE nStart = i * nRowCount;
- for ( SCSIZE j = 0; j < mRes.nRowCount; j++ )
- {
- if ( IsNonValueType( (nType = mnValType[nStart+j]) ))
- mRes.PutStringEntry( pMat[nStart+j].pS, nType,
- i*mRes.nRowCount+j );
- else
- {
- mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal;
- mRes.mnValType[i*mRes.nRowCount+j] = nType;
- }
- }
- }
- }
- else
- {
- mRes.DeleteIsString();
- for ( SCSIZE i = 0; i < mRes.nColCount; i++ )
- {
- SCSIZE nStart = i * nRowCount;
- for ( SCSIZE j = 0; j < mRes.nRowCount; j++ )
- {
- mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal;
- }
- }
- }
- }
-}
+//UNUSED2009-05 void ScMatrix::MatCopyUpperLeft(ScMatrix& mRes) const
+//UNUSED2009-05 {
+//UNUSED2009-05 if (nColCount < mRes.nColCount || nRowCount < mRes.nRowCount)
+//UNUSED2009-05 {
+//UNUSED2009-05 DBG_ERRORFILE("ScMatrix::MatCopyUpperLeft: dimension error");
+//UNUSED2009-05 }
+//UNUSED2009-05 else
+//UNUSED2009-05 {
+//UNUSED2009-05 if (mnValType)
+//UNUSED2009-05 {
+//UNUSED2009-05 ScMatValType nType;
+//UNUSED2009-05 mRes.ResetIsString();
+//UNUSED2009-05 for ( SCSIZE i = 0; i < mRes.nColCount; i++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 SCSIZE nStart = i * nRowCount;
+//UNUSED2009-05 for ( SCSIZE j = 0; j < mRes.nRowCount; j++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( IsNonValueType( (nType = mnValType[nStart+j]) ))
+//UNUSED2009-05 mRes.PutStringEntry( pMat[nStart+j].pS, nType,
+//UNUSED2009-05 i*mRes.nRowCount+j );
+//UNUSED2009-05 else
+//UNUSED2009-05 {
+//UNUSED2009-05 mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal;
+//UNUSED2009-05 mRes.mnValType[i*mRes.nRowCount+j] = nType;
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 else
+//UNUSED2009-05 {
+//UNUSED2009-05 mRes.DeleteIsString();
+//UNUSED2009-05 for ( SCSIZE i = 0; i < mRes.nColCount; i++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 SCSIZE nStart = i * nRowCount;
+//UNUSED2009-05 for ( SCSIZE j = 0; j < mRes.nRowCount; j++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal;
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
void ScMatrix::FillDouble( double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 )
{
diff --git a/sc/source/core/tool/subtotal.cxx b/sc/source/core/tool/subtotal.cxx
index 828a65654242..c8061441abfc 100644
--- a/sc/source/core/tool/subtotal.cxx
+++ b/sc/source/core/tool/subtotal.cxx
@@ -39,188 +39,6 @@
// -----------------------------------------------------------------------
-#if OLD_PIVOT_IMPLEMENTATION
-SubTotal::SubTotal()
-{
- nIndex = 0; //! test fuer Pivot
-
- nCount = 0;
- nCount2 = 0;
- nSum = 0.0;
- nSumSqr = 0.0;
- nMax = -MAXDOUBLE;
- nMin = MAXDOUBLE;
- nProduct = 1.0;
- bSumOk = TRUE;
- bSumSqrOk = TRUE;
- bProductOk = TRUE;
-}
-
-
-SubTotal::~SubTotal()
-{
-}
-
-
-void SubTotal::UpdateNoVal()
-{
- nCount++;
-}
-
-
-void SubTotal::Update( double nVal )
-{
- SAL_MATH_FPEXCEPTIONS_OFF();
- nCount++;
- nCount2++;
- if (nVal > nMax) nMax = nVal;
- if (nVal < nMin) nMin = nVal;
- nProgress = 0;
- if (bSumOk) nSum += nVal;
- nProgress = 1;
- if (bProductOk) nProduct *= nVal;
- nProgress = 2;
- if (bSumSqrOk) nSumSqr += nVal*nVal;
- if (!::rtl::math::isFinite(nSum))
- bSumOk = FALSE;
- if (!::rtl::math::isFinite(nProduct))
- bProductOk = FALSE;
- if (!::rtl::math::isFinite(nSumSqr))
- bSumSqrOk = FALSE;
-}
-
-
-void SubTotal::Update( const SubTotal& rVal )
-{
- SAL_MATH_FPEXCEPTIONS_OFF();
- nCount += rVal.nCount;
- nCount2 += rVal.nCount2;
- if (rVal.nMax > nMax) nMax = rVal.nMax;
- if (rVal.nMin < nMin) nMin = rVal.nMin;
- nProgress = 0;
- if (rVal.bSumOk && bSumOk)
- nSum += rVal.nSum;
- else
- bSumOk = FALSE;
- nProgress = 1;
- if (rVal.bProductOk && bProductOk)
- nProduct *= rVal.nProduct;
- else
- bProductOk = FALSE;
- nProgress = 2;
- if (rVal.bSumSqrOk && bSumSqrOk)
- nSumSqr += rVal.nSumSqr;
- else
- bSumSqrOk = FALSE;
- if (!::rtl::math::isFinite(nSum))
- bSumOk = FALSE;
- if (!::rtl::math::isFinite(nProduct))
- bProductOk = FALSE;
- if (!::rtl::math::isFinite(nSumSqr))
- bSumSqrOk = FALSE;
-}
-
-
-short SubTotal::Valid( USHORT nFunction ) const
- // return 0 => Fehler, -1 => kein Wert, 1 => ok
-{
- short nRet;
- switch (nFunction)
- {
- case PIVOT_FUNC_AVERAGE:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = bSumOk;
- break;
- case PIVOT_FUNC_STD_DEVP:
- case PIVOT_FUNC_STD_VARP:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = bSumSqrOk;
- break;
- case PIVOT_FUNC_STD_DEV:
- case PIVOT_FUNC_STD_VAR:
- if (nCount2 < 2)
- nRet = -1;
- else
- nRet = bSumSqrOk;
- break;
- case PIVOT_FUNC_MAX:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = 1;
- break;
- case PIVOT_FUNC_MIN:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = 1;
- break;
- case PIVOT_FUNC_SUM:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = bSumOk;
- break;
- case PIVOT_FUNC_PRODUCT:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = bProductOk;
- break;
- default:
- nRet = 1;
- break;
- }
- return nRet;
-}
-
-
-double SubTotal::Result( USHORT nFunction ) const
-{
- double nRet = 0.0;
- switch (nFunction)
- {
- case PIVOT_FUNC_COUNT: nRet = (double) nCount; break;
- case PIVOT_FUNC_COUNT_NUM: nRet = (double) nCount2; break;
- case PIVOT_FUNC_SUM: nRet = nSum; break;
- case PIVOT_FUNC_MAX: nRet = nMax; break;
- case PIVOT_FUNC_MIN: nRet = nMin; break;
- case PIVOT_FUNC_PRODUCT: nRet = nProduct; break;
- case PIVOT_FUNC_AVERAGE:
- if (nCount2 > 0)
- nRet = nSum / (double) nCount2;
- break;
- case PIVOT_FUNC_STD_DEV:
- if (nCount2 > 1)
- nRet = sqrt((nSumSqr - nSum*nSum/(double)(nCount2))
- / (double)(nCount2-1));
- break;
- case PIVOT_FUNC_STD_DEVP:
- if (nCount2 > 0)
- nRet = sqrt((nSumSqr - nSum*nSum/(double)(nCount2))
- / (double)nCount2);
- break;
- case PIVOT_FUNC_STD_VAR:
- if (nCount2 > 1)
- nRet = (nSumSqr - nSum*nSum/(double)(nCount2))
- / (double)(nCount2-1);
- break;
- case PIVOT_FUNC_STD_VARP:
- if (nCount2 > 0)
- nRet = (nSumSqr - nSum*nSum/(double)(nCount2))
- / (double)(nCount2);
- break;
- default:
- DBG_ERROR("unbekannte Funktion bei SubTotal::Result");
- }
- return nRet;
-}
-#endif
-
BOOL SubTotal::SafePlus(double& fVal1, double fVal2)
{
BOOL bOk = TRUE;
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 7072785b8936..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"
@@ -86,9 +87,13 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument
{
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_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW );
xImporter->setTargetDocument( xComponent );
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index b62470ceee3b..1d209b91bc68 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;
@@ -249,6 +243,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);
@@ -295,6 +294,8 @@ void ImportExcel8::PostDocLoad( void )
pExcRoot->pAutoFilterBuffer->Apply();
GetWebQueryBuffer().Apply(); //! test if extant
+ GetSheetProtectBuffer().Apply();
+ GetDocProtectBuffer().Apply();
ImportExcel::PostDocLoad();
@@ -426,6 +427,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;
@@ -463,14 +496,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;
@@ -558,8 +591,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..bff8d4cba246 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;
@@ -217,12 +218,6 @@ UINT16 ExcDummyRec::GetNum( void ) const
//------------------------------------------------------- class ExcBoolRecord -
-ExcBoolRecord::ExcBoolRecord( SfxItemSet* pItemSet, USHORT nWhich, BOOL bDefault )
-{
- bVal = pItemSet? ( ( const SfxBoolItem& ) pItemSet->Get( nWhich ) ).GetValue() : bDefault;
-}
-
-
void ExcBoolRecord::SaveCont( XclExpStream& rStrm )
{
rStrm << (UINT16)(bVal ? 0x0001 : 0x0000);
@@ -432,7 +427,9 @@ ExcBundlesheetBase::ExcBundlesheetBase() :
void ExcBundlesheetBase::UpdateStreamPos( XclExpStream& rStrm )
{
rStrm.SetSvStreamPos( nOwnPos );
+ rStrm.DisableEncryption();
rStrm << static_cast<sal_uInt32>(nStrPos);
+ rStrm.EnableEncryption();
}
@@ -532,7 +529,7 @@ void XclExpWsbool::SaveXml( XclExpXmlStream& rStrm )
// XclExpWindowProtection ===============================================================
XclExpWindowProtection::XclExpWindowProtection(bool bValue) :
- XclExpBoolRecord(EXC_ID_WINDOWPROTECT,bValue)
+ XclExpBoolRecord(EXC_ID_WINDOWPROTECT, bValue)
{
}
@@ -545,13 +542,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 +718,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 +802,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/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/namebuff.cxx b/sc/source/filter/excel/namebuff.cxx
index df53c3edcd3c..b01f5a728263 100644
--- a/sc/source/filter/excel/namebuff.cxx
+++ b/sc/source/filter/excel/namebuff.cxx
@@ -127,6 +127,9 @@ void ShrfmlaBuffer::Store( const ScRange& rRange, const ScTokenArray& rToken )
DBG_ASSERT( mnCurrIdx <= 0xFFFF, "*ShrfmlaBuffer::Store(): Gleich wird mir schlecht...!" );
ScRangeData* pData = new ScRangeData( pExcRoot->pIR->GetDocPtr(), aName, rToken, rRange.aStart, RT_SHARED );
+ const ScAddress& rMaxPos = pExcRoot->pIR->GetMaxPos();
+ pData->SetMaxCol(rMaxPos.Col());
+ pData->SetMaxRow(rMaxPos.Row());
pData->SetIndex( static_cast< USHORT >( mnCurrIdx ) );
pExcRoot->pIR->GetNamedRanges().Insert( pData );
index_hash[rRange.aStart] = static_cast< USHORT >( mnCurrIdx );
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index a06cf041e7cf..e7473ba23d02 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -354,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]
@@ -469,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:
@@ -596,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;
@@ -895,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 );
@@ -1039,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 ]
@@ -1055,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/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx
index 28ce1a19b932..34c2b9284fed 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -208,20 +208,20 @@ void TokenPool::GrowDouble( void )
}
-void TokenPool::GrowError( void )
-{
- UINT16 nP_ErrNew = nP_Err * 2;
-
- USHORT* pP_ErrNew = new USHORT[ nP_ErrNew ];
-
- for( UINT16 nL = 0 ; nL < nP_Err ; nL++ )
- pP_ErrNew[ nL ] = pP_Err[ nL ];
-
- nP_Err = nP_ErrNew;
-
- delete[] pP_Err;
- pP_Err = pP_ErrNew;
-}
+//UNUSED2009-05 void TokenPool::GrowError( void )
+//UNUSED2009-05 {
+//UNUSED2009-05 UINT16 nP_ErrNew = nP_Err * 2;
+//UNUSED2009-05
+//UNUSED2009-05 USHORT* pP_ErrNew = new USHORT[ nP_ErrNew ];
+//UNUSED2009-05
+//UNUSED2009-05 for( UINT16 nL = 0 ; nL < nP_Err ; nL++ )
+//UNUSED2009-05 pP_ErrNew[ nL ] = pP_Err[ nL ];
+//UNUSED2009-05
+//UNUSED2009-05 nP_Err = nP_ErrNew;
+//UNUSED2009-05
+//UNUSED2009-05 delete[] pP_Err;
+//UNUSED2009-05 pP_Err = pP_ErrNew;
+//UNUSED2009-05 }
void TokenPool::GrowTripel( void )
@@ -593,28 +593,6 @@ const TokenId TokenPool::Store( const double& rDouble )
}
-//UNUSED2008-05 const TokenId TokenPool::StoreError( USHORT nError )
-//UNUSED2008-05 {
-//UNUSED2008-05 if( nElementAkt >= nElement )
-//UNUSED2008-05 GrowElement();
-//UNUSED2008-05
-//UNUSED2008-05 if( nP_ErrAkt >= nP_Err )
-//UNUSED2008-05 GrowError();
-//UNUSED2008-05
-//UNUSED2008-05 pElement[ nElementAkt ] = nP_ErrAkt; // Index in Error-Array
-//UNUSED2008-05 pType[ nElementAkt ] = T_Err; // Typinfo Error eintragen
-//UNUSED2008-05
-//UNUSED2008-05 pP_Err[ nP_ErrAkt ] = nError;
-//UNUSED2008-05
-//UNUSED2008-05 pSize[ nElementAkt ] = 1; // eigentlich Banane
-//UNUSED2008-05
-//UNUSED2008-05 nElementAkt++;
-//UNUSED2008-05 nP_ErrAkt++;
-//UNUSED2008-05
-//UNUSED2008-05 return ( const TokenId ) nElementAkt; // Ausgabe von altem Wert + 1!
-//UNUSED2008-05 }
-
-
const TokenId TokenPool::Store( const UINT16 nIndex )
{
if( nElementAkt >= nElement )
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 60479659e957..d1fed27bbec1 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -814,10 +814,11 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > x
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();
ScCompiler aComp( GetDocPtr(), ScAddress() );
- aComp.SetGrammar( FormulaGrammar::GRAM_ENGLISH );
+ aComp.SetGrammar( GetDocPtr()->GetGrammar() );
ScTokenArray* pArray = aComp.CompileString( aRangeRepr );
if( !pArray )
return nDefCount;
@@ -1713,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();
@@ -1729,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
+ }
}
}
@@ -1751,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 );
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/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index e065099b2824..457c31d4ab04 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -619,7 +619,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA
DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" );
// clone the passed token array, convert references relative to current cell position
mxOwnScTokArr.reset( rScTokArr.Clone() );
- ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos );
+ ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW );
// don't remember pScBasePos in mpScBasePos, shared formulas use real relative refs
break;
default:;
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 3fc04d7edd1a..2c6741811f3f 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -846,11 +846,11 @@ SCTAB XclExpTabInfo::GetRealScTab( SCTAB nSortedScTab ) const
return (nSortedScTab < mnScCnt) ? maFromSortedVec[ nSortedScTab ] : SCTAB_INVALID;
}
-SCTAB XclExpTabInfo::GetSortedScTab( SCTAB nScTab ) const
-{
- DBG_ASSERT( nScTab < mnScCnt, "XclExpTabInfo::GetSortedScTab - sheet out of range" );
- return (nScTab < mnScCnt) ? maToSortedVec[ nScTab ] : SCTAB_INVALID;
-}
+//UNUSED2009-05 SCTAB XclExpTabInfo::GetSortedScTab( SCTAB nScTab ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 DBG_ASSERT( nScTab < mnScCnt, "XclExpTabInfo::GetSortedScTab - sheet out of range" );
+//UNUSED2009-05 return (nScTab < mnScCnt) ? maToSortedVec[ nScTab ] : SCTAB_INVALID;
+//UNUSED2009-05 }
bool XclExpTabInfo::GetFlag( SCTAB nScTab, sal_uInt8 nFlags ) const
{
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index b4de1126959d..ace7a66dc1f9 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -720,10 +720,10 @@ sal_uInt16 XclExpNameManager::InsertDBRange( USHORT nScDBRangeIdx )
return mxImpl->InsertDBRange( nScDBRangeIdx );
}
-sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab )
-{
- return mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, nScTab );
-}
+//UNUSED2009-05 sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab )
+//UNUSED2009-05 {
+//UNUSED2009-05 return mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, nScTab );
+//UNUSED2009-05 }
sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange )
{
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 457cdd2a17e4..4695c2c191cf 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -701,10 +701,10 @@ const XclExpPCField* XclExpPivotCache::GetField( sal_uInt16 nFieldIdx ) const
return maFieldList.GetRecord( nFieldIdx ).get();
}
-const XclExpPCField* XclExpPivotCache::GetField( const String& rFieldName ) const
-{
- return const_cast< XclExpPivotCache* >( this )->GetFieldAcc( rFieldName );
-}
+//UNUSED2009-05 const XclExpPCField* XclExpPivotCache::GetField( const String& rFieldName ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 return const_cast< XclExpPivotCache* >( this )->GetFieldAcc( rFieldName );
+//UNUSED2009-05 }
bool XclExpPivotCache::HasAddFields() const
{
@@ -1014,10 +1014,10 @@ sal_uInt16 XclExpPTField::GetLastDataInfoIndex() const
return static_cast< sal_uInt16 >( maDataInfoVec.size() - 1 );
}
-const XclExpPTItem* XclExpPTField::GetItem( const String& rName ) const
-{
- return const_cast< XclExpPTField* >( this )->GetItemAcc( rName );
-}
+//UNUSED2009-05 const XclExpPTItem* XclExpPTField::GetItem( const String& rName ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 return const_cast< XclExpPTField* >( this )->GetItemAcc( rName );
+//UNUSED2009-05 }
sal_uInt16 XclExpPTField::GetItemIndex( const String& rName, sal_uInt16 nDefaultIdx ) const
{
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/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index fadc916d7b86..ef30e9a78f6d 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -653,36 +653,36 @@ void XclExpBooleanCell::WriteContents( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
-IMPL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell, 256, 256 )
-
-XclExpErrorCell::XclExpErrorCell(
- const XclExpRoot rRoot, const XclAddress& rXclPos,
- const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, sal_uInt8 nErrCode ) :
- // #i41210# always use latin script for error cells
- XclExpSingleCellBase( rRoot, EXC_ID3_BOOLERR, 2, rXclPos, pPattern, ApiScriptType::LATIN, nForcedXFId ),
- mnErrCode( nErrCode )
-{
-}
-
-void XclExpErrorCell::SaveXml( XclExpXmlStream& rStrm )
-{
- sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
- rWorksheet->startElement( XML_c,
- XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
- XML_s, lcl_GetStyleId( rStrm, *this ).getStr(),
- XML_t, "e",
- // OOXTODO: XML_cm, XML_vm, XML_ph
- FSEND );
- rWorksheet->startElement( XML_v, FSEND );
- rWorksheet->write( (sal_Int32) mnErrCode );
- rWorksheet->endElement( XML_v );
- rWorksheet->endElement( XML_c );
-}
-
-void XclExpErrorCell::WriteContents( XclExpStream& rStrm )
-{
- rStrm << mnErrCode << EXC_BOOLERR_ERROR;
-}
+//UNUSED2009-05 IMPL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell, 256, 256 )
+//UNUSED2009-05
+//UNUSED2009-05 XclExpErrorCell::XclExpErrorCell(
+//UNUSED2009-05 const XclExpRoot rRoot, const XclAddress& rXclPos,
+//UNUSED2009-05 const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, sal_uInt8 nErrCode ) :
+//UNUSED2009-05 // #i41210# always use latin script for error cells
+//UNUSED2009-05 XclExpSingleCellBase( rRoot, EXC_ID3_BOOLERR, 2, rXclPos, pPattern, ApiScriptType::LATIN, nForcedXFId ),
+//UNUSED2009-05 mnErrCode( nErrCode )
+//UNUSED2009-05 {
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void XclExpErrorCell::SaveXml( XclExpXmlStream& rStrm )
+//UNUSED2009-05 {
+//UNUSED2009-05 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+//UNUSED2009-05 rWorksheet->startElement( XML_c,
+//UNUSED2009-05 XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
+//UNUSED2009-05 XML_s, lcl_GetStyleId( rStrm, *this ).getStr(),
+//UNUSED2009-05 XML_t, "e",
+//UNUSED2009-05 // OOXTODO: XML_cm, XML_vm, XML_ph
+//UNUSED2009-05 FSEND );
+//UNUSED2009-05 rWorksheet->startElement( XML_v, FSEND );
+//UNUSED2009-05 rWorksheet->write( (sal_Int32) mnErrCode );
+//UNUSED2009-05 rWorksheet->endElement( XML_v );
+//UNUSED2009-05 rWorksheet->endElement( XML_c );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void XclExpErrorCell::WriteContents( XclExpStream& rStrm )
+//UNUSED2009-05 {
+//UNUSED2009-05 rStrm << mnErrCode << EXC_BOOLERR_ERROR;
+//UNUSED2009-05 }
// ----------------------------------------------------------------------------
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index d74071f17cab..2d920b0a0bd4 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -69,6 +69,9 @@
#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"
@@ -77,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;
@@ -638,8 +638,11 @@ Reference< XLabeledDataSequence > lclCreateLabeledDataSequence(
// ----------------------------------------------------------------------------
XclImpChSourceLink::XclImpChSourceLink( const XclImpChRoot& rRoot ) :
- XclImpChRoot( rRoot ),
- mpTokenArray(static_cast<ScTokenArray*>(NULL))
+ XclImpChRoot( rRoot )
+{
+}
+
+XclImpChSourceLink::~XclImpChSourceLink()
{
}
@@ -650,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
@@ -688,38 +689,37 @@ 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
@@ -738,25 +738,23 @@ Reference< XDataSequence > XclImpChSourceLink::CreateDataSequence( const OUStrin
{
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" );
}
-
- // set sequence role
- ScfPropertySet aSeqProp( xDataSeq );
- aSeqProp.SetProperty( EXC_CHPROP_ROLE, rRole );
}
return xDataSeq;
}
@@ -1782,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() )
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 ad164cd691fa..599b33f9c8aa 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
@@ -2904,10 +2900,10 @@ void XclImpPictureObj::ReadPictFmla( XclImpStream& rStrm, sal_uInt16 nLinkSize )
// DFF stream conversion ======================================================
-void XclImpSolverContainer::ReadSolverContainer( SvStream& rDffStrm )
-{
- rDffStrm >> *this;
-}
+//UNUSED2009-05 void XclImpSolverContainer::ReadSolverContainer( SvStream& rDffStrm )
+//UNUSED2009-05 {
+//UNUSED2009-05 rDffStrm >> *this;
+//UNUSED2009-05 }
void XclImpSolverContainer::InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 nDffShapeId, sal_uInt32 nDffFlags )
{
@@ -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/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index dab0a5c412c2..47b42ad51e93 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -137,23 +137,23 @@ bool XclImpAddressConverter::ConvertRange( ScRange& rScRange,
return bValidStart;
}
-ScRange XclImpAddressConverter::CreateValidRange(
- const XclRange& rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn )
-{
- return ScRange(
- CreateValidAddress( rXclRange.maFirst, nScTab1, bWarn ),
- CreateValidAddress( rXclRange.maLast, nScTab2, bWarn ) );
-}
+//UNUSED2009-05 ScRange XclImpAddressConverter::CreateValidRange(
+//UNUSED2009-05 const XclRange& rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn )
+//UNUSED2009-05 {
+//UNUSED2009-05 return ScRange(
+//UNUSED2009-05 CreateValidAddress( rXclRange.maFirst, nScTab1, bWarn ),
+//UNUSED2009-05 CreateValidAddress( rXclRange.maLast, nScTab2, bWarn ) );
+//UNUSED2009-05 }
// cell range list ------------------------------------------------------------
-bool XclImpAddressConverter::CheckRangeList( const XclRangeList& rXclRanges, bool bWarn )
-{
- for( XclRangeList::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt )
- if( !CheckRange( *aIt, bWarn ) )
- return false;
- return true;
-}
+//UNUSED2009-05 bool XclImpAddressConverter::CheckRangeList( const XclRangeList& rXclRanges, bool bWarn )
+//UNUSED2009-05 {
+//UNUSED2009-05 for( XclRangeList::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt )
+//UNUSED2009-05 if( !CheckRange( *aIt, bWarn ) )
+//UNUSED2009-05 return false;
+//UNUSED2009-05 return true;
+//UNUSED2009-05 }
void XclImpAddressConverter::ConvertRangeList( ScRangeList& rScRanges,
const XclRangeList& rXclRanges, SCTAB nScTab, bool bWarn )
@@ -254,11 +254,11 @@ EditTextObject* XclImpStringHelper::CreateTextObject(
return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_EDITENG, 0 );
}
-EditTextObject* XclImpStringHelper::CreateNoteObject(
- const XclImpRoot& rRoot, const XclImpString& rString )
-{
- return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_NOTE, 0 );
-}
+//UNUSED2009-05 EditTextObject* XclImpStringHelper::CreateNoteObject(
+//UNUSED2009-05 const XclImpRoot& rRoot, const XclImpString& rString )
+//UNUSED2009-05 {
+//UNUSED2009-05 return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_NOTE, 0 );
+//UNUSED2009-05 }
ScBaseCell* XclImpStringHelper::CreateCell(
const XclImpRoot& rRoot, const XclImpString& rString, sal_uInt16 nXFIndex )
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 16a3edf46373..9033ecc125bd 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -206,20 +206,20 @@ public:
private:
/** Returns the specified SUPBOOK (external document). */
const XclImpSupbook* GetSupbook( sal_uInt32 nXtiIndex ) const;
- /** Returns the SUPBOOK (external workbook) specified by its URL. */
- const XclImpSupbook* GetSupbook( const String& rUrl ) const;
+//UNUSED2009-05 /** Returns the SUPBOOK (external workbook) specified by its URL. */
+//UNUSED2009-05 const XclImpSupbook* GetSupbook( const String& rUrl ) const;
void LoadCachedValues();
- /** Finds the largest range of sheet indexes in a SUPBOOK after a start sheet index.
- @param rnSBTabFirst (out-param) The first sheet index of the range in SUPBOOK is returned here.
- @param rnSBTabLast (out-param) The last sheet index of the range in SUPBOOK is returned here (inclusive).
- @param nSupbook The list index of the SUPBOOK.
- @param nSBTabStart The first allowed sheet index. Sheet ranges with an earlier start index are ignored.
- @return true = the return values are valid; false = nothing found. */
- bool FindNextTabRange(
- sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast,
- sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const;
+//UNUSED2009-05 /** Finds the largest range of sheet indexes in a SUPBOOK after a start sheet index.
+//UNUSED2009-05 @param rnSBTabFirst (out-param) The first sheet index of the range in SUPBOOK is returned here.
+//UNUSED2009-05 @param rnSBTabLast (out-param) The last sheet index of the range in SUPBOOK is returned here (inclusive).
+//UNUSED2009-05 @param nSupbook The list index of the SUPBOOK.
+//UNUSED2009-05 @param nSBTabStart The first allowed sheet index. Sheet ranges with an earlier start index are ignored.
+//UNUSED2009-05 @return true = the return values are valid; false = nothing found. */
+//UNUSED2009-05 bool FindNextTabRange(
+//UNUSED2009-05 sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast,
+//UNUSED2009-05 sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const;
private:
typedef ScfDelList< XclImpXti > XclImpXtiList;
@@ -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();
@@ -676,13 +677,13 @@ const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt32 nXtiIndex ) c
return pXti ? maSupbookList.GetObject( pXti->mnSupbook ) : 0;
}
-const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( const String& rUrl ) const
-{
- for( const XclImpSupbook* pSupbook = maSupbookList.First(); pSupbook; pSupbook = maSupbookList.Next() )
- if( pSupbook->GetXclUrl() == rUrl )
- return pSupbook;
- return 0;
-}
+//UNUSED2009-05 const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( const String& rUrl ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 for( const XclImpSupbook* pSupbook = maSupbookList.First(); pSupbook; pSupbook = maSupbookList.Next() )
+//UNUSED2009-05 if( pSupbook->GetXclUrl() == rUrl )
+//UNUSED2009-05 return pSupbook;
+//UNUSED2009-05 return 0;
+//UNUSED2009-05 }
void XclImpLinkManagerImpl::LoadCachedValues()
{
@@ -697,21 +698,21 @@ void XclImpLinkManagerImpl::LoadCachedValues()
}
}
-bool XclImpLinkManagerImpl::FindNextTabRange(
- sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast,
- sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const
-{
- rnSBTabFirst = rnSBTabLast = EXC_NOTAB;
- for( const XclImpXti* pXti = maXtiList.First(); pXti; pXti = maXtiList.Next() )
- {
- if( (nSupbook == pXti->mnSupbook) && (nSBTabStart <= pXti->mnSBTabLast) && (pXti->mnSBTabFirst < rnSBTabFirst) )
- {
- rnSBTabFirst = ::std::max( nSBTabStart, pXti->mnSBTabFirst );
- rnSBTabLast = pXti->mnSBTabLast;
- }
- }
- return rnSBTabFirst != EXC_NOTAB;
-}
+//UNUSED2009-05 bool XclImpLinkManagerImpl::FindNextTabRange(
+//UNUSED2009-05 sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast,
+//UNUSED2009-05 sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 rnSBTabFirst = rnSBTabLast = EXC_NOTAB;
+//UNUSED2009-05 for( const XclImpXti* pXti = maXtiList.First(); pXti; pXti = maXtiList.Next() )
+//UNUSED2009-05 {
+//UNUSED2009-05 if( (nSupbook == pXti->mnSupbook) && (nSBTabStart <= pXti->mnSBTabLast) && (pXti->mnSBTabFirst < rnSBTabFirst) )
+//UNUSED2009-05 {
+//UNUSED2009-05 rnSBTabFirst = ::std::max( nSBTabStart, pXti->mnSBTabFirst );
+//UNUSED2009-05 rnSBTabLast = pXti->mnSBTabLast;
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return rnSBTabFirst != EXC_NOTAB;
+//UNUSED2009-05 }
// ============================================================================
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 af8cbfdf229f..d5664c088e29 100644
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -504,34 +504,36 @@ const XclChFormatInfo& XclChFormatInfoProvider::GetFormatInfo( XclChObjectType e
namespace {
// chart type service names
-const sal_Char SERVICE_CHART2_AREA[] = "com.sun.star.chart2.AreaChartType";
-const sal_Char SERVICE_CHART2_CANDLE[] = "com.sun.star.chart2.CandleStickChartType";
-const sal_Char SERVICE_CHART2_COLUMN[] = "com.sun.star.chart2.ColumnChartType";
-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_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo
+const sal_Char SERVICE_CHART2_AREA[] = "com.sun.star.chart2.AreaChartType";
+const sal_Char SERVICE_CHART2_CANDLE[] = "com.sun.star.chart2.CandleStickChartType";
+const sal_Char SERVICE_CHART2_COLUMN[] = "com.sun.star.chart2.ColumnChartType";
+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_FILLEDNET[] = "com.sun.star.chart2.FilledNetChartType";
+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 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, 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, 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_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 }
+ // 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, 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, 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_FILLEDNET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, true, 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_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 }
};
} // namespace
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 e8fab52ca819..401f135b381a 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -471,11 +471,11 @@ void XclFontData::SetApiFamily( sal_Int16 nApiFamily )
}
}
-void XclFontData::SetApiFontEncoding( sal_Int16 nApiFontEnc )
-{
- // API constants are equal to rtl_TextEncoding constants
- SetFontEncoding( static_cast< rtl_TextEncoding >( nApiFontEnc ) );
-}
+//UNUSED2009-05 void XclFontData::SetApiFontEncoding( sal_Int16 nApiFontEnc )
+//UNUSED2009-05 {
+//UNUSED2009-05 // API constants are equal to rtl_TextEncoding constants
+//UNUSED2009-05 SetFontEncoding( static_cast< rtl_TextEncoding >( nApiFontEnc ) );
+//UNUSED2009-05 }
void XclFontData::SetApiPosture( Awt::FontSlant eApiPosture )
{
@@ -664,6 +664,8 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData,
sal_Int16 nApiEscapement = 0;
sal_Int8 nApiEscHeight = 0;
maHlpChEscapement.ReadFromPropertySet( rPropSet );
+ maHlpChEscapement.ReadFromPropertySet( rPropSet );
+ maHlpChEscapement.ReadFromPropertySet( rPropSet );
maHlpChEscapement >> nApiEscapement >> nApiEscHeight;
rFontData.SetApiEscapement( nApiEscapement );
}
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index e8be57015216..36bbfe1d2787 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1715,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 ) :
@@ -1764,7 +1762,6 @@ ScHTMLOptionIterator& ScHTMLOptionIterator::operator++()
return *this;
}
-
// ============================================================================
ScHTMLEntry::ScHTMLEntry( const SfxItemSet& rItemSet, ScHTMLTableId nTableId ) :
@@ -1819,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:
@@ -1838,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 ) :
@@ -1908,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 )
@@ -1941,7 +1939,6 @@ ScHTMLTableIterator::ScHTMLTableIterator( const ScHTMLTableMap* pTableMap )
}
}
-
// ============================================================================
ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ) :
@@ -1951,7 +1948,6 @@ ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ) :
++mrnUnusedId;
}
-
// ----------------------------------------------------------------------------
ScHTMLTable::ScHTMLTable( ScHTMLTable& rParentTable, const ImportInfo& rInfo, bool bPreFormText ) :
@@ -2010,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()
@@ -2020,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();
@@ -2084,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 )
@@ -2118,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 );
}
@@ -2144,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() ) );
@@ -2159,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 );
@@ -2186,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 );
}
@@ -2220,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
@@ -2252,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
@@ -2281,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;
@@ -2304,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
@@ -2328,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" );
@@ -2369,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;
}
@@ -2397,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 )
@@ -2425,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 );
@@ -2449,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;
@@ -2461,7 +2474,7 @@ void ScHTMLTable::ImplRowOff()
ImplDataOff();
if( mbRowOn )
{
- mpRowItemSet.reset();
+ mxRowItemSet.reset();
++maCurrCell.mnRow;
mbRowOn = mbDataOn = false;
}
@@ -2473,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;
@@ -2483,7 +2496,7 @@ void ScHTMLTable::ImplDataOff()
{
if( mbDataOn )
{
- mpDataItemSet.reset();
+ mxDataItemSet.reset();
++maCurrCell.mnCol;
mpCurrEntryList = 0;
mbDataOn = false;
@@ -2546,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(
@@ -2569,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 );
}
}
}
@@ -2602,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
@@ -2617,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;
@@ -2637,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;
@@ -2646,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 );
}
}
}
@@ -2682,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 )
{
@@ -2723,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;
}
}
@@ -2735,7 +2758,6 @@ void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos )
}
}
-
// ============================================================================
ScHTMLGlobalTable::ScHTMLGlobalTable( SfxItemPool& rPool, EditEngine& rEditEngine, ScEEParseList& rEEParseList, ScHTMLTableId& rnUnusedId ) :
@@ -2757,7 +2779,6 @@ void ScHTMLGlobalTable::Recalc()
RecalcDocPos( GetDocPos() );
}
-
// ============================================================================
ScHTMLQueryParser::ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc ) :
@@ -2765,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()
@@ -2804,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 )
@@ -2928,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;
@@ -3004,7 +3025,6 @@ void ScHTMLQueryParser::CloseTable( const ImportInfo& rInfo )
mpCurrTable = mpCurrTable->CloseTable( rInfo );
}
-
// ----------------------------------------------------------------------------
IMPL_LINK( ScHTMLQueryParser, HTMLImportHdl, const ImportInfo*, pInfo )
@@ -3039,6 +3059,5 @@ IMPL_LINK( ScHTMLQueryParser, HTMLImportHdl, const ImportInfo*, pInfo )
return 0;
}
-
// ============================================================================
diff --git a/sc/source/filter/inc/excimp8.hxx b/sc/source/filter/inc/excimp8.hxx
index 2f3913f01c57..9bd633eae879 100644
--- a/sc/source/filter/inc/excimp8.hxx
+++ b/sc/source/filter/inc/excimp8.hxx
@@ -61,7 +61,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
@@ -73,6 +72,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..568032aa317f 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -149,7 +149,6 @@ protected:
public:
inline ExcBoolRecord( const BOOL bDefault ) : bVal( bDefault ) {}
- ExcBoolRecord( SfxItemSet*, USHORT nWhich, BOOL bDefault );
virtual sal_Size GetLen( void ) const;
};
@@ -246,10 +245,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/op.h b/sc/source/filter/inc/op.h
index fb79084f48fb..2bfbedde0aed 100644
--- a/sc/source/filter/inc/op.h
+++ b/sc/source/filter/inc/op.h
@@ -42,7 +42,7 @@ void OP_EOF( SvStream &aStream, USHORT nLaenge );
void OP_Integer( SvStream &aStream, USHORT nLaenge );
void OP_Number( SvStream &aStream, USHORT nLaenge );
void OP_Label( SvStream &aStream, USHORT nLaenge );
-void OP_Text( SvStream &aStream, USHORT nLaenge ); // WK3
+//UNUSED2009-05 void OP_Text( SvStream &aStream, USHORT nLaenge ); // WK3
void OP_Integer3( SvStream &aStream, USHORT nLaenge ); // WK3
void OP_Number3( SvStream &aStream, USHORT nLaenge ); // WK3
void OP_Formula( SvStream &aStream, USHORT nLaenge );
diff --git a/sc/source/filter/inc/qpro.hxx b/sc/source/filter/inc/qpro.hxx
index 0db26b9c280c..a9b1c61955c5 100644
--- a/sc/source/filter/inc/qpro.hxx
+++ b/sc/source/filter/inc/qpro.hxx
@@ -48,7 +48,6 @@ class ScQProReader : public ScBiffReader
{
public:
bool recordsLeft();
- bool IsEndOfFile();
void SetEof( bool bValue ){ mbEndOfFile = bValue; }
bool nextRecord();
sal_uInt16 getId() { return mnId; }
diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx
index 9627f2457a67..3a60b709d5bf 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -179,7 +179,7 @@ class TokenPool
void GrowString( void );
void GrowDouble( void );
- void GrowError( void );
+//UNUSED2009-05 void GrowError( void );
void GrowTripel( void );
void GrowId( void );
void GrowElement( void );
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/xelink.hxx b/sc/source/filter/inc/xelink.hxx
index 3a016759275e..1b49bf7bac02 100644
--- a/sc/source/filter/inc/xelink.hxx
+++ b/sc/source/filter/inc/xelink.hxx
@@ -84,8 +84,8 @@ public:
/** Returns the Calc sheet index of the nSortedTab-th entry in the sorted sheet names list. */
SCTAB GetRealScTab( SCTAB nSortedScTab ) const;
- /** Returns the index of the passed Calc sheet in the sorted sheet names list. */
- SCTAB GetSortedScTab( SCTAB nScTab ) const;
+//UNUSED2009-05 /** Returns the index of the passed Calc sheet in the sorted sheet names list. */
+//UNUSED2009-05 SCTAB GetSortedScTab( SCTAB nScTab ) const;
/** Returns the number of Calc sheets. */
inline SCTAB GetScTabCount() const { return mnScCnt; }
diff --git a/sc/source/filter/inc/xename.hxx b/sc/source/filter/inc/xename.hxx
index affe57264331..32c48e779cad 100644
--- a/sc/source/filter/inc/xename.hxx
+++ b/sc/source/filter/inc/xename.hxx
@@ -56,8 +56,8 @@ public:
/** Inserts the Calc database range with the passed index and returns the Excel NAME index. */
sal_uInt16 InsertDBRange( USHORT nScDBRangeIdx );
- /** Inserts a new built-in defined name. */
- sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab );
+//UNUSED2009-05 /** Inserts a new built-in defined name. */
+//UNUSED2009-05 sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab );
/** Inserts a new built-in defined name, referring to the passed sheet range. */
sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange );
/** Inserts a new built-in defined name, referring to the passed sheet range list. */
diff --git a/sc/source/filter/inc/xepivot.hxx b/sc/source/filter/inc/xepivot.hxx
index 80356d41f4a8..28df1586cdcb 100644
--- a/sc/source/filter/inc/xepivot.hxx
+++ b/sc/source/filter/inc/xepivot.hxx
@@ -198,8 +198,8 @@ public:
sal_uInt16 GetFieldCount() const;
/** Returns the specified pivot cache field. */
const XclExpPCField* GetField( sal_uInt16 nFieldIdx ) const;
- /** Returns a pivot cache field by its name. */
- const XclExpPCField* GetField( const String& rFieldName ) const;
+//UNUSED2009-05 /** Returns a pivot cache field by its name. */
+//UNUSED2009-05 const XclExpPCField* GetField( const String& rFieldName ) const;
/** Returns true, if this pivot cache contains non-standard fields (e.g. grouping fields). */
bool HasAddFields() const;
@@ -301,8 +301,8 @@ public:
/** Returns the index of the last inserted data info struct. */
sal_uInt16 GetLastDataInfoIndex() const;
- /** Returns an item by its name. */
- const XclExpPTItem* GetItem( const String& rName ) const;
+//UNUSED2009-05 /** Returns an item by its name. */
+//UNUSED2009-05 const XclExpPTItem* GetItem( const String& rName ) const;
/** Returns the list index of an item by its name.
@param nDefaultIdx This value will be returned, if the item could not be found. */
sal_uInt16 GetItemIndex( const String& rName, sal_uInt16 nDefaultIdx ) const;
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/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 7be4f406ee23..6680aa1719ca 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -409,23 +409,23 @@ private:
// ----------------------------------------------------------------------------
-/** Represents a BOOLERR record that describes a cell with an error code. */
-class XclExpErrorCell : public XclExpSingleCellBase
-{
- DECL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell )
-
-public:
- explicit XclExpErrorCell( const XclExpRoot rRoot, const XclAddress& rXclPos,
- const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
- sal_uInt8 nErrCode );
-
- virtual void SaveXml( XclExpXmlStream& rStrm );
-private:
- virtual void WriteContents( XclExpStream& rStrm );
-
-private:
- sal_uInt8 mnErrCode; /// The error code.
-};
+//UNUSED2009-05 /** Represents a BOOLERR record that describes a cell with an error code. */
+//UNUSED2009-05 class XclExpErrorCell : public XclExpSingleCellBase
+//UNUSED2009-05 {
+//UNUSED2009-05 DECL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell )
+//UNUSED2009-05
+//UNUSED2009-05 public:
+//UNUSED2009-05 explicit XclExpErrorCell( const XclExpRoot rRoot, const XclAddress& rXclPos,
+//UNUSED2009-05 const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
+//UNUSED2009-05 sal_uInt8 nErrCode );
+//UNUSED2009-05
+//UNUSED2009-05 virtual void SaveXml( XclExpXmlStream& rStrm );
+//UNUSED2009-05 private:
+//UNUSED2009-05 virtual void WriteContents( XclExpStream& rStrm );
+//UNUSED2009-05
+//UNUSED2009-05 private:
+//UNUSED2009-05 sal_uInt8 mnErrCode; /// The error code.
+//UNUSED2009-05 };
// ----------------------------------------------------------------------------
@@ -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 8383f58857d3..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;
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/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index 5fd785992ae4..c9d2daa6bb2f 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -917,8 +917,8 @@ private:
class XclImpSolverContainer : public SvxMSDffSolverContainer
{
public:
- /** Reads the entire solver container. Stream must point to begin of container header. */
- void ReadSolverContainer( SvStream& rDffStrm );
+//UNUSED2009-05 /** Reads the entire solver container. Stream must point to begin of container header. */
+//UNUSED2009-05 void ReadSolverContainer( SvStream& rDffStrm );
/** Inserts information about a new SdrObject. */
void InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 nDffShapeId, sal_uInt32 nDffFlags );
diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx
index 5e60feeb49bb..a46d473f02a9 100644
--- a/sc/source/filter/inc/xihelper.hxx
+++ b/sc/source/filter/inc/xihelper.hxx
@@ -89,24 +89,24 @@ public:
bool ConvertRange( ScRange& rScRange, const XclRange& rXclRange,
SCTAB nScTab1, SCTAB nScTab2, bool bWarn );
- /** Returns a valid cell range by moving it into allowed dimensions.
- @descr The start and/or end position of the range may be modified.
- @param rXclRange The Excel cell range to convert.
- @param bWarn true = Sets the internal flag that produces a warning box
- after loading/saving the file, if the cell range contains invalid cells.
- @return The converted Calc cell range. */
- ScRange CreateValidRange( const XclRange& rXclRange,
- SCTAB nScTab1, SCTAB nScTab2, bool bWarn );
+//UNUSED2009-05 /** Returns a valid cell range by moving it into allowed dimensions.
+//UNUSED2009-05 @descr The start and/or end position of the range may be modified.
+//UNUSED2009-05 @param rXclRange The Excel cell range to convert.
+//UNUSED2009-05 @param bWarn true = Sets the internal flag that produces a warning box
+//UNUSED2009-05 after loading/saving the file, if the cell range contains invalid cells.
+//UNUSED2009-05 @return The converted Calc cell range. */
+//UNUSED2009-05 ScRange CreateValidRange( const XclRange& rXclRange,
+//UNUSED2009-05 SCTAB nScTab1, SCTAB nScTab2, bool bWarn );
// cell range list --------------------------------------------------------
- /** Checks if the passed cell range list is valid.
- @param rXclRanges The Excel cell range list to check.
- @param bWarn true = Sets the internal flag that produces a warning box
- after loading/saving the file, if the cell range list contains at
- least one invalid range.
- @return true = Cell range list in rScRanges is completly valid. */
- bool CheckRangeList( const XclRangeList& rXclRanges, bool bWarn );
+//UNUSED2009-05 /** Checks if the passed cell range list is valid.
+//UNUSED2009-05 @param rXclRanges The Excel cell range list to check.
+//UNUSED2009-05 @param bWarn true = Sets the internal flag that produces a warning box
+//UNUSED2009-05 after loading/saving the file, if the cell range list contains at
+//UNUSED2009-05 least one invalid range.
+//UNUSED2009-05 @return true = Cell range list in rScRanges is completly valid. */
+//UNUSED2009-05 bool CheckRangeList( const XclRangeList& rXclRanges, bool bWarn );
/** Converts the passed Excel cell range list to a Calc cell range list.
@descr The start position of the ranges will not be modified. Cell
@@ -139,11 +139,11 @@ public:
const XclImpRoot& rRoot,
const XclImpString& rString );
- /** Returns a new edit engine text object for a cell note.
- @param nXFIndex Index to XF for first text portion (for escapement). */
- static EditTextObject* CreateNoteObject(
- const XclImpRoot& rRoot,
- const XclImpString& rString );
+//UNUSED2009-05 /** Returns a new edit engine text object for a cell note.
+//UNUSED2009-05 @param nXFIndex Index to XF for first text portion (for escapement). */
+//UNUSED2009-05 static EditTextObject* CreateNoteObject(
+//UNUSED2009-05 const XclImpRoot& rRoot,
+//UNUSED2009-05 const XclImpString& rString );
/** Creates a new text cell or edit cell for a Calc document.
@param nXFIndex Index to XF for first text portion (for escapement). */
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 77e85eda32b9..7e3873b1f1cf 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -156,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 =================================================
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/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx
index 303da212d262..9d02f0720efc 100644
--- a/sc/source/filter/inc/xlstyle.hxx
+++ b/sc/source/filter/inc/xlstyle.hxx
@@ -372,8 +372,8 @@ struct XclFontData
void SetApiHeight( float fPoint );
/** Sets the API font family. */
void SetApiFamily( sal_Int16 nApiFamily );
- /** Sets the API font text encoding. */
- void SetApiFontEncoding( sal_Int16 nApiFontEnc );
+//UNUSED2009-05 /** Sets the API font text encoding. */
+//UNUSED2009-05 void SetApiFontEncoding( sal_Int16 nApiFontEnc );
/** Sets the API font posture. */
void SetApiPosture( ::com::sun::star::awt::FontSlant eApiPosture );
/** Sets the API font weight. */
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index dab66815947e..8759d21297f3 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -171,20 +171,20 @@ void OP_Label( SvStream& r, UINT16 n )
}
-void OP_Text( SvStream& r, UINT16 n ) // WK3
-{
- UINT16 nRow;
- BYTE nCol, nTab;
- sal_Char pText[ 256 ];
-
- r >> nRow >> nTab >> nCol;
- n -= 4;
-
- r.Read( pText, n );
- pText[ n ] = 0; // zur Sicherheit Nullterminator anhaengen
-
- PutFormString( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), static_cast<SCTAB> (nTab), pText );
-}
+//UNUSED2009-05 void OP_Text( SvStream& r, UINT16 n ) // WK3
+//UNUSED2009-05 {
+//UNUSED2009-05 UINT16 nRow;
+//UNUSED2009-05 BYTE nCol, nTab;
+//UNUSED2009-05 sal_Char pText[ 256 ];
+//UNUSED2009-05
+//UNUSED2009-05 r >> nRow >> nTab >> nCol;
+//UNUSED2009-05 n -= 4;
+//UNUSED2009-05
+//UNUSED2009-05 r.Read( pText, n );
+//UNUSED2009-05 pText[ n ] = 0; // zur Sicherheit Nullterminator anhaengen
+//UNUSED2009-05
+//UNUSED2009-05 PutFormString( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), static_cast<SCTAB> (nTab), pText );
+//UNUSED2009-05 }
void OP_Formula( SvStream& r, UINT16 /*n*/ )
@@ -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 52627c7848e4..5ea9efae2b3e 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -217,12 +217,6 @@ bool ScQProReader::recordsLeft()
return bValue;
}
-bool ScQProReader::IsEndOfFile()
-{
- bool bValue = ScBiffReader::mbEndOfFile;
- return bValue;
-}
-
bool ScQProReader::nextRecord()
{
bool bValue = ScBiffReader::nextRecord();
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 760599ff594b..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;
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/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
index 370341dc96d3..6a182dcdc737 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/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 b446732a534f..8250051f4334 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -69,6 +69,7 @@
#include "postit.hxx"
#include "externalrefmgr.hxx"
#include "editutil.hxx"
+#include "tabprotection.hxx"
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -595,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" ));
@@ -1469,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());
}
@@ -1543,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());
}
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/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 4e36c8df0196..4dbc47524276 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -371,7 +371,7 @@ ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell)
::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos)
{
::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData
- (new ScAccessibleCellTextData(pViewShell, aCell, eSplitPos));
+ ( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) );
::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData));
return pEditSource;
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 6e0f4f10abec..2e6d9a256d75 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/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index bd09a1f93359..9801c9eeb972 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1906,40 +1906,40 @@ ScShapeChilds* ScAccessibleDocumentPagePreview::GetShapeChilds()
return mpShapeChilds;
}
-uno::Reference < XAccessible > ScAccessibleDocumentPagePreview::GetCurrentAccessibleTable()
-{
- if (!mpTable)
- {
- if ( mpViewShell )
- {
- const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
- ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
- //! order is background shapes, header, table or notes, footer, foreground shapes, controls
- sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders);
-
- mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex );
- mpTable->acquire();
- mpTable->Init();
- }
- }
- return mpTable;
-}
-
-void ScAccessibleDocumentPagePreview::ChildCountChanged()
-{
- if (mpViewShell)
- {
- const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
- ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
- //! order is background shapes, header, table or notes, footer, foreground shapes, controls
- if(mpHeader)
- mpHeader->SetCurrentIndexInParent(aCount.nBackShapes);
- if (mpTable)
- mpTable->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders);
- if (mpFooter)
- mpFooter->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs);
-
- if (mpNotesChilds)
- mpNotesChilds->SetOffset(aCount.nBackShapes + aCount.nHeaders);
- }
-}
+//UNUSED2009-05 uno::Reference < XAccessible > ScAccessibleDocumentPagePreview::GetCurrentAccessibleTable()
+//UNUSED2009-05 {
+//UNUSED2009-05 if (!mpTable)
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( mpViewShell )
+//UNUSED2009-05 {
+//UNUSED2009-05 const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+//UNUSED2009-05 ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+//UNUSED2009-05 //! order is background shapes, header, table or notes, footer, foreground shapes, controls
+//UNUSED2009-05 sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders);
+//UNUSED2009-05
+//UNUSED2009-05 mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex );
+//UNUSED2009-05 mpTable->acquire();
+//UNUSED2009-05 mpTable->Init();
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return mpTable;
+//UNUSED2009-05 }
+
+//UNUSED2009-05 void ScAccessibleDocumentPagePreview::ChildCountChanged()
+//UNUSED2009-05 {
+//UNUSED2009-05 if (mpViewShell)
+//UNUSED2009-05 {
+//UNUSED2009-05 const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+//UNUSED2009-05 ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+//UNUSED2009-05 //! order is background shapes, header, table or notes, footer, foreground shapes, controls
+//UNUSED2009-05 if(mpHeader)
+//UNUSED2009-05 mpHeader->SetCurrentIndexInParent(aCount.nBackShapes);
+//UNUSED2009-05 if (mpTable)
+//UNUSED2009-05 mpTable->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders);
+//UNUSED2009-05 if (mpFooter)
+//UNUSED2009-05 mpFooter->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs);
+//UNUSED2009-05
+//UNUSED2009-05 if (mpNotesChilds)
+//UNUSED2009-05 mpNotesChilds->SetOffset(aCount.nBackShapes + aCount.nHeaders);
+//UNUSED2009-05 }
+//UNUSED2009-05 }
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 18470475cebf..feeae8c73023 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -37,6 +37,7 @@
#include <memory>
#include "AccessibleText.hxx"
+#include "AccessibleCell.hxx"
#include "tabvwsh.hxx"
#include "editutil.hxx"
#include "document.hxx"
@@ -54,6 +55,7 @@
#include <svx/editobj.hxx>
#include <svx/adjitem.hxx>
#include <svx/svdmodel.hxx>
+#include <svx/algitem.hxx>
// ============================================================================
@@ -753,13 +755,14 @@ void ScEditViewForwarder::SetInvalid()
// ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object
ScAccessibleCellTextData::ScAccessibleCellTextData(ScTabViewShell* pViewShell,
- const ScAddress& rP, ScSplitPos eSplitPos)
+ const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell)
: ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP),
mpViewForwarder(NULL),
mpEditViewForwarder(NULL),
mpViewShell(pViewShell),
meSplitPos(eSplitPos),
- mbViewEditEngine(sal_False)
+ mbViewEditEngine(sal_False),
+ mpAccessibleCell( pAccCell )
{
}
@@ -792,7 +795,7 @@ void ScAccessibleCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
ScAccessibleTextData* ScAccessibleCellTextData::Clone() const
{
- return new ScAccessibleCellTextData(mpViewShell, aCellPos, meSplitPos);
+ return new ScAccessibleCellTextData( mpViewShell, aCellPos, meSplitPos, mpAccessibleCell );
}
void ScAccessibleCellTextData::GetCellText(const ScAddress& rCellPos, String& rText)
@@ -866,7 +869,8 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
if (!bHasForwarder)*/
ScCellTextData::GetTextForwarder(); // creates Forwarder and EditEngine
- if (pEditEngine && mpViewShell)
+ ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL );
+ if ( pDoc && pEditEngine && mpViewShell )
{
long nSizeX, nSizeY;
mpViewShell->GetViewData()->GetMergeSizePixel(
@@ -874,9 +878,39 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
Size aSize(nSizeX, nSizeY);
- Window* pWin = mpViewShell->GetWindowByPos(meSplitPos);
- if (pWin)
- aSize = pWin->PixelToLogic(aSize, pEditEngine->GetRefMapMode());
+ // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
+ long nIndent = 0;
+ const SvxHorJustifyItem* pHorJustifyItem = static_cast< const SvxHorJustifyItem* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY ) );
+ SvxCellHorJustify eHorJust = ( pHorJustifyItem ? static_cast< SvxCellHorJustify >( pHorJustifyItem->GetValue() ) : SVX_HOR_JUSTIFY_STANDARD );
+ if ( eHorJust == SVX_HOR_JUSTIFY_LEFT )
+ {
+ const SfxUInt16Item* pIndentItem = static_cast< const SfxUInt16Item* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_INDENT ) );
+ if ( pIndentItem )
+ {
+ nIndent = static_cast< long >( pIndentItem->GetValue() );
+ }
+ }
+
+ const SvxMarginItem* pMarginItem = static_cast< const SvxMarginItem* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_MARGIN ) );
+ ScViewData* pViewData = mpViewShell->GetViewData();
+ double nPPTX = ( pViewData ? pViewData->GetPPTX() : 0 );
+ double nPPTY = ( pViewData ? pViewData->GetPPTY() : 0 );
+ long nLeftM = ( pMarginItem ? static_cast< long >( ( pMarginItem->GetLeftMargin() + nIndent ) * nPPTX ) : 0 );
+ long nTopM = ( pMarginItem ? static_cast< long >( pMarginItem->GetTopMargin() * nPPTY ) : 0 );
+ long nRightM = ( pMarginItem ? static_cast< long >( pMarginItem->GetRightMargin() * nPPTX ) : 0 );
+ long nBottomM = ( pMarginItem ? static_cast< long >( pMarginItem->GetBottomMargin() * nPPTY ) : 0 );
+ long nWidth = aSize.getWidth() - nLeftM - nRightM;
+ aSize.setWidth( nWidth );
+ aSize.setHeight( aSize.getHeight() - nTopM - nBottomM );
+
+ Window* pWin = mpViewShell->GetWindowByPos( meSplitPos );
+ if ( pWin )
+ {
+ aSize = pWin->PixelToLogic( aSize, pEditEngine->GetRefMapMode() );
+ }
/* #i19430# Gnopernicus reads text partly if it sticks out of the cell
boundaries. This leads to wrong results in cases where the cell text
@@ -888,20 +922,94 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
return the size of the complete text then, which is used to expand
the cell bounding box in ScAccessibleCell::GetBoundingBox()
(see sc/source/ui/Accessibility/AccessibleCell.cxx). */
- if (pDocShell && pDocShell->GetDocument())
+ const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) );
+ if( pItem && (pItem->GetValue() != 0) )
+ {
+ pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
+ long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
+ aSize.setWidth( std::max( aSize.getWidth(), nTxtWidth + 2 ) );
+ }
+ else
{
- const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >(
- pDocShell->GetDocument()->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) );
- if( pItem && (pItem->GetValue() != 0) )
+ // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
+ const SfxBoolItem* pLineBreakItem = static_cast< const SfxBoolItem* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_LINEBREAK ) );
+ bool bLineBreak = ( pLineBreakItem && pLineBreakItem->GetValue() );
+ if ( !bLineBreak )
{
- pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
- long nTextWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
- aSize.setWidth( std::max( aSize.getWidth(), nTextWidth + 2 ) );
+ long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
+ aSize.setWidth( ::std::max( aSize.getWidth(), nTxtWidth ) );
}
}
- // #i70916# Text in spread sheet cells return the wrong extents
- pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
+ pEditEngine->SetPaperSize( aSize );
+
+ // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
+ if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD && pDoc->HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) )
+ {
+ pEditEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+ }
+
+ Size aTextSize;
+ if ( pWin )
+ {
+ aTextSize = pWin->LogicToPixel( Size( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() ), pEditEngine->GetRefMapMode() );
+ }
+ long nTextWidth = aTextSize.Width();
+ long nTextHeight = aTextSize.Height();
+
+ long nOffsetX = nLeftM;
+ long nDiffX = nTextWidth - nWidth;
+ if ( nDiffX > 0 )
+ {
+ switch ( eHorJust )
+ {
+ case SVX_HOR_JUSTIFY_RIGHT:
+ {
+ nOffsetX -= nDiffX;
+ }
+ break;
+ case SVX_HOR_JUSTIFY_CENTER:
+ {
+ nOffsetX -= nDiffX / 2;
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+ }
+
+ long nOffsetY = 0;
+ const SvxVerJustifyItem* pVerJustifyItem = static_cast< const SvxVerJustifyItem* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) );
+ SvxCellVerJustify eVerJust = ( pVerJustifyItem ? static_cast< SvxCellVerJustify >( pVerJustifyItem->GetValue() ) : SVX_VER_JUSTIFY_STANDARD );
+ switch ( eVerJust )
+ {
+ case SVX_VER_JUSTIFY_STANDARD:
+ case SVX_VER_JUSTIFY_BOTTOM:
+ {
+ nOffsetY = nSizeY - nBottomM - nTextHeight;
+ }
+ break;
+ case SVX_VER_JUSTIFY_CENTER:
+ {
+ nOffsetY = ( nSizeY - nTopM - nBottomM - nTextHeight ) / 2 + nTopM;
+ }
+ break;
+ default:
+ {
+ nOffsetY = nTopM;
+ }
+ break;
+ }
+
+ if ( mpAccessibleCell )
+ {
+ mpAccessibleCell->SetOffset( Point( nOffsetX, nOffsetY ) );
+ }
pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) );
}
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 3e069b6c9e59..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
@@ -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;
}
@@ -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();
}
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/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 84d274580aa0..60b101d482c0 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -714,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
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 2bec64c31e13..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; \
@@ -398,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/csvtablebox.cxx b/sc/source/ui/dbgui/csvtablebox.cxx
index 2c7691bd7188..c3cfb97cd52c 100644
--- a/sc/source/ui/dbgui/csvtablebox.cxx
+++ b/sc/source/ui/dbgui/csvtablebox.cxx
@@ -42,16 +42,16 @@
// ============================================================================
-ScCsvTableBox::ScCsvTableBox( Window* pParent ) :
- ScCsvControl( pParent, maData, WB_BORDER | WB_TABSTOP | WB_DIALOGCONTROL ),
- maRuler( *this ),
- maGrid( *this ),
- maHScroll( this, WB_HORZ | WB_DRAG ),
- maVScroll( this, WB_VERT | WB_DRAG ),
- maScrollBox( this )
-{
- Init();
-}
+//UNUSED2009-05 ScCsvTableBox::ScCsvTableBox( Window* pParent ) :
+//UNUSED2009-05 ScCsvControl( pParent, maData, WB_BORDER | WB_TABSTOP | WB_DIALOGCONTROL ),
+//UNUSED2009-05 maRuler( *this ),
+//UNUSED2009-05 maGrid( *this ),
+//UNUSED2009-05 maHScroll( this, WB_HORZ | WB_DRAG ),
+//UNUSED2009-05 maVScroll( this, WB_VERT | WB_DRAG ),
+//UNUSED2009-05 maScrollBox( this )
+//UNUSED2009-05 {
+//UNUSED2009-05 Init();
+//UNUSED2009-05 }
ScCsvTableBox::ScCsvTableBox( Window* pParent, const ResId& rResId ) :
ScCsvControl( pParent, maData, rResId ),
@@ -225,24 +225,24 @@ void ScCsvTableBox::SetUniStrings(
EnableRepaint();
}
-void ScCsvTableBox::SetByteStrings(
- const ByteString* pTextLines, CharSet eCharSet,
- const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep )
-{
- // assuming that pTextLines is a string array with size CSV_PREVIEW_LINES
- // -> will be dynamic sometime
- DisableRepaint();
- sal_Int32 nEndLine = GetFirstVisLine() + CSV_PREVIEW_LINES;
- const ByteString* pString = pTextLines;
- for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString )
- {
- if( mbFixedMode )
- maGrid.ImplSetTextLineFix( nLine, String( *pString, eCharSet ) );
- else
- maGrid.ImplSetTextLineSep( nLine, String( *pString, eCharSet ), rSepChars, cTextSep, bMergeSep );
- }
- EnableRepaint();
-}
+//UNUSED2009-05 void ScCsvTableBox::SetByteStrings(
+//UNUSED2009-05 const ByteString* pTextLines, CharSet eCharSet,
+//UNUSED2009-05 const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep )
+//UNUSED2009-05 {
+//UNUSED2009-05 // assuming that pTextLines is a string array with size CSV_PREVIEW_LINES
+//UNUSED2009-05 // -> will be dynamic sometime
+//UNUSED2009-05 DisableRepaint();
+//UNUSED2009-05 sal_Int32 nEndLine = GetFirstVisLine() + CSV_PREVIEW_LINES;
+//UNUSED2009-05 const ByteString* pString = pTextLines;
+//UNUSED2009-05 for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString )
+//UNUSED2009-05 {
+//UNUSED2009-05 if( mbFixedMode )
+//UNUSED2009-05 maGrid.ImplSetTextLineFix( nLine, String( *pString, eCharSet ) );
+//UNUSED2009-05 else
+//UNUSED2009-05 maGrid.ImplSetTextLineSep( nLine, String( *pString, eCharSet ), rSepChars, cTextSep, bMergeSep );
+//UNUSED2009-05 }
+//UNUSED2009-05 EnableRepaint();
+//UNUSED2009-05 }
// column settings ------------------------------------------------------------
diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
index 00931de58924..7d1462f62f27 100644
--- a/sc/source/ui/dbgui/sortdlg.cxx
+++ b/sc/source/ui/dbgui/sortdlg.cxx
@@ -34,7 +34,7 @@
#undef SC_DLLIMPLEMENTATION
-
+#include <vcl/msgbox.hxx>
#include "tpsort.hxx"
#include "sortdlg.hxx"
#include "scresid.hxx"
@@ -69,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/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 84b2330a533b..61bd4f7bf0e9 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -93,7 +93,12 @@
#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 -----------------------------------------------------------
@@ -955,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;
@@ -974,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
@@ -1011,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
@@ -1025,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 );
@@ -1047,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 ) );
@@ -1075,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 !!!
@@ -1099,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 );
@@ -1438,8 +1451,8 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
- if(( eCmd == INS_CELLSDOWN && ( nMergeStartX != nMergeTestStartX || nMergeEndX != nMergeTestEndX ))||
- eCmd == INS_CELLSRIGHT && ( nMergeStartY != nMergeTestStartY || nMergeEndY != nMergeTestEndY ) )
+ if(( eCmd == INS_CELLSDOWN && ( nMergeStartX != nMergeTestStartX || nMergeEndX != nMergeTestEndX )) ||
+ (eCmd == INS_CELLSRIGHT && ( nMergeStartY != nMergeTestStartY || nMergeEndY != nMergeTestEndY )) )
{
if (!bApi)
rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
@@ -2065,6 +2078,12 @@ 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 ) );
@@ -2747,42 +2766,42 @@ BOOL ScDocFunc::SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL /* bApi */ )
return TRUE;
}
-BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar )
-{
- ScDocument* pDoc = rDocShell.GetDocument();
-
- if ( pDoc->GetGrammar() == eGrammar )
- return TRUE;
-
- BOOL bUndo(pDoc->IsUndoEnabled());
- ScDocShellModificator aModificator( rDocShell );
-
- pDoc->SetGrammar( eGrammar );
-
- if (bUndo)
- {
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoSetGrammar( &rDocShell, eGrammar ) );
- }
-
- rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL );
-
- ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if (NULL != pViewSh)
- {
- pViewSh->UpdateInputHandler( FALSE, FALSE );
- }
-
- aModificator.SetDocumentModified();
-
- SfxBindings* pBindings = rDocShell.GetViewBindings();
- if (pBindings)
- {
- // erAck: 2006-09-07T22:19+0200 commented out in CWS scr1c1
- //pBindings->Invalidate( FID_TAB_USE_R1C1 );
- }
-
- return TRUE;
-}
+//UNUSED2009-05 BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar )
+//UNUSED2009-05 {
+//UNUSED2009-05 ScDocument* pDoc = rDocShell.GetDocument();
+//UNUSED2009-05
+//UNUSED2009-05 if ( pDoc->GetGrammar() == eGrammar )
+//UNUSED2009-05 return TRUE;
+//UNUSED2009-05
+//UNUSED2009-05 BOOL bUndo(pDoc->IsUndoEnabled());
+//UNUSED2009-05 ScDocShellModificator aModificator( rDocShell );
+//UNUSED2009-05
+//UNUSED2009-05 pDoc->SetGrammar( eGrammar );
+//UNUSED2009-05
+//UNUSED2009-05 if (bUndo)
+//UNUSED2009-05 {
+//UNUSED2009-05 rDocShell.GetUndoManager()->AddUndoAction( new ScUndoSetGrammar( &rDocShell, eGrammar ) );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL );
+//UNUSED2009-05
+//UNUSED2009-05 ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
+//UNUSED2009-05 if (NULL != pViewSh)
+//UNUSED2009-05 {
+//UNUSED2009-05 pViewSh->UpdateInputHandler( FALSE, FALSE );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 aModificator.SetDocumentModified();
+//UNUSED2009-05
+//UNUSED2009-05 SfxBindings* pBindings = rDocShell.GetViewBindings();
+//UNUSED2009-05 if (pBindings)
+//UNUSED2009-05 {
+//UNUSED2009-05 // erAck: 2006-09-07T22:19+0200 commented out in CWS scr1c1
+//UNUSED2009-05 //pBindings->Invalidate( FID_TAB_USE_R1C1 );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 return TRUE;
+//UNUSED2009-05 }
BOOL ScDocFunc::RenameTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi )
{
@@ -3126,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;
}
//------------------------------------------------------------------------
@@ -3449,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 );
@@ -3498,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;
@@ -4428,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 f8ce7cf8a70e..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"
@@ -1327,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);
@@ -1792,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" );
@@ -1846,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 )
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 36989cff8a80..812d0263a866 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
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index f73389cb866f..d4df2863eec5 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1842,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();
@@ -2501,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..b8d89a644fb4 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -393,21 +393,52 @@ 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 );
}
-#if OLD_PIVOT_IMPLEMENTATION
-void ScDocShell::PivotUpdate( ScPivot*, ScPivot*, BOOL, BOOL )
+void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
{
- DBG_ERRORFILE("PivotUpdate is obsolete!");
+ 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 );
}
-#endif
void ScDocShell::RefreshPivotTables( const ScRange& rSource )
{
@@ -827,7 +858,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 637093275bad..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)
@@ -737,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)
@@ -791,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;
+ }
}
}
}
@@ -1317,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
{
@@ -1480,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 )
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 8b86e0d886ef..63f958763479 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -230,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;
}
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/formdlg/privsplt.cxx b/sc/source/ui/formdlg/privsplt.cxx
index 2ea9636691d7..c6eedbc5f06e 100644
--- a/sc/source/ui/formdlg/privsplt.cxx
+++ b/sc/source/ui/formdlg/privsplt.cxx
@@ -232,24 +232,6 @@ void ScPrivatSplit::MouseMove( const MouseEvent& rMEvt )
}
/*************************************************************************
-#* Member: SetXRange Datum:14.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScPrivatSplit
-#*
-#* Funktion: Setzt den Range fuer die X- Verschiebung
-#*
-#* Input: neuer Bereich
-#*
-#* Output: ---
-#*
-#************************************************************************/
-void ScPrivatSplit::SetXRange(Range cRgeX)
-{
- aXMovingRange=cRgeX;
-}
-
-/*************************************************************************
#* Member: SetYRange Datum:14.10.97
#*------------------------------------------------------------------------
#*
diff --git a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
index ba1b10dc4ccd..af871def7b65 100644
--- a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
+++ b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
@@ -116,10 +116,10 @@ public:
///===== internal ========================================================
- com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible >
- GetCurrentAccessibleTable();
+//UNUSED2009-05 com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible >
+//UNUSED2009-05 GetCurrentAccessibleTable();
- void ChildCountChanged();
+//UNUSED2009-05 void ChildCountChanged();
protected:
/// Return this object's description.
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index 63e263a12f8a..a1138e869d3b 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -46,6 +46,7 @@ class ScEditViewForwarder;
class ScPreviewShell;
class EditTextObject;
class ScCsvViewForwarder;
+class ScAccessibleCell;
// ============================================================================
@@ -103,7 +104,7 @@ class ScAccessibleCellTextData : public ScAccessibleCellBaseTextData
{
public:
ScAccessibleCellTextData(ScTabViewShell* pViewShell,
- const ScAddress& rP, ScSplitPos eSplitPos);
+ const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell);
virtual ~ScAccessibleCellTextData();
virtual ScAccessibleTextData* Clone() const;
@@ -123,6 +124,7 @@ private:
ScTabViewShell* mpViewShell;
ScSplitPos meSplitPos;
sal_Bool mbViewEditEngine;
+ ScAccessibleCell* mpAccessibleCell;
// prevent the using of this method of the base class
ScSharedCellEditSource* GetOriginalSource() { return NULL; }
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 74621d3ced41..9e2d833b27d0 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -128,7 +128,6 @@ private:
protected:
virtual BOOL DoClose( USHORT nId );
- void EnableSpreadsheets( BOOL bFlag = TRUE, BOOL bChilds = TRUE );
void SetDispatcherLock( BOOL bLock );
virtual long PreNotify( NotifyEvent& rNEvt );
diff --git a/sc/source/ui/inc/csvtablebox.hxx b/sc/source/ui/inc/csvtablebox.hxx
index 544ec0aaecee..6e9c6b379ca9 100644
--- a/sc/source/ui/inc/csvtablebox.hxx
+++ b/sc/source/ui/inc/csvtablebox.hxx
@@ -77,7 +77,7 @@ private:
// ------------------------------------------------------------------------
public:
- explicit ScCsvTableBox( Window* pParent );
+//UNUSED2009-05 explicit ScCsvTableBox( Window* pParent );
explicit ScCsvTableBox( Window* pParent, const ResId& rResId );
// common table box handling ----------------------------------------------
@@ -112,10 +112,10 @@ public:
void SetUniStrings(
const String* pTextLines, const String& rSepChars,
sal_Unicode cTextSep, bool bMergeSep );
- /** Fills all cells of all lines with the passed texts (ByteStrings). */
- void SetByteStrings(
- const ByteString* pLineTexts, CharSet eCharSet,
- const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep );
+//UNUSED2009-05 /** Fills all cells of all lines with the passed texts (ByteStrings). */
+//UNUSED2009-05 void SetByteStrings(
+//UNUSED2009-05 const ByteString* pLineTexts, CharSet eCharSet,
+//UNUSED2009-05 const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep );
// column settings --------------------------------------------------------
public:
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index ecdaceb55294..3e9ff5258682 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -33,7 +33,6 @@
#include <tools/link.hxx>
#include "global.hxx"
-#include "postit.hxx"
#include "formula/grammar.hxx"
class ScEditEngineDefaulter;
@@ -47,7 +46,7 @@ class ScRangeName;
class ScBaseCell;
class ScTokenArray;
struct ScTabOpParam;
-
+class ScTableProtection;
// ---------------------------------------------------------------------------
@@ -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 ); }
@@ -124,7 +124,7 @@ public:
BOOL SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL bApi );
- BOOL SetGrammar( formula::FormulaGrammar::Grammar eGrammar );
+//UNUSED2009-05 BOOL SetGrammar( formula::FormulaGrammar::Grammar eGrammar );
SC_DLLPUBLIC BOOL SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges,
SCTAB nTab, ScSizeMode eMode, USHORT nSizeTwips,
@@ -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 df102a54f355..4e6cf05ddd0d 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -59,9 +59,6 @@ class INetURLObject;
class ScPaintItem;
class ScViewData;
class ScDocFunc;
-#if OLD_PIVOT_IMPLEMENTATION
-class ScPivot;
-#endif
class ScDrawLayer;
class ScTabViewShell;
class ScSbxDocHelper;
@@ -290,12 +287,9 @@ 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,
- BOOL bRecord = TRUE, BOOL bApi = FALSE );
-#endif
void RefreshPivotTables( const ScRange& rSource );
void DoConsolidate( const ScConsolidateParam& rParam, BOOL bRecord = TRUE );
void UseScenario( SCTAB nTab, const String& rName, BOOL bRecord = TRUE );
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 33d0f4adf95d..1890bb1247c4 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -143,7 +143,7 @@ public:
inline void UnlockInternalLayer() { LockInternalLayer( false ); }
SdrEndTextEditKind ScEndTextEdit(); // ruft SetDrawTextUndo(0)
- void CaptionTextDirection(USHORT nSlot);
+//UNUSED2009-05 void CaptionTextDirection(USHORT nSlot);
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
};
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..8b680daad6cb 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -37,6 +37,7 @@
#include "viewdata.hxx"
#include "cbutton.hxx"
#include <svx/sdr/overlay/overlayobject.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
#include <vector>
@@ -44,9 +45,6 @@
struct ScTableInfo;
class ScViewSelectionEngine;
-#if OLD_PIVOT_IMPLEMENTATION
-class ScPivot;
-#endif
class ScDPObject;
class ScOutputData;
class ScFilterListBox;
@@ -97,43 +95,7 @@ public:
// ---------------------------------------------------------------------------
// predefines
-class ScGridWindow;
-
-enum ScOverlayType { SC_OVERLAY_INVERT, SC_OVERLAY_SOLID, SC_OVERLAY_BORDER_TRANSPARENT };
-
-// #114409#
-namespace sdr
-{
- namespace overlay
- {
- // predefines
- class OverlayObjectList;
-
- // OverlayObjectCell - used for cell cursor, selection and AutoFill handle
-
- class OverlayObjectCell : public OverlayObject
- {
- public:
- typedef ::std::vector< basegfx::B2DRange > RangeVector;
-
- private:
- ScOverlayType mePaintType;
- RangeVector maRectangles;
-
- virtual void drawGeometry(OutputDevice& rOutputDevice);
- virtual void createBaseRange(OutputDevice& rOutputDevice);
-
- public:
- OverlayObjectCell( ScOverlayType eType, const Color& rColor, const RangeVector& rRects);
- virtual ~OverlayObjectCell();
-
- virtual void transform(const basegfx::B2DHomMatrix& rMatrix);
- };
-
- } // end of namespace overlay
-} // end of namespace sdr
-
-// ---------------------------------------------------------------------------
+namespace sdr { namespace overlay { class OverlayObjectList; }}
class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHelper
{
@@ -169,14 +131,6 @@ private:
BYTE nMouseStatus;
BYTE nNestedButtonState; // track nested button up/down calls
-#if OLD_PIVOT_IMPLEMENTATION
- BOOL bPivotMouse; // Pivot-D&D (alte Pivottabellen)
- ScPivot* pDragPivot;
- BOOL bPivotColField;
- SCCOL nPivotCol;
- SCCOL nPivotField;
-#endif
-
BOOL bDPMouse; // DataPilot-D&D (neue Pivottabellen)
long nDPField;
ScDPObject* pDragDPObj; //! name?
@@ -234,12 +188,6 @@ private:
BOOL DoPageFieldSelection( SCCOL nCol, SCROW nRow );
void DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt );
-#if OLD_PIVOT_IMPLEMENTATION
- void PivotMouseMove( const MouseEvent& rMEvt );
- void PivotMouseButtonUp( const MouseEvent& rMEvt );
- BOOL PivotTestMouse( const MouseEvent& rMEvt, BOOL bMove );
- void DoPivotDrop( BOOL bDelete, BOOL bToCols, SCSIZE nDestPos );
-#endif
void DPMouseMove( const MouseEvent& rMEvt );
void DPMouseButtonUp( const MouseEvent& rMEvt );
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index da70a3465dc6..80da3d20982e 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -244,7 +244,9 @@ public:
void FindChanged();
void SetPagebreakMode( ScPageBreakData* pPageData );
+#ifdef OLD_SELECTION_PAINT
void DrawMark( Window* pWin );
+#endif
void DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
SCCOL nRefEndX, SCROW nRefEndY,
const Color& rColor, BOOL bHandle );
diff --git a/sc/source/ui/inc/privsplt.hxx b/sc/source/ui/inc/privsplt.hxx
index b8277a46c4f7..d3b7c9ad96b8 100644
--- a/sc/source/ui/inc/privsplt.hxx
+++ b/sc/source/ui/inc/privsplt.hxx
@@ -73,7 +73,6 @@ class ScPrivatSplit : public Control
virtual void CtrModified();
- void SetXRange(Range cRgeX);
void SetYRange(Range cRgeY);
void MoveSplitTo(Point aPos);
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/refundo.hxx b/sc/source/ui/inc/refundo.hxx
index a796fcd611de..f3250e708b4c 100644
--- a/sc/source/ui/inc/refundo.hxx
+++ b/sc/source/ui/inc/refundo.hxx
@@ -37,9 +37,6 @@ class ScDocument;
class ScDBCollection;
class ScRangeName;
class ScPrintRangeSaver;
-#if OLD_PIVOT_IMPLEMENTATION
-class ScPivotCollection;
-#endif
class ScDPCollection;
class ScChartCollection;
class ScConditionalFormatList;
@@ -54,9 +51,6 @@ private:
ScDBCollection* pDBCollection;
ScRangeName* pRangeName;
ScPrintRangeSaver* pPrintRanges;
-#if OLD_PIVOT_IMPLEMENTATION
- ScPivotCollection* pPivotCollection;
-#endif
ScDPCollection* pDPCollection;
ScConditionalFormatList* pCondFormList;
ScDetOpList* pDetOpList;
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 3dcb3a08191d..d1ffb8aac0ed 100644
--- a/sc/source/ui/inc/sortdlg.hxx
+++ b/sc/source/ui/inc/sortdlg.hxx
@@ -32,6 +32,10 @@
#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 LAYOUT_SFX_TABDIALOG_BROKEN
#define LAYOUT_SFX_TABDIALOG_BROKEN 1
@@ -65,6 +69,20 @@ 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;
+};
+
#if !LAYOUT_SFX_TABDIALOG_BROKEN
#include <layout/layout-post.hxx>
#endif
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index d7b5e2a8260b..fe5da618e895 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -181,9 +181,6 @@ private:
BOOL bMoveIsShift;
BOOL bNewStartIfMarking;
- BOOL bOldSelection; // old style (inverting) of selection
-
-
void Init();
void DoAddWin( ScGridWindow* pWin );
@@ -227,7 +224,7 @@ protected:
public:
ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
- ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell );
+//UNUSED2009-05 ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell );
~ScTabView();
void MakeDrawLayer();
@@ -528,9 +525,6 @@ public:
void SetBrushDocument( ScDocument* pNew, BOOL bLock );
void SetDrawBrushSet( SfxItemSet* pNew, BOOL bLock );
void ResetBrushDocument();
-
- void UpdateSelectionType();
- BOOL IsOldSelection() const { return bOldSelection; }
};
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 13cd49df6879..10224536bf0b 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -39,6 +39,7 @@
#include "target.hxx"
#include "rangelst.hxx" // ScRangeListRef
#include "shellids.hxx"
+#include "tabprotection.hxx" // for ScPasswordHash
class FmFormShell;
class SbxObject;
@@ -430,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/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..a7cf0d094d6b 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;
- void DoProtect( BOOL bDo );
+private:
+ SCTAB mnTab;
+ ::std::auto_ptr<ScTableProtection> mpProtectSettings;
+
+ void DoProtect(bool bProtect);
};
@@ -465,26 +493,26 @@ private:
};
-class ScUndoSetGrammar : public ScSimpleUndo
-{
-public:
- TYPEINFO();
- ScUndoSetGrammar( ScDocShell* pShell,
- formula::FormulaGrammar::Grammar eGrammar );
- virtual ~ScUndoSetGrammar();
-
- virtual void Undo();
- virtual void Redo();
- virtual void Repeat(SfxRepeatTarget& rTarget);
- virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
-
- virtual String GetComment() const;
-
-private:
- formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar;
-
- void DoChange( formula::FormulaGrammar::Grammar eGrammar );
-};
+//UNUSED2009-05 class ScUndoSetGrammar : public ScSimpleUndo
+//UNUSED2009-05 {
+//UNUSED2009-05 public:
+//UNUSED2009-05 TYPEINFO();
+//UNUSED2009-05 ScUndoSetGrammar( ScDocShell* pShell,
+//UNUSED2009-05 formula::FormulaGrammar::Grammar eGrammar );
+//UNUSED2009-05 virtual ~ScUndoSetGrammar();
+//UNUSED2009-05
+//UNUSED2009-05 virtual void Undo();
+//UNUSED2009-05 virtual void Redo();
+//UNUSED2009-05 virtual void Repeat(SfxRepeatTarget& rTarget);
+//UNUSED2009-05 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
+//UNUSED2009-05
+//UNUSED2009-05 virtual String GetComment() const;
+//UNUSED2009-05
+//UNUSED2009-05 private:
+//UNUSED2009-05 formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar;
+//UNUSED2009-05
+//UNUSED2009-05 void DoChange( formula::FormulaGrammar::Grammar eGrammar );
+//UNUSED2009-05 };
#endif
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 bfc24e36b464..e7e4e27f233c 100644
--- a/sc/source/ui/inc/viewutil.hxx
+++ b/sc/source/ui/inc/viewutil.hxx
@@ -106,8 +106,10 @@ public:
ScUpdateRect( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 );
void SetNew( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 );
BOOL GetDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
+#ifdef OLD_SELECTION_PAINT
BOOL GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, BOOL& rCont );
void GetContDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
+#endif
};
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 874236075d9f..befabb51a17c 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -826,11 +826,6 @@ BOOL __EXPORT ScAnyRefDlg::DoClose( USHORT nId )
return TRUE;
}
-void ScAnyRefDlg::EnableSpreadsheets(BOOL bFlag, BOOL bChilds)
-{
- m_aHelper.EnableSpreadsheets(bFlag, bChilds);
-}
-
void ScAnyRefDlg::SetDispatcherLock( BOOL bLock )
{
m_aHelper.SetDispatcherLock( bLock );
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/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/src/filter.src b/sc/source/ui/src/filter.src
index 73108b984ebe..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 ( 251 , 121 ) ;
+ Size = MAP_APPFONT ( 279 , 121 ) ;
Text [ en-US ] = "Standard Filter" ;
Moveable = TRUE ;
Closeable = FALSE ;
@@ -58,7 +58,7 @@ 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" ;
};
@@ -150,7 +150,7 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 25 ) ;
- Size = MAP_APPFONT ( 47 , 145 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -165,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 , 145 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -186,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 , 145 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -207,13 +219,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_COND4
{
Border = TRUE ;
Pos = MAP_APPFONT ( 122 , 73 ) ;
- Size = MAP_APPFONT ( 47 , 145 ) ;
+ Size = MAP_APPFONT ( 75 , 145 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
stringlist [ en-US ] =
@@ -228,39 +246,45 @@ 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 ; > ;
};
};
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 ( 173 , 73 ) ;
+ Pos = MAP_APPFONT ( 201 , 73 ) ;
Size = MAP_APPFONT ( 60 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
ScrollBar LB_SCROLL
{
- Pos = MAP_APPFONT ( 237, 25 ) ;
+ Pos = MAP_APPFONT ( 265, 25 ) ;
Size = MAP_APPFONT ( 8 , 60 ) ;
TabStop = TRUE ;
VScroll = TRUE ;
@@ -269,7 +293,7 @@ ModelessDialog RID_SCDLG_FILTER
FixedLine FL_CRITERIA
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 275 , 8 ) ;
+ Size = MAP_APPFONT ( 267 , 8 ) ;
Text [ en-US ] = "Filter criteria";
};
CheckBox BTN_CASE
@@ -325,7 +349,7 @@ ModelessDialog RID_SCDLG_FILTER
Border = TRUE ;
Hide = TRUE ;
Pos = MAP_APPFONT ( 21 , 170 ) ;
- Size = MAP_APPFONT ( 90 , 90 ) ;
+ Size = MAP_APPFONT ( 110 , 90 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
@@ -333,13 +357,13 @@ ModelessDialog RID_SCDLG_FILTER
{
Border = TRUE ;
Hide = TRUE ;
- Pos = MAP_APPFONT ( 115 , 170 ) ;
- 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 , 169 ) ;
+ Pos = MAP_APPFONT ( 248 , 169 ) ;
Size = MAP_APPFONT ( 13 , 15 ) ;
TabStop = FALSE ;
QuickHelpText [ en-US ] = "Shrink" ;
@@ -348,7 +372,7 @@ ModelessDialog RID_SCDLG_FILTER
{
Hide = TRUE ;
Pos = MAP_APPFONT ( 6 , 118 ) ;
- Size = MAP_APPFONT ( 239 , 8 ) ;
+ Size = MAP_APPFONT ( 267 , 8 ) ;
};
FixedText FT_DBAREA
{
@@ -367,14 +391,14 @@ ModelessDialog RID_SCDLG_FILTER
};
OKButton BTN_OK
{
- Pos = MAP_APPFONT ( 141 , 101 ) ;
+ Pos = MAP_APPFONT ( 169 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton BTN_CANCEL
{
- Pos = MAP_APPFONT ( 195 , 101 ) ;
+ Pos = MAP_APPFONT ( 223 , 101 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
@@ -395,7 +419,7 @@ ModelessDialog RID_SCDLG_FILTER
FixedLine FL_SEPARATOR
{
Pos = MAP_APPFONT ( 0 , 91 ) ;
- Size = MAP_APPFONT ( 251 , 6 ) ;
+ Size = MAP_APPFONT ( 279 , 6 ) ;
};
};
//============================================================================
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/refundo.cxx b/sc/source/ui/undo/refundo.cxx
index 85bf65179bd8..8c72da7e7e25 100644
--- a/sc/source/ui/undo/refundo.cxx
+++ b/sc/source/ui/undo/refundo.cxx
@@ -66,10 +66,6 @@ ScRefUndoData::ScRefUndoData( const ScDocument* pDoc ) :
pPrintRanges = pDoc->CreatePrintRangeSaver(); // neu erzeugt
-#if OLD_PIVOT_IMPLEMENTATION
- ScPivotCollection* pOldPivot = pDoc->GetPivotCollection();
- pPivotCollection = pOldPivot ? new ScPivotCollection(*pOldPivot) : NULL;
-#endif
//! bei Pivot nur Bereiche merken ???
ScDPCollection* pOldDP = ((ScDocument*)pDoc)->GetDPCollection(); //! const
@@ -96,9 +92,6 @@ ScRefUndoData::~ScRefUndoData()
delete pDBCollection;
delete pRangeName;
delete pPrintRanges;
-#if OLD_PIVOT_IMPLEMENTATION
- delete pPivotCollection;
-#endif
delete pDPCollection;
delete pCondFormList;
delete pDetOpList;
@@ -130,15 +123,6 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc )
delete pNewRanges;
}
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- {
- ScPivotCollection* pNewPivot = pDoc->GetPivotCollection();
- if ( pNewPivot && *pPivotCollection == *pNewPivot )
- DELETEZ(pPivotCollection);
- }
-#endif
-
if (pDPCollection)
{
ScDPCollection* pNewDP = ((ScDocument*)pDoc)->GetDPCollection(); //! const
@@ -195,11 +179,6 @@ void ScRefUndoData::DoUndo( ScDocument* pDoc, BOOL bUndoRefFirst )
if (pPrintRanges)
pDoc->RestorePrintRanges(*pPrintRanges);
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pDoc->SetPivotCollection( new ScPivotCollection(*pPivotCollection) );
-#endif
-
if (pDPCollection)
{
ScDPCollection* pDocDP = pDoc->GetDPCollection();
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..ce428311d3f8 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,12 +88,11 @@ TYPEINIT1(ScUndoMakeScenario, SfxUndoAction);
TYPEINIT1(ScUndoImportTab, SfxUndoAction);
TYPEINIT1(ScUndoRemoveLink, SfxUndoAction);
TYPEINIT1(ScUndoShowHideTab, SfxUndoAction);
-TYPEINIT1(ScUndoProtect, SfxUndoAction);
TYPEINIT1(ScUndoPrintRange, SfxUndoAction);
TYPEINIT1(ScUndoScenarioFlags, SfxUndoAction);
TYPEINIT1(ScUndoRenameObject, SfxUndoAction);
TYPEINIT1(ScUndoLayoutRTL, SfxUndoAction);
-TYPEINIT1(ScUndoSetGrammar, SfxUndoAction);
+//UNUSED2009-05 TYPEINIT1(ScUndoSetGrammar, 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 = 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)
{
- USHORT nId;
- if ( nTab == TABLEID_DOC )
- nId = bProtect ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
+}
+
+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 );
}
@@ -1552,59 +1611,54 @@ String __EXPORT ScUndoLayoutRTL::GetComment() const
// Set the grammar used for the sheet
//
-ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell,
- formula::FormulaGrammar::Grammar eGrammar ) :
- ScSimpleUndo( pShell ),
- meNewGrammar( eGrammar )
-{
- meOldGrammar = pDocShell->GetDocument()->GetGrammar();
-}
-
-__EXPORT ScUndoSetGrammar::~ScUndoSetGrammar()
-{
-}
-
-void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar )
-{
- pDocShell->SetInUndo( TRUE );
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->SetGrammar( eGrammar );
- pDocShell->SetDocumentModified();
- pDocShell->SetInUndo( FALSE );
-}
-
-void __EXPORT ScUndoSetGrammar::Undo()
-{
- DoChange( meOldGrammar );
-}
-
-void __EXPORT ScUndoSetGrammar::Redo()
-{
- DoChange( meNewGrammar );
-}
-
-void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
-{
-#if 0
-// erAck: 2006-09-07T23:00+0200 commented out in CWS scr1c1
- if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
- Execute( FID_TAB_USE_R1C1, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
-#endif
-}
-
-BOOL __EXPORT ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
-{
- return (rTarget.ISA(ScTabViewTarget));
-}
-
-String __EXPORT ScUndoSetGrammar::GetComment() const
-{
- return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 );
-}
-
-
-
-
-
+//UNUSED2009-05 ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell,
+//UNUSED2009-05 formula::FormulaGrammar::Grammar eGrammar ) :
+//UNUSED2009-05 ScSimpleUndo( pShell ),
+//UNUSED2009-05 meNewGrammar( eGrammar )
+//UNUSED2009-05 {
+//UNUSED2009-05 meOldGrammar = pDocShell->GetDocument()->GetGrammar();
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 __EXPORT ScUndoSetGrammar::~ScUndoSetGrammar()
+//UNUSED2009-05 {
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar )
+//UNUSED2009-05 {
+//UNUSED2009-05 pDocShell->SetInUndo( TRUE );
+//UNUSED2009-05 ScDocument* pDoc = pDocShell->GetDocument();
+//UNUSED2009-05 pDoc->SetGrammar( eGrammar );
+//UNUSED2009-05 pDocShell->SetDocumentModified();
+//UNUSED2009-05 pDocShell->SetInUndo( FALSE );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Undo()
+//UNUSED2009-05 {
+//UNUSED2009-05 DoChange( meOldGrammar );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Redo()
+//UNUSED2009-05 {
+//UNUSED2009-05 DoChange( meNewGrammar );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
+//UNUSED2009-05 {
+//UNUSED2009-05 #if 0
+//UNUSED2009-05 // erAck: 2006-09-07T23:00+0200 commented out in CWS scr1c1
+//UNUSED2009-05 if (rTarget.ISA(ScTabViewTarget))
+//UNUSED2009-05 ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+//UNUSED2009-05 Execute( FID_TAB_USE_R1C1, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
+//UNUSED2009-05 #endif
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 BOOL __EXPORT ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
+//UNUSED2009-05 {
+//UNUSED2009-05 return (rTarget.ISA(ScTabViewTarget));
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 String __EXPORT ScUndoSetGrammar::GetComment() const
+//UNUSED2009-05 {
+//UNUSED2009-05 return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 );
+//UNUSED2009-05 }
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 7bdb9c7718d2..cfe51aed6edc 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1170,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;
@@ -1226,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;
@@ -5052,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 ) )
{
@@ -5068,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
{
@@ -5086,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
@@ -5153,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
{
@@ -5269,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)
@@ -5633,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 );
@@ -6198,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 );
}
}
@@ -6246,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);
}
}
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 083dfc3f9374..d63fbb837e44 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -957,15 +957,6 @@ void lcl_convertTokensToString(OUString& rStr, const vector<ScSharedTokenRef>& r
func.getString(rStr);
}
-void lcl_convertTokenToString(OUString& rStr, const ScSharedTokenRef& rToken, ScDocument* pDoc,
- FormulaGrammar::Grammar eGrammar)
-{
- const sal_Unicode cRangeSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
- Tokens2RangeString func(pDoc, eGrammar, cRangeSep);
- func.operator() (rToken);
- func.getString(rStr);
-}
-
} // anonymous namespace
// DataProvider ==============================================================
@@ -995,44 +986,6 @@ void ScChart2DataProvider::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
}
}
-void lcl_SeperateOneColumnRange(ScRange aR, const ScAddress& rPos, ScRangeListRef& xRanges)
-{
- if (aR.aStart == rPos)
- {
- aR.aStart.SetRow(aR.aStart.Row() + 1);
- xRanges->Join(aR);
- }
- else if (aR.aEnd == rPos)
- {
- aR.aStart.SetRow(aR.aStart.Row() - 1);
- xRanges->Join(aR);
- }
- else
- {
- xRanges->Join(ScRange(aR.aStart, ScAddress(rPos.Col(), rPos.Row() - 1, rPos.Tab())));
- xRanges->Join(ScRange(ScAddress(rPos.Col(), rPos.Row() + 1, rPos.Tab()), aR.aEnd ));
- }
-}
-
-void lcl_SeperateOneRowRange(ScRange aR, const ScAddress& rPos, ScRangeListRef& xRanges)
-{
- if (aR.aStart == rPos)
- {
- aR.aStart.SetCol(aR.aStart.Col() + 1);
- xRanges->Join(aR);
- }
- else if (aR.aEnd == rPos)
- {
- aR.aStart.SetCol(aR.aStart.Col() - 1);
- xRanges->Join(aR);
- }
- else
- {
- xRanges->Join(ScRange(aR.aStart, ScAddress(rPos.Col() - 1, rPos.Row(), rPos.Tab())));
- xRanges->Join(ScRange(ScAddress(rPos.Col() + 1, rPos.Row(), rPos.Tab()), aR.aEnd ));
- }
-}
-
::sal_Bool SAL_CALL ScChart2DataProvider::createDataSourcePossible( const uno::Sequence< beans::PropertyValue >& aArguments )
throw (uno::RuntimeException)
{
@@ -1051,7 +1004,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();
}
@@ -1445,7 +1398,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();
@@ -2180,7 +2133,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();
}
@@ -2197,6 +2150,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())
@@ -2242,7 +2201,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();
@@ -2483,7 +2442,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);
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 98a8a8551d6c..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"
@@ -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/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index f25d4a41980a..a4370f6665fb 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -271,17 +271,10 @@ SfxObjectShell* ScModelObj::GetEmbeddedObject() const
return pDocShell;
}
-void ScModelObj::UpdateAllRowHeights()
+void ScModelObj::UpdateAllRowHeights(const ScMarkData* pTabMark)
{
if (pDocShell)
- pDocShell->UpdateAllRowHeights();
-}
-
-ScDrawLayer* ScModelObj::MakeDrawLayer()
-{
- if (pDocShell)
- return pDocShell->MakeDrawLayer();
- return NULL;
+ pDocShell->UpdateAllRowHeights(pTabMark);
}
void ScModelObj::BeforeXMLLoading()
@@ -2791,7 +2784,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 )
@@ -2813,16 +2825,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/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index 14fdb958a180..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,7 +50,8 @@
#include "tokenarray.hxx"
#include "tokenuno.hxx"
-using namespace com::sun::star;
+using namespace ::com::sun::star;
+using namespace ::formula;
//------------------------------------------------------------------------
@@ -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/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index 4a9cd420f5de..e44dab865d46 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -220,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)
@@ -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/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index c543b5880fe7..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 SfxItemPropertyMapEntry* lcl_GetFormulaParserMap()
{
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 SfxItemPropertyMapEntry* 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 )
{
@@ -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 fa27b94a9956..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;
@@ -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 6446d023fe9b..e5bb702402d8 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -103,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
@@ -1708,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:
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 564053a937ef..039e4dc256ba 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 = TRUE;
- 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();
@@ -1143,22 +1235,6 @@ void __EXPORT ScCellShell::GetDBState( SfxItemSet& rSet )
bOk = pDBData->HasQueryParam() ||
pDBData->HasSortParam() ||
pDBData->HasSubTotalParam();
-#if OLD_PIVOT_IMPLEMENTATION
- if (!bOk)
- {
- // Pivottabelle mit den Daten als Quellbereich ?
- ScRange aDataRange;
- pDBData->GetArea(aDataRange);
- ScPivotCollection* pPivotCollection = pDoc->GetPivotCollection();
- USHORT nCount = pPivotCollection ? pPivotCollection->GetCount() : 0;
- for (USHORT i=0; i<nCount; i++)
- {
- ScPivot* pTemp = (*pPivotCollection)[i];
- if ( pTemp && pTemp->GetSrcArea().Intersects( aDataRange ) )
- bOk = TRUE;
- }
- }
-#endif
}
}
if (!bOk)
@@ -1242,6 +1318,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 4bb33a4c7855..dd79bb52a112 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -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");
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 0c59e083f0fe..ef68bbc9bd0c 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -828,28 +828,28 @@ void ScDrawView::MarkDropObj( SdrObject* pObj )
}
}
-void ScDrawView::CaptionTextDirection( USHORT nSlot )
-{
- if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM)
- return;
-
- SdrObject* pObject = GetTextEditObject();
- if ( ScDrawLayer::IsNoteCaption( pObject ) )
- {
- if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
- {
- SfxItemSet aAttr(pCaption->GetMergedItemSet());
- aAttr.Put( SvxWritingModeItem(
- nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
- com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
- SDRATTR_TEXTDIRECTION ) );
- pCaption->SetMergedItemSet(aAttr);
- FuPoor* pPoor = pViewData->GetView()->GetDrawFuncPtr();
- if ( pPoor )
- {
- FuText* pText = static_cast<FuText*>(pPoor);
- pText->StopEditMode(TRUE);
- }
- }
- }
-}
+//UNUSED2009-05 void ScDrawView::CaptionTextDirection( USHORT nSlot )
+//UNUSED2009-05 {
+//UNUSED2009-05 if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM)
+//UNUSED2009-05 return;
+//UNUSED2009-05
+//UNUSED2009-05 SdrObject* pObject = GetTextEditObject();
+//UNUSED2009-05 if ( ScDrawLayer::IsNoteCaption( pObject ) )
+//UNUSED2009-05 {
+//UNUSED2009-05 if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
+//UNUSED2009-05 {
+//UNUSED2009-05 SfxItemSet aAttr(pCaption->GetMergedItemSet());
+//UNUSED2009-05 aAttr.Put( SvxWritingModeItem(
+//UNUSED2009-05 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
+//UNUSED2009-05 com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
+//UNUSED2009-05 SDRATTR_TEXTDIRECTION ) );
+//UNUSED2009-05 pCaption->SetMergedItemSet(aAttr);
+//UNUSED2009-05 FuPoor* pPoor = pViewData->GetView()->GetDrawFuncPtr();
+//UNUSED2009-05 if ( pPoor )
+//UNUSED2009-05 {
+//UNUSED2009-05 FuText* pText = static_cast<FuText*>(pPoor);
+//UNUSED2009-05 pText->StopEditMode(TRUE);
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index dda608037012..de2b962f3272 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -119,14 +119,14 @@
#include "drwlayer.hxx"
#include "attrib.hxx"
#include "validat.hxx"
+#include "tabprotection.hxx"
+#include "postit.hxx"
-// #114409#
-#include <vcl/salbtype.hxx> // FRound
#include "drawview.hxx"
#include <svx/sdrpagewindow.hxx>
-#include <svx/sdrpaintwindow.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <vcl/svapp.hxx>
+#include <svx/sdr/overlay/overlayselection.hxx>
using namespace com::sun::star;
using ::com::sun::star::uno::Sequence;
@@ -352,8 +352,7 @@ void lcl_UnLockComment( ScDrawView* pView, SdrPageView* pPV, SdrModel* pDrDoc, c
}
}
-//==================================================================
-
+// ---------------------------------------------------------------------------
// WB_DIALOGCONTROL noetig fuer UNO-Controls
ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos )
: Window( pParent, WB_CLIPCHILDREN | WB_DIALOGCONTROL ),
@@ -376,9 +375,6 @@ ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhic
bEEMouse( FALSE ),
nMouseStatus( SC_GM_NONE ),
nNestedButtonState( SC_NESTEDBUTTON_NONE ),
-#if OLD_PIVOT_IMPLEMENTATION
- bPivotMouse( FALSE ),
-#endif
bDPMouse( FALSE ),
bRFMouse( FALSE ),
nPagebreakMouse( SC_PD_NONE ),
@@ -1837,15 +1833,6 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
return;
}
-#if OLD_PIVOT_IMPLEMENTATION
- if (bPivotMouse)
- {
- PivotMouseButtonUp( rMEvt );
- bPivotMouse = FALSE;
- return;
- }
-#endif
-
if (bDPMouse)
{
DPMouseButtonUp( rMEvt ); // resets bDPMouse
@@ -2027,8 +2014,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() );
@@ -2070,16 +2058,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;
}
@@ -2234,14 +2240,6 @@ void __EXPORT ScGridWindow::MouseMove( const MouseEvent& rMEvt )
return;
}
-#if OLD_PIVOT_IMPLEMENTATION
- if (bPivotMouse)
- {
- PivotMouseMove( rMEvt );
- return;
- }
-#endif
-
if (bDPMouse)
{
DPMouseMove( rMEvt );
@@ -2452,10 +2450,6 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt )
{
if (!pViewData->GetView()->IsInActivatePart())
{
-#if OLD_PIVOT_IMPLEMENTATION
- if (bPivotMouse)
- bPivotMouse = FALSE; // gezeichnet wird per bDragRect
-#endif
if (bDPMouse)
bDPMouse = FALSE; // gezeichnet wird per bDragRect
if (bDragRect)
@@ -4864,7 +4858,6 @@ BOOL ScGridWindow::GetEditUrlOrError( BOOL bSpellErr, const Point& rPos,
MapMode aEditMode = pViewData->GetLogicMode(eWhich); // ohne Drawing-Skalierung
Rectangle aLogicEdit = PixelToLogic( aEditRect, aEditMode );
long nThisColLogic = aLogicEdit.Right() - aLogicEdit.Left() + 1;
-
Size aPaperSize = Size( 1000000, 1000000 );
if(pCell->GetCellType() == CELLTYPE_FORMULA)
{
@@ -5179,37 +5172,30 @@ void ScGridWindow::UpdateCursorOverlay()
}
}
- //
- // convert into logic units and create overlay object
- //
-
if ( aPixelRects.size() )
{
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
-
- std::vector<Rectangle>::const_iterator aPixelEnd( aPixelRects.end() );
- for ( std::vector<Rectangle>::const_iterator aPixelIter( aPixelRects.begin() );
- aPixelIter != aPixelEnd; ++aPixelIter )
- {
- Rectangle aLogic( PixelToLogic( *aPixelIter, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- aRanges.push_back( a2DRange );
- }
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- BOOL bOld = pViewData->GetView()->IsOldSelection();
+ const Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
- ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_SOLID;
- Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
- sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aCursorColor, aRanges );
+ for(sal_uInt32 a(0); a < aPixelRects.size(); a++)
+ {
+ const Rectangle aRA(aPixelRects[a]);
+ basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1);
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+ }
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_SOLID,
+ aCursorColor,
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOOCursors = new ::sdr::overlay::OverlayObjectList;
@@ -5234,50 +5220,52 @@ void ScGridWindow::UpdateSelectionOverlay()
SetMapMode( aDrawMode );
DeleteSelectionOverlay();
-
std::vector<Rectangle> aPixelRects;
GetSelectionRects( aPixelRects );
if ( aPixelRects.size() && pViewData->IsActive() )
{
- SCTAB nTab = pViewData->GetTabNo();
- BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( nTab );
- BOOL bOld = pViewData->GetView()->IsOldSelection();
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
+ // #i70788# get the OverlayManager safely
+ ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
- std::vector<Rectangle>::const_iterator aPixelEnd( aPixelRects.end() );
- for ( std::vector<Rectangle>::const_iterator aPixelIter( aPixelRects.begin() );
- aPixelIter != aPixelEnd; ++aPixelIter )
+ if(pOverlayManager)
{
- Rectangle aPixel( *aPixelIter );
- if ( !bOld )
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+
+ for(sal_uInt32 a(0); a < aPixelRects.size(); a++)
{
- // for transparent selection, add a pixel so the border is on the grid on all edges
- if ( bLayoutRTL )
- aPixel.Right() += 1;
- else
- aPixel.Left() -= 1;
- aPixel.Top() -= 1;
+ const Rectangle aRA(aPixelRects[a]);
+ basegfx::B2DRange aRB(aRA.Left() - 1, aRA.Top() - 1, aRA.Right(), aRA.Bottom());
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
}
- Rectangle aLogic( PixelToLogic( aPixel, aDrawMode ) );
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
+ // #i97672# get the system's hilight color and limit it to the maximum
+ // allowed luminance. This is needed to react on too bright hilight colors
+ // which would otherwise vive a bad visualisation
+ Color aHighlight(GetSettings().GetStyleSettings().GetHighlightColor());
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const basegfx::BColor aSelection(aHighlight.getBColor());
+ const double fLuminance(aSelection.luminance());
+ const double fMaxLum(aSvtOptionsDrawinglayer.GetSelectionMaximumLuminancePercent() / 100.0);
- aRanges.push_back( a2DRange );
- }
+ if(fLuminance > fMaxLum)
+ {
+ const double fFactor(fMaxLum / fLuminance);
+ const basegfx::BColor aNewSelection(
+ aSelection.getRed() * fFactor,
+ aSelection.getGreen() * fFactor,
+ aSelection.getBlue() * fFactor);
- // #i70788# get the OverlayManager safely
- ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
+ aHighlight = Color(aNewSelection);
+ }
- if(pOverlayManager)
- {
- ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_BORDER_TRANSPARENT;
- Color aHighlight( GetSettings().GetStyleSettings().GetHighlightColor() );
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_TRANSPARENT,
+ aHighlight,
+ aRanges,
+ true);
pOverlayManager->add(*pOverlay);
mpOOSelection = new ::sdr::overlay::OverlayObjectList;
@@ -5329,31 +5317,24 @@ void ScGridWindow::UpdateAutoFillOverlay()
aFillPos.Y() -= 2;
Rectangle aFillRect( aFillPos, Size(6,6) );
- //
- // convert into logic units
- //
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
-
- Rectangle aLogic( PixelToLogic( aFillRect, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- aRanges.push_back( a2DRange );
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- BOOL bOld = pViewData->GetView()->IsOldSelection();
+ const Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+ basegfx::B2DRange aRB(aFillRect.Left(), aFillRect.Top(), aFillRect.Right() + 1, aFillRect.Bottom() + 1);
+
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
- ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_SOLID;
- Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHandleColor, aRanges );
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_SOLID,
+ aHandleColor,
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOOAutoFill = new ::sdr::overlay::OverlayObjectList;
@@ -5464,34 +5445,28 @@ void ScGridWindow::UpdateDragRectOverlay()
aPixelRects.push_back( Rectangle( aRect.Left()+3, aRect.Bottom()-2, aRect.Right()-3, aRect.Bottom() ) );
}
- //
- // convert into logic units and create overlay object
- //
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
-
- std::vector<Rectangle>::const_iterator aPixelEnd( aPixelRects.end() );
- for ( std::vector<Rectangle>::const_iterator aPixelIter( aPixelRects.begin() );
- aPixelIter != aPixelEnd; ++aPixelIter )
- {
- Rectangle aLogic( PixelToLogic( *aPixelIter, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- aRanges.push_back( a2DRange );
- }
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- ScOverlayType eType = SC_OVERLAY_INVERT;
- Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+ // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+
+ for(sal_uInt32 a(0); a < aPixelRects.size(); a++)
+ {
+ const Rectangle aRA(aPixelRects[a]);
+ basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1);
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+ }
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_INVERT,
+ Color(COL_BLACK),
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOODragRect = new ::sdr::overlay::OverlayObjectList;
@@ -5518,31 +5493,26 @@ void ScGridWindow::UpdateHeaderOverlay()
DeleteHeaderOverlay();
// Pixel rectangle is in aInvertRect
-
- //
- // convert into logic units and create overlay object
- //
-
if ( !aInvertRect.IsEmpty() )
{
- Rectangle aLogic( PixelToLogic( aInvertRect, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
- aRanges.push_back( a2DRange );
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- ScOverlayType eType = SC_OVERLAY_INVERT;
- Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+ // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+ basegfx::B2DRange aRB(aInvertRect.Left(), aInvertRect.Top(), aInvertRect.Right() + 1, aInvertRect.Bottom() + 1);
+
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_INVERT,
+ Color(COL_BLACK),
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOOHeader = new ::sdr::overlay::OverlayObjectList;
@@ -5593,30 +5563,26 @@ void ScGridWindow::UpdateShrinkOverlay()
}
}
- //
- // convert into logic units and create overlay object
- //
-
if ( !aPixRect.IsEmpty() )
{
- Rectangle aLogic( PixelToLogic( aPixRect, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
- aRanges.push_back( a2DRange );
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- ScOverlayType eType = SC_OVERLAY_INVERT;
- Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+ // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+ basegfx::B2DRange aRB(aPixRect.Left(), aPixRect.Top(), aPixRect.Right() + 1, aPixRect.Bottom() + 1);
+
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_INVERT,
+ Color(COL_BLACK),
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOOShrink = new ::sdr::overlay::OverlayObjectList;
@@ -5658,126 +5624,4 @@ void ScGridWindow::flushOverlayManager()
}
// ---------------------------------------------------------------------------
-
-// #114409#
-namespace sdr
-{
- namespace overlay
- {
- OverlayObjectCell::OverlayObjectCell( ScOverlayType eType, const Color& rColor, const RangeVector& rRects )
- : OverlayObject( rColor ),
- mePaintType( eType ),
- maRectangles( rRects )
- {
- }
-
- OverlayObjectCell::~OverlayObjectCell()
- {
- }
-
- void OverlayObjectCell::drawGeometry(OutputDevice& rOutputDevice)
- {
- // safe original AA and switch off for selection
- const sal_uInt16 nOriginalAA(rOutputDevice.GetAntialiasing());
- rOutputDevice.SetAntialiasing(0);
-
- // set colors
- rOutputDevice.SetLineColor();
- rOutputDevice.SetFillColor(getBaseColor());
-
- if ( mePaintType == SC_OVERLAY_BORDER_TRANSPARENT )
- {
- // 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)
- {
- 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 );
- }
-
- for(sal_uInt32 a(0L);a < maRectangles.size(); a++)
- {
- const basegfx::B2DRange& rRange(maRectangles[a]);
- const Rectangle aRectangle(FRound(rRange.getMinX()), FRound(rRange.getMinY()), FRound(rRange.getMaxX()), FRound(rRange.getMaxY()));
-
- 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
- }
- }
- }
-
- if ( mePaintType == SC_OVERLAY_INVERT )
- {
- rOutputDevice.Pop();
- }
- }
-
- // restore original AA
- rOutputDevice.SetAntialiasing(nOriginalAA);
- }
-
- void OverlayObjectCell::createBaseRange(OutputDevice& /* rOutputDevice */)
- {
- maBaseRange.reset();
-
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
- {
- maBaseRange.expand(maRectangles[a]);
- }
- }
-
- void OverlayObjectCell::transform(const basegfx::B2DHomMatrix& rMatrix)
- {
- for(sal_uInt32 a(0L); a < maRectangles.size(); a++)
- {
- maRectangles[a].transform(rMatrix);
- }
- }
-
- } // end of namespace overlay
-} // end of namespace sdr
-
-// ---------------------------------------------------------------------------
-
// eof
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 92743ef65524..643928a7c8aa 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -104,91 +104,6 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt
ScDPObject* pDPObj = pDoc->GetDPAtCursor(nCol, nRow, nTab);
-#if OLD_PIVOT_IMPLEMENTATION
- ScPivotCollection* pPivotCollection = pDoc->GetPivotCollection();
- ScPivot* pPivot = pPivotCollection->GetPivotAtCursor(nCol, nRow, nTab);
-
- if (pPivot) // alte Pivottabellen
- {
- if (pPivot->IsFilterAtCursor(nCol, nRow, nTab))
- {
- ReleaseMouse(); // falls schon beim ButtonDown gecaptured, #44018#
-
- ScQueryParam aQueryParam;
- pPivot->GetQuery(aQueryParam);
- SCTAB nSrcTab = pPivot->GetSrcArea().aStart.Tab();
-
- SfxItemSet aArgSet( pViewData->GetViewShell()->GetPool(),
- SCITEM_QUERYDATA, SCITEM_QUERYDATA );
- aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, pViewData, &aQueryParam ) );
-
- //CHINA001 ScPivotFilterDlg* pDlg = new ScPivotFilterDlg(
- //CHINA001 pViewData->GetViewShell()->GetDialogParent(),
- //CHINA001 aArgSet, nSrcTab );
- ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
-
- AbstractScPivotFilterDlg* pDlg = pFact->CreateScPivotFilterDlg( pViewData->GetViewShell()->GetDialogParent(),
- aArgSet, nSrcTab,
- RID_SCDLG_PIVOTFILTER);
- DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
- if ( pDlg->Execute() == RET_OK )
- {
- ScPivot* pNewPivot = pPivot->CreateNew();
-
- const ScQueryItem& rQueryItem = pDlg->GetOutputItem();
- pNewPivot->SetQuery(rQueryItem.GetQueryData());
-
- PivotField* pColArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nColCount;
- pPivot->GetColFields( pColArr, nColCount );
- PivotField* pRowArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nRowCount;
- pPivot->GetRowFields( pRowArr, nRowCount );
- PivotField* pDataArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nDataCount;
- pPivot->GetDataFields( pDataArr, nDataCount );
-
- pNewPivot->SetColFields( pColArr, nColCount );
- pNewPivot->SetRowFields( pRowArr, nRowCount );
- pNewPivot->SetDataFields( pDataArr, nDataCount );
-
- pNewPivot->SetName( pPivot->GetName() );
- pNewPivot->SetTag( pPivot->GetTag() );
-
- pViewData->GetDocShell()->PivotUpdate( pPivot, pNewPivot );
- }
- delete pDlg;
- }
- else
- {
- SCCOL nField;
- if (pPivot->GetColFieldAtCursor(nCol, nRow, nTab, nField))
- {
- bPivotMouse = TRUE;
- nPivotField = nField;
- bPivotColField = TRUE;
- nPivotCol = nCol;
- pDragPivot = pPivot;
- PivotTestMouse( rMEvt, TRUE );
- // CaptureMouse();
- StartTracking();
- }
- else if (pPivot->GetRowFieldAtCursor(nCol, nRow, nTab, nField))
- {
- bPivotMouse = TRUE;
- nPivotField = nField;
- bPivotColField = FALSE;
- nPivotCol = nCol;
- pDragPivot = pPivot;
- PivotTestMouse( rMEvt, TRUE );
- // CaptureMouse();
- StartTracking();
- }
- }
- }
-#endif
-
if (pDPObj)
{
USHORT nOrient = sheet::DataPilotFieldOrientation_HIDDEN;
@@ -256,365 +171,6 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt
}
}
-#if OLD_PIVOT_IMPLEMENTATION
-void ScGridWindow::DoPivotDrop( BOOL bDelete, BOOL bToCols, SCSIZE nDestPos )
-{
- if ( nPivotField == PIVOT_DATA_FIELD && bDelete )
- {
- pViewData->GetView()->ErrorMessage(STR_PIVOT_MOVENOTALLOWED);
- return;
- }
-
- if ( bPivotColField != bToCols && !bDelete )
- {
- SCSIZE nDestCount = bToCols ? pDragPivot->GetColFieldCount()
- : pDragPivot->GetRowFieldCount();
- if ( nDestCount >= PIVOT_MAXFIELD ) // schon voll?
- {
- // Versuch, mehr als PIVOT_MAXFIELD Eintraege zu erzeugen
- pViewData->GetView()->ErrorMessage(STR_PIVOT_ERROR);
- return;
- }
- }
-
- PivotField* pColArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nColCount;
- pDragPivot->GetColFields( pColArr, nColCount );
-
- PivotField* pRowArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nRowCount;
- pDragPivot->GetRowFields( pRowArr, nRowCount );
-
- PivotField* pDataArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nDataCount;
- pDragPivot->GetDataFields( pDataArr, nDataCount );
-
- SCSIZE nOldPos = 0;
- PivotField aMoveField;
-
- PivotField* pSource = bPivotColField ? pColArr : pRowArr;
- SCSIZE& rCount = bPivotColField ? nColCount : nRowCount;
-
- BOOL bFound = FALSE;
- for (SCSIZE i=0; i<rCount && !bFound; i++)
- if (pSource[i].nCol == nPivotField)
- {
- nOldPos = i;
- aMoveField = pSource[i];
- --rCount;
- if (i<rCount)
- memmove( &pSource[i], &pSource[i+1], (rCount-i)*sizeof(PivotField) );
- if ( bPivotColField == bToCols )
- if (nDestPos > i)
- --nDestPos;
- bFound = TRUE;
- }
-
- if (bFound)
- {
- if (!bDelete)
- {
- PivotField* pDest = bToCols ? pColArr : pRowArr;
- SCSIZE& rDestCount = bToCols ? nColCount : nRowCount;
-
- if (nDestPos < rDestCount)
- memmove( &pDest[nDestPos+1], &pDest[nDestPos],
- (rDestCount-nDestPos)*sizeof(PivotField) );
- pDest[nDestPos] = aMoveField;
- ++rDestCount;
- }
-
- BOOL bEmpty = ( nColCount + nRowCount == 0 ||
- ( nColCount + nRowCount == 1 && nDataCount <= 1 ) );
-
- if ( bEmpty ) // Pivottabelle loeschen
- {
- pViewData->GetDocShell()->PivotUpdate( pDragPivot, NULL );
- }
- else
- {
- ScPivot* pNewPivot = pDragPivot->CreateNew();
- pNewPivot->SetColFields( pColArr, nColCount );
- pNewPivot->SetRowFields( pRowArr, nRowCount );
- pNewPivot->SetDataFields( pDataArr, nDataCount );
-
- pNewPivot->SetName( pDragPivot->GetName() );
- pNewPivot->SetTag( pDragPivot->GetTag() );
-
- pViewData->GetDocShell()->PivotUpdate( pDragPivot, pNewPivot );
- }
- pDragPivot = NULL;
- }
- else
- {
- DBG_ASSERT(0,"Pivot-Eintrag nicht gefunden");
- }
-
- delete[] pColArr;
- delete[] pRowArr;
- delete[] pDataArr;
-}
-
-BOOL ScGridWindow::PivotTestMouse( const MouseEvent& rMEvt, BOOL bMove )
-{
- BOOL bRet = FALSE;
- BOOL bTimer = FALSE;
- Point aPos = rMEvt.GetPosPixel();
-
- SCsCOL nDx = 0;
- SCsROW nDy = 0;
- if ( aPos.X() < 0 )
- nDx = -1;
- if ( aPos.Y() < 0 )
- nDy = -1;
- Size aSize = GetOutputSizePixel();
- if ( aPos.X() >= aSize.Width() )
- nDx = 1;
- if ( aPos.Y() >= aSize.Height() )
- nDy = 1;
- if ( nDx != 0 || nDy != 0 )
- {
- if (bDragRect)
- {
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
- bDragRect = FALSE;
- UpdateDragRectOverlay();
- }
-
- if ( nDx != 0 )
- pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) );
- if ( nDy != 0 )
- pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) );
-
- bTimer = TRUE;
- }
-
- SCsCOL nPosX;
- SCsROW nPosY;
- pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
- BOOL bMouseLeft;
- BOOL bMouseTop;
- pViewData->GetMouseQuadrant( aPos, eWhich, nPosX, nPosY, bMouseLeft, bMouseTop );
-
- SCCOL nPiCol1;
- SCROW nPiRow1;
- SCCOL nPiCol2;
- SCROW nPiRow2;
- SCTAB nTab;
- pDragPivot->GetDestArea( nPiCol1, nPiRow1, nPiCol2, nPiRow2, nTab );
-
- if ( nPosX >= (SCsCOL) nPiCol1 && nPosX <= (SCsCOL) nPiCol2 &&
- nPosY >= (SCsROW) nPiRow1 && nPosY <= (SCsROW) nPiRow2 )
- {
- SCsROW nFilterAdd = 2; // Platz fuer Filter-Button
- SCsROW nColRows = 1; //! Ueberschrift: 0, wenn keine Zeilen, aber mehrere Datenfelder
- SCCOL nNewStartX;
- SCROW nNewStartY;
- SCCOL nNewEndX;
- SCROW nNewEndY;
-
- SCsCOL nRelX = nPosX - (SCsCOL) nPiCol1;
- SCsROW nRelY = nPosY - (SCsROW) nPiRow1 - nFilterAdd;
-
- PivotField* pFieldArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nColCount;
- pDragPivot->GetColFields( pFieldArr, nColCount );
- SCSIZE nRowCount;
- pDragPivot->GetRowFields( pFieldArr, nRowCount );
- delete[] pFieldArr;
-
- BOOL bBefore;
- SCsCOL nColSize = static_cast<SCsCOL>(Max( nColCount, (SCSIZE) 1 ));
- SCsROW nRowSize = static_cast<SCsROW>(Max( nRowCount, (SCSIZE) 1 ));
-
- BOOL bToCols;
- if (nRelX < nColSize && nRelY >= nRowSize)
- bToCols = TRUE; // links
- else if (nRelY < nRowSize && nRelX >= nColSize)
- bToCols = FALSE; // oben
- else
- bToCols = ( nRelY-nRowSize > static_cast<SCsCOLROW>(nRelX-nColSize) );
-
- SCsCOL nDestCol = 0;
- SCsROW nDestRow = 0;
- BOOL bNothing = FALSE;
-
- if ( bToCols )
- {
- bBefore = bMouseLeft;
- nDestCol = nRelX;
- if (nDestCol < 0)
- {
- nDestCol = 0;
- bBefore = TRUE;
- }
- if (nDestCol >= static_cast<SCsCOL>(nColCount))
- {
- nDestCol = static_cast<SCsCOL>(nColCount)-1;
- bBefore = FALSE;
- }
-
- nNewStartY = nPiRow1 + nFilterAdd + static_cast<SCROW>(nRowCount) + nColRows;
- nNewEndY = nPiRow2 - 1;
- nNewStartX = nPiCol1 + (SCCOL) nDestCol;
- nNewEndX = nNewStartX;
-
- if ( !bPivotColField ) // von der anderen Seite
- {
- if (bBefore)
- nNewEndX = nNewStartX - 1; // vor dem Feld
- else
- nNewStartX = nNewEndX + 1; // hinter dem Feld
- }
- else
- {
- SCCOL nThisCol = (SCCOL) nPosX; // absolute Spalte ( == Maus )
- if ( nThisCol < nPivotCol )
- {
- nNewEndX = nNewStartX - 1; // vor dem Feld
- bBefore = TRUE;
- }
- else if ( nThisCol > nPivotCol )
- {
- nNewStartX = nNewEndX + 1; // hinter dem Feld
- bBefore = FALSE;
- }
- else
- bNothing = TRUE;
- }
- SetPointer( Pointer( POINTER_PIVOT_ROW ) );
- }
- else
- {
- if (nRelY <= 0 && static_cast<SCsCOLROW>(nRelX) < static_cast<SCsCOLROW>(nColCount)+static_cast<SCsCOLROW>(nRowCount))
- {
- nDestRow = static_cast<SCsCOLROW>(nRelX) - static_cast<SCsCOLROW>(nColCount);
- bBefore = bMouseLeft;
- }
- else
- {
- nDestRow = nRelY-1;
- bBefore = bMouseTop;
- }
- if (nDestRow < 0)
- {
- nDestRow = 0;
- bBefore = TRUE;
- }
- if (nDestRow >= static_cast<SCsROW>(nRowCount))
- {
- nDestRow = static_cast<SCsROW>(nRowCount)-1;
- bBefore = FALSE;
- }
-
- nNewStartX = nPiCol1 + (SCCOL) nColCount;
- nNewEndX = nPiCol2 - 1;
- nNewStartY = nPiRow1 + nFilterAdd + nDestRow + nColRows;
- nNewEndY = nNewStartY;
- if ( bPivotColField ) // von der anderen Seite
- {
- if (bBefore)
- nNewEndY = nNewStartY - 1; // vor dem Feld
- else
- nNewStartY = nNewEndY + 1; // hinter dem Feld
- }
- else
- {
- SCCOL nThisCol =
- static_cast<SCCOL>(static_cast<SCCOLROW>(nDestRow) +
- static_cast<SCCOLROW>(nColCount) + nPiCol1);
- // absolute Spalte
- if ( nThisCol < nPivotCol )
- {
- bBefore = TRUE;
- nNewEndY = nNewStartY - 1; // vor dem Feld
- }
- else if ( nThisCol > nPivotCol )
- {
- bBefore = FALSE;
- nNewStartY = nNewEndY + 1; // hinter dem Feld
- }
- else
- bNothing = TRUE;
- }
- SetPointer( Pointer( POINTER_PIVOT_COL ) );
- }
-
- if (bMove)
- {
- if ( nNewStartX != nDragStartX || nNewEndX != nDragEndX ||
- nNewStartY != nDragStartY || nNewEndY != nDragEndY || !bDragRect )
- {
- //if (bDragRect)
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
-
- nDragStartX = nNewStartX;
- nDragStartY = nNewStartY;
- nDragEndX = nNewEndX;
- nDragEndY = nNewEndY;
- bDragRect = TRUE;
-
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
-
- UpdateDragRectOverlay();
- }
- }
- else
- {
- if (bDragRect)
- {
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
- bDragRect = FALSE;
- UpdateDragRectOverlay();
- }
-
- if (!bNothing)
- {
- SCSIZE nDestPos = bToCols ? static_cast<SCSIZE>(nDestCol) : static_cast<SCSIZE>(nDestRow);
- if (!bBefore)
- ++nDestPos;
- DoPivotDrop( FALSE, bToCols, nDestPos );
- }
- }
-
- bRet = TRUE;
- }
- else
- {
- if (bMove)
- SetPointer( Pointer( POINTER_PIVOT_DELETE ) );
- // if (bDragRect)
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
- bDragRect = FALSE;
- UpdateDragRectOverlay();
-
- if (!bMove)
- DoPivotDrop( TRUE, FALSE,0 );
- }
-
- if (bTimer && bMove)
- pViewData->GetView()->SetTimer( this, rMEvt ); // Event wiederholen
- else
- pViewData->GetView()->ResetTimer();
-
- return bRet;
-}
-
-void ScGridWindow::PivotMouseMove( const MouseEvent& rMEvt )
-{
- PivotTestMouse( rMEvt, TRUE );
-}
-
-void ScGridWindow::PivotMouseButtonUp( const MouseEvent& rMEvt )
-{
- bPivotMouse = FALSE; // als erstes, falls PivotTestMouse eine Fehlermeldung bringt
- ReleaseMouse();
-
- PivotTestMouse( rMEvt, FALSE );
- SetPointer( Pointer( POINTER_ARROW ) );
-}
-#endif
-
// -----------------------------------------------------------------------
//
// Data Pilot interaction
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index b90e5d3e802e..d700ee606731 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -2045,8 +2045,6 @@ void ScGridWindow::DataChanged( const DataChangedEvent& rDCEvt )
// RepeatResize in case scroll bar sizes have changed
pView->RepeatResize();
-
- pView->UpdateSelectionType();
pView->UpdateAllOverlays();
// invalidate cell attribs in input handler, in case the
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/makefile.mk b/sc/source/ui/view/makefile.mk
index 9af8051b6613..466ab5dc8627 100644
--- a/sc/source/ui/view/makefile.mk
+++ b/sc/source/ui/view/makefile.mk
@@ -135,12 +135,10 @@ SLOFILES = \
$(SLO)$/viewfun4.obj \
$(SLO)$/viewfun2.obj
.ELIF "$(OS)$(COM)$(CPUNAME)"=="SOLARISC52INTEL"
-# tabcont can be removed if -xspace is no longer used (i99576, i99592)
NOOPTFILES=\
$(SLO)$/drawview.obj \
$(SLO)$/dbfunc2.obj \
- $(SLO)$/tabvwsh2.obj \
- $(SLO)$/tabcont.obj
+ $(SLO)$/tabvwsh2.obj
.ELSE
NOOPTFILES=\
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index b600600acb6b..9d2da303988c 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1816,6 +1816,7 @@ void ScOutputData::FindChanged()
pDoc->DisableIdle( bWasIdleDisabled );
}
+#ifdef OLD_SELECTION_PAINT
void ScOutputData::DrawMark( Window* pWin )
{
Rectangle aRect;
@@ -1826,14 +1827,14 @@ void ScOutputData::DrawMark( Window* pWin )
for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
{
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
- if ( pThisRowInfo->bChanged )
+ if (pThisRowInfo->bChanged)
{
long nPosX = nScrX;
- if ( bLayoutRTL )
+ if (bLayoutRTL)
nPosX += nMirrorW - 1; // always in pixels
aRect = Rectangle( Point( nPosX,nPosY ), Size(1, pThisRowInfo->nHeight) );
- if ( bLayoutRTL )
+ if (bLayoutRTL)
aRect.Left() = aRect.Right() + 1;
else
aRect.Right() = aRect.Left() - 1;
@@ -1841,12 +1842,12 @@ void ScOutputData::DrawMark( Window* pWin )
BOOL bOldMarked = FALSE;
for (SCCOL nX=nX1; nX<=nX2; nX++)
{
- if ( pThisRowInfo->pCellInfo[nX+1].bMarked != bOldMarked )
+ if (pThisRowInfo->pCellInfo[nX+1].bMarked != bOldMarked)
{
if (bOldMarked && aRect.Right() >= aRect.Left())
aInvert.AddRect( aRect );
- if ( bLayoutRTL )
+ if (bLayoutRTL)
aRect.Right() = nPosX;
else
aRect.Left() = nPosX;
@@ -1854,7 +1855,7 @@ void ScOutputData::DrawMark( Window* pWin )
bOldMarked = pThisRowInfo->pCellInfo[nX+1].bMarked;
}
- if ( bLayoutRTL )
+ if (bLayoutRTL)
{
nPosX -= pRowInfo[0].pCellInfo[nX+1].nWidth;
aRect.Left() = nPosX+1;
@@ -1871,6 +1872,7 @@ void ScOutputData::DrawMark( Window* pWin )
nPosY += pThisRowInfo->nHeight;
}
}
+#endif
void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
SCCOL nRefEndX, SCROW nRefEndY,
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 2906440d7e5a..b94837fc1793 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -244,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();
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index d14a87ffe783..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
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/tabview.cxx b/sc/source/ui/view/tabview.cxx
index c51c81c36dd8..3077e852dbaf 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -384,8 +384,7 @@ BOOL lcl_HasRowOutline( const ScViewData& rViewData )
bInActivatePart( FALSE ), \
bInZoomUpdate( FALSE ), \
bMoveIsShift( FALSE ), \
- bNewStartIfMarking( FALSE ), \
- bOldSelection( FALSE )
+ bNewStartIfMarking( FALSE )
ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
@@ -398,22 +397,22 @@ ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pView
Init();
}
-ScTabView::ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ) :
- pFrameWin( pParent ),
- aViewData( rScTabView.aViewData ),
- TABVIEW_INIT
-{
- RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" );
-
- aViewData.SetViewShell( pViewShell );
- Init();
-
- UpdateShow();
- if ( aViewData.GetActivePart() != SC_SPLIT_BOTTOMLEFT )
- pGridWin[SC_SPLIT_BOTTOMLEFT]->Show();
-
- InvalidateSplit();
-}
+//UNUSED2009-05 ScTabView::ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ) :
+//UNUSED2009-05 pFrameWin( pParent ),
+//UNUSED2009-05 aViewData( rScTabView.aViewData ),
+//UNUSED2009-05 TABVIEW_INIT
+//UNUSED2009-05 {
+//UNUSED2009-05 RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" );
+//UNUSED2009-05
+//UNUSED2009-05 aViewData.SetViewShell( pViewShell );
+//UNUSED2009-05 Init();
+//UNUSED2009-05
+//UNUSED2009-05 UpdateShow();
+//UNUSED2009-05 if ( aViewData.GetActivePart() != SC_SPLIT_BOTTOMLEFT )
+//UNUSED2009-05 pGridWin[SC_SPLIT_BOTTOMLEFT]->Show();
+//UNUSED2009-05
+//UNUSED2009-05 InvalidateSplit();
+//UNUSED2009-05 }
void ScTabView::InitScrollBar( ScrollBar& rScrollBar, long nMaxVal )
{
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 1be33a37cd26..f8cf331bc8cf 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>
@@ -465,19 +466,9 @@ void ScTabView::CursorPosChanged()
// Broadcast, damit andere Views des Dokuments auch umschalten
ScDocument* pDoc = aViewData.GetDocument();
-#if OLD_PIVOT_IMPLEMENTATION
- BOOL bPivot = ( NULL != pDoc->GetPivotAtCursor( aViewData.GetCurX(),
- aViewData.GetCurY(),
- aViewData.GetTabNo() ) ||
- NULL != pDoc->GetDPAtCursor( aViewData.GetCurX(),
- aViewData.GetCurY(),
- aViewData.GetTabNo() ) );
- aViewData.GetViewShell()->SetPivotShell(bPivot);
-#else
bool bDP = NULL != pDoc->GetDPAtCursor(
aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
aViewData.GetViewShell()->SetPivotShell(bDP);
-#endif
// UpdateInputHandler jetzt in CellContentChanged
@@ -946,6 +937,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 +967,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 +976,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 +1002,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 +1018,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 +1044,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 +1585,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
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index c27524c83542..75e961d5eeec 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -148,16 +148,6 @@ void __EXPORT ScTabView::Init()
// Das gilt auch fuer ViewOptionsHasChanged()
TestHintWindow();
-
- UpdateSelectionType();
-}
-
-void ScTabView::UpdateSelectionType()
-{
- // old selection in high contrast mode, or if transparent drawing isn't supported
-
- bOldSelection = pFrameWin->GetSettings().GetStyleSettings().GetHighContrastMode() ||
- !pFrameWin->supportsOperation( OutDevSupport_TransparentRect );
}
__EXPORT ScTabView::~ScTabView()
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 7461d884c5b2..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)
@@ -985,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();
@@ -1009,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) );
@@ -1064,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 2b9ef68b1f8a..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 );
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/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/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 015c5fd2c083..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());
}
@@ -2181,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++);
@@ -2546,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 83dd05c9d33c..d0a6f2acf015 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -481,12 +481,13 @@ BOOL ScUpdateRect::GetDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 )
return TRUE;
}
+#ifdef OLD_SELECTION_PAINT
BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, BOOL& rCont )
{
rCont = FALSE;
- if ( nNewStartX == nOldStartX && nNewEndX == nOldEndX &&
- nNewStartY == nOldStartY && nNewEndY == nOldEndY )
+ if (nNewStartX == nOldStartX && nNewEndX == nOldEndX &&
+ nNewStartY == nOldStartY && nNewEndY == nOldEndY)
{
rX1 = nNewStartX;
rY1 = nNewStartY;
@@ -500,14 +501,14 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
rX2 = Max(nNewEndX,nOldEndX);
rY2 = Max(nNewEndY,nOldEndY);
- if ( nNewStartX == nOldStartX && nNewEndX == nOldEndX ) // nur vertikal
+ if (nNewStartX == nOldStartX && nNewEndX == nOldEndX) // nur vertikal
{
- if ( nNewStartY == nOldStartY )
+ if (nNewStartY == nOldStartY)
{
rY1 = Min( nNewEndY, nOldEndY ) + 1;
rY2 = Max( nNewEndY, nOldEndY );
}
- else if ( nNewEndY == nOldEndY )
+ else if (nNewEndY == nOldEndY)
{
rY1 = Min( nNewStartY, nOldStartY );
rY2 = Max( nNewStartY, nOldStartY ) - 1;
@@ -523,14 +524,14 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContX2 = rX2;
}
}
- else if ( nNewStartY == nOldStartY && nNewEndY == nOldEndY ) // nur horizontal
+ else if (nNewStartY == nOldStartY && nNewEndY == nOldEndY) // nur horizontal
{
- if ( nNewStartX == nOldStartX )
+ if (nNewStartX == nOldStartX)
{
rX1 = Min( nNewEndX, nOldEndX ) + 1;
rX2 = Max( nNewEndX, nOldEndX );
}
- else if ( nNewEndX == nOldEndX )
+ else if (nNewEndX == nOldEndX)
{
rX1 = Min( nNewStartX, nOldStartX );
rX2 = Max( nNewStartX, nOldStartX ) - 1;
@@ -546,9 +547,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContY2 = rY2;
}
}
- else if ( nNewEndX == nOldEndX && nNewEndY == nOldEndY ) // links oben
+ else if (nNewEndX == nOldEndX && nNewEndY == nOldEndY) // links oben
{
- if ( (nNewStartX<nOldStartX) == (nNewStartY<nOldStartY) )
+ if ((nNewStartX<nOldStartX) == (nNewStartY<nOldStartY))
rX1 = Min( nNewStartX, nOldStartX );
else
rX1 = Max( nNewStartX, nOldStartX ); // Ecke weglassen
@@ -561,9 +562,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContX1 = Min( nNewStartX, nOldStartX ); // links
nContX2 = Max( nNewStartX, nOldStartX ) - 1;
}
- else if ( nNewStartX == nOldStartX && nNewEndY == nOldEndY ) // rechts oben
+ else if (nNewStartX == nOldStartX && nNewEndY == nOldEndY) // rechts oben
{
- if ( (nNewEndX<nOldEndX) != (nNewStartY<nOldStartY) )
+ if ((nNewEndX<nOldEndX) != (nNewStartY<nOldStartY))
rX2 = Max( nNewEndX, nOldEndX );
else
rX2 = Min( nNewEndX, nOldEndX ); // Ecke weglassen
@@ -576,9 +577,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContX1 = Min( nNewEndX, nOldEndX ) + 1; // rechts
nContX2 = Max( nNewEndX, nOldEndX );
}
- else if ( nNewEndX == nOldEndX && nNewStartY == nOldStartY ) // links unten
+ else if (nNewEndX == nOldEndX && nNewStartY == nOldStartY) // links unten
{
- if ( (nNewStartX<nOldStartX) != (nNewEndY<nOldEndY) )
+ if ((nNewStartX<nOldStartX) != (nNewEndY<nOldEndY))
rX1 = Min( nNewStartX, nOldStartX );
else
rX1 = Max( nNewStartX, nOldStartX ); // Ecke weglassen
@@ -591,9 +592,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContX1 = Min( nNewStartX, nOldStartX ); // links
nContX2 = Max( nNewStartX, nOldStartX ) - 1;
}
- else if ( nNewStartX == nOldStartX && nNewStartY == nOldStartY ) // rechts unten
+ else if (nNewStartX == nOldStartX && nNewStartY == nOldStartY) // rechts unten
{
- if ( (nNewEndX<nOldEndX) == (nNewEndY<nOldEndY) )
+ if ((nNewEndX<nOldEndX) == (nNewEndY<nOldEndY))
rX2 = Max( nNewEndX, nOldEndX );
else
rX2 = Min( nNewEndX, nOldEndX ); // Ecke weglassen
@@ -629,6 +630,7 @@ void ScUpdateRect::GetContDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 )
rX2 = nContX2;
rY2 = nContY2;
}
+#endif
diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk
index fe2bf6bc636d..49eb10b7e8b4 100644
--- a/sc/util/makefile.mk
+++ b/sc/util/makefile.mk
@@ -82,9 +82,11 @@ SHL1STDLIBS= \
$(SFXLIB) \
$(SVTOOLLIB) \
$(SVLLIB) \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(GOODIESLIB) \
$(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
$(VCLLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
@@ -187,8 +189,11 @@ SHL6STDLIBS= \
$(SFXLIB) \
$(SVTOOLLIB) \
$(SVLLIB) \
+ $(SVXCORELIB) \
+ $(SVXMSFILTERLIB) \
$(SVXLIB) \
$(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
$(VCLLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
@@ -213,6 +218,7 @@ DEF8NAME=$(SHL8TARGET)
SHL8STDLIBS= \
$(ISCLIB) \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(SFX2LIB) \
$(SVTOOLLIB) \
@@ -304,7 +310,7 @@ SHL9STDLIBS= \
$(SALLIB)\
$(BASICLIB) \
$(SFXLIB) \
- $(SVXLIB) \
+ $(SVXCORELIB) \
$(SVTOOLLIB) \
$(SVLLIB) \
$(ISCLIB) \