summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connectivity/inc/connectivity/predicateinput.hxx8
-rw-r--r--connectivity/inc/connectivity/sqlnode.hxx2
-rw-r--r--connectivity/qa/connectivity/tools/CRMDatabase.java5
-rw-r--r--connectivity/source/commontools/FValue.cxx48
-rw-r--r--connectivity/source/commontools/predicateinput.cxx136
-rw-r--r--connectivity/source/drivers/ado/AColumn.cxx5
-rw-r--r--connectivity/source/drivers/ado/AConnection.cxx5
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx4
-rwxr-xr-xconnectivity/source/drivers/macab/MacabRecord.cxx2
-rw-r--r--connectivity/source/parse/PColumn.cxx16
-rw-r--r--connectivity/source/parse/sqlbison.y474
-rw-r--r--connectivity/source/parse/sqlflex.l27
-rw-r--r--connectivity/source/parse/sqliterator.cxx34
-rw-r--r--connectivity/source/parse/sqlnode.cxx2
-rw-r--r--dbaccess/qa/complex/dbaccess/Query.java49
-rw-r--r--dbaccess/qa/complex/dbaccess/RowSet.java4
-rwxr-xr-xdbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java84
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx14
-rw-r--r--dbaccess/source/core/api/CacheSet.hxx3
-rw-r--r--dbaccess/source/core/api/KeySet.cxx62
-rw-r--r--dbaccess/source/core/api/KeySet.hxx9
-rw-r--r--dbaccess/source/core/api/OptimisticSet.cxx5
-rw-r--r--dbaccess/source/core/api/OptimisticSet.hxx3
-rw-r--r--dbaccess/source/core/api/RowSet.cxx90
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx9
-rw-r--r--dbaccess/source/core/api/RowSetBase.hxx3
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx141
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx28
-rw-r--r--dbaccess/source/core/dataaccess/SharedConnection.cxx2
-rw-r--r--[-rwxr-xr-x]dbaccess/source/core/dataaccess/datasource.cxx2
-rw-r--r--dbaccess/source/core/inc/SingleSelectQueryComposer.hxx30
-rw-r--r--dbaccess/source/ui/app/AppController.cxx106
-rw-r--r--dbaccess/source/ui/app/AppControllerGen.cxx1
-rw-r--r--dbaccess/source/ui/app/app.src6
-rw-r--r--dbaccess/source/ui/app/closeveto.cxx180
-rw-r--r--dbaccess/source/ui/app/closeveto.hxx67
-rw-r--r--dbaccess/source/ui/app/makefile.mk3
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx3
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx58
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.src2
-rw-r--r--dbaccess/source/ui/inc/dbu_qry.hrc4
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx3
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/query.src8
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx1
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx22
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx26
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx2
-rwxr-xr-xediteng/source/editeng/impedit2.cxx22
-rw-r--r--forms/source/component/DatabaseForm.cxx2
-rw-r--r--forms/source/component/Edit.cxx58
-rw-r--r--forms/source/component/Edit.hxx1
-rw-r--r--forms/source/component/FormattedField.cxx4
-rw-r--r--formula/inc/formula/compiler.hrc126
-rw-r--r--formula/inc/formula/opcode.hxx4
-rw-r--r--formula/source/core/resource/core_resource.src24
-rw-r--r--instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt1
-rw-r--r--instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt1
-rw-r--r--instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt1
-rw-r--r--io/source/TextInputStream/TextInputStream.cxx4
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java28
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java9
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java9
-rw-r--r--offapi/com/sun/star/security/CertAltNameEntry.idl59
-rw-r--r--offapi/com/sun/star/security/ExtAltNameType.idl110
-rw-r--r--offapi/com/sun/star/security/XSanExtension.idl57
-rw-r--r--offapi/com/sun/star/security/makefile.mk8
-rw-r--r--offapi/com/sun/star/sheet/DataPilotDescriptor.idl17
-rw-r--r--[-rwxr-xr-x]officecfg/registry/data/org/openoffice/Setup.xcu2
-rw-r--r--oox/inc/oox/core/contexthandler.hxx4
-rw-r--r--oox/inc/oox/core/fasttokenhandler.hxx4
-rw-r--r--oox/inc/oox/core/filterbase.hxx4
-rw-r--r--oox/inc/oox/core/fragmenthandler.hxx4
-rwxr-xr-xoox/inc/oox/core/relations.hxx6
-rw-r--r--oox/inc/oox/core/relationshandler.hxx6
-rw-r--r--oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx5
-rw-r--r--oox/inc/oox/drawingml/chart/converterbase.hxx1
-rw-r--r--oox/inc/oox/drawingml/color.hxx8
-rw-r--r--oox/inc/oox/drawingml/drawingmltypes.hxx23
-rw-r--r--oox/inc/oox/drawingml/fillproperties.hxx55
-rw-r--r--oox/inc/oox/drawingml/lineproperties.hxx48
-rwxr-xr-xoox/inc/oox/drawingml/shapepropertymap.hxx148
-rw-r--r--oox/inc/oox/dump/biffdumper.hxx5
-rw-r--r--oox/inc/oox/dump/dffdumper.hxx1
-rw-r--r--oox/inc/oox/dump/dumperbase.hxx135
-rw-r--r--oox/inc/oox/dump/oledumper.hxx11
-rw-r--r--oox/inc/oox/dump/pptxdumper.hxx5
-rw-r--r--oox/inc/oox/dump/xlsbdumper.hxx4
-rw-r--r--oox/inc/oox/helper/binaryinputstream.hxx323
-rw-r--r--oox/inc/oox/helper/binaryoutputstream.hxx86
-rw-r--r--oox/inc/oox/helper/binarystreambase.hxx130
-rw-r--r--oox/inc/oox/helper/containerhelper.hxx54
-rw-r--r--oox/inc/oox/helper/graphichelper.hxx2
-rw-r--r--oox/inc/oox/helper/helper.hxx30
-rw-r--r--oox/inc/oox/helper/modelobjecthelper.hxx22
-rw-r--r--oox/inc/oox/helper/propertymap.hxx16
-rw-r--r--oox/inc/oox/helper/propertyset.hxx46
-rwxr-xr-x[-rw-r--r--]oox/inc/oox/helper/textinputstream.hxx89
-rw-r--r--oox/inc/oox/helper/zipstorage.hxx11
-rw-r--r--oox/inc/oox/ole/axbinaryreader.hxx16
-rw-r--r--oox/inc/oox/ole/oleobjecthelper.hxx2
-rwxr-xr-x[-rw-r--r--]oox/inc/oox/ole/olestorage.hxx10
-rw-r--r--oox/inc/oox/ole/vbacontrol.hxx2
-rw-r--r--oox/inc/oox/ole/vbainputstream.hxx17
-rwxr-xr-x[-rw-r--r--]oox/inc/oox/ole/vbamodule.hxx4
-rw-r--r--oox/inc/oox/ole/vbaproject.hxx2
-rw-r--r--oox/inc/oox/ppt/slidepersist.hxx4
-rw-r--r--oox/inc/oox/vml/vmldrawing.hxx2
-rw-r--r--oox/inc/oox/vml/vmlformatting.hxx11
-rw-r--r--oox/inc/oox/vml/vmlinputstream.hxx66
-rw-r--r--oox/inc/oox/xls/biffhelper.hxx3
-rw-r--r--oox/inc/oox/xls/biffinputstream.hxx28
-rw-r--r--oox/inc/oox/xls/biffoutputstream.hxx32
-rw-r--r--oox/inc/oox/xls/chartsheetfragment.hxx11
-rw-r--r--oox/inc/oox/xls/commentsbuffer.hxx17
-rw-r--r--oox/inc/oox/xls/condformatbuffer.hxx4
-rw-r--r--oox/inc/oox/xls/defnamesbuffer.hxx23
-rwxr-xr-xoox/inc/oox/xls/drawingbase.hxx147
-rw-r--r--oox/inc/oox/xls/drawingfragment.hxx97
-rwxr-xr-xoox/inc/oox/xls/drawingmanager.hxx521
-rw-r--r--oox/inc/oox/xls/excelfilter.hxx10
-rw-r--r--oox/inc/oox/xls/excelhandlers.hxx82
-rw-r--r--oox/inc/oox/xls/formulabase.hxx136
-rw-r--r--oox/inc/oox/xls/formulaparser.hxx35
-rw-r--r--oox/inc/oox/xls/ooxformulaparser.hxx4
-rw-r--r--oox/inc/oox/xls/pivotcachebuffer.hxx11
-rw-r--r--oox/inc/oox/xls/pivotcachefragment.hxx10
-rw-r--r--oox/inc/oox/xls/richstring.hxx43
-rw-r--r--oox/inc/oox/xls/sharedformulabuffer.hxx111
-rw-r--r--oox/inc/oox/xls/sharedstringsbuffer.hxx11
-rwxr-xr-xoox/inc/oox/xls/sheetdatabuffer.hxx354
-rw-r--r--oox/inc/oox/xls/sheetdatacontext.hxx89
-rw-r--r--oox/inc/oox/xls/stylesbuffer.hxx5
-rw-r--r--oox/inc/oox/xls/workbookhelper.hxx68
-rw-r--r--oox/inc/oox/xls/worksheetfragment.hxx15
-rw-r--r--oox/inc/oox/xls/worksheethelper.hxx241
-rw-r--r--oox/prj/d.lst5
-rw-r--r--oox/source/core/binaryfilterbase.cxx4
-rw-r--r--oox/source/core/contexthandler.cxx2
-rw-r--r--oox/source/core/filterdetect.cxx188
-rw-r--r--oox/source/core/fragmenthandler.cxx4
-rwxr-xr-x[-rw-r--r--]oox/source/core/makefile.mk0
-rw-r--r--oox/source/core/xmlfilterbase.cxx4
-rwxr-xr-x[-rw-r--r--]oox/source/docprop/makefile.mk0
-rw-r--r--oox/source/drawingml/chart/chartdrawingfragment.cxx55
-rwxr-xr-x[-rw-r--r--]oox/source/drawingml/chart/makefile.mk0
-rw-r--r--oox/source/drawingml/chart/objectformatter.cxx212
-rw-r--r--oox/source/drawingml/color.cxx4
-rwxr-xr-x[-rw-r--r--]oox/source/drawingml/diagram/makefile.mk0
-rw-r--r--oox/source/drawingml/fillproperties.cxx122
-rw-r--r--oox/source/drawingml/lineproperties.cxx172
-rwxr-xr-x[-rw-r--r--]oox/source/drawingml/makefile.mk1
-rw-r--r--oox/source/drawingml/shape.cxx24
-rwxr-xr-xoox/source/drawingml/shapepropertymap.cxx194
-rwxr-xr-x[-rw-r--r--]oox/source/drawingml/table/makefile.mk0
-rw-r--r--oox/source/drawingml/table/tablecell.cxx6
-rw-r--r--oox/source/dump/biffdumper.cxx56
-rw-r--r--oox/source/dump/biffdumper.ini28
-rw-r--r--oox/source/dump/dffdumper.ini53
-rw-r--r--oox/source/dump/dumperbase.cxx358
-rwxr-xr-x[-rw-r--r--]oox/source/dump/makefile.mk0
-rw-r--r--oox/source/dump/oledumper.cxx46
-rw-r--r--oox/source/dump/pptxdumper.cxx23
-rw-r--r--oox/source/dump/xlsbdumper.cxx29
-rw-r--r--oox/source/dump/xlsbdumper.ini1
-rw-r--r--oox/source/export/ooxml-export-notes.txt (renamed from oox/workben/ooxml-export-notes.txt)0
-rw-r--r--oox/source/helper/binaryinputstream.cxx182
-rw-r--r--oox/source/helper/binaryoutputstream.cxx76
-rw-r--r--oox/source/helper/binarystreambase.cxx63
-rw-r--r--oox/source/helper/containerhelper.cxx68
-rwxr-xr-xoox/source/helper/graphichelper.cxx11
-rwxr-xr-x[-rw-r--r--]oox/source/helper/makefile.mk0
-rw-r--r--oox/source/helper/modelobjecthelper.cxx29
-rw-r--r--oox/source/helper/propertymap.cxx4
-rw-r--r--oox/source/helper/propertyset.cxx67
-rwxr-xr-x[-rw-r--r--]oox/source/helper/textinputstream.cxx223
-rw-r--r--oox/source/helper/zipstorage.cxx38
-rw-r--r--oox/source/ole/axbinaryreader.cxx57
-rw-r--r--oox/source/ole/axcontrol.cxx12
-rw-r--r--oox/source/ole/axcontrolfragment.cxx2
-rwxr-xr-x[-rw-r--r--]oox/source/ole/makefile.mk0
-rw-r--r--oox/source/ole/oleobjecthelper.cxx18
-rwxr-xr-x[-rw-r--r--]oox/source/ole/olestorage.cxx59
-rw-r--r--oox/source/ole/vbacontrol.cxx12
-rw-r--r--oox/source/ole/vbainputstream.cxx51
-rw-r--r--oox/source/ole/vbamodule.cxx6
-rw-r--r--oox/source/ole/vbaproject.cxx27
-rwxr-xr-x[-rw-r--r--]oox/source/ppt/makefile.mk0
-rw-r--r--oox/source/ppt/slidefragmenthandler.cxx2
-rw-r--r--oox/source/ppt/slidepersist.cxx25
-rwxr-xr-x[-rw-r--r--]oox/source/shape/makefile.mk0
-rwxr-xr-x[-rw-r--r--]oox/source/token/makefile.mk0
-rwxr-xr-xoox/source/token/namespaces.hxx.tail39
-rw-r--r--oox/source/token/properties.txt5
-rwxr-xr-x[-rw-r--r--]oox/source/vml/makefile.mk0
-rw-r--r--oox/source/vml/vmldrawing.cxx4
-rw-r--r--oox/source/vml/vmldrawingfragment.cxx3
-rw-r--r--oox/source/vml/vmlformatting.cxx32
-rw-r--r--oox/source/vml/vmlinputstream.cxx300
-rw-r--r--oox/source/vml/vmlshape.cxx19
-rwxr-xr-xoox/source/vml/vmltextboxcontext.cxx27
-rw-r--r--oox/source/xls/addressconverter.cxx4
-rwxr-xr-xoox/source/xls/autofilterbuffer.cxx2
-rw-r--r--oox/source/xls/biffdetector.cxx7
-rw-r--r--oox/source/xls/biffhelper.cxx15
-rw-r--r--oox/source/xls/biffinputstream.cxx137
-rw-r--r--oox/source/xls/biffoutputstream.cxx92
-rw-r--r--oox/source/xls/chartsheetfragment.cxx10
-rw-r--r--oox/source/xls/commentsbuffer.cxx146
-rw-r--r--oox/source/xls/condformatbuffer.cxx46
-rw-r--r--oox/source/xls/defnamesbuffer.cxx184
-rwxr-xr-xoox/source/xls/drawingbase.cxx324
-rw-r--r--oox/source/xls/drawingfragment.cxx364
-rwxr-xr-xoox/source/xls/drawingmanager.cxx1414
-rw-r--r--oox/source/xls/excelchartconverter.cxx11
-rw-r--r--oox/source/xls/excelfilter.cxx51
-rw-r--r--oox/source/xls/excelhandlers.cxx81
-rw-r--r--oox/source/xls/externallinkbuffer.cxx10
-rwxr-xr-xoox/source/xls/formulabase.cxx91
-rw-r--r--oox/source/xls/formulaparser.cxx321
-rwxr-xr-x[-rw-r--r--]oox/source/xls/makefile.mk4
-rw-r--r--oox/source/xls/numberformatsbuffer.cxx2
-rw-r--r--oox/source/xls/ooxformulaparser.cxx20
-rw-r--r--oox/source/xls/pagesettings.cxx3
-rw-r--r--oox/source/xls/pivotcachebuffer.cxx79
-rw-r--r--oox/source/xls/pivotcachefragment.cxx49
-rw-r--r--oox/source/xls/richstring.cxx94
-rw-r--r--oox/source/xls/sharedformulabuffer.cxx212
-rw-r--r--oox/source/xls/sharedstringsbuffer.cxx6
-rwxr-xr-xoox/source/xls/sheetdatabuffer.cxx935
-rw-r--r--oox/source/xls/sheetdatacontext.cxx870
-rw-r--r--oox/source/xls/stylesbuffer.cxx35
-rw-r--r--oox/source/xls/viewsettings.cxx4
-rw-r--r--oox/source/xls/workbookfragment.cxx102
-rw-r--r--oox/source/xls/workbookhelper.cxx243
-rw-r--r--oox/source/xls/workbooksettings.cxx2
-rw-r--r--oox/source/xls/worksheetfragment.cxx104
-rw-r--r--oox/source/xls/worksheethelper.cxx1316
-rwxr-xr-x[-rw-r--r--]oox/util/makefile.mk0
-rwxr-xr-x[-rw-r--r--]oox/util/makefile.pmk0
-rwxr-xr-xreportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java17
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx16
-rw-r--r--reportdesign/source/ui/report/dlgedfunc.cxx8
-rw-r--r--sc/inc/column.hxx1
-rw-r--r--sc/inc/dociter.hxx36
-rw-r--r--sc/inc/document.hxx20
-rw-r--r--sc/inc/dpobject.hxx4
-rw-r--r--sc/inc/dpsave.hxx14
-rw-r--r--sc/inc/notesuno.hxx197
-rw-r--r--sc/inc/shapeuno.hxx13
-rw-r--r--sc/inc/table.hxx1
-rw-r--r--sc/sdi/scalc.sdi8
-rw-r--r--sc/source/core/data/column2.cxx27
-rwxr-xr-xsc/source/core/data/dociter.cxx185
-rw-r--r--sc/source/core/data/documen2.cxx19
-rw-r--r--sc/source/core/data/documen8.cxx119
-rwxr-xr-xsc/source/core/data/documen9.cxx7
-rw-r--r--sc/source/core/data/document.cxx54
-rw-r--r--sc/source/core/data/dpglobal.cxx1
-rw-r--r--sc/source/core/data/dpobject.cxx12
-rw-r--r--sc/source/core/data/dptablecache.cxx1
-rw-r--r--sc/source/core/data/drwlayer.cxx3
-rw-r--r--sc/source/core/data/global.cxx1
-rw-r--r--sc/source/core/data/table5.cxx2
-rw-r--r--sc/source/core/inc/doubleref.hxx3
-rw-r--r--sc/source/core/inc/interpre.hxx19
-rw-r--r--sc/source/core/tool/doubleref.cxx52
-rw-r--r--sc/source/core/tool/interpr1.cxx24
-rw-r--r--sc/source/core/tool/interpr2.cxx54
-rwxr-xr-xsc/source/core/tool/interpr4.cxx6
-rw-r--r--sc/source/core/tool/interpr5.cxx1706
-rw-r--r--sc/source/core/tool/rangeseq.cxx30
-rw-r--r--sc/source/filter/excel/excform.cxx4
-rw-r--r--sc/source/filter/excel/impop.cxx59
-rw-r--r--sc/source/filter/excel/read.cxx96
-rw-r--r--sc/source/filter/excel/xechart.cxx2
-rw-r--r--sc/source/filter/excel/xeformula.cxx16
-rw-r--r--sc/source/filter/excel/xepivot.cxx10
-rw-r--r--sc/source/filter/excel/xichart.cxx54
-rw-r--r--sc/source/filter/excel/xiescher.cxx42
-rw-r--r--sc/source/filter/excel/xistream.cxx6
-rw-r--r--sc/source/filter/excel/xistyle.cxx24
-rw-r--r--sc/source/filter/excel/xladdress.cxx2
-rwxr-xr-xsc/source/filter/excel/xlchart.cxx33
-rwxr-xr-xsc/source/filter/excel/xlformula.cxx16
-rw-r--r--sc/source/filter/excel/xlpage.cxx4
-rw-r--r--sc/source/filter/excel/xlstyle.cxx10
-rw-r--r--sc/source/filter/excel/xltools.cxx20
-rw-r--r--sc/source/filter/inc/ftools.hxx5
-rw-r--r--sc/source/filter/inc/imp_op.hxx8
-rw-r--r--sc/source/filter/inc/xichart.hxx16
-rw-r--r--sc/source/filter/inc/xistream.hxx11
-rw-r--r--sc/source/filter/inc/xistyle.hxx5
-rwxr-xr-xsc/source/filter/inc/xlchart.hxx15
-rw-r--r--sc/source/filter/xml/XMLConverter.cxx2
-rw-r--r--sc/source/filter/xml/XMLExportDataPilot.cxx2
-rw-r--r--sc/source/filter/xml/xmldpimp.cxx7
-rw-r--r--sc/source/filter/xml/xmldpimp.hxx1
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx20
-rw-r--r--sc/source/filter/xml/xmlexprt.hxx4
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx24
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx1
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx36
-rw-r--r--sc/source/ui/app/inputhdl.cxx11
-rw-r--r--sc/source/ui/app/typemap.cxx1
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx8
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx9
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx37
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx158
-rw-r--r--sc/source/ui/docshell/docfunc.cxx6
-rw-r--r--sc/source/ui/docshell/docsh.cxx5
-rw-r--r--sc/source/ui/docshell/docsh4.cxx48
-rw-r--r--sc/source/ui/docshell/docsh5.cxx5
-rw-r--r--sc/source/ui/docshell/docsh8.cxx25
-rw-r--r--sc/source/ui/drawfunc/drawsh5.cxx9
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx3
-rw-r--r--sc/source/ui/inc/dbdocfun.hxx38
-rw-r--r--sc/source/ui/inc/output.hxx3
-rw-r--r--sc/source/ui/inc/preview.hxx5
-rw-r--r--sc/source/ui/inc/printfun.hxx14
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/inc/undodraw.hxx2
-rw-r--r--sc/source/ui/src/scfuncs.src1
-rw-r--r--sc/source/ui/undo/undodraw.cxx140
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx78
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx22
-rw-r--r--sc/source/ui/unoobj/datauno.cxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx27
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx491
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx56
-rw-r--r--sc/source/ui/view/dbfunc.cxx3
-rw-r--r--sc/source/ui/view/drawutil.cxx9
-rw-r--r--sc/source/ui/view/drawvie4.cxx2
-rw-r--r--sc/source/ui/view/drawview.cxx2
-rw-r--r--sc/source/ui/view/formatsh.cxx11
-rw-r--r--sc/source/ui/view/gridwin3.cxx2
-rw-r--r--sc/source/ui/view/output2.cxx67
-rw-r--r--sc/source/ui/view/pfuncache.cxx9
-rw-r--r--sc/source/ui/view/preview.cxx332
-rw-r--r--sc/source/ui/view/printfun.cxx77
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx27
-rw-r--r--sc/source/ui/view/tabvwshb.cxx2
-rw-r--r--sc/source/ui/view/viewfun5.cxx23
-rw-r--r--scaddins/source/analysis/bessel.cxx69
-rwxr-xr-xscp2/source/ooo/windowscustomaction_ooo.scp14
-rwxr-xr-xsd/source/filter/xml/sdxmlwrp.cxx21
-rwxr-xr-xsd/source/ui/unoidl/unomodel.cxx7
-rwxr-xr-xsetup_native/source/packinfo/shellscripts_extensions.txt24
-rw-r--r--setup_native/source/win32/customactions/rebase/rebase.cxx85
-rw-r--r--setup_native/source/win32/customactions/shellextensions/registerextensions.cxx55
-rw-r--r--sfx2/source/config/evntconf.cxx2
-rw-r--r--sfx2/source/control/unoctitm.cxx2
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx2
-rw-r--r--solenv/bin/modules/installer/globals.pm4
-rw-r--r--solenv/bin/modules/installer/windows/file.pm12
-rw-r--r--solenv/bin/modules/installer/windows/idtglobal.pm3
-rw-r--r--solenv/bin/modules/installer/windows/msp.pm197
-rw-r--r--solenv/bin/modules/installer/windows/property.pm6
-rw-r--r--solenv/bin/modules/installer/windows/registry.pm76
-rw-r--r--solenv/inc/minor.mk6
-rw-r--r--svl/inc/svl/nfkeytab.hxx14
-rw-r--r--svl/source/numbers/zforlist.cxx14
-rw-r--r--svl/source/numbers/zformat.cxx20
-rw-r--r--svl/source/numbers/zforscan.cxx22
-rw-r--r--svl/source/numbers/zforscan.hxx2
-rw-r--r--svtools/source/uno/unoiface.cxx1
-rw-r--r--svx/source/fmcomp/gridctrl.cxx12
-rw-r--r--svx/source/form/fmobj.cxx4
-rw-r--r--svx/source/form/fmpage.cxx5
-rw-r--r--svx/source/form/fmpgeimp.cxx76
-rw-r--r--svx/source/form/fmshell.cxx6
-rw-r--r--svx/source/inc/fmpgeimp.hxx4
-rwxr-xr-xsvx/source/sdr/contact/viewobjectcontactofunocontrol.cxx3
-rw-r--r--svx/source/svdraw/svdouno.cxx71
-rwxr-xr-xsw/JunitTest_sw_complex.mk8
-rw-r--r--sw/source/core/crsr/bookmrk.cxx2
-rw-r--r--sw/source/core/crsr/findattr.cxx31
-rw-r--r--sw/source/core/doc/doccorr.cxx16
-rw-r--r--sw/source/core/doc/docedt.cxx13
-rw-r--r--sw/source/core/doc/docfmt.cxx70
-rw-r--r--sw/source/core/layout/fly.cxx5
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx16
-rw-r--r--sw/source/core/txtnode/thints.cxx5
-rw-r--r--sw/source/core/unocore/unoframe.cxx2
-rw-r--r--sw/source/core/unocore/unoportenum.cxx12
-rw-r--r--sw/source/core/unocore/unotext.cxx14
-rw-r--r--sw/source/filter/ww1/fltshell.cxx15
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.cxx8
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.hxx2
-rwxr-xr-xsw/source/filter/ww8/wrtw8nds.cxx72
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx37
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx10
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx29
-rw-r--r--sw/source/filter/xml/swxml.cxx17
-rw-r--r--sw/source/filter/xml/xmlbrshi.hxx8
-rw-r--r--sw/source/filter/xml/xmlimp.cxx18
-rw-r--r--sw/source/filter/xml/xmlimp.hxx21
-rw-r--r--sw/source/filter/xml/xmlimpit.cxx17
-rw-r--r--sw/source/filter/xml/xmlimpit.hxx17
-rw-r--r--sw/source/filter/xml/xmlitem.cxx5
-rw-r--r--sw/source/filter/xml/xmlitem.hxx2
-rw-r--r--sw/source/filter/xml/xmlitemi.cxx165
-rw-r--r--sw/source/filter/xml/xmlitemm.cxx11
-rw-r--r--sw/source/filter/xml/xmlmeta.cxx26
-rw-r--r--sw/source/ui/docvw/AnnotationWin.cxx44
-rw-r--r--sw/source/ui/index/idxmrk.src34
-rwxr-xr-xsw/source/ui/ribbar/inputwin.cxx1
-rw-r--r--testautomation/dbaccess/optional/dba_db_MySQLnative.bas54
-rw-r--r--testautomation/dbaccess/optional/includes/db_MySQLnative.inc206
-rw-r--r--testautomation/dbaccess/optional/includes/db_Query.inc1
-rw-r--r--testautomation/dbaccess/optional/includes/wiz_ReportWizard.inc41
-rw-r--r--testautomation/dbaccess/tools/dbcreatetools.inc98
-rw-r--r--testautomation/dbaccess/tools/dbtools.inc17
-rw-r--r--testautomation/dbaccess/tools/tabletools.inc4
-rwxr-xr-xtestautomation/global/win/edia_d_h.win1
-rw-r--r--toolkit/inc/toolkit/helper/formpdfexport.hxx14
-rw-r--r--toolkit/source/controls/unocontrol.cxx18
-rw-r--r--toolkit/source/helper/formpdfexport.cxx58
-rw-r--r--unoxml/qa/complex/unoxml/RDFRepositoryTest.java18
-rw-r--r--uui/source/iahndl-ssl.cxx67
-rw-r--r--vcl/inc/vcl/pdfextoutdevdata.hxx34
-rw-r--r--vcl/inc/vcl/pdfwriter.hxx23
-rw-r--r--vcl/source/app/svmain.cxx4
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx53
-rw-r--r--vcl/source/gdi/pdfwriter.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx7
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx4
-rw-r--r--vcl/source/window/winproc.cxx8
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java108
-rw-r--r--wizards/com/sun/star/wizards/agenda/TopicsControl.java12
-rw-r--r--wizards/com/sun/star/wizards/common/PropertyNames.java5
-rw-r--r--wizards/com/sun/star/wizards/common/UCB.java2
-rw-r--r--wizards/com/sun/star/wizards/db/ColumnPropertySet.java2
-rw-r--r--wizards/com/sun/star/wizards/db/CommandMetaData.java877
-rw-r--r--wizards/com/sun/star/wizards/db/CommandName.java4
-rw-r--r--wizards/com/sun/star/wizards/db/QueryMetaData.java31
-rw-r--r--wizards/com/sun/star/wizards/db/SQLQueryComposer.java145
-rw-r--r--wizards/com/sun/star/wizards/db/TableDescriptor.java2
-rw-r--r--wizards/com/sun/star/wizards/document/Control.java4
-rw-r--r--wizards/com/sun/star/wizards/document/DatabaseControl.java2
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialog.java116
-rw-r--r--wizards/com/sun/star/wizards/form/DataEntrySetter.java12
-rw-r--r--wizards/com/sun/star/wizards/form/FieldLinker.java12
-rw-r--r--wizards/com/sun/star/wizards/form/Finalizer.java10
-rw-r--r--wizards/com/sun/star/wizards/form/FormConfiguration.java12
-rw-r--r--wizards/com/sun/star/wizards/form/FormControlArranger.java389
-rw-r--r--wizards/com/sun/star/wizards/form/FormDocument.java24
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java56
-rw-r--r--wizards/com/sun/star/wizards/form/StyleApplier.java26
-rw-r--r--wizards/com/sun/star/wizards/form/UIControlArranger.java41
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterDocument.java4
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialog.java170
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java5
-rw-r--r--wizards/com/sun/star/wizards/query/Finalizer.java14
-rw-r--r--wizards/com/sun/star/wizards/query/QuerySummary.java63
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java77
-rw-r--r--wizards/com/sun/star/wizards/report/Dataimport.java14
-rw-r--r--wizards/com/sun/star/wizards/report/GroupFieldHandler.java2
-rw-r--r--wizards/com/sun/star/wizards/report/ReportFinalizer.java16
-rw-r--r--wizards/com/sun/star/wizards/report/ReportLayouter.java24
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java14
-rw-r--r--wizards/com/sun/star/wizards/table/FieldDescription.java2
-rw-r--r--wizards/com/sun/star/wizards/table/FieldFormatter.java20
-rw-r--r--wizards/com/sun/star/wizards/table/Finalizer.java22
-rw-r--r--wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java24
-rw-r--r--wizards/com/sun/star/wizards/table/ScenarioSelector.java12
-rw-r--r--wizards/com/sun/star/wizards/table/TableWizard.java4
-rw-r--r--wizards/com/sun/star/wizards/ui/AggregateComponent.java18
-rw-r--r--wizards/com/sun/star/wizards/ui/ButtonList.java6
-rw-r--r--wizards/com/sun/star/wizards/ui/CommandFieldSelection.java4
-rw-r--r--wizards/com/sun/star/wizards/ui/ControlScroller.java4
-rw-r--r--wizards/com/sun/star/wizards/ui/FieldSelection.java16
-rw-r--r--wizards/com/sun/star/wizards/ui/FilterComponent.java63
-rw-r--r--wizards/com/sun/star/wizards/ui/ImageList.java18
-rwxr-xr-xwizards/com/sun/star/wizards/ui/PathSelection.java6
-rw-r--r--wizards/com/sun/star/wizards/ui/SortingComponent.java10
-rw-r--r--wizards/com/sun/star/wizards/ui/TitlesComponent.java8
-rw-r--r--wizards/com/sun/star/wizards/ui/UIConsts.java16
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.java2
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.java4
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.java16
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.java2
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAwareFields.java2
-rw-r--r--wizards/com/sun/star/wizards/ui/event/RadioDataAware.java2
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.java4
-rw-r--r--wizards/com/sun/star/wizards/web/FTPDialog.java44
-rw-r--r--wizards/com/sun/star/wizards/web/ImageListDialog.java14
-rw-r--r--wizards/com/sun/star/wizards/web/StatusDialog.java14
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizardDialog.java194
-rw-r--r--wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java6
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx3
-rw-r--r--writerfilter/source/ooxml/dummyannotate.xsl2
-rw-r--r--writerfilter/source/ooxml/makefile.mk4
-rw-r--r--writerfilter/source/ooxml/model.xml54
-rw-r--r--writerfilter/source/ooxml/modelcleanup.xsl19
-rw-r--r--writerfilter/source/resourcemodel/makefile.mk2
-rw-r--r--xmloff/inc/xmloff/PageMasterStyleMap.hxx17
-rw-r--r--xmloff/inc/xmloff/txtprmap.hxx8
-rw-r--r--xmloff/inc/xmloff/xmlmetai.hxx10
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx2
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx21
-rw-r--r--xmloff/source/meta/xmlmetai.cxx113
-rw-r--r--xmloff/source/style/PageMasterExportPropMapper.cxx46
-rw-r--r--xmloff/source/style/PageMasterImportPropMapper.cxx79
-rw-r--r--xmloff/source/style/PageMasterStyleMap.cxx28
-rw-r--r--xmloff/source/text/txtexppr.cxx123
-rw-r--r--xmloff/source/text/txtimppr.cxx78
-rw-r--r--xmloff/source/text/txtprmap.cxx27
-rw-r--r--xmlsecurity/prj/build.lst3
-rw-r--r--xmlsecurity/qa/certext/SanCertExt.cxx281
-rw-r--r--xmlsecurity/qa/certext/User_35_Root_11.crt64
-rw-r--r--xmlsecurity/qa/certext/export.map34
-rw-r--r--xmlsecurity/qa/certext/makefile.mk71
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/makefile.mk3
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx182
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx84
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx3
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx9
-rw-r--r--xmlsecurity/source/xmlsec/nss/makefile.mk3
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx244
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx77
-rw-r--r--xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx28
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx29
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt1
-rw-r--r--xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem64
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/demoCA/serial2
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/openssl.cfg17
-rw-r--r--xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt64
530 files changed, 17668 insertions, 10728 deletions
diff --git a/connectivity/inc/connectivity/predicateinput.hxx b/connectivity/inc/connectivity/predicateinput.hxx
index 5041fd30c060..2f4dfbbd3146 100644
--- a/connectivity/inc/connectivity/predicateinput.hxx
+++ b/connectivity/inc/connectivity/predicateinput.hxx
@@ -104,6 +104,12 @@ namespace dbtools
::rtl::OUString* _pErrorMessage = NULL
) const;
+ ::rtl::OUString getPredicateValue(
+ const ::rtl::OUString& _sField
+ , const ::rtl::OUString& _rPredicateValue
+ , sal_Bool _bForStatementUse
+ , ::rtl::OUString* _pErrorMessage = NULL) const;
+
private:
::connectivity::OSQLParseNode* implPredicateTree(
::rtl::OUString& _rErrorMessage,
@@ -116,6 +122,8 @@ namespace dbtools
sal_Unicode& _rDecSep,
sal_Unicode& _rThdSep
) const;
+
+ ::rtl::OUString implParseNode(::connectivity::OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const;
};
//.........................................................................
diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx
index 04ec8dc153df..2fe688574a0a 100644
--- a/connectivity/inc/connectivity/sqlnode.hxx
+++ b/connectivity/inc/connectivity/sqlnode.hxx
@@ -65,6 +65,8 @@ namespace rtl
{
class OUStringBuffer;
}
+#define ORDER_BY_CHILD_POS 5
+#define TABLE_EXPRESSION_CHILD_COUNT 9
namespace connectivity
{
diff --git a/connectivity/qa/connectivity/tools/CRMDatabase.java b/connectivity/qa/connectivity/tools/CRMDatabase.java
index a1b457884948..f9b6d52a8038 100644
--- a/connectivity/qa/connectivity/tools/CRMDatabase.java
+++ b/connectivity/qa/connectivity/tools/CRMDatabase.java
@@ -224,6 +224,7 @@ public class CRMDatabase
// --------------------------------------------------------------------------------------------------------
private void validateUnparseable()
{
+ /*
// The "unparseable" query should be indeed be unparseable by OOo (though a valid HSQL query)
XSingleSelectQueryComposer composer;
QueryDefinition unparseableQuery;
@@ -253,6 +254,7 @@ public class CRMDatabase
if ( !caughtExpected )
throw new RuntimeException( "Somebody improved the parser! This is bad :), since we need an unparsable query here!" );
+ */
}
// --------------------------------------------------------------------------------------------------------
@@ -284,9 +286,10 @@ public class CRMDatabase
m_database.getDataSource().createQuery( "parseable", "SELECT * FROM \"customers\"" );
m_database.getDataSource().createQuery( "parseable native", "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VIEWS", false );
+/*
m_database.getDataSource().createQuery( "unparseable",
"SELECT {fn DAYOFMONTH ('2001-01-01')} AS \"ID_VARCHAR\" FROM \"products\"", false );
-
+*/
validateUnparseable();
}
}
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 95aabb821b1a..6f65547736d9 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -787,12 +787,30 @@ sal_Bool operator==(const DateTime& _rLH,const DateTime& _rRH)
bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
{
- if(m_eTypeKind != _rRH.m_eTypeKind)
- return false;
- if ( m_bSigned != _rRH.m_bSigned )
- return false;
- if(m_bNull != _rRH.isNull())
+ if ( m_eTypeKind != _rRH.m_eTypeKind )
+ {
+ switch(m_eTypeKind)
+ {
+ case DataType::FLOAT:
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ return getDouble() == _rRH.getDouble();
+ default:
+ switch(_rRH.m_eTypeKind)
+ {
+ case DataType::FLOAT:
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ return getDouble() == _rRH.getDouble();
+ default:
+ break;
+ }
+ break;
+ }
return false;
+ }
+ if ( m_bNull != _rRH.isNull() )
+ return false;
if(m_bNull && _rRH.isNull())
return true;
@@ -802,16 +820,28 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const
{
case DataType::VARCHAR:
case DataType::CHAR:
- case DataType::DECIMAL:
- case DataType::NUMERIC:
case DataType::LONGVARCHAR:
{
::rtl::OUString aVal1(m_aValue.m_pString);
::rtl::OUString aVal2(_rRH.m_aValue.m_pString);
- bRet = aVal1 == aVal2;
- break;
+ return aVal1 == aVal2;
}
+ default:
+ if ( m_bSigned != _rRH.m_bSigned )
+ return false;
+ break;
+ }
+ switch(m_eTypeKind)
+ {
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ {
+ ::rtl::OUString aVal1(m_aValue.m_pString);
+ ::rtl::OUString aVal2(_rRH.m_aValue.m_pString);
+ bRet = aVal1 == aVal2;
+ }
+ break;
case DataType::FLOAT:
bRet = *(float*)m_aValue.m_pValue == *(float*)_rRH.m_aValue.m_pValue;
break;
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index 8ffebb0cfbda..dbac44b72424 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -31,8 +31,10 @@
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <osl/diagnose.h>
#include <connectivity/sqlnode.hxx>
+#include <connectivity/PColumn.hxx>
#include <comphelper/numbers.hxx>
//.........................................................................
@@ -325,63 +327,117 @@ namespace dbtools
::rtl::OUString sError;
OSQLParseNode* pParseNode = implPredicateTree( sError, sValue, _rxField );
- if ( _pErrorMessage ) *_pErrorMessage = sError;
+ if ( _pErrorMessage )
+ *_pErrorMessage = sError;
- if ( pParseNode )
+ sReturn = implParseNode(pParseNode,_bForStatementUse);
+ }
+
+ return sReturn;
+ }
+
+ ::rtl::OUString OPredicateInputController::getPredicateValue(
+ const ::rtl::OUString& _sField, const ::rtl::OUString& _rPredicateValue, sal_Bool _bForStatementUse, ::rtl::OUString* _pErrorMessage ) const
+ {
+ ::rtl::OUString sReturn = _rPredicateValue;
+ ::rtl::OUString sError;
+ ::rtl::OUString sField = _sField;
+ sal_Int32 nIndex = 0;
+ sField = sField.getToken(0,'(',nIndex);
+ if(nIndex == -1)
+ sField = _sField;
+ sal_Int32 nType = ::connectivity::OSQLParser::getFunctionReturnType(sField,&m_aParser.getContext());
+ if ( nType == DataType::OTHER || !sField.getLength() )
+ {
+ // first try the international version
+ ::rtl::OUString sSql;
+ sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT * "));
+ sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM x WHERE "));
+ sSql += sField;
+ sSql += _rPredicateValue;
+ ::std::auto_ptr<OSQLParseNode> pParseNode( const_cast< OSQLParser& >( m_aParser ).parseTree( sError, sSql, sal_True ) );
+ nType = DataType::DOUBLE;
+ if ( pParseNode.get() )
{
- OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec );
- if ( pOdbcSpec )
+ OSQLParseNode* pColumnRef = pParseNode->getByRule(OSQLParseNode::column_ref);
+ if ( pColumnRef )
{
- if ( !_bForStatementUse )
- {
- if ( ( pOdbcSpec->count() >= 2 )
- && ( SQL_NODE_STRING == pOdbcSpec->getChild(1)->getNodeType() )
- )
- {
+ }
+ }
+ }
- sReturn = pOdbcSpec->getChild(1)->getTokenValue();
- }
- else
- OSL_ENSURE( sal_False, "OPredicateInputController::getPredicateValue: unknown/invalid structure (odbc + param use)!" );
- }
- else
- {
- OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent();
- OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" );
- if ( pFuncSpecParent )
- pFuncSpecParent->parseNodeToStr(
- sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
- );
- }
+ Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+ parse::OParseColumn* pColumn = new parse::OParseColumn( sField,
+ ::rtl::OUString(),
+ ::rtl::OUString(),
+ ::rtl::OUString(),
+ ColumnValue::NULLABLE_UNKNOWN,
+ 0,
+ 0,
+ nType,
+ sal_False,
+ sal_False,
+ xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
+ Reference<XPropertySet> xColumn = pColumn;
+ pColumn->setFunction(sal_True);
+ pColumn->setRealName(sField);
+
+ OSQLParseNode* pParseNode = implPredicateTree( sError, _rPredicateValue, xColumn );
+ if ( _pErrorMessage )
+ *_pErrorMessage = sError;
+ return pParseNode ? implParseNode(pParseNode,_bForStatementUse) : sReturn;
+ }
+
+ ::rtl::OUString OPredicateInputController::implParseNode(OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const
+ {
+ ::rtl::OUString sReturn;
+ if ( pParseNode )
+ {
+ ::std::auto_ptr<OSQLParseNode> pTemp(pParseNode);
+ OSQLParseNode* pOdbcSpec = pParseNode->getByRule( OSQLParseNode::odbc_fct_spec );
+ if ( pOdbcSpec )
+ {
+ if ( _bForStatementUse )
+ {
+ OSQLParseNode* pFuncSpecParent = pOdbcSpec->getParent();
+ OSL_ENSURE( pFuncSpecParent, "OPredicateInputController::getPredicateValue: an ODBC func spec node without parent?" );
+ if ( pFuncSpecParent )
+ pFuncSpecParent->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True);
}
else
{
- if ( pParseNode->count() >= 3 )
+ OSQLParseNode* pValueNode = pOdbcSpec->getChild(1);
+ if ( SQL_NODE_STRING == pValueNode->getNodeType() )
+ sReturn = pValueNode->getTokenValue();
+ else
+ pValueNode->parseNodeToStr(sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True);
+ // sReturn = pOdbcSpec->getChild(1)->getTokenValue();
+ }
+ }
+ else
+ {
+ if ( pParseNode->count() >= 3 )
+ {
+ OSQLParseNode* pValueNode = pParseNode->getChild(2);
+ OSL_ENSURE( pValueNode, "OPredicateInputController::getPredicateValue: invalid node child!" );
+ if ( !_bForStatementUse )
{
- OSQLParseNode* pValueNode = pParseNode->getChild(2);
- OSL_ENSURE( pValueNode, "OPredicateInputController::getPredicateValue: invalid node child!" );
- if ( !_bForStatementUse )
- {
- if ( SQL_NODE_STRING == pValueNode->getNodeType() )
- sReturn = pValueNode->getTokenValue();
- else
- pValueNode->parseNodeToStr(
- sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
- );
- }
+ if ( SQL_NODE_STRING == pValueNode->getNodeType() )
+ sReturn = pValueNode->getTokenValue();
else
pValueNode->parseNodeToStr(
sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
);
}
else
- OSL_ENSURE( sal_False, "OPredicateInputController::getPredicateValue: unknown/invalid structure (noodbc)!" );
+ pValueNode->parseNodeToStr(
+ sReturn, m_xConnection, &m_aParser.getContext(), sal_False, sal_True
+ );
}
-
- delete pParseNode;
+ else
+ OSL_ENSURE( sal_False, "OPredicateInputController::getPredicateValue: unknown/invalid structure (noodbc)!" );
}
}
-
return sReturn;
}
//.........................................................................
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index aa287c185b26..510c2790e777 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -165,7 +165,8 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
{
sal_Int32 nVal=0;
rValue >>= nVal;
- m_aColumn.put_NumericScale((sal_Int8)nVal);
+ if ( !m_IsCurrency )
+ m_aColumn.put_NumericScale((sal_Int8)nVal);
}
break;
case PROPERTY_ID_ISNULLABLE:
@@ -212,6 +213,8 @@ void OAdoColumn::fillPropertyValues()
DataTypeEnum eType = m_aColumn.get_Type();
m_IsCurrency = (eType == adCurrency);
+ if ( m_IsCurrency && !m_Scale)
+ m_Scale = 4;
m_Type = ADOS::MapADOType2Jdbc(eType);
sal_Bool bForceTo = sal_True;
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index a7e2ec4df490..6596b9b8d946 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -466,6 +466,11 @@ void OConnection::buildTypeInfo() throw( SQLException)
aInfo->aSimpleType.aLocalTypeName = ADOS::getField(pRecordset,nPos++).get_Value();
aInfo->aSimpleType.nMinimumScale = ADOS::getField(pRecordset,nPos++).get_Value();
aInfo->aSimpleType.nMaximumScale = ADOS::getField(pRecordset,nPos++).get_Value();
+ if ( adCurrency == aInfo->eType && !aInfo->aSimpleType.nMaximumScale)
+ {
+ aInfo->aSimpleType.nMinimumScale = 4;
+ aInfo->aSimpleType.nMaximumScale = 4;
+ }
aInfo->aSimpleType.nNumPrecRadix = ADOS::getField(pRecordset,nPos++).get_Value();
// Now that we have the type info, save it
// in the Hashtable if we don't already have an
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index 4ea918ef3e27..9a303d1f1d27 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -99,7 +99,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
OSQLParseNode * pTableExp = pSQLParseNode->getChild(3);
DBG_ASSERT(pTableExp != NULL,"Fehler im Parse Tree");
DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp)," Fehler im Parse Tree");
- DBG_ASSERT(pTableExp->count() == 5,"Fehler im Parse Tree");
+ DBG_ASSERT(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"Fehler im Parse Tree");
// check that we don't use anything other than count(*) as function
OSQLParseNode* pSelection = pSQLParseNode->getChild(2);
@@ -117,7 +117,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode)
pWhereClause = pTableExp->getChild(1);
- pOrderbyClause = pTableExp->getChild(4);
+ pOrderbyClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
}
else if (SQL_ISRULE(pSQLParseNode,update_statement_searched))
{
diff --git a/connectivity/source/drivers/macab/MacabRecord.cxx b/connectivity/source/drivers/macab/MacabRecord.cxx
index 35817526ff17..e161ece74522 100755
--- a/connectivity/source/drivers/macab/MacabRecord.cxx
+++ b/connectivity/source/drivers/macab/MacabRecord.cxx
@@ -202,7 +202,7 @@ sal_Int32 MacabRecord::compareFields(const macabfield *_field1, const macabfield
result = CFStringCompare(
(CFStringRef) _field1->value,
(CFStringRef) _field2->value,
- 0); // 0 = no options (like ignore case)
+ kCFCompareLocalized); // Specifies that the comparison should take into account differences related to locale, such as the thousands separator character.
break;
case kABDateProperty:
diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx
index 10f4b5b4bdcf..8f3014908b10 100644
--- a/connectivity/source/parse/PColumn.cxx
+++ b/connectivity/source/parse/PColumn.cxx
@@ -155,13 +155,15 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe
_rxResMetaData->isCurrency( _nColumnPos ),
_rxDBMetaData->supportsMixedCaseQuotedIdentifiers()
);
- pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData,
- _rxResMetaData->getCatalogName( _nColumnPos ),
- _rxResMetaData->getSchemaName( _nColumnPos ),
- _rxResMetaData->getTableName( _nColumnPos ),
- sal_False,
- eComplete
- ) );
+ const ::rtl::OUString sTableName = _rxResMetaData->getTableName( _nColumnPos );
+ if ( sTableName.getLength() )
+ pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData,
+ _rxResMetaData->getCatalogName( _nColumnPos ),
+ _rxResMetaData->getSchemaName( _nColumnPos ),
+ sTableName,
+ sal_False,
+ eComplete
+ ) );
pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) );
pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos ));
pColumn->setLabel(sLabel);
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index 9709d33fdf76..ad271e855e20 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -217,6 +217,14 @@ using namespace connectivity;
%token <pParseNode> SQL_TOKEN_VALUE SQL_TOKEN_CURRENT_CATALOG SQL_TOKEN_CURRENT_DEFAULT_TRANSFORM_GROUP SQL_TOKEN_CURRENT_PATH SQL_TOKEN_CURRENT_ROLE SQL_TOKEN_CURRENT_SCHEMA SQL_TOKEN_CURRENT_USER
%token <pParseNode> SQL_TOKEN_SESSION_USER SQL_TOKEN_SYSTEM_USER SQL_TOKEN_VARCHAR SQL_TOKEN_VARBINARY SQL_TOKEN_VARYING SQL_TOKEN_OBJECT SQL_TOKEN_NCLOB SQL_TOKEN_NATIONAL
%token <pParseNode> SQL_TOKEN_LARGE SQL_TOKEN_CLOB SQL_TOKEN_BLOB SQL_TOKEN_BIGINT SQL_TOKEN_BINARY SQL_TOKEN_WITHOUT SQL_TOKEN_BOOLEAN SQL_TOKEN_INTERVAL
+// window function
+%token <pParseNode> SQL_TOKEN_OVER SQL_TOKEN_ROW_NUMBER SQL_TOKEN_NTILE SQL_TOKEN_LEAD SQL_TOKEN_LAG SQL_TOKEN_RESPECT SQL_TOKEN_IGNORE SQL_TOKEN_NULLS
+%token <pParseNode> SQL_TOKEN_FIRST_VALUE SQL_TOKEN_LAST_VALUE SQL_TOKEN_NTH_VALUE SQL_TOKEN_FIRST SQL_TOKEN_LAST
+%token <pParseNode> SQL_TOKEN_EXCLUDE SQL_TOKEN_OTHERS SQL_TOKEN_TIES SQL_TOKEN_FOLLOWING SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING SQL_TOKEN_RANGE SQL_TOKEN_ROWS
+%token <pParseNode> SQL_TOKEN_PARTITION SQL_TOKEN_WINDOW SQL_TOKEN_NO
+// LIMIT and OFFSEt
+%token <pParseNode> SQL_TOKEN_LIMIT SQL_TOKEN_OFFSET SQL_TOKEN_NEXT SQL_TOKEN_ONLY
+
/* operators */
%left SQL_TOKEN_NAME
%left <pParseNode> SQL_TOKEN_OR
@@ -271,7 +279,7 @@ using namespace connectivity;
%type <pParseNode> form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist
%type <pParseNode> /*bit_concatenation*/ bit_value_exp bit_factor bit_primary collate_clause char_value_fct unique_spec value_exp_commalist in_predicate_value unique_test update_source
%type <pParseNode> function_arg_commalist3 string_function_3Argument function_arg_commalist4 string_function_4Argument function_arg_commalist2 string_function_1Argument string_function_2Argument
-%type <pParseNode> date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument date_function_3Argument
+%type <pParseNode> date_function_0Argument date_function_1Argument function_name12 function_name23 function_name1 function_name2 function_name3 function_name0 numeric_function_0Argument numeric_function_1Argument numeric_function_2Argument
%type <pParseNode> all query_primary sql_not for_length upper_lower comparison column_val cross_union /*opt_schema_element_list*/
%type <pParseNode> /*op_authorization op_schema*/ nil_fkt schema_element base_table_def base_table_element base_table_element_commalist
%type <pParseNode> column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement
@@ -286,6 +294,16 @@ using namespace connectivity;
%type <pParseNode> binary_string_type numeric_type boolean_type datetime_type interval_type opt_paren_precision paren_char_length opt_paren_char_large_length paren_character_large_object_length
%type <pParseNode> large_object_length opt_multiplier character_large_object_type national_character_large_object_type binary_large_object_string_type opt_with_or_without_time_zone
%type <pParseNode> approximate_numeric_type exact_numeric_type opt_paren_precision_scale
+/* window function rules */
+%type <pParseNode> window_function window_function_type ntile_function number_of_tiles lead_or_lag_function lead_or_lag lead_or_lag_extent offset default_expression null_treatment
+%type <pParseNode> first_or_last_value_function first_or_last_value nth_value_function nth_row from_first_or_last window_name_or_specification in_line_window_specification opt_lead_or_lag_function
+%type <pParseNode> opt_null_treatment opt_from_first_or_last simple_value_specification dynamic_parameter_specification window_name window_clause window_definition_list window_definition
+%type <pParseNode> new_window_name window_specification_details existing_window_name window_partition_clause window_partition_column_reference_list window_partition_column_reference window_frame_clause
+%type <pParseNode> window_frame_units window_frame_extent window_frame_start window_frame_preceding window_frame_between window_frame_bound_1 window_frame_bound_2 window_frame_bound window_frame_following window_frame_exclusion
+%type <pParseNode> opt_window_frame_clause opt_window_partition_clause opt_existing_window_name window_specification opt_window_frame_exclusion opt_window_clause opt_offset
+%type <pParseNode> opt_fetch_first_row_count fetch_first_clause offset_row_count fetch_first_row_count first_or_next row_or_rows opt_result_offset_clause result_offset_clause
+/* LIMIT and OFFSET */
+%type <pParseNode> opt_limit_offset_clause limit_offset_clause opt_fetch_first_clause
%%
/* Parse Tree an OSQLParser zurueckliefern
@@ -920,19 +938,89 @@ selection:
}
| scalar_exp_commalist
;
+opt_result_offset_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | result_offset_clause
+ ;
+result_offset_clause:
+ SQL_TOKEN_OFFSET offset_row_count row_or_rows
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+opt_fetch_first_row_count:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | fetch_first_row_count
+ ;
+first_or_next:
+ SQL_TOKEN_FIRST
+ | SQL_TOKEN_NEXT
+ ;
+row_or_rows:
+ SQL_TOKEN_ROW
+ | SQL_TOKEN_ROWS
+ ;
+opt_fetch_first_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | fetch_first_clause
+ ;
+fetch_first_clause:
+ SQL_TOKEN_FETCH first_or_next opt_fetch_first_row_count row_or_rows SQL_TOKEN_ONLY
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ $$->append($4);
+ $$->append($5);
+ }
+ ;
+offset_row_count:
+ literal
+ ;
+fetch_first_row_count:
+ literal
+ ;
+opt_limit_offset_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | limit_offset_clause
+ ;
+opt_offset:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | SQL_TOKEN_OFFSET SQL_TOKEN_INTNUM
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+limit_offset_clause:
+ SQL_TOKEN_LIMIT SQL_TOKEN_INTNUM opt_offset
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
table_exp:
- from_clause
- opt_where_clause
- opt_group_by_clause
- opt_having_clause
- opt_order_by_clause
- {$$ = SQL_NEW_RULE;
+ from_clause opt_where_clause opt_group_by_clause opt_having_clause opt_window_clause opt_order_by_clause opt_limit_offset_clause opt_result_offset_clause opt_fetch_first_clause
+ {
+ $$ = SQL_NEW_RULE;
$$->append($1);
$$->append($2);
$$->append($3);
$$->append($4);
- $$->append($5);}
+ $$->append($5);
+ $$->append($6);
+ $$->append($7);
+ $$->append($8);
+ $$->append($9);
+ }
;
from_clause:
@@ -1851,10 +1939,10 @@ function_name12:
;
function_name23:
SQL_TOKEN_LOCATE
+ | SQL_TOKEN_DATEDIFF
;
function_name3:
string_function_3Argument
- | date_function_3Argument
;
function_name:
string_function
@@ -1912,8 +2000,6 @@ date_function_1Argument:
| SQL_TOKEN_TIMEVALUE
| SQL_TOKEN_DATEVALUE
;
-date_function_3Argument:
- SQL_TOKEN_DATEDIFF
date_function:
SQL_TOKEN_TIMESTAMPADD
@@ -1951,6 +2037,362 @@ numeric_function:
SQL_TOKEN_RAND
| SQL_TOKEN_TRUNCATE
;
+
+window_function:
+ window_function_type SQL_TOKEN_OVER window_name_or_specification
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+window_function_type :
+ rank_function_type '(' ')'
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
+ }
+ | SQL_TOKEN_ROW_NUMBER '(' ')'
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
+ }
+ | general_set_fct
+ | ntile_function
+ | lead_or_lag_function
+ | first_or_last_value_function
+ | nth_value_function
+;
+ntile_function :
+ SQL_TOKEN_NTILE '(' number_of_tiles ')'
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));
+ }
+ ;
+dynamic_parameter_specification:
+ parameter
+ ;
+simple_value_specification:
+ literal
+ ;
+number_of_tiles :
+ simple_value_specification
+ | dynamic_parameter_specification
+ ;
+opt_lead_or_lag_function:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | ',' offset
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION));
+ $$->append($2);
+ }
+ | ',' offset ',' default_expression
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1 = newNode(",", SQL_NODE_PUNCTUATION));
+ $$->append($2);
+ $$->append($3 = newNode(",", SQL_NODE_PUNCTUATION));
+ $$->append($4);
+ }
+ ;
+opt_null_treatment:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | null_treatment
+ ;
+
+lead_or_lag_function:
+ lead_or_lag '(' lead_or_lag_extent opt_lead_or_lag_function ')' opt_null_treatment
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4);
+ $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION));
+ $$->append($6);
+ }
+ ;
+lead_or_lag:
+ SQL_TOKEN_LEAD
+ | SQL_TOKEN_LAG
+ ;
+lead_or_lag_extent:
+ value_exp
+ ;
+offset:
+ SQL_TOKEN_INTNUM
+ ;
+default_expression:
+ value_exp
+ ;
+null_treatment:
+ SQL_TOKEN_RESPECT SQL_TOKEN_NULLS
+ | SQL_TOKEN_IGNORE SQL_TOKEN_NULLS
+ ;
+first_or_last_value_function:
+ first_or_last_value '(' value_exp ')' opt_null_treatment
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));
+ $$->append($5);
+ }
+ ;
+first_or_last_value :
+ SQL_TOKEN_FIRST_VALUE
+ | SQL_TOKEN_LAST_VALUE
+ ;
+opt_from_first_or_last:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | from_first_or_last
+ ;
+nth_value_function:
+ SQL_TOKEN_NTH_VALUE '(' value_exp ',' nth_row ')' opt_from_first_or_last opt_null_treatment
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($3);
+ $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION));
+ $$->append($5);
+ $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));
+ $$->append($7);
+ $$->append($8);
+ }
+ ;
+nth_row:
+ simple_value_specification
+ | dynamic_parameter_specification
+ ;
+from_first_or_last:
+ SQL_TOKEN_FROM SQL_TOKEN_FIRST
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | SQL_TOKEN_FROM SQL_TOKEN_LAST
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_name:
+ SQL_TOKEN_NAME
+ ;
+window_name_or_specification:
+ window_name
+ | in_line_window_specification
+ ;
+in_line_window_specification:
+ window_specification
+ ;
+opt_window_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | window_clause
+ ;
+window_clause:
+ SQL_TOKEN_WINDOW window_definition_list
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_definition_list:
+ window_definition_list ',' window_definition
+ {$1->append($3);
+ $$ = $1;}
+ | window_definition
+ {$$ = SQL_NEW_COMMALISTRULE;
+ $$->append($1);}
+ ;
+window_definition:
+ new_window_name SQL_TOKEN_AS window_specification
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+new_window_name:
+ window_name
+ ;
+window_specification:
+ '(' window_specification_details ')'
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION));
+ $$->append($2);
+ $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));
+ }
+ ;
+opt_existing_window_name:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | existing_window_name
+ ;
+opt_window_partition_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | window_partition_clause
+ ;
+opt_window_frame_clause:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | window_frame_clause
+ ;
+window_specification_details:
+ opt_existing_window_name
+ opt_window_partition_clause
+ opt_order_by_clause
+ opt_window_frame_clause
+ ;
+existing_window_name:
+ window_name
+ ;
+window_partition_clause:
+ SQL_TOKEN_PARTITION SQL_TOKEN_BY window_partition_column_reference_list
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+window_partition_column_reference_list:
+ window_partition_column_reference_list ',' window_partition_column_reference
+ {$1->append($3);
+ $$ = $1;}
+ | window_partition_column_reference
+ {$$ = SQL_NEW_COMMALISTRULE;
+ $$->append($1);}
+ ;
+window_partition_column_reference:
+ column_ref opt_collate_clause
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+opt_window_frame_exclusion:
+ /* empty */ {$$ = SQL_NEW_RULE;}
+ | window_frame_exclusion
+ ;
+window_frame_clause:
+ window_frame_units window_frame_extent opt_window_frame_exclusion
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
+window_frame_units:
+ SQL_TOKEN_ROWS
+ | SQL_TOKEN_RANGE
+ ;
+window_frame_extent:
+ window_frame_start
+ | window_frame_between
+ ;
+window_frame_start:
+ SQL_TOKEN_UNBOUNDED SQL_TOKEN_PRECEDING
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | window_frame_preceding
+ | SQL_TOKEN_CURRENT SQL_TOKEN_ROW
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_frame_preceding:
+ unsigned_value_spec SQL_TOKEN_PRECEDING
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_frame_between:
+ SQL_TOKEN_BETWEEN window_frame_bound_1 SQL_TOKEN_AND window_frame_bound_2
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ $$->append($4);
+ }
+ ;
+window_frame_bound_1:
+ window_frame_bound
+ ;
+window_frame_bound_2:
+ window_frame_bound
+ ;
+window_frame_bound:
+ window_frame_start
+ | SQL_TOKEN_UNBOUNDED SQL_TOKEN_FOLLOWING
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | window_frame_following
+ ;
+window_frame_following:
+ unsigned_value_spec SQL_TOKEN_FOLLOWING
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ ;
+window_frame_exclusion:
+ SQL_TOKEN_EXCLUDE SQL_TOKEN_CURRENT SQL_TOKEN_ROW
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ | SQL_TOKEN_EXCLUDE SQL_TOKEN_GROUP
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | SQL_TOKEN_EXCLUDE SQL_TOKEN_TIES
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
+ | SQL_TOKEN_EXCLUDE SQL_TOKEN_NO SQL_TOKEN_OTHERS
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ $$->append($3);
+ }
+ ;
op_parameter:
{$$ = SQL_NEW_RULE;}
| '?' SQL_EQUAL
@@ -2005,11 +2447,16 @@ odbc_fct_spec:
$$->append($1);
$$->append($2);
}
+ | SQL_TOKEN_FN set_fct_spec
+ {
+ $$ = SQL_NEW_RULE;
+ $$->append($1);
+ $$->append($2);
+ }
;
odbc_fct_type:
- SQL_TOKEN_FN
- | SQL_TOKEN_D
+ SQL_TOKEN_D
| SQL_TOKEN_T
| SQL_TOKEN_TS
;
@@ -2315,6 +2762,7 @@ value_exp_primary:
| set_fct_spec
| scalar_subquery
| case_expression
+ | window_function
| '(' value_exp ')'
{
$$ = SQL_NEW_RULE;
diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l
index c6723dfd6869..35a9278a8e49 100644
--- a/connectivity/source/parse/sqlflex.l
+++ b/connectivity/source/parse/sqlflex.l
@@ -212,15 +212,19 @@ END {SQL_NEW_KEYWORD(SQL_TOKEN_END); }
EVERY {SQL_NEW_KEYWORD(SQL_TOKEN_EVERY); }
ESCAPE {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); }
EXCEPT {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); }
+EXCLUDE {SQL_NEW_KEYWORD(SQL_TOKEN_EXCLUDE); }
EXISTS {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); }
EXP {SQL_NEW_KEYWORD(SQL_TOKEN_EXP); }
EXTRACT {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); }
FALSE {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); }
FETCH {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); }
+FIRST {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST); }
+FIRST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_FIRST_VALUE); }
FLOAT {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); }
FLOOR {SQL_NEW_KEYWORD(SQL_TOKEN_FLOOR); }
FN {SQL_NEW_KEYWORD(SQL_TOKEN_FN); }
+FOLLOWING {SQL_NEW_KEYWORD(SQL_TOKEN_FOLLOWING); }
FOR {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); }
FOREIGN {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); }
FOUND {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); }
@@ -234,6 +238,7 @@ GROUP {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); }
HAVING {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); }
HOUR {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); }
+IGNORE {SQL_NEW_KEYWORD(SQL_TOKEN_IGNORE); }
IN {SQL_NEW_KEYWORD(SQL_TOKEN_IN); }
INNER {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); }
INSERT {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); }
@@ -249,12 +254,17 @@ JOIN {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); }
KEY {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); }
+LAG {SQL_NEW_KEYWORD(SQL_TOKEN_LAG); }
LARGE {SQL_NEW_KEYWORD(SQL_TOKEN_LARGE); }
+LAST {SQL_NEW_KEYWORD(SQL_TOKEN_LAST); }
+LAST_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_LAST_VALUE); }
LCASE {SQL_NEW_KEYWORD(SQL_TOKEN_LCASE); }
+LEAD {SQL_NEW_KEYWORD(SQL_TOKEN_LEAD); }
LEADING {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); }
LEFT {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); }
LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_LENGTH); }
LIKE {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); }
+LIMIT {SQL_NEW_KEYWORD(SQL_TOKEN_LIMIT); }
LN {SQL_NEW_KEYWORD(SQL_TOKEN_LN); }
LOCAL {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); }
LOCATE {SQL_NEW_KEYWORD(SQL_TOKEN_LOCATE); }
@@ -276,29 +286,40 @@ NATURAL {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); }
NCHAR {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); }
NCLOB {SQL_NEW_KEYWORD(SQL_TOKEN_NCLOB); }
NEW {SQL_NEW_KEYWORD(SQL_TOKEN_NEW); }
+NEXT {SQL_NEW_KEYWORD(SQL_TOKEN_NEXT); }
+NO {SQL_NEW_KEYWORD(SQL_TOKEN_NO); }
NOT {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); }
NOW {SQL_NEW_KEYWORD(SQL_TOKEN_NOW); }
+NTH_VALUE {SQL_NEW_KEYWORD(SQL_TOKEN_NTH_VALUE); }
+NTILE {SQL_NEW_KEYWORD(SQL_TOKEN_NTILE); }
NULL {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); }
NULLIF {SQL_NEW_KEYWORD(SQL_TOKEN_NULLIF); }
+NULLS {SQL_NEW_KEYWORD(SQL_TOKEN_NULLS); }
NUMERIC {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); }
OBJECT {SQL_NEW_KEYWORD(SQL_TOKEN_OBJECT); }
OCTET_LENGTH {SQL_NEW_KEYWORD(SQL_TOKEN_OCTET_LENGTH); }
OF {SQL_NEW_KEYWORD(SQL_TOKEN_OF); }
+OFFSET {SQL_NEW_KEYWORD(SQL_TOKEN_OFFSET); }
OJ {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); }
OLD {SQL_NEW_KEYWORD(SQL_TOKEN_OLD); }
ON {SQL_NEW_KEYWORD(SQL_TOKEN_ON); }
+ONLY {SQL_NEW_KEYWORD(SQL_TOKEN_ONLY); }
OPTION {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); }
OR {SQL_NEW_KEYWORD(SQL_TOKEN_OR); }
ORDER {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); }
+OTHERS {SQL_NEW_KEYWORD(SQL_TOKEN_OTHERS); }
OUTER {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); }
+OVER {SQL_NEW_KEYWORD(SQL_TOKEN_OVER); }
+PARTITION {SQL_NEW_KEYWORD(SQL_TOKEN_PARTITION); }
PERCENT_RANK {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENT_RANK); }
PERCENTILE_CONT {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_CONT); }
PERCENTILE_DISC {SQL_NEW_KEYWORD(SQL_TOKEN_PERCENTILE_DISC); }
PI {SQL_NEW_KEYWORD(SQL_TOKEN_PI); }
POSITION {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); }
POWER {SQL_NEW_KEYWORD(SQL_TOKEN_POWER); }
+PRECEDING {SQL_NEW_KEYWORD(SQL_TOKEN_PRECEDING); }
PRECISION {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); }
PRIMARY {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); }
PRIVILEGES {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); }
@@ -309,16 +330,20 @@ QUARTER {SQL_NEW_KEYWORD(SQL_TOKEN_QUARTER); }
RADIANS {SQL_NEW_KEYWORD(SQL_TOKEN_RADIANS); }
RAND {SQL_NEW_KEYWORD(SQL_TOKEN_RAND); }
+RANGE {SQL_NEW_KEYWORD(SQL_TOKEN_RANGE); }
RANK {SQL_NEW_KEYWORD(SQL_TOKEN_RANK); }
REAL {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); }
REFERENCES {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); }
REFERENCING {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCING); }
REPEAT {SQL_NEW_KEYWORD(SQL_TOKEN_REPEAT); }
REPLACE {SQL_NEW_KEYWORD(SQL_TOKEN_REPLACE); }
+RESPECT {SQL_NEW_KEYWORD(SQL_TOKEN_RESPECT); }
ROLLBACK {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); }
ROUND {SQL_NEW_KEYWORD(SQL_TOKEN_ROUND); }
ROUNDMAGIC {SQL_NEW_KEYWORD(SQL_TOKEN_ROUNDMAGIC); }
ROW {SQL_NEW_KEYWORD(SQL_TOKEN_ROW); }
+ROWS {SQL_NEW_KEYWORD(SQL_TOKEN_ROWS); }
+ROW_NUMBER {SQL_NEW_KEYWORD(SQL_TOKEN_ROW_NUMBER); }
RIGHT {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); }
RTRIM {SQL_NEW_KEYWORD(SQL_TOKEN_RTRIM); }
@@ -345,6 +370,7 @@ SYSTEM_USER {SQL_NEW_KEYWORD(SQL_TOKEN_SYSTEM_USER); }
TABLE {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); }
TAN {SQL_NEW_KEYWORD(SQL_TOKEN_TAN); }
THEN {SQL_NEW_KEYWORD(SQL_TOKEN_THEN); }
+TIES {SQL_NEW_KEYWORD(SQL_TOKEN_TIES); }
TIME {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); }
TIMESTAMP {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); }
TIMESTAMPADD {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMPADD); }
@@ -363,6 +389,7 @@ TS {SQL_NEW_KEYWORD(SQL_TOKEN_TS); }
T {SQL_NEW_KEYWORD(SQL_TOKEN_T); }
UCASE {SQL_NEW_KEYWORD(SQL_TOKEN_UCASE); }
+UNBOUNDED {SQL_NEW_KEYWORD(SQL_TOKEN_UNBOUNDED); }
UNION {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); }
UNIQUE {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); }
UNKNOWN {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); }
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 34ba49566383..e0ea97f1f7aa 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1068,9 +1068,9 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator:table_exp error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
- sal_uInt32 nPos = ( _bOrder ? 4 : 2 );
+ sal_uInt32 nPos = ( _bOrder ? ORDER_BY_CHILD_POS : 2 );
OSQLParseNode * pOptByClause = pTableExp->getChild(nPos);
OSL_ENSURE(pOptByClause != NULL,"OSQLParseTreeIterator: error in parse tree!");
@@ -1233,7 +1233,7 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele
OSQLParseNode * pTableExp = pSelectNode->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pTableExp->getChild(1);
} else if (SQL_ISRULE(pSelectNode,update_statement_searched)) {
@@ -1451,7 +1451,7 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition
}
//-----------------------------------------------------------------------------
void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
- ,const OSQLParseNode* _pColumnRef
+ ,const OSQLParseNode* _pParentNode
,const ::rtl::OUString& _aColumnName
,const ::rtl::OUString& _aTableRange
,const ::rtl::OUString& _rColumnAlias)
@@ -1490,18 +1490,18 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
}
// found a parameter
- if ( _pColumnRef && (SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec)) )
+ if ( _pParentNode && (SQL_ISRULE(_pParentNode,general_set_fct) || SQL_ISRULE(_pParentNode,set_fct_spec)) )
{// found a function as column_ref
::rtl::OUString sFunctionName;
- _pColumnRef->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
- const sal_uInt32 nCount = _pColumnRef->count();
+ _pParentNode->getChild(0)->parseNodeToStr( sFunctionName, m_pImpl->m_xConnection, NULL, sal_False, sal_False );
+ const sal_uInt32 nCount = _pParentNode->count();
sal_uInt32 i = 0;
for(; i < nCount;++i)
{
- if ( _pColumnRef->getChild(i) == _pParseNode )
+ if ( _pParentNode->getChild(i) == _pParseNode )
break;
}
- sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pColumnRef->getParent()->getChild(0)->getTokenID(), i+1);
+ sal_Int32 nType = ::connectivity::OSQLParser::getFunctionParameterType( _pParentNode->getChild(0)->getTokenID(), i-1);
OParseColumn* pColumn = new OParseColumn( sParameterName,
::rtl::OUString(),
@@ -1552,14 +1552,14 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode
if ( bNotFound )
{
sal_Int32 nType = DataType::VARCHAR;
- OSQLParseNode* pParent = _pColumnRef ? _pColumnRef->getParent() : NULL;
+ OSQLParseNode* pParent = _pParentNode ? _pParentNode->getParent() : NULL;
if ( pParent && (SQL_ISRULE(pParent,general_set_fct) || SQL_ISRULE(pParent,set_fct_spec)) )
{
- const sal_uInt32 nCount = _pColumnRef->count();
+ const sal_uInt32 nCount = _pParentNode->count();
sal_uInt32 i = 0;
for(; i < nCount;++i)
{
- if ( _pColumnRef->getChild(i) == _pParseNode )
+ if ( _pParentNode->getChild(i) == _pParseNode )
break;
}
nType = ::connectivity::OSQLParser::getFunctionParameterType( pParent->getChild(0)->getTokenID(), i+1);
@@ -1967,7 +1967,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pWhereClause = pTableExp->getChild(1);
}
@@ -1997,9 +1997,9 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
- pOrderClause = pTableExp->getChild(4);
+ pOrderClause = pTableExp->getChild(ORDER_BY_CHILD_POS);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
if(pOrderClause->count() != 3)
pOrderClause = NULL;
@@ -2019,7 +2019,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pGroupClause = pTableExp->getChild(2);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
@@ -2040,7 +2040,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const
OSQLParseNode * pTableExp = m_pParseTree->getChild(3);
OSL_ENSURE(pTableExp != NULL,"OSQLParseTreeIterator: error in parse tree!");
OSL_ENSURE(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: error in parse tree!");
- OSL_ENSURE(pTableExp->count() == 5,"OSQLParseTreeIterator: error in parse tree!");
+ OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!");
pHavingClause = pTableExp->getChild(3);
// Wenn es aber eine order_by ist, dann darf sie nicht leer sein:
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 8f2b3d69812a..9a3abb0d4fc2 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -2468,7 +2468,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode
if (rString.getLength())
rString.appendAscii(" ");
- const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, &rParam.m_rContext);
+ const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, rParam.bInternational ? &rParam.m_rContext : NULL);
rString.append(::rtl::OUString(sT,sT.getLength(),RTL_TEXTENCODING_UTF8));
} break;
case SQL_NODE_STRING:
diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java
index e78f6859fb88..40af4387bb5c 100644
--- a/dbaccess/qa/complex/dbaccess/Query.java
+++ b/dbaccess/qa/complex/dbaccess/Query.java
@@ -40,7 +40,8 @@ import org.junit.Test;
import static org.junit.Assert.*;
// ------------------------------------------
-public class Query extends TestCase {
+public class Query extends TestCase
+{
connectivity.tools.HsqlDatabase m_database;
@@ -49,17 +50,17 @@ public class Query extends TestCase {
{
try
{
- if ( m_database == null )
+ if (m_database == null)
{
- final CRMDatabase database = new CRMDatabase( getMSF(), false );
+ final CRMDatabase database = new CRMDatabase(getMSF(), false);
m_database = database.getDatabase();
}
}
- catch( Exception e )
+ catch (Exception e)
{
- System.out.println( "could not create the test case, error message:\n" + e.getMessage() );
- e.printStackTrace( System.err );
- fail( "failed to created the test case");
+ System.out.println("could not create the test case, error message:\n" + e.getMessage());
+ e.printStackTrace(System.err);
+ fail("failed to created the test case");
}
}
@@ -68,7 +69,6 @@ public class Query extends TestCase {
// {
// return (XMultiServiceFactory)param.getMSF();
// }
-
// --------------------------------------------------------------------------------------------------------
@Test
public void testQueryColumns()
@@ -90,23 +90,26 @@ public class Query extends TestCase {
for ( int i = 0; i < queryNames.length; ++i )
{
- final XPropertySet query = UnoRuntime.queryInterface(
- XPropertySet.class, queries.getByName( queryNames[i] ) );
+ if (queries.hasByName(queryNames[i]))
+ {
+ final XPropertySet query = UnoRuntime.queryInterface(
+ XPropertySet.class, queries.getByName( queryNames[i] ) );
- final XColumnsSupplier suppCols = UnoRuntime.queryInterface(
- XColumnsSupplier.class, query);
- final XIndexAccess columns = UnoRuntime.queryInterface(
- XIndexAccess.class, suppCols.getColumns());
+ final XColumnsSupplier suppCols = UnoRuntime.queryInterface(
+ XColumnsSupplier.class, query);
+ final XIndexAccess columns = UnoRuntime.queryInterface(
+ XIndexAccess.class, suppCols.getColumns());
- // check whether the columns supplied by the query match what we expected
- assertTrue( "invalid column count (found " + columns.getCount() + ", expected: " + expectedColumnNames[i].length + ") for query \"" + queryNames[i] + "\"",
- columns.getCount() == expectedColumnNames[i].length );
- for ( int col = 0; col < columns.getCount(); ++col )
- {
- final XNamed columnName = UnoRuntime.queryInterface(
- XNamed.class, columns.getByIndex(col) );
- assertTrue( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching",
- columnName.getName().equals( expectedColumnNames[i][col] ) );
+ // check whether the columns supplied by the query match what we expected
+ assertTrue( "invalid column count (found " + columns.getCount() + ", expected: " + expectedColumnNames[i].length + ") for query \"" + queryNames[i] + "\"",
+ columns.getCount() == expectedColumnNames[i].length );
+ for ( int col = 0; col < columns.getCount(); ++col )
+ {
+ final XNamed columnName = UnoRuntime.queryInterface(
+ XNamed.class, columns.getByIndex(col) );
+ assertTrue( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching",
+ columnName.getName().equals( expectedColumnNames[i][col] ) );
+ }
}
}
}
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index 7716f7f30512..921aff2046ef 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -435,6 +435,10 @@ public class RowSet extends TestCase
testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_MODIFIED] = false;
+ updRow.updateString(2, m_row.getString(2));
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+
+ moves[RowSetEventListener.IS_MODIFIED] = false;
final Class cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate");
final XResultSetUpdate upd = UnoRuntime.queryInterface( XResultSetUpdate.class, m_resultSet );
testCursorMove(upd, cupd.getMethod("moveToInsertRow", (Class[]) null), pRow, moves, null);
diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
index 89d107ed5bb1..4823f5d50e4c 100755
--- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
+++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
@@ -55,11 +55,12 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
{
private XSingleSelectQueryComposer m_composer = null;
- private final static String COMPLEXFILTER = "( \"ID\" = 1 AND \"Postal\" = '4' )" +
- " OR ( \"ID\" = 2 AND \"Postal\" = '5' )" +
- " OR ( \"ID\" = '3' AND \"Postal\" = '6' AND \"Address\" = '7' )" +
- " OR ( \"Address\" = '8' )" +
- " OR ( \"Postal\" = '9' )";
+ private final static String COMPLEXFILTER = "( \"ID\" = 1 AND \"Postal\" = '4' )"
+ + " OR ( \"ID\" = 2 AND \"Postal\" = '5' )"
+ + " OR ( \"ID\" = 3 AND \"Postal\" = '6' AND \"Address\" = '7' )"
+ + " OR ( \"Address\" = '8' )"
+ + " OR ( \"Postal\" = '9' )"
+ + " OR ( NOW( ) = {D '2010-01-01' } )";
private final static String INNERPRODUCTSQUERY = "products (inner)";
// --------------------------------------------------------------------------------------------------------
@@ -135,15 +136,15 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
try
{
final String table = "SELECT * FROM \"customers\"";
- m_composer.setCommand("customers",CommandType.TABLE);
+ m_composer.setCommand("customers", CommandType.TABLE);
assertTrue("setCommand/getQuery TABLE inconsistent", m_composer.getQuery().equals(table));
m_database.getDatabase().getDataSource().createQuery("set command test", "SELECT * FROM \"orders for customer\" \"a\", \"customers\" \"b\" WHERE \"a\".\"Product Name\" = \"b\".\"Name\"");
- m_composer.setCommand("set command test",CommandType.QUERY);
+ m_composer.setCommand("set command test", CommandType.QUERY);
assertTrue("setCommand/getQuery QUERY inconsistent", m_composer.getQuery().equals(m_database.getDatabase().getDataSource().getQueryDefinition("set command test").getCommand()));
final String sql = "SELECT * FROM \"orders for customer\" WHERE \"Product Name\" = 'test'";
- m_composer.setCommand(sql,CommandType.COMMAND);
+ m_composer.setCommand(sql, CommandType.COMMAND);
assertTrue("setCommand/getQuery COMMAND inconsistent", m_composer.getQuery().equals(sql));
}
catch (Exception e)
@@ -151,6 +152,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
fail("Exception caught: " + e);
}
}
+
/** tests accessing attributes of the composer (order, filter, group by, having)
*/
@Test
@@ -161,6 +163,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
try
{
System.out.println("check setElementaryQuery");
+
final String simpleQuery2 = "SELECT * FROM \"customers\" WHERE \"Name\" = 'oranges'";
m_composer.setElementaryQuery(simpleQuery2);
assertTrue("setElementaryQuery/getQuery inconsistent", m_composer.getQuery().equals(simpleQuery2));
@@ -177,16 +180,16 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
final XIndexAccess orderColumns = m_composer.getOrderColumns();
assertTrue("Order columns doesn't exist: \"Address\"",
- orderColumns != null && orderColumns.getCount() == 1 && orderColumns.getByIndex(0) != null);
+ orderColumns != null && orderColumns.getCount() == 1 && orderColumns.getByIndex(0) != null);
final XIndexAccess groupColumns = m_composer.getGroupColumns();
assertTrue("Group columns doesn't exist: \"City\"",
- groupColumns != null && groupColumns.getCount() == 1 && groupColumns.getByIndex(0) != null);
+ groupColumns != null && groupColumns.getCount() == 1 && groupColumns.getByIndex(0) != null);
// XColumnsSupplier
final XColumnsSupplier xSelectColumns = UnoRuntime.queryInterface(XColumnsSupplier.class, m_composer);
assertTrue("no select columns, or wrong number of select columns",
- xSelectColumns != null && xSelectColumns.getColumns() != null && xSelectColumns.getColumns().getElementNames().length == 6);
+ xSelectColumns != null && xSelectColumns.getColumns() != null && xSelectColumns.getColumns().getElementNames().length == 6);
// structured filter
m_composer.setQuery("SELECT \"ID\", \"Postal\", \"Address\" FROM \"customers\"");
@@ -194,6 +197,11 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
final PropertyValue[][] aStructuredFilter = m_composer.getStructuredFilter();
m_composer.setFilter("");
m_composer.setStructuredFilter(aStructuredFilter);
+ if (!m_composer.getFilter().equals(COMPLEXFILTER))
+ {
+ System.out.println(COMPLEXFILTER);
+ System.out.println(m_composer.getFilter());
+ }
assertTrue("Structured Filter not identical", m_composer.getFilter().equals(COMPLEXFILTER));
// structured having clause
@@ -244,6 +252,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
final XIndexAccess parameters = suppParams.getParameters();
final String expectedParamNames[] =
+
{
"cname",
"Product Name"
@@ -276,6 +285,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
m_composer.setQuery("SELECT * FROM \"customers\"");
final Object initArgs[] =
+
{
new NamedValue("AutomaticAddition", Boolean.valueOf(true))
};
@@ -288,8 +298,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
filter.addProperty("Type", PropertyAttribute.MAYBEVOID, Integer.valueOf(DataType.LONGVARCHAR));
final XPropertySet column = UnoRuntime.queryInterface(XPropertySet.class, filter);
- m_composer.appendFilterByColumn(column, true,SQLFilterOperator.LIKE);
- assertTrue("At least one row should exist",m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next());
+ m_composer.appendFilterByColumn(column, true, SQLFilterOperator.LIKE);
+ assertTrue("At least one row should exist", m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next());
}
catch (Exception e)
@@ -333,16 +343,16 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
{
// a simple case: WHERE clause simply is a combination of predicates knitted with AND
String query =
- "SELECT \"customers\".\"Name\", " +
- "\"customers\".\"Address\", " +
- "\"customers\".\"City\", " +
- "\"customers\".\"Postal\", " +
- "\"products\".\"Name\" " +
- "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " +
- "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " +
- "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
- "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
- ") ";
+ "SELECT \"customers\".\"Name\", "
+ + "\"customers\".\"Address\", "
+ + "\"customers\".\"City\", "
+ + "\"customers\".\"Postal\", "
+ + "\"products\".\"Name\" "
+ + "FROM \"orders\", \"customers\", \"orders_details\", \"products\" "
+ + "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" "
+ + "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" "
+ + "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" "
+ + ") ";
impl_testDisjunctiveNormalForm(query, new PropertyValue[][]
{
@@ -356,20 +366,20 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
// somewhat more challenging: One of the conjunction terms is a disjunction itself
query =
- "SELECT \"customers\".\"Name\", " +
- "\"customers\".\"Address\", " +
- "\"customers\".\"City\", " +
- "\"customers\".\"Postal\", " +
- "\"products\".\"Name\" " +
- "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " +
- "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " +
- "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
- "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
- ") " +
- "AND " +
- "( \"products\".\"Name\" = 'Apples' " +
- "OR \"products\".\"ID\" = 2 " +
- ")";
+ "SELECT \"customers\".\"Name\", "
+ + "\"customers\".\"Address\", "
+ + "\"customers\".\"City\", "
+ + "\"customers\".\"Postal\", "
+ + "\"products\".\"Name\" "
+ + "FROM \"orders\", \"customers\", \"orders_details\", \"products\" "
+ + "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" "
+ + "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" "
+ + "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" "
+ + ") "
+ + "AND "
+ + "( \"products\".\"Name\" = 'Apples' "
+ + "OR \"products\".\"ID\" = 2 "
+ + ")";
impl_testDisjunctiveNormalForm(query, new PropertyValue[][]
{
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index 783c93f56593..1c21ed2dbfa0 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -691,6 +691,20 @@ sal_Bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException)
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
return m_xDriverSet->previous();
}
+sal_Bool OCacheSet::last_checked( sal_Bool /*i_bFetchRow*/)
+{
+ return last();
+}
+// -------------------------------------------------------------------------
+sal_Bool OCacheSet::previous_checked( sal_Bool /*i_bFetchRow*/ )
+{
+ return previous();
+}
+// -------------------------------------------------------------------------
+sal_Bool OCacheSet::absolute_checked( sal_Int32 row,sal_Bool /*i_bFetchRow*/ )
+{
+ return absolute(row);
+}
// -------------------------------------------------------------------------
void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException)
{
diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index 70905c444610..f4486239e540 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -174,6 +174,9 @@ namespace dbaccess
virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow);
virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns);
virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const;
+ virtual sal_Bool previous_checked( sal_Bool i_bFetchRow );
+ virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow );
+ virtual sal_Bool last_checked( sal_Bool i_bFetchRow);
};
}
#endif //DBACCESS_CORE_API_CACHESET_HXX
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 8df84766575c..21dc7d8443e6 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -154,7 +154,8 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name
const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
- sal_Int32 i_nMaxRows)
+ sal_Int32 i_nMaxRows,
+ sal_Int32& o_nRowCount)
:OCacheSet(i_nMaxRows)
,m_aParameterValueForCache(_aParameterValueForCache)
,m_pKeyColumnNames(NULL)
@@ -165,6 +166,7 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
,m_xTableKeys(_xTableKeys)
,m_xComposer(_xComposer)
,m_sUpdateTableName(_rUpdateTableName)
+ ,m_rRowCount(o_nRowCount)
,m_bRowCountFinal(sal_False)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::OKeySet" );
@@ -1167,6 +1169,12 @@ sal_Bool SAL_CALL OKeySet::next( ) throw(SQLException, RuntimeException)
++m_aKeyIter; // this is possible because we stand on begin() and this is the "beforefirst" row
if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
m_aKeyIter = m_aKeyMap.end();
+ else
+ {
+ //m_aKeyIter->second.second.second = new OPrivateRow(_rInsertRow->get());
+ m_xRow.set(m_xDriverRow,UNO_QUERY_THROW);
+ return !isAfterLast();
+ }
}
else if(!isAfterLast())
++m_aKeyIter;
@@ -1233,20 +1241,26 @@ sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException)
++m_aKeyIter;
if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
m_aKeyIter = m_aKeyMap.end();
-
- refreshRow();
+ else
+ refreshRow();
return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OKeySet::last( ) throw(SQLException, RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last" );
+ return last_checked(sal_True);
+}
+
+sal_Bool OKeySet::last_checked( sal_Bool i_bFetchRow)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last_checked" );
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
fillAllRows();
m_aKeyIter = m_aKeyMap.end();
--m_aKeyIter;
- refreshRow();
+ if ( i_bFetchRow )
+ refreshRow();
return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
}
// -----------------------------------------------------------------------------
@@ -1261,6 +1275,10 @@ sal_Int32 SAL_CALL OKeySet::getRow( ) throw(SQLException, RuntimeException)
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
{
+ return absolute_checked(row,sal_True);
+}
+sal_Bool OKeySet::absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow )
+{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::absolute" );
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
OSL_ENSURE(row,"absolute(0) isn't allowed!");
@@ -1281,6 +1299,11 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime
sal_Bool bNext = sal_True;
for(sal_Int32 i=m_aKeyMap.size()-1;i < row && bNext;++i)
bNext = fetchRow();
+ if ( bNext )
+ {
+ m_xRow.set(m_xDriverRow,UNO_QUERY_THROW);
+ return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
+ }
}
else
m_aKeyIter = m_aKeyMap.end();
@@ -1292,7 +1315,8 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime
++m_aKeyIter;
}
}
- refreshRow();
+ if ( i_bFetchRow )
+ refreshRow();
return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
}
@@ -1308,18 +1332,25 @@ sal_Bool SAL_CALL OKeySet::relative( sal_Int32 rows ) throw(SQLException, Runtim
return absolute(getRow()+rows);
}
// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException)
+sal_Bool OKeySet::previous_checked( sal_Bool i_bFetchRow )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::previous" );
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
if(m_aKeyIter != m_aKeyMap.begin())
{
--m_aKeyIter;
- refreshRow();
+ if ( i_bFetchRow )
+ refreshRow();
}
return m_aKeyIter != m_aKeyMap.begin();
}
// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException)
+{
+ return previous_checked(sal_True);
+}
+
+// -----------------------------------------------------------------------------
void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::refreshRow" );
@@ -1374,9 +1405,18 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
OSL_ENSURE(m_xSet.is(),"No resultset form statement!");
sal_Bool bOK = m_xSet->next();
if ( !bOK )
- m_aKeyIter = m_aKeyMap.end();
- m_xRow.set(m_xSet,UNO_QUERY);
- OSL_ENSURE(m_xRow.is(),"No row form statement!");
+ {
+ OKeySetMatrix::iterator aTemp = m_aKeyIter;
+ ++m_aKeyIter;
+ m_aKeyMap.erase(aTemp);
+ --m_rRowCount;
+ refreshRow();
+ }
+ else
+ {
+ m_xRow.set(m_xSet,UNO_QUERY);
+ OSL_ENSURE(m_xRow.is(),"No row form statement!");
+ }
}
// -----------------------------------------------------------------------------
sal_Bool OKeySet::fetchRow()
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 597f659f1d94..2f9d1b002cb1 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -113,6 +113,7 @@ namespace dbaccess
::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer > m_xComposer;
::rtl::OUString m_sUpdateTableName;
::std::vector< ::rtl::OUString > m_aFilterColumns;
+ sal_Int32& m_rRowCount;
sal_Bool m_bRowCountFinal;
@@ -160,7 +161,8 @@ namespace dbaccess
const ::rtl::OUString& _rUpdateTableName,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
- sal_Int32 i_nMaxRows);
+ sal_Int32 i_nMaxRows,
+ sal_Int32& o_nRowCount);
// late ctor which can throw exceptions
virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter);
@@ -228,6 +230,11 @@ namespace dbaccess
virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+
+ virtual sal_Bool previous_checked( sal_Bool i_bFetchRow );
+ virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow );
+ virtual sal_Bool last_checked( sal_Bool i_bFetchRow);
};
}
#endif // DBACCESS_CORE_API_KEYSET_HXX
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index d984ca2c78c6..2637a4f6bea6 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -103,8 +103,9 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext,
const Reference< XConnection>& i_xConnection,
const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
- sal_Int32 i_nMaxRows)
- :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows)
+ sal_Int32 i_nMaxRows,
+ sal_Int32& o_nRowCount)
+ :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows,o_nRowCount)
,m_aSqlParser( _rContext.getLegacyServiceFactory() )
,m_aSqlIterator( i_xConnection, Reference<XTablesSupplier>(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL )
,m_bResultSetChanged(false)
diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx
index da73eaeee8c5..f3b75e08ed5b 100644
--- a/dbaccess/source/core/api/OptimisticSet.hxx
+++ b/dbaccess/source/core/api/OptimisticSet.hxx
@@ -80,7 +80,8 @@ namespace dbaccess
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_xConnection,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
- sal_Int32 i_nMaxRows);
+ sal_Int32 i_nMaxRows,
+ sal_Int32& o_nRowCount);
// late ctor which can throw exceptions
virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter);
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 4118794d5b52..38220bcade48 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -595,6 +595,7 @@ void ORowSet::freeResources( bool _bComplete )
m_bAfterLast = sal_False;
m_bNew = sal_False;
m_bModified = sal_False;
+ m_bIsInsertRow = sal_False;
m_bLastKnownRowCountFinal = sal_False;
m_nLastKnownRowCount = 0;
if ( m_aOldRow.isValid() )
@@ -707,6 +708,7 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateValue(columnIndex,x,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
// -------------------------------------------------------------------------
@@ -722,6 +724,7 @@ void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, R
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateNull(columnIndex,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
// -------------------------------------------------------------------------
@@ -819,6 +822,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateCharacterStream(columnIndex,x,length,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
// -------------------------------------------------------------------------
@@ -862,6 +866,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateObject(columnIndex,aNewValue,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
}
@@ -875,6 +880,7 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x,
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateNumericObject(columnIndex,x,scale,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
// -------------------------------------------------------------------------
@@ -892,52 +898,49 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException)
if(!m_pCache || !m_bNew || !m_bModified || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
throwFunctionSequenceException(*this);
- if(m_bModified)
- {
- // remember old value for fire
- sal_Bool bOld = m_bNew;
+ // remember old value for fire
+ sal_Bool bOld = m_bNew;
- ORowSetRow aOldValues;
- if ( !m_aCurrentRow.isNull() )
- aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() );
- Sequence<Any> aChangedBookmarks;
- RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks);
- notifyAllListenersRowBeforeChange(aGuard,aEvt);
+ ORowSetRow aOldValues;
+ if ( !m_aCurrentRow.isNull() )
+ aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() );
+ Sequence<Any> aChangedBookmarks;
+ RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks);
+ notifyAllListenersRowBeforeChange(aGuard,aEvt);
- ::std::vector< Any > aBookmarks;
- sal_Bool bInserted = m_pCache->insertRow(aBookmarks);
+ ::std::vector< Any > aBookmarks;
+ sal_Bool bInserted = m_pCache->insertRow(aBookmarks);
- // make sure that our row is set to the new inserted row before clearing the insert flags in the cache
- m_pCache->resetInsertRow(bInserted);
+ // make sure that our row is set to the new inserted row before clearing the insert flags in the cache
+ m_pCache->resetInsertRow(bInserted);
- // notification order
- // - column values
- setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here
+ // notification order
+ // - column values
+ setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here
- // read-only flag restored
- impl_restoreDataColumnsWriteable_throw();
+ // read-only flag restored
+ impl_restoreDataColumnsWriteable_throw();
- // - rowChanged
- notifyAllListenersRowChanged(aGuard,aEvt);
+ // - rowChanged
+ notifyAllListenersRowChanged(aGuard,aEvt);
- if ( !aBookmarks.empty() )
- {
- RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size()));
- notifyAllListenersRowChanged(aGuard,aUpEvt);
- }
+ if ( !aBookmarks.empty() )
+ {
+ RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size()));
+ notifyAllListenersRowChanged(aGuard,aUpEvt);
+ }
- // - IsModified
- if(!m_bModified)
- fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
- OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" );
+ // - IsModified
+ if(!m_bModified)
+ fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
+ OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" );
- // - IsNew
- if(m_bNew != bOld)
- fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld);
+ // - IsNew
+ if(m_bNew != bOld)
+ fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld);
- // - RowCount/IsRowCountFinal
- fireRowcount();
- }
+ // - RowCount/IsRowCountFinal
+ fireRowcount();
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException)
@@ -946,7 +949,7 @@ sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException)
checkCache();
// check if we are inserting a row
- return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : ORowSetBase::getRow();
+ return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow();
}
// -------------------------------------------------------------------------
void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException)
@@ -975,6 +978,7 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException)
aEvt.Rows += aBookmarks.size();
m_aBookmark = m_pCache->getBookmark();
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && (*m_pCache->m_aMatrixIter).isValid() )
{
if ( m_pCache->isResultSetChanged() )
@@ -1085,6 +1089,7 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL
m_aBookmark = m_pCache->getBookmark();
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
m_aCurrentRow.setBookmark(m_aBookmark);
// notification order
@@ -1219,6 +1224,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
m_pCache->moveToInsertRow();
m_aCurrentRow = m_pCache->m_aInsertRow;
+ m_bIsInsertRow = sal_True;
// set read-only flag to false
impl_setDataColumnsWriteable_throw();
@@ -1829,6 +1835,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
}
m_pCache->setFetchSize(m_nFetchSize);
m_aCurrentRow = m_pCache->createIterator(this);
+ m_bIsInsertRow = sal_False;
m_aOldRow = m_pCache->registerOldRow();
}
@@ -2716,6 +2723,7 @@ void ORowSet::doCancelModification( )
m_pCache->cancelRowModification();
}
m_bModified = sal_False;
+ m_bIsInsertRow = sal_False;
}
// -----------------------------------------------------------------------------
@@ -2739,14 +2747,12 @@ sal_Bool ORowSet::isNew( )
// -----------------------------------------------------------------------------
void ORowSet::checkUpdateIterator()
{
- if(!m_bModified && !m_bNew)
+ if(!m_bIsInsertRow)
{
m_pCache->setUpdateIterator(m_aCurrentRow);
m_aCurrentRow = m_pCache->m_aInsertRow;
- m_bModified = sal_True;
- } // if(!m_bModified && !m_bNew)
- else if ( m_bNew ) // here we are modifing a value
- m_bModified = sal_True;
+ m_bIsInsertRow = sal_True;
+ }
}
// -----------------------------------------------------------------------------
void ORowSet::checkUpdateConditions(sal_Int32 columnIndex)
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 4cb218d628b6..b8f489d65728 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -112,6 +112,7 @@ ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cpp
,m_bIgnoreResult(sal_False)
,m_bBeforeFirst(sal_True) // changed from sal_False
,m_bAfterLast(sal_False)
+ ,m_bIsInsertRow(sal_False)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::ORowSetBase" );
DBG_CTOR(ORowSetBase,NULL);
@@ -257,6 +258,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
// currentrow is null when the clone moves the window
positionCache( MOVE_NONE_REFRESH_ONLY );
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null.");
bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() );
@@ -398,6 +400,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS
{
positionCache( MOVE_NONE_REFRESH_ONLY );
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null.");
bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->isValid() );
@@ -1121,6 +1124,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR
m_aBookmark = m_pCache->getBookmark();
OSL_ENSURE(m_aBookmark.hasValue(),"Bookmark has no value!");
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is null!");
m_aCurrentRow.setBookmark(m_aBookmark);
OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd(),"Position of matrix iterator isn't valid!");
@@ -1136,6 +1140,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR
#endif
OSL_ENSURE(nOldRow == nNewRow,"Old position is not equal to new postion");
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!");
#if OSL_DEBUG_LEVEL > 0
ORowSetRow rRow = (*m_aCurrentRow);
@@ -1147,6 +1152,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR
{
positionCache( MOVE_NONE_REFRESH_ONLY );
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!");
}
}
@@ -1574,7 +1580,8 @@ void ORowSetNotifier::firePropertyChange()
{
m_pRowSet->firePropertyChange((*aIter)-1 ,m_pImpl->aRow[(*aIter)-1], ORowSetBase::GrantNotifierAccess());
}
- m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False, ORowSetBase::GrantNotifierAccess());
+ if ( !m_pImpl->aChangedColumns.empty() )
+ m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False, ORowSetBase::GrantNotifierAccess());
}
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index 9a7e9182e1d0..83b4d2fb74ef 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -158,6 +158,7 @@ namespace dbaccess
sal_Bool m_bIgnoreResult ;
sal_Bool m_bBeforeFirst : 1;
sal_Bool m_bAfterLast : 1;
+ sal_Bool m_bIsInsertRow : 1;
protected:
ORowSetBase(
@@ -383,7 +384,7 @@ namespace dbaccess
inline sal_Bool isModification( const GrantNotifierAccess& ) { return isModification(); }
inline sal_Bool isModified( const GrantNotifierAccess& ) { return isModified(); }
inline sal_Bool isNew( const GrantNotifierAccess& ) { return isNew(); }
- inline sal_Bool isInsertRow() { return isNew() || isModified(); }
+ inline sal_Bool isInsertRow() { return m_bIsInsertRow; } // isNew() || isModified(); }
inline void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld, const GrantNotifierAccess& )
{
fireProperty( _nProperty, _bNew, _bOld );
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 0ca34e11b66b..6f3ec5e53265 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -176,7 +176,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
if ( aTableNames.getLength() > 1 && !_rUpdateTableName.getLength() && bNeedKeySet )
{// here we have a join or union and nobody told us which table to update, so we update them all
m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE;
- OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows);
+ OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
m_pCacheSet = pCursor;
m_xCacheSet = m_pCacheSet;
try
@@ -309,7 +309,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
}
}
- OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows);
+ OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
try
{
m_pCacheSet = pKeySet;
@@ -441,6 +441,13 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize)
m_nStartPos = 0;
m_nEndPos = _nSize;
}
+ else if (m_nStartPos < m_nPosition && m_nPosition < m_nEndPos)
+ {
+ sal_Int32 nNewSt = -1;
+ fillMatrix(nNewSt,_nSize+1);
+ m_nStartPos = 0;
+ m_nEndPos = _nSize;
+ }
}
// -------------------------------------------------------------------------
@@ -548,13 +555,16 @@ void ORowSetCache::updateNull(sal_Int32 columnIndex,ORowSetValueVector::Vector&
checkUpdateConditions(columnIndex);
ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get());
- rInsert[columnIndex].setBound(sal_True);
- rInsert[columnIndex].setNull();
- rInsert[columnIndex].setModified();
- io_aRow[columnIndex].setNull();
+ if ( !rInsert[columnIndex].isNull() )
+ {
+ rInsert[columnIndex].setBound(sal_True);
+ rInsert[columnIndex].setNull();
+ rInsert[columnIndex].setModified();
+ io_aRow[columnIndex].setNull();
- m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
- impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
+ impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ }
}
// -----------------------------------------------------------------------------
void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x
@@ -565,13 +575,16 @@ void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x
checkUpdateConditions(columnIndex);
ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get());
- rInsert[columnIndex].setBound(sal_True);
- rInsert[columnIndex] = x;
- rInsert[columnIndex].setModified();
- io_aRow[columnIndex] = rInsert[columnIndex];
+ if ( rInsert[columnIndex] != x )
+ {
+ rInsert[columnIndex].setBound(sal_True);
+ rInsert[columnIndex] = x;
+ rInsert[columnIndex].setModified();
+ io_aRow[columnIndex] = rInsert[columnIndex];
- m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
- impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
+ impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ }
}
// -------------------------------------------------------------------------
void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x
@@ -603,13 +616,18 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x
checkUpdateConditions(columnIndex);
ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get());
- rInsert[columnIndex].setBound(sal_True);
- rInsert[columnIndex] = x;
- rInsert[columnIndex].setModified();
- io_aRow[columnIndex] = rInsert[columnIndex];
+ ORowSetValue aTemp;
+ aTemp.fill(x);
+ if ( rInsert[columnIndex] != aTemp )
+ {
+ rInsert[columnIndex].setBound(sal_True);
+ rInsert[columnIndex] = aTemp;
+ rInsert[columnIndex].setModified();
+ io_aRow[columnIndex] = rInsert[columnIndex];
- m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
- impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
+ impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ }
}
// -------------------------------------------------------------------------
void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/
@@ -620,13 +638,18 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal
checkUpdateConditions(columnIndex);
ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get());
- rInsert[columnIndex].setBound(sal_True);
- rInsert[columnIndex] = x;
- rInsert[columnIndex].setModified();
- io_aRow[columnIndex] = rInsert[columnIndex];
+ ORowSetValue aTemp;
+ aTemp.fill(x);
+ if ( rInsert[columnIndex] != aTemp )
+ {
+ rInsert[columnIndex].setBound(sal_True);
+ rInsert[columnIndex] = aTemp;
+ rInsert[columnIndex].setModified();
+ io_aRow[columnIndex] = rInsert[columnIndex];
- m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
- impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
+ impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ }
}
// -------------------------------------------------------------------------
// XResultSet
@@ -654,34 +677,26 @@ sal_Bool ORowSetCache::next( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isBeforeFirst( )
{
- // return !m_nPosition;
-
return m_bBeforeFirst;
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isAfterLast( )
{
-
return m_bAfterLast;
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isFirst( )
{
-
return m_nPosition == 1; // ask resultset for
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::isLast( )
{
- // return m_bRowCountFinal ? (m_nPosition==m_nRowCount) : m_pCacheSet->isLast();
-
return m_nPosition == m_nRowCount;
}
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::beforeFirst( )
{
-
-
if(!m_bBeforeFirst)
{
m_bAfterLast = sal_False;
@@ -696,8 +711,6 @@ sal_Bool ORowSetCache::beforeFirst( )
// -------------------------------------------------------------------------
sal_Bool ORowSetCache::afterLast( )
{
-
-
if(!m_bAfterLast)
{
m_bBeforeFirst = sal_False;
@@ -705,7 +718,7 @@ sal_Bool ORowSetCache::afterLast( )
if(!m_bRowCountFinal)
{
- m_pCacheSet->last();
+ m_pCacheSet->last_checked(sal_False);
m_bRowCountFinal = sal_True;
m_nRowCount = m_pCacheSet->getRow();// + 1 removed
}
@@ -721,10 +734,22 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
{
OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!");
// fill the whole window with new data
- ORowSetMatrix::iterator aIter = m_pMatrix->begin();
- sal_Bool bCheck = m_pCacheSet->absolute(_nNewStartPos); // -1 no need to
+ ORowSetMatrix::iterator aIter;
+ sal_Int32 i;
+ sal_Bool bCheck;
+ if ( _nNewStartPos == -1 )
+ {
+ aIter = m_pMatrix->begin() + m_nEndPos;
+ i = m_nEndPos+1;
+ }
+ else
+ {
+ aIter = m_pMatrix->begin();
+ i = _nNewStartPos;
+ }
+ bCheck = m_pCacheSet->absolute(i); // -1 no need to
+
- sal_Int32 i=_nNewStartPos;
for(;i<_nNewEndPos;++i,++aIter)
{
if(bCheck)
@@ -732,13 +757,15 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
if(!aIter->isValid())
*aIter = new ORowSetValueVector(m_xMetaData->getColumnCount());
m_pCacheSet->fillValueRow(*aIter,i);
+ if(!m_bRowCountFinal)
+ ++m_nRowCount;
}
else
{ // there are no more rows found so we can fetch some before start
if(!m_bRowCountFinal)
{
- if(m_pCacheSet->previous()) // because we stand after the last row
+ if(m_pCacheSet->previous_checked(sal_False)) // because we stand after the last row
m_nRowCount = m_pCacheSet->getRow(); // here we have the row count
if(!m_nRowCount)
m_nRowCount = i-1; // it can be that getRow return zero
@@ -767,16 +794,18 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
}
break;
}
- bCheck = m_pCacheSet->next();
+ if ( i < (_nNewEndPos-1) )
+ bCheck = m_pCacheSet->next();
}
// m_nStartPos = _nNewStartPos;
- // we have to read one row forward to enshure that we know when we are on last row
+ // we have to read one row forward to ensure that we know when we are on last row
// but only when we don't know it already
+ /*
if(!m_bRowCountFinal)
{
if(!m_pCacheSet->next())
{
- if(m_pCacheSet->previous()) // because we stand after the last row
+ if(m_pCacheSet->previous_checked(sal_False)) // because we stand after the last row
m_nRowCount = m_pCacheSet->getRow(); // here we have the row count
m_bRowCountFinal = sal_True;
}
@@ -784,6 +813,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
m_nRowCount = std::max(i,m_nRowCount);
}
+ */
return bCheck;
}
// -------------------------------------------------------------------------
@@ -813,7 +843,6 @@ sal_Bool ORowSetCache::moveWindow()
if ( nNewStartPos < 1 )
{
bCheck = m_pCacheSet->first();
- // aEnd = m_pMatrix->begin() + (sal_Int32)(m_nFetchSize*0.5);
OSL_ENSURE((nNewEndPos - m_nStartPos - nNewStartPos) < (sal_Int32)m_pMatrix->size(),"Position is behind end()!");
aEnd = m_pMatrix->begin() + (nNewEndPos - m_nStartPos - nNewStartPos);
aIter = aEnd;
@@ -921,19 +950,16 @@ sal_Bool ORowSetCache::moveWindow()
// but only when we don't know it already
if ( !m_bRowCountFinal )
{
- bOk = m_pCacheSet->absolute( m_nPosition + 1 );
+ bOk = m_pCacheSet->absolute_checked( m_nPosition + 1,sal_False );
if ( bOk )
m_nRowCount = std::max(sal_Int32(m_nPosition+1),m_nRowCount);
}
}
- if(!bOk)
+ if(!bOk && !m_bRowCountFinal)
{
- if(!m_bRowCountFinal)
- {
- // because we stand after the last row
- m_nRowCount = m_pCacheSet->previous() ? m_pCacheSet->getRow() : 0;// + 1 removed
- m_bRowCountFinal = sal_True;
- }
+ // because we stand after the last row
+ m_nRowCount = m_pCacheSet->previous_checked(sal_False) ? m_pCacheSet->getRow() : 0;// + 1 removed
+ m_bRowCountFinal = sal_True;
}
}
}
@@ -949,9 +975,6 @@ sal_Bool ORowSetCache::moveWindow()
sal_Bool bCheck = m_pCacheSet->absolute(nPos);
bCheck = fill(aIter,aEnd,nPos,bCheck); // refill the region wew don't need anymore
-// // we know that this is the current maximal rowcount here
-// if ( !m_bRowCountFinal && bCheck )
-// m_nRowCount = std::max(nPos,m_nRowCount);
// we have to read one row forward to enshure that we know when we are on last row
// but only when we don't know it already
sal_Bool bOk = sal_True;
@@ -967,7 +990,7 @@ sal_Bool ORowSetCache::moveWindow()
// now I can say how many rows we have
if(!bOk)
{
- m_pCacheSet->previous(); // because we stand after the last row
+ m_pCacheSet->previous_checked(sal_False); // because we stand after the last row
m_nRowCount = nPos; // here we have the row count
m_bRowCountFinal = sal_True;
}
@@ -985,7 +1008,7 @@ sal_Bool ORowSetCache::moveWindow()
if ( !m_bRowCountFinal )
{
- m_pCacheSet->previous(); // because we stand after the last row
+ m_pCacheSet->previous_checked(sal_False); // because we stand after the last row
m_nRowCount = std::max(m_nRowCount,--nPos); // here we have the row count
OSL_ENSURE(nPos == m_pCacheSet->getRow(),"nPos isn't valid!");
m_bRowCountFinal = sal_True;
@@ -1001,7 +1024,7 @@ sal_Bool ORowSetCache::moveWindow()
aIter = m_pMatrix->begin();
nPos = m_nStartPos;
- bCheck = m_pCacheSet->absolute(m_nStartPos);
+ bCheck = m_pCacheSet->absolute_checked(m_nStartPos,sal_False);
for(; !aIter->isValid() && bCheck;++aIter)
{
OSL_ENSURE(aIter != m_pMatrix->end(),"Invalid iterator");
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index fa67a3d8cfdb..f3b40ffe968e 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -58,6 +58,7 @@
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <connectivity/predicateinput.hxx>
#include <rtl/logfile.hxx>
#include <unotools/syslocale.hxx>
#include <tools/debug.hxx>
@@ -1243,16 +1244,12 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon
::rtl::OUString aValue;
::rtl::OUString aColumnName;
- pCondition->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pCondition->getChild(2)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
pCondition->getChild(0)->parseNodeToPredicateStr( aColumnName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep .toChar() ) );
- // don't display the column name
- aValue = aValue.copy(aColumnName.getLength());
- aValue.trim();
-
aItem.Name = getColumnName(pCondition->getChild(0),_rIterator);
aItem.Value <<= aValue;
- aItem.Handle = pCondition->getNodeType();
+ aItem.Handle = getPredicateType(pCondition->getChild(1));
rFilter.push_back(aItem);
}
else // kann sich nur um einen Expr. Ausdruck handeln
@@ -1269,7 +1266,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon
pLhs->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
// Kriterium
- aItem.Handle = pCondition->getChild(1)->getNodeType();
+ aItem.Handle = getPredicateType(pCondition->getChild(1));
aValue = pCondition->getChild(1)->getTokenValue();
for(i=0;i< pRhs->count();i++)
pRhs->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
@@ -1514,7 +1511,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns(
// -----------------------------------------------------------------------------
namespace
{
- ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter )
+ ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,const OPredicateInputController& i_aPredicateInputController,const Reference< XNameAccess >& i_xSelectColumns)
{
::rtl::OUStringBuffer sRet;
const Sequence< PropertyValue >* pOrIter = filter.getConstArray();
@@ -1531,6 +1528,15 @@ namespace
sRet.append(pAndIter->Name);
::rtl::OUString sValue;
pAndIter->Value >>= sValue;
+ if ( i_xSelectColumns.is() && i_xSelectColumns->hasByName(pAndIter->Name) )
+ {
+ Reference<XPropertySet> xColumn(i_xSelectColumns->getByName(pAndIter->Name),UNO_QUERY);
+ sValue = i_aPredicateInputController.getPredicateValue(sValue,xColumn,sal_True);
+ }
+ else
+ {
+ sValue = i_aPredicateInputController.getPredicateValue(pAndIter->Name,sValue,sal_True);
+ }
lcl_addFilterCriteria_throw(pAndIter->Handle,sValue,sRet);
++pAndIter;
if ( pAndIter != pAndEnd )
@@ -1549,13 +1555,15 @@ namespace
void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, ::com::sun::star::lang::IllegalArgumentException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredFilter" );
- setFilter(lcl_getCondition(filter));
+ OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection);
+ setFilter(lcl_getCondition(filter,aPredicateInput,getColumns()));
}
// -----------------------------------------------------------------------------
void SAL_CALL OSingleSelectQueryComposer::setStructuredHavingClause( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredHavingClause" );
- setHavingClause(lcl_getCondition(filter));
+ OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection);
+ setHavingClause(lcl_getCondition(filter,aPredicateInput,getColumns()));
}
// -----------------------------------------------------------------------------
void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor,sal_Int32 filterOperator)
diff --git a/dbaccess/source/core/dataaccess/SharedConnection.cxx b/dbaccess/source/core/dataaccess/SharedConnection.cxx
index d2b9f4d5196a..58625fe15170 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.cxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.cxx
@@ -129,6 +129,8 @@ void SAL_CALL OSharedConnection::rollback( ) throw(SQLException, RuntimeExcepti
sal_Bool SAL_CALL OSharedConnection::isClosed( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xConnection.is() )
+ return sal_True;
return m_xConnection->isClosed();
}
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 835f5398efc7..4cd88751ea15 100755..100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -204,7 +204,7 @@ void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source ) t
if ( xListener.is() )
xListener->disposing( Source );
- impl_dispose( false );
+ impl_dispose( true );
}
//--------------------------------------------------------------------------
diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
index 7c0d2ba4cea3..412fbb1c5231 100644
--- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
+++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
@@ -27,51 +27,21 @@
#ifndef DBACCESS_CORE_API_SINGLESELECTQUERYCOMPOSER_HXX
#define DBACCESS_CORE_API_SINGLESELECTQUERYCOMPOSER_HXX
-#ifndef _COM_SUN_STAR_SDB_XPARAMETERSSUPPLIER_HPP_
#include <com/sun/star/sdb/XParametersSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_
#include <com/sun/star/script/XTypeConverter.hpp>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE5_HXX_
#include <cppuhelper/implbase5.hxx>
-#endif
-#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
#include <connectivity/sqliterator.hxx>
-#endif
-#ifndef _CONNECTIVITY_SQLPARSE_HXX
#include <connectivity/sqlparse.hxx>
-#endif
-#ifndef _DBASHARED_APITOOLS_HXX_
#include "apitools.hxx"
-#endif
-#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
#include <comphelper/broadcasthelper.hxx>
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
#include <comphelper/proparrhlp.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTYCONTAINER_HXX_
#include <comphelper/propertycontainer.hxx>
-#endif
-#ifndef COMPHELPER_COMPONENTCONTEXT_HXX
#include <comphelper/componentcontext.hxx>
-#endif
#include <memory>
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index f624853c8852..8559c3249feb 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -32,6 +32,7 @@
#include "dbustrings.hrc"
#include "advancedsettingsdlg.hxx"
#include "subcomponentmanager.hxx"
+#include "closeveto.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/beans/NamedValue.hpp>
@@ -1300,8 +1301,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
::comphelper::NamedValueCollection aCreationArgs;
aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId );
- Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
- Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY );
+ const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
+ const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY );
onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL );
}
}
@@ -1352,8 +1353,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
{
RelationDesigner aDesigner( getORB(), this, m_aCurrentFrame.getFrame() );
- Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
- Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
+ const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
+ const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
onDocumentOpened( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, NULL );
}
}
@@ -1949,6 +1950,9 @@ IMPL_LINK( OApplicationController, OnCreateWithPilot, void*, _pType )
// -----------------------------------------------------------------------------
void OApplicationController::newElementWithPilot( ElementType _eType )
{
+ CloseVeto aKeepDoc( getFrame() );
+ // prevent the document being closed while the wizard is open
+
OSL_ENSURE( getContainer(), "OApplicationController::newElementWithPilot: without a view?" );
switch ( _eType )
@@ -2710,61 +2714,83 @@ void SAL_CALL OApplicationController::attachFrame( const Reference< XFrame > & i
sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException )
{
::osl::MutexGuard aGuard( getMutex() );
- Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY );
- if ( !xOfficeDoc.is() && _rxModel.is() )
+ const Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY );
+ const Reference< XModifiable > xDocModify( _rxModel, UNO_QUERY );
+ if ( ( !xOfficeDoc.is() || !xDocModify.is() ) && _rxModel.is() )
{
DBG_ERROR( "OApplicationController::attachModel: invalid model!" );
return sal_False;
}
- DBG_ASSERT( !( m_xModel.is() && ( m_xModel != _rxModel ) ),
- "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" );
- // at least: remove as property change listener from the old model/data source
+ if ( m_xModel.is() && ( m_xModel != _rxModel ) && ( _rxModel.is() ) )
+ {
+ OSL_ENSURE( false, "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" );
+ // we'd need to completely update our view here, close sub components, and the like
+ return sal_False;
+ }
+
+ const ::rtl::OUString aPropertyNames[] =
+ {
+ PROPERTY_URL, PROPERTY_USER
+ };
+
+ // disconnect from old model
+ try
+ {
+ if ( m_xDataSource.is() )
+ {
+ for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
+ {
+ m_xDataSource->removePropertyChangeListener( aPropertyNames[i], this );
+ }
+ }
+
+ Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
+ if ( xBroadcaster.is() )
+ xBroadcaster->removeModifyListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
m_xModel = _rxModel;
- if ( m_xModel.is() )
+ m_xDocumentModify = xDocModify;
+ m_xDataSource.set( xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference< XDataSource >(), UNO_QUERY );
+
+ // connect to new model
+ try
{
- m_xDocumentModify.set( m_xModel, UNO_QUERY_THROW );
+ if ( m_xDataSource.is() )
+ {
+ for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
+ {
+ m_xDataSource->addPropertyChangeListener( aPropertyNames[i], this );
+ }
+ }
+
+ Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( this );
+
}
- else
+ catch( const Exception& )
{
- m_xDocumentModify.clear();
+ DBG_UNHANDLED_EXCEPTION();
}
- m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference<XDataSource>(),UNO_QUERY);
+ // initial preview mode
if ( m_xDataSource.is() )
{
try
{
- m_xDataSource->addPropertyChangeListener(PROPERTY_INFO, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_URL, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_ISPASSWORDREQUIRED, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_LAYOUTINFORMATION, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_SUPPRESSVERSIONCL, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_TABLEFILTER, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_TABLETYPEFILTER, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_USER, this);
// to get the 'modified' for the data source
- Reference< XModifyBroadcaster > xBroadcaster(m_xModel, UNO_QUERY);
- if ( xBroadcaster.is() )
- xBroadcaster->addModifyListener(static_cast<XModifyListener*>(this));
-
- Sequence<PropertyValue> aFields;
- m_xDataSource->getPropertyValue(PROPERTY_LAYOUTINFORMATION) >>= aFields;
- PropertyValue *pIter = aFields.getArray();
- PropertyValue *pEnd = pIter + aFields.getLength();
- for (; pIter != pEnd && pIter->Name != INFO_PREVIEW; ++pIter)
- ;
-
- if ( pIter != pEnd )
+ ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
+ if ( aLayoutInfo.has( (rtl::OUString)INFO_PREVIEW ) )
{
- sal_Int32 nValue = 0;
- pIter->Value >>= nValue;
- m_ePreviewMode = static_cast<PreviewMode>(nValue);
+ const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( (rtl::OUString)INFO_PREVIEW, (sal_Int32)0 ) );
+ m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode );
if ( getView() )
- {
- getContainer()->switchPreview(m_ePreviewMode);
- }
+ getContainer()->switchPreview( m_ePreviewMode );
}
}
catch( const Exception& )
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index e6159a204d2a..f7fb899388c6 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -670,7 +670,6 @@ void OApplicationController::askToReconnect()
void OApplicationController::onDocumentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nType,
const ElementOpenMode _eMode, const Reference< XComponent >& _xDocument, const Reference< XComponent >& _rxDefinition )
{
- OSL_PRECOND( _xDocument.is(), "OApplicationController::onDocumentOpened: illegal document!" );
if ( !_xDocument.is() )
return;
diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src
index 4af2bdb70521..529e6ac55009 100644
--- a/dbaccess/source/ui/app/app.src
+++ b/dbaccess/source/ui/app/app.src
@@ -261,19 +261,19 @@ Menu RID_MENU_APP_EDIT
MenuItem
{
Identifier = SID_DB_APP_DSPROPS;
- Text[ en-US ] = "Properties";
+ Text[ en-US ] = "Properties...";
Command = ".uno:DBDSProperties";
};
MenuItem
{
Identifier = SID_DB_APP_DSCONNECTION_TYPE;
- Text[ en-US ] = "Connection Type";
+ Text[ en-US ] = "Connection Type...";
Command = ".uno:DBDSConnectionType";
};
MenuItem
{
Identifier = SID_DB_APP_DSADVANCED_SETTINGS;
- Text[ en-US ] = "Advanced Settings";
+ Text[ en-US ] = "Advanced Settings...";
Command = ".uno:DBDSAdvancedSettings";
};
};
diff --git a/dbaccess/source/ui/app/closeveto.cxx b/dbaccess/source/ui/app/closeveto.cxx
new file mode 100644
index 000000000000..558df26b643e
--- /dev/null
+++ b/dbaccess/source/ui/app/closeveto.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_dbaccess.hxx"
+
+#include "closeveto.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/util/XCloseable.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/ref.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::util::XCloseable;
+ using ::com::sun::star::util::XCloseListener;
+ using ::com::sun::star::util::CloseVetoException;
+ using ::com::sun::star::lang::EventObject;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= CloseListener_Impl
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper1 < XCloseListener
+ > CloseListener_Base;
+ class DBACCESS_DLLPRIVATE CloseListener_Impl : public CloseListener_Base
+ {
+ public:
+ CloseListener_Impl()
+ :m_bHasOwnership( false )
+ {
+ }
+
+ // XCloseListener
+ virtual void SAL_CALL queryClosing( const EventObject& Source, ::sal_Bool GetsOwnership ) throw (CloseVetoException, RuntimeException);
+ virtual void SAL_CALL notifyClosing( const EventObject& Source ) throw (RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source) throw (RuntimeException);
+
+ bool hasOwnership() const { return m_bHasOwnership; }
+
+ protected:
+ ~CloseListener_Impl()
+ {
+ }
+
+ private:
+ bool m_bHasOwnership;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL CloseListener_Impl::queryClosing( const EventObject& i_source, ::sal_Bool i_deliverOwnership ) throw (CloseVetoException, RuntimeException)
+ {
+ (void)i_source;
+
+ if ( !m_bHasOwnership )
+ m_bHasOwnership = i_deliverOwnership;
+
+ throw CloseVetoException();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL CloseListener_Impl::notifyClosing( const EventObject& i_source ) throw (RuntimeException)
+ {
+ (void)i_source;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL CloseListener_Impl::disposing( const EventObject& i_source ) throw (RuntimeException)
+ {
+ (void)i_source;
+ }
+
+ //==================================================================================================================
+ //= CloseVeto_Data
+ //==================================================================================================================
+ struct DBACCESS_DLLPRIVATE CloseVeto_Data
+ {
+ Reference< XCloseable > xCloseable;
+ ::rtl::Reference< CloseListener_Impl > pListener;
+ };
+
+ //==================================================================================================================
+ //= operations
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_init( CloseVeto_Data& i_data, const Reference< XInterface >& i_closeable )
+ {
+ i_data.xCloseable.set( i_closeable, UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( i_data.xCloseable.is(), "CloseVeto: the component is not closeable!" );
+
+ i_data.pListener = new CloseListener_Impl;
+ i_data.xCloseable->addCloseListener( i_data.pListener.get() );
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_deinit( CloseVeto_Data& i_data )
+ {
+ if ( !i_data.xCloseable.is() )
+ return;
+
+ i_data.xCloseable->removeCloseListener( i_data.pListener.get() );
+ if ( i_data.pListener->hasOwnership() )
+ {
+ try
+ {
+ i_data.xCloseable->close( sal_True );
+ }
+ catch( const CloseVetoException& ) { }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ }
+
+ //==================================================================================================================
+ //= CloseVeto
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ CloseVeto::CloseVeto( const Reference< XInterface >& i_closeable )
+ :m_pData( new CloseVeto_Data )
+ {
+ lcl_init( *m_pData, i_closeable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ CloseVeto::~CloseVeto()
+ {
+ lcl_deinit( *m_pData );
+ }
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
diff --git a/dbaccess/source/ui/app/closeveto.hxx b/dbaccess/source/ui/app/closeveto.hxx
new file mode 100644
index 000000000000..f7e1c83644d1
--- /dev/null
+++ b/dbaccess/source/ui/app/closeveto.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef DBACCESS_CLOSEVETO_HXX
+#define DBACCESS_CLOSEVETO_HXX
+
+#include "dbaccessdllapi.h"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/XInterface.hpp>
+/** === end UNO includes === **/
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= CloseVeto
+ //==================================================================================================================
+ struct CloseVeto_Data;
+ /** will add a XCloseListener to a given component, and veto its closing as long as the <code>CloseVeto</code>
+ instance is alive.
+
+ If closing has been requested and vetoed while the <code>CloseVeto</code> instance is alive, and the ownership
+ went to the <code>CloseVeto</code> instance, then it will close the component in its dtor.
+ */
+ class DBACCESS_DLLPRIVATE CloseVeto
+ {
+ public:
+ CloseVeto( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_closeable );
+ ~CloseVeto();
+
+ private:
+ ::boost::scoped_ptr< CloseVeto_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
+
+#endif // DBACCESS_CLOSEVETO_HXX
diff --git a/dbaccess/source/ui/app/makefile.mk b/dbaccess/source/ui/app/makefile.mk
index a7097b4330e1..e26927d99628 100644
--- a/dbaccess/source/ui/app/makefile.mk
+++ b/dbaccess/source/ui/app/makefile.mk
@@ -48,7 +48,8 @@ EXCEPTIONSFILES=\
$(SLO)$/AppSwapWindow.obj \
$(SLO)$/AppTitleWindow.obj \
$(SLO)$/AppView.obj \
- $(SLO)$/subcomponentmanager.obj
+ $(SLO)$/subcomponentmanager.obj \
+ $(SLO)$/closeveto.obj
SLOFILES =\
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 200c87a729b3..99208c0de2ae 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -965,6 +965,9 @@ void OGenericUnoController::disposing()
m_xMasterDispatcher = NULL;
m_xSlaveDispatcher = NULL;
m_xServiceFactory = NULL;
+ m_xTitleHelper.clear();
+ m_xUrlTransformer.clear();
+ m_aInitParameters.clear();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index a187217f2f5f..8e7c75418875 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -469,7 +469,7 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow()
// check if the order columns apply to tables which really exist in the statement
const Reference< XIndexAccess > xOrderColumns( xComposer->getOrderColumns(), UNO_SET_THROW );
const sal_Int32 nOrderColumns( xOrderColumns->getCount() );
- bool invalidColumn = false;
+ bool invalidColumn = nOrderColumns == 0;
for ( sal_Int32 c=0; ( c < nOrderColumns ) && !invalidColumn; ++c )
{
const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW );
@@ -2701,6 +2701,8 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
sStatus.SearchAndReplaceAscii("$name$", aName);
BrowserViewStatusDisplay aShowStatus(static_cast<UnoDataBrowserView*>(getView()), sStatus);
+
+ sal_Bool bEscapeProcessing = sal_True;
if(xNameAccess.is() && xNameAccess->hasByName(sSimpleName))
{
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pEntry->GetUserData());
@@ -2711,38 +2713,42 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
{
pData->xObjectProperties = pData->xObjectProperties.query( xObject );
// if the query contains a parameterized statement and preview is enabled we won't get any data.
- if ( m_bPreview && nCommandType == CommandType::QUERY && xObject.is() )
+ if ( nCommandType == CommandType::QUERY && xObject.is() )
{
- ::rtl::OUString sSql;
Reference<XPropertySet> xObjectProps(xObject,UNO_QUERY);
- xObjectProps->getPropertyValue(PROPERTY_COMMAND) >>= sSql;
- Reference< XMultiServiceFactory > xFactory( pConData->xConnection, UNO_QUERY );
- if (xFactory.is())
+ xObjectProps->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) >>= bEscapeProcessing;
+ if ( m_bPreview )
{
- try
+ ::rtl::OUString sSql;
+ xObjectProps->getPropertyValue(PROPERTY_COMMAND) >>= sSql;
+ Reference< XMultiServiceFactory > xFactory( pConData->xConnection, UNO_QUERY );
+ if (xFactory.is())
{
- Reference<XSingleSelectQueryAnalyzer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
- if ( xAnalyzer.is() )
+ try
{
- xAnalyzer->setQuery(sSql);
- Reference<XParametersSupplier> xParSup(xAnalyzer,UNO_QUERY);
- if ( xParSup->getParameters()->getCount() > 0 )
+ Reference<XSingleSelectQueryAnalyzer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
+ if ( xAnalyzer.is() )
{
- String sFilter = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "));
- sFilter = sFilter + xAnalyzer->getFilter();
- String sReplace(sSql);
- sReplace.SearchAndReplace(sFilter,String());
- xAnalyzer->setQuery(sReplace);
- Reference<XSingleSelectQueryComposer> xComposer(xAnalyzer,UNO_QUERY);
- xComposer->setFilter(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0=1")));
- aName = xAnalyzer->getQuery();
- nCommandType = CommandType::COMMAND;
+ xAnalyzer->setQuery(sSql);
+ Reference<XParametersSupplier> xParSup(xAnalyzer,UNO_QUERY);
+ if ( xParSup->getParameters()->getCount() > 0 )
+ {
+ String sFilter = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "));
+ sFilter = sFilter + xAnalyzer->getFilter();
+ String sReplace(sSql);
+ sReplace.SearchAndReplace(sFilter,String());
+ xAnalyzer->setQuery(sReplace);
+ Reference<XSingleSelectQueryComposer> xComposer(xAnalyzer,UNO_QUERY);
+ xComposer->setFilter(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0=1")));
+ aName = xAnalyzer->getQuery();
+ nCommandType = CommandType::COMMAND;
+ }
}
}
- }
- catch (Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
+ catch (Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
}
}
@@ -2751,7 +2757,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
}
String sDataSourceName( getDataSourceAcessor( pConnection ) );
- bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, sal_True, pConData->xConnection );
+ bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, bEscapeProcessing, pConData->xConnection );
if ( !bSuccess )
{ // clean up
criticalFail();
diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src
index 9a2dc467d586..b78536762287 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.src
+++ b/dbaccess/source/ui/dlg/advancedsettings.src
@@ -382,5 +382,5 @@ TabDialog DLG_DATABASE_ADVANCED
Text [ en-US ] = "Special Settings";
};
- Text [ en-US ] = "Advanced Properties" ;
+ Text [ en-US ] = "Advanced Settings" ;
};
diff --git a/dbaccess/source/ui/inc/dbu_qry.hrc b/dbaccess/source/ui/inc/dbu_qry.hrc
index 26bd4c82b374..bf09f2356de4 100644
--- a/dbaccess/source/ui/inc/dbu_qry.hrc
+++ b/dbaccess/source/ui/inc/dbu_qry.hrc
@@ -56,8 +56,8 @@
#define STR_QUERY_NOTABLE RID_STR_QRY_START + 21
#define STR_QRY_ORDERBY_UNRELATED RID_STR_QRY_START + 22
#define STR_QUERY_HANDLETEXT RID_STR_QRY_START + 23
-#define STR_QUERY_FALSE RID_STR_QRY_START + 24
-#define STR_QUERY_TRUE RID_STR_QRY_START + 25
+// free
+// free
#define STR_QRY_TOO_MANY_COLUMNS RID_STR_QRY_START + 26
#define STR_SVT_SQL_SYNTAX_ERROR RID_STR_QRY_START + 27
#define STR_QUERYDESIGN_NO_VIEW_SUPPORT RID_STR_QRY_START + 28
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 9e134b784ea1..2507f94cc5e8 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -447,7 +447,8 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl
if ( eNumLang != LANGUAGE_NONE )
{
nFormatKey = m_pFormatter->GetFormatForLanguageIfBuiltIn( nFormatKey, eNumLang );
- m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber );
+ if ( !m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber ) )
+ return NumberFormat::TEXT;
}
Reference<XPropertySet> xProp = xFormats->getByKey(nFormatKey);
xProp->getPropertyValue(PROPERTY_TYPE) >>= nNumberFormat;
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index 68f702b11d75..bcbfd019e48d 100644
--- a/dbaccess/source/ui/misc/databaseobjectview.cxx
+++ b/dbaccess/source/ui/misc/databaseobjectview.cxx
@@ -162,9 +162,6 @@ namespace dbaui
0,
i_rDispatchArgs.getPropertyValues()
);
-
- if ( !xReturn.is() )
- xReturn.set( m_xFrameLoader, UNO_QUERY );
}
catch( const Exception& )
{
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 35d46b2f9a5e..8b3911985549 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2061,6 +2061,13 @@ namespace
break;
}
+ const OSQLParseNode* pTableExp = pParseTree->getChild(3);
+ if ( pTableExp->getChild(6)->count() > 0 || pTableExp->getChild(7)->count() > 0 || pTableExp->getChild(8)->count() > 0)
+ {
+ eErrorCode = eStatementTooComplex;
+ break;
+ }
+
Reference< XConnection> xConnection = rController.getConnection();
if ( !xConnection.is() )
{
@@ -2142,7 +2149,7 @@ namespace
pTableView->RemoveTabWin(aIterTableMap->second);
}
- if ( eOk == (eErrorCode = FillOuterJoins(_pView,pParseTree->getChild(3)->getChild(0)->getChild(1))) )
+ if ( eOk == (eErrorCode = FillOuterJoins(_pView,pTableExp->getChild(0)->getChild(1))) )
{
// check if we have a distinct statement
if(SQL_ISTOKEN(pParseTree->getChild(1),DISTINCT))
diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src
index d8a2162e1d14..01e4182e72ff 100644
--- a/dbaccess/source/ui/querydesign/query.src
+++ b/dbaccess/source/ui/querydesign/query.src
@@ -281,14 +281,6 @@ ErrorBox ERR_QRY_ORDERBY_ON_ASTERISK
{
Message [ en-US ] = "[*] cannot be used as a sort criterion.";
};
-String STR_QUERY_TRUE
-{
- Text [ en-US ] = "TRUE" ;
-};
-String STR_QUERY_FALSE
-{
- Text [ en-US ] = "FALSE" ;
-};
String STR_QRY_TOO_MANY_TABLES
{
Text [ en-US ] = "There are too many tables.";
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index bb0231ba30b0..b11a18c8de74 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -629,6 +629,7 @@ TOTypeInfoSP OFieldDescription::getSpecialTypeInfo() const
*pSpecialType = *m_pType;
pSpecialType->nPrecision = GetPrecision();
pSpecialType->nMaximumScale = static_cast<sal_Int16>(GetScale());
+ pSpecialType->bAutoIncrement = IsAutoIncrement(); // http://dba.openoffice.org/issues/show_bug.cgi?id=115398 fixed by ludob
return pSpecialType;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index ea3c1afbe28a..054653694a4c 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -443,20 +443,14 @@ void OTableEditorCtrl::PaintCell(OutputDevice& rDev, const Rectangle& rRect,
sal_uInt16 nColumnId ) const
{
DBG_CHKTHIS(OTableEditorCtrl,NULL);
- String aText( GetCellText( m_nCurrentPos, nColumnId ));
- Point aPos(rRect.TopLeft());
- Size TxtSize(GetDataWindow().GetTextWidth(aText), GetDataWindow().GetTextHeight());
-
- if (aPos.X() < rRect.Right() || aPos.X() + TxtSize.Width() > rRect.Right() ||
- aPos.Y() < rRect.Top() || aPos.Y() + TxtSize.Height() > rRect.Bottom())
- rDev.SetClipRegion( rRect );
-
- rDev.DrawText(aPos, aText);
-
- if (rDev.IsClipRegion())
- rDev.SetClipRegion();
-// rDev.DrawText(rRect.TopLeft(), aText);
-// rDev.SetClipRegion( );
+ const String aText( GetCellText( m_nCurrentPos, nColumnId ));
+ const Point aPos(rRect.TopLeft());
+ const Size TxtSize(GetDataWindow().GetTextWidth(aText), GetDataWindow().GetTextHeight());
+
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.SetClipRegion( rRect );
+ rDev.DrawText( rRect, aText, TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER );
+ rDev.Pop();
}
//------------------------------------------------------------------------------
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 650a7585d929..0035b67d8ef7 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -1779,17 +1779,23 @@ void BackendImpl::ComponentsPackageImpl::processPackage_(
if (doRegisterPackage) {
ComponentBackendDb::Data data;
data.javaTypeLibrary = false;
- std::vector< css::uno::Reference< css::uno::XInterface > > factories;
- css::uno::Reference< css::uno::XComponentContext > context(
- that->getObject(url), css::uno::UNO_QUERY);
- if (!context.is()) {
- context.set(
- that->insertObject(
- url,
- raise_uno_process(
- that->getComponentContext(), abortChannel)),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::uno::XComponentContext > context;
+ if (startup) {
+ context = that->getComponentContext();
+ } else {
+ context.set(that->getObject(url), css::uno::UNO_QUERY);
+ if (!context.is()) {
+ context.set(
+ that->insertObject(
+ url,
+ raise_uno_process(
+ that->getComponentContext(), abortChannel)),
+ css::uno::UNO_QUERY_THROW);
+ }
}
+
+ std::vector< css::uno::Reference< css::uno::XInterface > > factories;
+
css::uno::Reference< css::registry::XSimpleRegistry > registry(
css::uno::Reference< css::lang::XMultiComponentFactory >(
that->getComponentContext()->getServiceManager(),
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index b845ed189aad..c8899514d5a3 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -865,7 +865,7 @@ namespace drawinglayer
// I have now moved describePDFControl to toolkit, thus i can implement the PDF
// form control support now as follows
::std::auto_ptr< ::vcl::PDFWriter::AnyWidget > pPDFControl;
- ::toolkitform::describePDFControl(rXControl, pPDFControl);
+ ::toolkitform::describePDFControl( rXControl, pPDFControl, *mpPDFExtOutDevData );
if(pPDFControl.get())
{
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index f2a94c2dd1a6..352ff91d2e9e 100755
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2756,7 +2756,10 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS
// get word boundaries in order to clear possible WrongList entries
// and invalidate all the necessary text (everything after and including the
// start of the word)
- EditSelection aCurWord( SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD ) );
+ // #i107201# do the expensive SelectWord call only if online spelling is active
+ EditSelection aCurWord;
+ if ( GetStatus().DoOnlineSpelling() )
+ aCurWord = SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD );
XubString aText( rStr );
aText.ConvertLineEnd( LINEEND_LF );
@@ -2813,12 +2816,17 @@ EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS
ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
DBG_ASSERT( pPortion, "Blinde Portion in InsertText" );
- // now remove the Wrongs (red spell check marks) from both words...
- WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList();
- if (pWrongs && pWrongs->HasWrongs())
- pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() );
- // ... and mark both words as 'to be checked again'
- pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() );
+ if ( GetStatus().DoOnlineSpelling() )
+ {
+ // now remove the Wrongs (red spell check marks) from both words...
+ WrongList *pWrongs = aCurPaM.GetNode()->GetWrongList();
+ if (pWrongs && pWrongs->HasWrongs())
+ pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() );
+ // ... and mark both words as 'to be checked again'
+ pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() );
+ }
+ else
+ pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.Len() );
}
if ( nEnd < aText.Len() )
aPaM = ImpInsertParaBreak( aPaM );
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index d7c56b293523..8ff11dfc2f59 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -2905,7 +2905,7 @@ void ODatabaseForm::load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirs
// a database form always uses caching
// we use starting fetchsize with at least 10 rows
if (bConnected)
- m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)10));
+ m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)40));
// if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded"
// so we don't need to execute the statement again, this was already done
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index c3f759696ef9..113d664acf33 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -675,7 +675,6 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType )
void OEditModel::resetNoBroadcast()
{
OEditBaseModel::resetNoBroadcast();
- m_aLastKnownValue.clear();
}
//------------------------------------------------------------------------------
@@ -683,38 +682,34 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( aNewValue != m_aLastKnownValue )
- {
- ::rtl::OUString sNewValue;
- aNewValue >>= sNewValue;
+ ::rtl::OUString sNewValue;
+ aNewValue >>= sNewValue;
- if ( !aNewValue.hasValue()
- || ( !sNewValue.getLength() // an empty string
- && m_bEmptyIsNull // which should be interpreted as NULL
- )
+ if ( !aNewValue.hasValue()
+ || ( !sNewValue.getLength() // an empty string
+ && m_bEmptyIsNull // which should be interpreted as NULL
)
+ )
+ {
+ m_xColumnUpdate->updateNull();
+ }
+ else
+ {
+ OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" );
+ try
{
- m_xColumnUpdate->updateNull();
- }
- else
- {
- OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" );
- try
+ if ( m_pValueFormatter.get() )
{
- if ( m_pValueFormatter.get() )
- {
- if ( !m_pValueFormatter->setFormattedValue( sNewValue ) )
- return sal_False;
- }
- else
- m_xColumnUpdate->updateString( sNewValue );
- }
- catch ( const Exception& )
- {
- return sal_False;
+ if ( !m_pValueFormatter->setFormattedValue( sNewValue ) )
+ return sal_False;
}
+ else
+ m_xColumnUpdate->updateString( sNewValue );
+ }
+ catch ( const Exception& )
+ {
+ return sal_False;
}
- m_aLastKnownValue = aNewValue;
}
return sal_True;
@@ -724,6 +719,7 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
Any OEditModel::translateDbColumnToControlValue()
{
OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::translateDbColumnToControlValue: no value formatter!" );
+ Any aRet;
if ( m_pValueFormatter.get() )
{
::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() );
@@ -732,7 +728,6 @@ Any OEditModel::translateDbColumnToControlValue()
&& m_pValueFormatter->getColumn()->wasNull()
)
{
- m_aLastKnownValue.clear();
}
else
{
@@ -744,14 +739,11 @@ Any OEditModel::translateDbColumnToControlValue()
sValue = sValue.replaceAt( nMaxTextLen, nDiff, ::rtl::OUString() );
}
- m_aLastKnownValue <<= sValue;
+ aRet <<= sValue;
}
}
- else
- m_aLastKnownValue.clear();
- return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() );
- // (m_aLastKnownValue is alllowed to be VOID, the control value isn't)
+ return aRet.hasValue() ? aRet : makeAny( ::rtl::OUString() );
}
//------------------------------------------------------------------------------
diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx
index 5b4146b82d06..3b4c7c55a436 100644
--- a/forms/source/component/Edit.hxx
+++ b/forms/source/component/Edit.hxx
@@ -44,7 +44,6 @@ namespace frm
class OEditModel
:public OEditBaseModel
{
- ::com::sun::star::uno::Any m_aLastKnownValue;
::std::auto_ptr< ::dbtools::FormattedColumnValue >
m_pValueFormatter;
sal_Bool m_bMaxTextLenModified : 1; // set to <TRUE/> when we change the MaxTextLen of the aggregate
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index 63195bf74af0..5f36934cb98e 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -1040,10 +1040,10 @@ sal_Bool OFormattedModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
m_xColumnUpdate->updateNull();
else
{
- // als Value koennen nur double, string oder void auftreten
try
{
- if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE )
+ double f = 0.0;
+ if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323
{
DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType );
}
diff --git a/formula/inc/formula/compiler.hrc b/formula/inc/formula/compiler.hrc
index e4dc05aca4e9..5c58d9d3e068 100644
--- a/formula/inc/formula/compiler.hrc
+++ b/formula/inc/formula/compiler.hrc
@@ -130,67 +130,71 @@
#define SC_OPCODE_ARC_COS_HYP 95
#define SC_OPCODE_ARC_TAN_HYP 96
#define SC_OPCODE_ARC_COT_HYP 97
-#define SC_OPCODE_EXP 98
-#define SC_OPCODE_LN 99
-#define SC_OPCODE_SQRT 100
-#define SC_OPCODE_FACT 101
-#define SC_OPCODE_GET_YEAR 102 /* date and time */
-#define SC_OPCODE_GET_MONTH 103
-#define SC_OPCODE_GET_DAY 104
-#define SC_OPCODE_GET_HOUR 105
-#define SC_OPCODE_GET_MIN 106
-#define SC_OPCODE_GET_SEC 107
-#define SC_OPCODE_PLUS_MINUS 108 /* miscellaneous */
-#define SC_OPCODE_ABS 109
-#define SC_OPCODE_INT 110
-#define SC_OPCODE_PHI 111
-#define SC_OPCODE_GAUSS 112
-#define SC_OPCODE_IS_EMPTY 113 /* obtain type */
-#define SC_OPCODE_IS_STRING 114
-#define SC_OPCODE_IS_NON_STRING 115
-#define SC_OPCODE_IS_LOGICAL 116
-#define SC_OPCODE_TYPE 117
-#define SC_OPCODE_IS_REF 118
-#define SC_OPCODE_IS_VALUE 119
-#define SC_OPCODE_IS_FORMULA 120
-#define SC_OPCODE_IS_NV 121
-#define SC_OPCODE_IS_ERR 122
-#define SC_OPCODE_IS_ERROR 123
-#define SC_OPCODE_IS_EVEN 124
-#define SC_OPCODE_IS_ODD 125
-#define SC_OPCODE_N 126
-#define SC_OPCODE_GET_DATE_VALUE 127 /* string functions */
-#define SC_OPCODE_GET_TIME_VALUE 128
-#define SC_OPCODE_CODE 129
-#define SC_OPCODE_TRIM 130
-#define SC_OPCODE_UPPER 131
-#define SC_OPCODE_PROPPER 132
-#define SC_OPCODE_LOWER 133
-#define SC_OPCODE_LEN 134
-#define SC_OPCODE_T 135 /* miscellaneous, part 21 */
-#define SC_OPCODE_VALUE 136
-#define SC_OPCODE_CLEAN 137
-#define SC_OPCODE_CHAR 138
-#define SC_OPCODE_LOG10 139
-#define SC_OPCODE_EVEN 140
-#define SC_OPCODE_ODD 141
-#define SC_OPCODE_STD_NORM_DIST 142
-#define SC_OPCODE_FISHER 143
-#define SC_OPCODE_FISHER_INV 144
-#define SC_OPCODE_S_NORM_INV 145
-#define SC_OPCODE_GAMMA_LN 146
-#define SC_OPCODE_ERROR_TYPE 147
-#define SC_OPCODE_ERR_CELL 148
-#define SC_OPCODE_FORMULA 149
-#define SC_OPCODE_ARABIC 150
-#define SC_OPCODE_INFO 151
-#define SC_OPCODE_BAHTTEXT 152
-#define SC_OPCODE_JIS 153
-#define SC_OPCODE_ASC 154
-#define SC_OPCODE_UNICODE 155
-#define SC_OPCODE_UNICHAR 156
-#define SC_OPCODE_GAMMA 157
-#define SC_OPCODE_STOP_1_PAR 158
+#define SC_OPCODE_COSECANT 98
+#define SC_OPCODE_SECANT 99
+#define SC_OPCODE_COSECANT_HYP 100
+#define SC_OPCODE_SECANT_HYP 101
+#define SC_OPCODE_EXP 102
+#define SC_OPCODE_LN 103
+#define SC_OPCODE_SQRT 104
+#define SC_OPCODE_FACT 105
+#define SC_OPCODE_GET_YEAR 106 /* date and time */
+#define SC_OPCODE_GET_MONTH 107
+#define SC_OPCODE_GET_DAY 108
+#define SC_OPCODE_GET_HOUR 109
+#define SC_OPCODE_GET_MIN 110
+#define SC_OPCODE_GET_SEC 111
+#define SC_OPCODE_PLUS_MINUS 112 /* miscellaneous */
+#define SC_OPCODE_ABS 113
+#define SC_OPCODE_INT 114
+#define SC_OPCODE_PHI 115
+#define SC_OPCODE_GAUSS 116
+#define SC_OPCODE_IS_EMPTY 117 /* obtain type */
+#define SC_OPCODE_IS_STRING 118
+#define SC_OPCODE_IS_NON_STRING 119
+#define SC_OPCODE_IS_LOGICAL 120
+#define SC_OPCODE_TYPE 121
+#define SC_OPCODE_IS_REF 122
+#define SC_OPCODE_IS_VALUE 123
+#define SC_OPCODE_IS_FORMULA 124
+#define SC_OPCODE_IS_NV 125
+#define SC_OPCODE_IS_ERR 126
+#define SC_OPCODE_IS_ERROR 127
+#define SC_OPCODE_IS_EVEN 128
+#define SC_OPCODE_IS_ODD 129
+#define SC_OPCODE_N 130
+#define SC_OPCODE_GET_DATE_VALUE 131 /* string functions */
+#define SC_OPCODE_GET_TIME_VALUE 132
+#define SC_OPCODE_CODE 133
+#define SC_OPCODE_TRIM 134
+#define SC_OPCODE_UPPER 135
+#define SC_OPCODE_PROPPER 136
+#define SC_OPCODE_LOWER 137
+#define SC_OPCODE_LEN 138
+#define SC_OPCODE_T 139 /* miscellaneous, part 21 */
+#define SC_OPCODE_VALUE 140
+#define SC_OPCODE_CLEAN 141
+#define SC_OPCODE_CHAR 142
+#define SC_OPCODE_LOG10 143
+#define SC_OPCODE_EVEN 144
+#define SC_OPCODE_ODD 145
+#define SC_OPCODE_STD_NORM_DIST 146
+#define SC_OPCODE_FISHER 147
+#define SC_OPCODE_FISHER_INV 148
+#define SC_OPCODE_S_NORM_INV 149
+#define SC_OPCODE_GAMMA_LN 150
+#define SC_OPCODE_ERROR_TYPE 151
+#define SC_OPCODE_ERR_CELL 152
+#define SC_OPCODE_FORMULA 153
+#define SC_OPCODE_ARABIC 154
+#define SC_OPCODE_INFO 155
+#define SC_OPCODE_BAHTTEXT 156
+#define SC_OPCODE_JIS 157
+#define SC_OPCODE_ASC 158
+#define SC_OPCODE_UNICODE 159
+#define SC_OPCODE_UNICHAR 160
+#define SC_OPCODE_GAMMA 161
+#define SC_OPCODE_STOP_1_PAR 162
/*** Functions with more than one parameters ***/
#define SC_OPCODE_START_2_PAR 201
diff --git a/formula/inc/formula/opcode.hxx b/formula/inc/formula/opcode.hxx
index cfd3af767465..0e70ffc01e44 100644
--- a/formula/inc/formula/opcode.hxx
+++ b/formula/inc/formula/opcode.hxx
@@ -121,6 +121,10 @@ enum OpCodeEnum
ocArcCosHyp = SC_OPCODE_ARC_COS_HYP,
ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP,
ocArcCotHyp = SC_OPCODE_ARC_COT_HYP,
+ ocCosecant = SC_OPCODE_COSECANT,
+ ocSecant = SC_OPCODE_SECANT,
+ ocCosecantHyp = SC_OPCODE_COSECANT_HYP,
+ ocSecantHyp = SC_OPCODE_SECANT_HYP,
ocExp = SC_OPCODE_EXP,
ocLn = SC_OPCODE_LN,
ocSqrt = SC_OPCODE_SQRT,
diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index d2996e78fba7..b8a5f1250941 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -88,6 +88,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
String SC_OPCODE_ARC_COS_HYP { Text = "ACOSH" ; };
String SC_OPCODE_ARC_TAN_HYP { Text = "ATANH" ; };
String SC_OPCODE_ARC_COT_HYP { Text = "ACOTH" ; };
+ String SC_OPCODE_COSECANT { Text = "CSC" ; };
+ String SC_OPCODE_SECANT { Text = "SEC" ; };
+ String SC_OPCODE_COSECANT_HYP { Text = "CSCH" ; };
+ String SC_OPCODE_SECANT_HYP { Text = "SECH" ; };
String SC_OPCODE_EXP { Text = "EXP" ; };
String SC_OPCODE_LN { Text = "LN" ; };
String SC_OPCODE_SQRT { Text = "SQRT" ; };
@@ -412,6 +416,10 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
String SC_OPCODE_ARC_COS_HYP { Text = "ACOSH" ; };
String SC_OPCODE_ARC_TAN_HYP { Text = "ATANH" ; };
String SC_OPCODE_ARC_COT_HYP { Text = "ACOTH" ; };
+ String SC_OPCODE_COSECANT { Text = "CSC" ; };
+ String SC_OPCODE_SECANT { Text = "SEC" ; };
+ String SC_OPCODE_COSECANT_HYP { Text = "CSCH" ; };
+ String SC_OPCODE_SECANT_HYP { Text = "SECH" ; };
String SC_OPCODE_EXP { Text = "EXP" ; };
String SC_OPCODE_LN { Text = "LN" ; };
String SC_OPCODE_SQRT { Text = "SQRT" ; };
@@ -830,6 +838,22 @@ Resource RID_STRLIST_FUNCTION_NAMES
{
Text [ en-US ] = "ACOTH" ;
};
+ String SC_OPCODE_COSECANT
+ {
+ Text = "CSC" ;
+ };
+ String SC_OPCODE_SECANT
+ {
+ Text = "SEC" ;
+ };
+ String SC_OPCODE_COSECANT_HYP
+ {
+ Text = "CSCH" ;
+ };
+ String SC_OPCODE_SECANT_HYP
+ {
+ Text = "SECH" ;
+ };
String SC_OPCODE_EXP
{
Text [ en-US ] = "EXP";
diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt
index ede3f7cb4f42..18b3ca47bdf2 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/AdminExe.idt
@@ -11,3 +11,4 @@ InstallFinalize 400
InstallInitialize 250
InstallValidate 200
ScheduleReboot ISSCHEDULEREBOOT 375
+SetInstalllocation 390
diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt
index 17a47e8e9889..8708803f2cc9 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/CustomAc.idt
@@ -122,6 +122,7 @@ setAllUsersProfile2K 51 ALLUSERSPROFILE [%ALLUSERSPROFILE]
SetAllUsersProfileNT 51 ALLUSERSPROFILE [%SystemRoot]\Profiles\All Users
setUserProfileNT 51 USERPROFILE [%USERPROFILE]
SetARPInstallLocation 51 ARPINSTALLLOCATION [INSTALLLOCATION]
+SetInstalllocation 51 RegisterExtensions [INSTALLLOCATION]
NewProductFound 19 OOO_CUSTOMACTION_1
SameProductFound 19 OOO_CUSTOMACTION_2
SetLanguageSelected 51 LANG_SELECTED 1
diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt
index defde2299409..13ac5a5aaf55 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/InstallE.idt
@@ -173,6 +173,7 @@ ScheduleReboot ISSCHEDULEREBOOT 3125
SelfRegModules 2850
SelfUnregModules 1100
SetARPInstallLocation 990
+SetInstalllocation 3140
SetODBCFolders 550
StartServices VersionNT 2800
StopServices VersionNT 950
diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx
index bb91337fc40a..5829fe43cce3 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -171,10 +171,10 @@ OUString OTextInputStream::readLine( )
return implReadString( aDummySeq, sal_True, sal_True );
}
-OUString OTextInputStream::readString( const Sequence< sal_Unicode >& Delimiters, sal_Bool )
+OUString OTextInputStream::readString( const Sequence< sal_Unicode >& Delimiters, sal_Bool bRemoveDelimiter )
throw(IOException, RuntimeException)
{
- return implReadString( Delimiters, sal_True, sal_False );
+ return implReadString( Delimiters, bRemoveDelimiter, sal_False );
}
sal_Bool OTextInputStream::isEOF()
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java
index b435b480eaea..f5ff37ad4d70 100755
--- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java
@@ -39,6 +39,7 @@ import org.openoffice.setup.Util.InfoDir;
import org.openoffice.setup.Util.PackageCollector;
import org.openoffice.setup.Util.SystemManager;
import java.io.File;
+import java.util.Collections;
import java.util.Vector;
public class InstallationOngoingCtrl extends PanelController {
@@ -105,6 +106,7 @@ public class InstallationOngoingCtrl extends PanelController {
private Vector installedPackages = new Vector();
public void run() {
+ boolean ignoreMajorUpgrade = false;
LogManager.setCommandsHeaderLine("Installation");
Installer installer = InstallerFactory.getInstance();
String titleText = ResourceManager.getString("String_InstallationOngoing1");
@@ -131,32 +133,46 @@ public class InstallationOngoingCtrl extends PanelController {
installer.installPackage(packageData);
installedPackages.add(packageData);
- if ( installData.isAbortedInstallation() ) {
+ if (( installData.isAbortedInstallation() ) || ( installData.isErrorInstallation() )) {
+ ignoreMajorUpgrade = true;
break;
}
}
- if ( installData.isMajorUpgrade() ) {
+ if (( installData.isMajorUpgrade() ) && ( ! ignoreMajorUpgrade )) {
for (int i = 0; i < removePackages.size(); i++) {
PackageDescription packageData = (PackageDescription) removePackages.get(i);
installer.uninstallPackage(packageData);
}
}
- if ( installData.isAbortedInstallation() ) {
+ if (( installData.isAbortedInstallation() ) || ( installData.isErrorInstallation() )) {
// undoing the installation
- LogManager.setCommandsHeaderLine("Installation aborted!");
- titleText = ResourceManager.getString("String_UninstallationOngoing1");
+ if ( installData.isAbortedInstallation() ) {
+ LogManager.setCommandsHeaderLine("Installation aborted!");
+ titleText = ResourceManager.getString("String_UninstallationOngoing1");
+ } else {
+ LogManager.setCommandsHeaderLine("Error during installation!");
+ titleText = ResourceManager.getString("String_UninstallationOngoing1");
+ }
panel.setTitle(titleText);
panel.setStopButtonEnabled(false);
LogManager.setCommandsHeaderLine("Uninstallation");
+ // Inverting the package order for uninstallation
+ Collections.reverse(installedPackages);
+
for (int i = 0; i < installedPackages.size(); i++) {
PackageDescription packageData = (PackageDescription) installedPackages.get(i);
int progress = java.lang.Math.round(100/installedPackages.size()) * (i+1);
panel.setProgressValue(progress);
panel.setProgressText(packageData.getPackageName());
+ if ( i == 0 ) {
+ installData.setIsFirstPackage(true);
+ } else {
+ installData.setIsFirstPackage(false);
+ }
installer.uninstallPackage(packageData);
}
@@ -185,7 +201,7 @@ public class InstallationOngoingCtrl extends PanelController {
getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_CANCEL);
InstallData installData = InstallData.getInstance();
- if ( ! installData.isAbortedInstallation() ) {
+ if (( ! installData.isAbortedInstallation() ) && ( ! installData.isErrorInstallation() )) {
InfoDir.prepareUninstallation();
}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java
index 358ebd489db4..71b1f702f2e8 100755
--- a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java
@@ -78,6 +78,7 @@ public class InstallData
static private boolean isDebianSystem = false;
static private boolean useForceDebian = false; /* --force-debian */
static private boolean debianInvestigated = false;
+ static private boolean isFirstPackage = false;
static private String installType; /* custom or typical installation */
static private String osType; /* Linux, SunOS, ... */
static private String installDir = null;
@@ -668,6 +669,14 @@ public class InstallData
isDebianSystem = value;
}
+ public boolean isFirstPackage() {
+ return isFirstPackage;
+ }
+
+ public void setIsFirstPackage(boolean value) {
+ isFirstPackage = value;
+ }
+
public boolean useForceDebian() {
return useForceDebian;
}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java
index 4383904569c0..c13f32f68339 100755
--- a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java
@@ -346,6 +346,7 @@ public class LinuxInstaller extends Installer {
String forceDebianString = "";
String nodepsString = "";
+ String noscriptsString = "";
if ( ! data.debianInvestigated() ) {
helper.investigateDebian(data);
@@ -360,6 +361,10 @@ public class LinuxInstaller extends Installer {
}
}
+ if (( data.isErrorInstallation() ) && ( data.isFirstPackage() )) {
+ noscriptsString = "--noscripts";
+ }
+
// Defining a Vector that contains the full rpm command. Then the string array can be
// created dynamically. Otherwise there would be too many different scenarios.
@@ -375,6 +380,10 @@ public class LinuxInstaller extends Installer {
rpmVector.add(nodepsString);
}
+ if ( ! noscriptsString.equals("") ) {
+ rpmVector.add(noscriptsString);
+ }
+
rpmVector.add("-ev");
if ( useLocalDatabase ) {
diff --git a/offapi/com/sun/star/security/CertAltNameEntry.idl b/offapi/com/sun/star/security/CertAltNameEntry.idl
new file mode 100644
index 000000000000..1ef827b77f89
--- /dev/null
+++ b/offapi/com/sun/star/security/CertAltNameEntry.idl
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef __com_sun_star_security_CertAltNameEntry_idl__
+#define __com_sun_star_security_CertAltNameEntry_idl__
+
+#include <com/sun/star/security/ExtAltNameType.idl>
+
+//=============================================================================
+
+ module com { module sun { module star { module security {
+
+//=============================================================================
+/**
+ * struct contains a single entry within a Subject Alternative Name Extension of a
+ * X509 certificate.
+ */
+struct CertAltNameEntry
+{
+ /**
+ * defines the type of the value . With this information you can determine how to interprete the Any value.
+ * @see com::sun::star::security::ExtAltNameType
+ */
+ com::sun::star::security::ExtAltNameType Type;
+
+ /**
+ * stores the value of entry.
+ */
+ any Value;
+};
+
+
+}; }; }; };
+#endif
diff --git a/offapi/com/sun/star/security/ExtAltNameType.idl b/offapi/com/sun/star/security/ExtAltNameType.idl
new file mode 100644
index 000000000000..3910772c28c8
--- /dev/null
+++ b/offapi/com/sun/star/security/ExtAltNameType.idl
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/** -- idl definition -- **/
+
+#ifndef __com_sun_star_security_ExtAltNameType_idl_
+#define __com_sun_star_security_ExtAltNameType_idl_
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module com { module sun { module star { module security {
+
+/**
+ * Constant definiton of a certificate container status.
+ */
+enum ExtAltNameType
+{
+ /**
+ * Cutomize name/value pair
+ * The value of CertAltNameEntry contains a NamedValue.
+ *
+ * @see com::sun::star::security::CertAltNameEntry
+ */
+ OTHER_NAME,
+
+ /**
+ * The entry contains rfc822 name.
+ * The value of CertAltNameEntry contains a OUString.
+ *
+ * @see com::sun::star::security::CertAltNameEntry
+ */
+ RFC822_NAME,
+
+ /**
+ * The entry contains a dns name.
+ * The value of CertAltNameEntry contains a OUString.
+ *
+ * @see com::sun::star::security::CertAltNameEntry
+ */
+ DNS_NAME,
+
+ /**
+ * Currently unsupported.
+ */
+ DIRECTORY_NAME,
+
+ /**
+ * The entry contains an url.
+ * The value of CertAltNameEntry contains a OUString.
+ *
+ * @see com::sun::star::security::CertAltNameEntry
+ */
+ URL,
+
+ /**
+ * The entry contains a ip address.
+ * The value of CertAltNameEntry contains a Sequence of sal_Int8.
+ *
+ * @see com::sun::star::security::CertAltNameEntry
+ */
+ IP_ADDRESS,
+
+ /**
+ * The entry contains a registered id.
+ * The value of CertAltNameEntry contains a OUString.
+ *
+ * @see com::sun::star::security::CertAltNameEntry
+ */
+ REGISTERED_ID,
+
+ /**
+ * Currently unsupported.
+ */
+ EDI_PARTY_NAME,
+
+ /**
+ * Currently unsupported.
+ */
+ X400_ADDRESS
+
+};
+
+} ; } ; } ; } ;
+
+#endif
+
diff --git a/offapi/com/sun/star/security/XSanExtension.idl b/offapi/com/sun/star/security/XSanExtension.idl
new file mode 100644
index 000000000000..e378e1b0817e
--- /dev/null
+++ b/offapi/com/sun/star/security/XSanExtension.idl
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//i20156 - new file for xmlsecurity module
+
+/** -- idl definition -- **/
+
+#ifndef __com_sun_star_security_XSanExtension_idl_
+#define __com_sun_star_security_XSanExtension_idl_
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/security/XCertificateExtension.idl>
+#include <com/sun/star/security/CertAltNameEntry.idl>
+
+module com { module sun { module star { module security {
+
+/**
+ * Interface of a X509 Subject Alternative Name Certificate Extension
+ *
+ * <p>This interface represents a x509 certificate extension.</p>
+ */
+interface XSanExtension : com::sun::star::security::XCertificateExtension
+{
+ /**
+ * Contains the alternative names of a certificate
+ */
+ [attribute, readonly] sequence< com::sun::star::security::CertAltNameEntry > AlternativeNames;
+};
+
+} ; } ; } ; } ;
+
+#endif
+
diff --git a/offapi/com/sun/star/security/makefile.mk b/offapi/com/sun/star/security/makefile.mk
index 21667da10972..2064e9fb4bea 100644
--- a/offapi/com/sun/star/security/makefile.mk
+++ b/offapi/com/sun/star/security/makefile.mk
@@ -59,7 +59,13 @@ IDLFILES=\
XSerialNumberAdapter.idl \
SerialNumberAdapter.idl \
CertificateContainer.idl \
- CertificateContainerStatus.idl
+ CertificateContainerStatus.idl \
+ ExtAltNameType.idl \
+ XSanExtension.idl \
+ CertAltNameEntry.idl
+
+
+
# ------------------------------------------------------------------
diff --git a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl
index 939ff469b674..c01f450676dc 100644
--- a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl
+++ b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl
@@ -107,25 +107,26 @@ published service DataPilotDescriptor
//-------------------------------------------------------------------------
- /** specifies the orientation of the field.
+ /** specifies if empty rows in the source data are ignored.
*/
[optional, property] boolean IgnoreEmptyRows;
//-------------------------------------------------------------------------
- /** specifies the orientation of the field.
+ /** specifies if empty category cells in the source data should be treated
+ as repetition of the content from the previous row.
*/
[optional, property] boolean RepeatIfEmpty;
//-------------------------------------------------------------------------
- /** specifies the orientation of the field.
+ /** specifies if columns for grand total results are created.
*/
[optional, property] boolean ColumnGrand;
//-------------------------------------------------------------------------
- /** specifies the orientation of the field.
+ /** specifies if rows for grand total results are created.
*/
[optional, property] boolean RowGrand;
@@ -142,6 +143,14 @@ published service DataPilotDescriptor
[optional, property] boolean DrillDownOnDoubleClick;
//-------------------------------------------------------------------------
+
+ /** specifies a label for grand total results.
+
+ @since OOo 3.4
+ */
+ [optional, property] string GrandTotalName;
+
+ //-------------------------------------------------------------------------
};
//=============================================================================
diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu
index e8b483b8622d..27054b8a3417 100755..100644
--- a/officecfg/registry/data/org/openoffice/Setup.xcu
+++ b/officecfg/registry/data/org/openoffice/Setup.xcu
@@ -348,7 +348,7 @@
<value >swform</value>
</prop>
<prop oor:name="ooSetupFactoryUIName">
- <value>Base: Form Design</value>
+ <value>Base: Database Form</value>
</prop>
<prop oor:name="ooSetupFactoryWindowStateConfigRef">
<value >WriterFormWindowState</value>
diff --git a/oox/inc/oox/core/contexthandler.hxx b/oox/inc/oox/core/contexthandler.hxx
index b1f24d051c70..0242ee023589 100644
--- a/oox/inc/oox/core/contexthandler.hxx
+++ b/oox/inc/oox/core/contexthandler.hxx
@@ -57,9 +57,9 @@ typedef ::rtl::Reference< ContextHandler > ContextHandlerRef;
struct FragmentBaseData;
typedef ::boost::shared_ptr< FragmentBaseData > FragmentBaseDataRef;
-typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > ContextHandlerImplBase;
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > ContextHandler_BASE;
-class ContextHandler : public ContextHandlerImplBase
+class ContextHandler : public ContextHandler_BASE
{
public:
explicit ContextHandler( ContextHandler& rParent );
diff --git a/oox/inc/oox/core/fasttokenhandler.hxx b/oox/inc/oox/core/fasttokenhandler.hxx
index a6c73de9842b..c85bfda085f9 100644
--- a/oox/inc/oox/core/fasttokenhandler.hxx
+++ b/oox/inc/oox/core/fasttokenhandler.hxx
@@ -39,12 +39,12 @@ namespace core {
// ============================================================================
-typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandlerBase;
+typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandler_BASE;
/** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface
that provides access to the tokens generated from the internal token name list.
*/
-class FastTokenHandler : public FastTokenHandlerBase
+class FastTokenHandler : public FastTokenHandler_BASE
{
public:
explicit FastTokenHandler();
diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx
index 80dc233491d4..839eec165974 100644
--- a/oox/inc/oox/core/filterbase.hxx
+++ b/oox/inc/oox/core/filterbase.hxx
@@ -87,9 +87,9 @@ typedef ::cppu::WeakImplHelper5<
::com::sun::star::document::XImporter,
::com::sun::star::document::XExporter,
::com::sun::star::document::XFilter >
- FilterBaseBase;
+ FilterBase_BASE;
-class OOX_DLLPUBLIC FilterBase : public FilterBaseBase, public ::cppu::BaseMutex
+class OOX_DLLPUBLIC FilterBase : public FilterBase_BASE, public ::cppu::BaseMutex
{
public:
explicit FilterBase(
diff --git a/oox/inc/oox/core/fragmenthandler.hxx b/oox/inc/oox/core/fragmenthandler.hxx
index ba3164a74da8..f9c32a8814dd 100644
--- a/oox/inc/oox/core/fragmenthandler.hxx
+++ b/oox/inc/oox/core/fragmenthandler.hxx
@@ -81,9 +81,9 @@ struct RecordInfo
// ============================================================================
-typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandlerImplBase;
+typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandler_BASE;
-class FragmentHandler : public FragmentHandlerImplBase
+class FragmentHandler : public FragmentHandler_BASE
{
public:
explicit FragmentHandler( XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath );
diff --git a/oox/inc/oox/core/relations.hxx b/oox/inc/oox/core/relations.hxx
index 285c4ed947e4..8795960bcd9f 100755
--- a/oox/inc/oox/core/relations.hxx
+++ b/oox/inc/oox/core/relations.hxx
@@ -25,8 +25,8 @@
*
************************************************************************/
-#ifndef OOX_CORE_RELATIONS
-#define OOX_CORE_RELATIONS
+#ifndef OOX_CORE_RELATIONS_HXX
+#define OOX_CORE_RELATIONS_HXX
#include <map>
#include <boost/shared_ptr.hpp>
@@ -105,4 +105,4 @@ private:
} // namespace core
} // namespace oox
-#endif // OOX_CORE_RELATIONS
+#endif
diff --git a/oox/inc/oox/core/relationshandler.hxx b/oox/inc/oox/core/relationshandler.hxx
index b2da8d59c39f..e8191bdddb47 100644
--- a/oox/inc/oox/core/relationshandler.hxx
+++ b/oox/inc/oox/core/relationshandler.hxx
@@ -25,8 +25,8 @@
*
************************************************************************/
-#ifndef OOX_CORE_RELATIONSHANDLER
-#define OOX_CORE_RELATIONSHANDLER
+#ifndef OOX_CORE_RELATIONSHANDLER_HXX
+#define OOX_CORE_RELATIONSHANDLER_HXX
#include "oox/core/fragmenthandler.hxx"
@@ -57,4 +57,4 @@ private:
} // namespace core
} // namespace oox
-#endif // OOX_CORE_RELATIONSHANDLER
+#endif
diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
index 3ff545cda295..9b495c72365a 100644
--- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
+++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
@@ -72,8 +72,7 @@ public:
void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue );
/** Calculates the resulting shape anchor in EMUs. */
- ::com::sun::star::awt::Rectangle
- calcEmuLocation( const EmuRectangle& rEmuChartRect ) const;
+ EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const;
private:
AnchorPosModel maFrom; /// Top-left position relative to chart object.
@@ -109,7 +108,7 @@ private:
mxDrawPage; /// Drawing page of this sheet.
::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
- EmuRectangle maEmuChartRect; /// Position and size of the chart object for embedded shapes (in EMUs).
+ EmuRectangle maChartRectEmu; /// Position and size of the chart object for embedded shapes (in EMUs).
bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page.
};
diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx
index 12c6c2294b32..c174dc40505a 100644
--- a/oox/inc/oox/drawingml/chart/converterbase.hxx
+++ b/oox/inc/oox/drawingml/chart/converterbase.hxx
@@ -34,7 +34,6 @@
namespace com { namespace sun { namespace star {
namespace awt { struct Rectangle; }
namespace awt { struct Size; }
- namespace lang { class XMultiServiceFactory; }
namespace chart2 { class XChartDocument; }
namespace chart2 { class XTitle; }
namespace drawing { class XShape; }
diff --git a/oox/inc/oox/drawingml/color.hxx b/oox/inc/oox/drawingml/color.hxx
index 51e9501205cf..ae5b82022f59 100644
--- a/oox/inc/oox/drawingml/color.hxx
+++ b/oox/inc/oox/drawingml/color.hxx
@@ -92,10 +92,10 @@ public:
@param nPhClr Actual color for the phClr placeholder color used in theme style lists. */
sal_Int32 getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
- /** Returns true, if the color has a transparence set. */
- bool hasTransparence() const;
- /** Returns the transparence of the color (0 = opaque, 100 = full transparent). */
- sal_Int16 getTransparence() const;
+ /** Returns true, if the color is transparent. */
+ bool hasTransparency() const;
+ /** Returns the transparency of the color (0 = opaque, 100 = full transparent). */
+ sal_Int16 getTransparency() const;
private:
/** Internal helper for getColor(). */
diff --git a/oox/inc/oox/drawingml/drawingmltypes.hxx b/oox/inc/oox/drawingml/drawingmltypes.hxx
index f8bb4c91b5d5..f0b66de6c273 100644
--- a/oox/inc/oox/drawingml/drawingmltypes.hxx
+++ b/oox/inc/oox/drawingml/drawingmltypes.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include "oox/helper/helper.hxx"
namespace oox {
namespace drawingml {
@@ -150,6 +151,23 @@ IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::st
// ============================================================================
+const sal_Int32 EMU_PER_HMM = 360; /// 360 EMUs per 1/100 mm.
+
+/** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
+inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
+{
+ return static_cast< sal_Int64 >( nValue ) * EMU_PER_HMM;
+}
+
+/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
+inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
+{
+ return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) / EMU_PER_HMM, 0, SAL_MAX_INT32 );
+}
+
+// ============================================================================
+
+/** A structure for a point with 64-bit interger components. */
struct EmuPoint
{
sal_Int64 X;
@@ -161,6 +179,7 @@ struct EmuPoint
// ============================================================================
+/** A structure for a size with 64-bit interger components. */
struct EmuSize
{
sal_Int64 Width;
@@ -172,11 +191,15 @@ struct EmuSize
// ============================================================================
+/** A structure for a rectangle with 64-bit interger components. */
struct EmuRectangle : public EmuPoint, public EmuSize
{
inline explicit EmuRectangle() {}
inline explicit EmuRectangle( const EmuPoint& rPos, const EmuSize& rSize ) : EmuPoint( rPos ), EmuSize( rSize ) {}
inline explicit EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {}
+
+ inline void setPos( const EmuPoint& rPos ) { static_cast< EmuPoint& >( *this ) = rPos; }
+ inline void setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; }
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx
index d62651ebdc20..9f0271e418e8 100644
--- a/oox/inc/oox/drawingml/fillproperties.hxx
+++ b/oox/inc/oox/drawingml/fillproperties.hxx
@@ -36,7 +36,6 @@
namespace oox {
class GraphicHelper;
- class ModelObjectHelper;
class PropertyMap;
class PropertySet;
}
@@ -44,38 +43,7 @@ namespace oox {
namespace oox {
namespace drawingml {
-// ============================================================================
-
-enum FillPropertyId
-{
- FillStyleId,
- FillColorId,
- FillTransparenceId,
- FillGradientId,
- FillBitmapUrlId,
- FillBitmapModeId,
- FillBitmapSizeXId,
- FillBitmapSizeYId,
- FillBitmapOffsetXId,
- FillBitmapOffsetYId,
- FillBitmapRectanglePointId,
- FillId_END
-};
-
-struct FillPropertyIds
-{
- const sal_Int32* mpnPropertyIds;
- bool mbNamedFillGradient;
- bool mbNamedFillBitmap;
-
- explicit FillPropertyIds(
- const sal_Int32* pnPropertyIds,
- bool bNamedFillGradient,
- bool bNamedFillBitmap );
-
- inline bool has( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
- inline sal_Int32 operator[]( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
-};
+class ShapePropertyMap;
// ============================================================================
@@ -147,8 +115,6 @@ struct FillProperties
PatternFillProperties maPatternProps; /// Properties for pattern fills.
BlipFillProperties maBlipProps; /// Properties for bitmap fills.
- static FillPropertyIds DEFAULT_IDS; /// Default fill property identifiers for shape fill.
-
/** Overwrites all members that are explicitly set in rSourceProps. */
void assignUsed( const FillProperties& rSourceProps );
@@ -158,19 +124,8 @@ struct FillProperties
/** Writes the properties to the passed property map. */
void pushToPropMap(
- PropertyMap& rPropMap,
- ModelObjectHelper& rModelObjHelper,
+ ShapePropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper,
- const FillPropertyIds& rPropIds = DEFAULT_IDS,
- sal_Int32 nShapeRotation = 0,
- sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
-
- /** Writes the properties to the passed property set. */
- void pushToPropSet(
- PropertySet& rPropSet,
- ModelObjectHelper& rModelObjHelper,
- const GraphicHelper& rGraphicHelper,
- const FillPropertyIds& rPropIds = DEFAULT_IDS,
sal_Int32 nShapeRotation = 0,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
};
@@ -189,12 +144,6 @@ struct GraphicProperties
PropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
-
- /** Writes the properties to the passed property set. */
- void pushToPropSet(
- PropertySet& rPropSet,
- const GraphicHelper& rGraphicHelper,
- sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/lineproperties.hxx b/oox/inc/oox/drawingml/lineproperties.hxx
index 0f034a89f65b..2ddb21d2fb93 100644
--- a/oox/inc/oox/drawingml/lineproperties.hxx
+++ b/oox/inc/oox/drawingml/lineproperties.hxx
@@ -35,40 +35,6 @@ namespace drawingml {
// ============================================================================
-enum LinePropertyId
-{
- LineStyleId,
- LineWidthId,
- LineColorId,
- LineTransparenceId,
- LineDashId,
- LineJointId,
- LineStartId,
- LineStartWidthId,
- LineStartCenterId,
- LineEndId,
- LineEndWidthId,
- LineEndCenterId,
- LineId_END
-};
-
-struct LinePropertyIds
-{
- const sal_Int32* mpnPropertyIds;
- bool mbNamedLineDash;
- bool mbNamedLineMarker;
-
- explicit LinePropertyIds(
- const sal_Int32* pnPropertyIds,
- bool bNamedLineDash,
- bool bNamedLineMarker );
-
- inline bool has( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
- inline sal_Int32 operator[]( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
-};
-
-// ============================================================================
-
struct LineArrowProperties
{
OptValue< sal_Int32 > moArrowType;
@@ -96,25 +62,13 @@ struct LineProperties
OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token).
OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token).
- static LinePropertyIds DEFAULT_IDS; /// Default line property identifiers.
-
/** Overwrites all members that are explicitly set in rSourceProps. */
void assignUsed( const LineProperties& rSourceProps );
/** Writes the properties to the passed property map. */
void pushToPropMap(
- PropertyMap& rPropMap,
- ModelObjectHelper& rModelObjHelper,
- const GraphicHelper& rGraphicHelper,
- const LinePropertyIds& rPropIds = DEFAULT_IDS,
- sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
-
- /** Writes the properties to the passed property map. */
- void pushToPropSet(
- PropertySet& rPropSet,
- ModelObjectHelper& rModelObjHelper,
+ ShapePropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper,
- const LinePropertyIds& rPropIds = DEFAULT_IDS,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
};
diff --git a/oox/inc/oox/drawingml/shapepropertymap.hxx b/oox/inc/oox/drawingml/shapepropertymap.hxx
new file mode 100755
index 000000000000..e012d4b2a9ac
--- /dev/null
+++ b/oox/inc/oox/drawingml/shapepropertymap.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+#define OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+
+#include "oox/helper/propertymap.hxx"
+
+namespace oox { class ModelObjectHelper; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** Enumeration for various properties related to drawing shape formatting.
+
+ This is an abstraction for shape formatting properties that have different
+ names in various implementations, e.g. drawing shapes vs. chart objects.
+ */
+enum ShapePropertyId
+{
+ SHAPEPROP_LineStyle,
+ SHAPEPROP_LineWidth,
+ SHAPEPROP_LineColor,
+ SHAPEPROP_LineTransparency,
+ SHAPEPROP_LineDash, /// Explicit line dash or name of a line dash stored in a global container.
+ SHAPEPROP_LineJoint,
+ SHAPEPROP_LineStart, /// Explicit line start marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineStartWidth,
+ SHAPEPROP_LineStartCenter,
+ SHAPEPROP_LineEnd, /// Explicit line end marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineEndWidth,
+ SHAPEPROP_LineEndCenter,
+ SHAPEPROP_FillStyle,
+ SHAPEPROP_FillColor,
+ SHAPEPROP_FillTransparency,
+ SHAPEPROP_FillGradient, /// Explicit fill gradient or name of a fill gradient stored in a global container.
+ SHAPEPROP_FillBitmapUrl, /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container.
+ SHAPEPROP_FillBitmapMode,
+ SHAPEPROP_FillBitmapSizeX,
+ SHAPEPROP_FillBitmapSizeY,
+ SHAPEPROP_FillBitmapOffsetX,
+ SHAPEPROP_FillBitmapOffsetY,
+ SHAPEPROP_FillBitmapRectanglePoint,
+ SHAPEPROP_END
+};
+
+// ============================================================================
+
+struct ShapePropertyInfo
+{
+ const sal_Int32* mpnPropertyIds; /// Pointer to array of property identifiers for all SHAPEPROP properties.
+ bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
+ bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
+ bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
+ bool mbNamedFillBitmapUrl; /// True = use named fill bitmap URL instead of explicit fill bitmap URL.
+
+ static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods).
+
+ explicit ShapePropertyInfo(
+ const sal_Int32* pnPropertyIds,
+ bool bNamedLineMarker,
+ bool bNamedLineDash,
+ bool bNamedFillGradient,
+ bool bNamedFillBitmapUrl );
+
+ inline bool has( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
+ inline sal_Int32 operator[]( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
+};
+
+// ============================================================================
+
+class ShapePropertyMap : public PropertyMap
+{
+public:
+ explicit ShapePropertyMap(
+ ModelObjectHelper& rModelObjHelper,
+ const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
+
+ /** Returns true, if the specified property is supported. */
+ bool supportsProperty( ShapePropertyId ePropId ) const;
+
+ /** Returns true, if named line markers are supported, and the specified
+ line marker has already been inserted into the marker table. */
+ bool hasNamedLineMarkerInTable( const ::rtl::OUString& rMarkerName ) const;
+
+ /** Sets the specified shape property to the passed value. */
+ bool setAnyProperty( ShapePropertyId ePropId, const ::com::sun::star::uno::Any& rValue );
+
+ /** Sets the specified shape property to the passed value. */
+ template< typename Type >
+ inline bool setProperty( ShapePropertyId ePropId, const Type& rValue )
+ { return setAnyProperty( ePropId, ::com::sun::star::uno::Any( rValue ) ); }
+
+ using PropertyMap::setAnyProperty;
+ using PropertyMap::setProperty;
+ using PropertyMap::operator[];
+
+private:
+ /** Sets an explicit line marker, or creates a named line marker. */
+ bool setLineMarker( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit line dash, or creates a named line dash. */
+ bool setLineDash( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill gradient, or creates a named fill gradient. */
+ bool setFillGradient( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */
+ bool setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+
+ // not implemented, to prevent implicit conversion from enum to int
+ ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId );
+ const ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId ) const;
+
+private:
+ ModelObjectHelper& mrModelObjHelper;
+ ShapePropertyInfo maShapePropInfo;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/dump/biffdumper.hxx b/oox/inc/oox/dump/biffdumper.hxx
index a3bdc4a87c73..8e90e362eff1 100644
--- a/oox/inc/oox/dump/biffdumper.hxx
+++ b/oox/inc/oox/dump/biffdumper.hxx
@@ -530,7 +530,7 @@ public:
protected:
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -554,7 +554,7 @@ public:
explicit Dumper( const ::oox::core::FilterBase& rFilter );
explicit Dumper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
const ::rtl::OUString& rSysFileName );
@@ -571,4 +571,3 @@ protected:
#endif
#endif
-
diff --git a/oox/inc/oox/dump/dffdumper.hxx b/oox/inc/oox/dump/dffdumper.hxx
index f229c19eff8c..93868b29e5a7 100644
--- a/oox/inc/oox/dump/dffdumper.hxx
+++ b/oox/inc/oox/dump/dffdumper.hxx
@@ -79,4 +79,3 @@ private:
#endif
#endif
-
diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx
index d9acaa1f1011..4b10a1b25324 100644
--- a/oox/inc/oox/dump/dumperbase.hxx
+++ b/oox/inc/oox/dump/dumperbase.hxx
@@ -49,10 +49,9 @@
namespace com { namespace sun { namespace star {
namespace io { class XInputStream; }
- namespace io { class XTextInputStream; }
namespace io { class XOutputStream; }
namespace io { class XTextOutputStream; }
- namespace lang { class XMultiServiceFactory; }
+ namespace uno { class XComponentContext; }
} } }
namespace comphelper {
@@ -124,43 +123,46 @@ public:
// input streams ----------------------------------------------------------
static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
- getXInputStream( BinaryInputStream& rStrm );
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
openInputStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::rtl::OUString& rFileName );
- static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
- openTextInputStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
- const ::rtl::OUString& rEncoding );
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
- openTextInputStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
- const ::rtl::OUString& rFileName,
- const ::rtl::OUString& rEncoding );
-
// output streams ---------------------------------------------------------
static ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
openOutputStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::rtl::OUString& rFileName );
static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >
openTextOutputStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
- const ::rtl::OUString& rEncoding );
+ rtl_TextEncoding eTextEnc );
static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >
openTextOutputStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::rtl::OUString& rFileName,
- const ::rtl::OUString& rEncoding );
+ rtl_TextEncoding eTextEnc );
+};
+
+// ============================================================================
+
+class BinaryInputStreamRef : public ::oox::BinaryInputStreamRef
+{
+public:
+ inline BinaryInputStreamRef() {}
+
+ inline /*implicit*/ BinaryInputStreamRef( BinaryInputStream* pInStrm ) :
+ ::oox::BinaryInputStreamRef( pInStrm ) {}
+
+ inline /*implicit*/ BinaryInputStreamRef( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( new BinaryXInputStream( rxInStrm, true ) ) {}
+
+ template< typename StreamType >
+ inline /*implicit*/ BinaryInputStreamRef( const ::boost::shared_ptr< StreamType >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( rxInStrm ) {}
};
// ============================================================================
@@ -550,7 +552,9 @@ typedef ::boost::shared_ptr< Base > BaseRef;
| |
| +----> BinaryStreamObject
| |
- | +----> TextStreamObject
+ | +----> TextStreamObjectBase
+ | | |
+ | | +----> TextStreamObject
| | |
| | +----> XmlStreamObject
| |
@@ -890,14 +894,14 @@ class SharedConfigData : public Base, public ConfigItemBase
public:
explicit SharedConfigData(
const ::rtl::OUString& rFileName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const StorageRef& rxRootStrg,
const ::rtl::OUString& rSysFileName,
::comphelper::MediaDescriptor& rMediaDesc );
virtual ~SharedConfigData();
- inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getFactory() const { return mxFactory; }
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxContext; }
inline const StorageRef& getRootStorage() const { return mxRootStrg; }
inline const ::rtl::OUString& getSysFileName() const { return maSysFileName; }
@@ -932,7 +936,7 @@ private:
typedef ::std::map< ::rtl::OUString, ::rtl::OUString > ConfigDataMap;
typedef ::std::map< ::rtl::OUString, NameListRef > NameListMap;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
StorageRef mxRootStrg;
::rtl::OUString maSysFileName;
::comphelper::MediaDescriptor& mrMediaDesc;
@@ -977,14 +981,14 @@ public:
const ::oox::core::FilterBase& rFilter );
explicit Config(
const sal_Char* pcEnvVar,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const StorageRef& rxRootStrg,
const ::rtl::OUString& rSysFileName,
::comphelper::MediaDescriptor& rMediaDesc );
virtual ~Config();
- inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getFactory() const { return mxCfgData->getFactory(); }
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxCfgData->getContext(); }
inline const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); }
inline const ::rtl::OUString& getSysFileName() const { return mxCfgData->getSysFileName(); }
@@ -1022,7 +1026,7 @@ protected:
const ::oox::core::FilterBase& rFilter );
void construct(
const sal_Char* pcEnvVar,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const StorageRef& rxRootStrg,
const ::rtl::OUString& rSysFileName,
::comphelper::MediaDescriptor& rMediaDesc );
@@ -1076,10 +1080,7 @@ class Output : public Base
{
public:
explicit Output(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >& rxStrm );
-
- explicit Output(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::rtl::OUString& rFileName );
// ------------------------------------------------------------------------
@@ -1152,8 +1153,6 @@ public:
// ------------------------------------------------------------------------
protected:
- void construct( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >& rxStrm );
-
virtual bool implIsValid() const;
private:
@@ -1279,8 +1278,8 @@ class ObjectBase : public Base
public:
virtual ~ObjectBase();
- inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
- getFactory() const { return mxConfig->getFactory(); }
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
+ getContext() const { return mxConfig->getContext(); }
void dump();
@@ -1323,7 +1322,7 @@ protected:
virtual void implDump();
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -1394,7 +1393,6 @@ protected:
using ObjectBase::construct;
void construct( const ObjectBase& rParent, const ::rtl::OUString& rSysFileName );
- void construct( const ObjectBase& rParent, const OutputRef& rxOut );
void construct( const OutputObjectBase& rParent );
virtual bool implIsValid() const;
@@ -1453,6 +1451,7 @@ protected:
protected:
OutputRef mxOut;
+ ::rtl::OUString maSysFileName;
};
typedef ::boost::shared_ptr< OutputObjectBase > OutputObjectRef;
@@ -1578,7 +1577,6 @@ protected:
using OutputObjectBase::construct;
void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
- void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OutputRef& rxOut );
void construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
void construct( const InputObjectBase& rParent );
@@ -1805,46 +1803,76 @@ protected:
};
// ============================================================================
+// ============================================================================
-class TextStreamObject : public InputObjectBase
+class TextStreamObjectBase : public InputObjectBase
{
-public:
- explicit TextStreamObject(
+protected:
+ inline TextStreamObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm,
rtl_TextEncoding eTextEnc,
const ::rtl::OUString& rSysFileName );
-
- explicit TextStreamObject(
+ void construct(
const OutputObjectBase& rParent,
const BinaryInputStreamRef& rxStrm,
rtl_TextEncoding eTextEnc );
+ void construct(
+ const InputObjectBase& rParent,
+ rtl_TextEncoding eTextEnc );
-protected:
virtual bool implIsValid() const;
virtual void implDump();
- virtual void implDumpLine( const ::rtl::OUString& rLine, sal_uInt32 nLine );
+
+ virtual void implDumpText( TextInputStream& rTextStrm ) = 0;
private:
+ void constructTextStrmObj( rtl_TextEncoding eTextEnc );
+
+protected:
::boost::shared_ptr< TextInputStream > mxTextStrm;
};
// ============================================================================
-class XmlStreamObject : public TextStreamObject
+class TextLineStreamObject : public TextStreamObjectBase
{
public:
- explicit XmlStreamObject(
+ explicit TextLineStreamObject(
const ObjectBase& rParent,
const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
const ::rtl::OUString& rSysFileName );
+ explicit TextLineStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
protected:
- virtual void implDump();
+ virtual void implDumpText( TextInputStream& rTextStrm );
virtual void implDumpLine( const ::rtl::OUString& rLine, sal_uInt32 nLine );
+};
-private:
- ::rtl::OUString maIncompleteLine;
+// ============================================================================
+
+class XmlStreamObject : public TextStreamObjectBase
+{
+public:
+ explicit XmlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const ::rtl::OUString& rSysFileName );
+
+ explicit XmlStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm );
+
+protected:
+ virtual void implDumpText( TextInputStream& rTextStrm );
};
// ============================================================================
@@ -1976,4 +2004,3 @@ do { \
#endif // OOX_INCLUDE_DUMPER
#endif
-
diff --git a/oox/inc/oox/dump/oledumper.hxx b/oox/inc/oox/dump/oledumper.hxx
index 8f706f4c40f1..ac59f0efcc68 100644
--- a/oox/inc/oox/dump/oledumper.hxx
+++ b/oox/inc/oox/dump/oledumper.hxx
@@ -180,7 +180,7 @@ protected:
void construct( const ObjectBase& rParent );
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -762,7 +762,7 @@ public:
protected:
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -857,7 +857,7 @@ public:
protected:
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -879,7 +879,7 @@ public:
protected:
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -897,7 +897,7 @@ public:
protected:
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -936,4 +936,3 @@ protected:
#endif
#endif
-
diff --git a/oox/inc/oox/dump/pptxdumper.hxx b/oox/inc/oox/dump/pptxdumper.hxx
index 535c7ceadc36..acfa08244552 100644
--- a/oox/inc/oox/dump/pptxdumper.hxx
+++ b/oox/inc/oox/dump/pptxdumper.hxx
@@ -45,7 +45,7 @@ public:
protected:
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -59,7 +59,7 @@ public:
explicit Dumper( const ::oox::core::FilterBase& rFilter );
explicit Dumper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
const ::rtl::OUString& rSysFileName );
@@ -75,4 +75,3 @@ protected:
#endif
#endif
-
diff --git a/oox/inc/oox/dump/xlsbdumper.hxx b/oox/inc/oox/dump/xlsbdumper.hxx
index 6fa1c9bd7e45..606af8c1cc6b 100644
--- a/oox/inc/oox/dump/xlsbdumper.hxx
+++ b/oox/inc/oox/dump/xlsbdumper.hxx
@@ -225,7 +225,7 @@ public:
protected:
virtual void implDumpStream(
- const BinaryInputStreamRef& rxStrm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
const ::rtl::OUString& rStrgPath,
const ::rtl::OUString& rStrmName,
const ::rtl::OUString& rSysFileName );
@@ -239,7 +239,7 @@ public:
explicit Dumper( const ::oox::core::FilterBase& rFilter );
explicit Dumper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
const ::rtl::OUString& rSysFileName );
diff --git a/oox/inc/oox/helper/binaryinputstream.hxx b/oox/inc/oox/helper/binaryinputstream.hxx
index 52a3a4de9f0f..8bb554a2b57d 100644
--- a/oox/inc/oox/helper/binaryinputstream.hxx
+++ b/oox/inc/oox/helper/binaryinputstream.hxx
@@ -28,10 +28,14 @@
#ifndef OOX_HELPER_BINARYINPUTSTREAM_HXX
#define OOX_HELPER_BINARYINPUTSTREAM_HXX
-#include <boost/shared_ptr.hpp>
+#include <vector>
#include <com/sun/star/io/XInputStream.hpp>
#include "oox/helper/binarystreambase.hxx"
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
namespace oox {
class BinaryOutputStream;
@@ -46,24 +50,51 @@ class BinaryInputStream : public virtual BinaryStreamBase
{
public:
/** Derived classes implement reading nBytes bytes to the passed sequence.
- @return Number of bytes really read. */
- virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes ) = 0;
- /** Derived classes implement reading nBytes bytes to the (existing) buffer opMem.
- @return Number of bytes really read. */
- virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes ) = 0;
+ The sequence will be reallocated internally.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement reading nBytes bytes to the (preallocated!)
+ memory buffer opMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
/** Derived classes implement seeking the stream forward by the passed
- number of bytes. This should work for non-seekable streams too. */
- virtual void skip( sal_Int32 nBytes ) = 0;
+ number of bytes. This should work for non-seekable streams too.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
/** Reads a value from the stream and converts it to platform byte order.
- Supported types: SAL integers (8 to 64 bit), float, double. */
+ All data types supported by the ByteOrderConverter class can be used.
+ */
template< typename Type >
void readValue( Type& ornValue );
+
/** Reads a value from the stream and converts it to platform byte order.
- Supported types: SAL integers (8 to 64 bit), float, double. */
+ All data types supported by the ByteOrderConverter class can be used.
+ */
template< typename Type >
inline Type readValue() { Type nValue; readValue( nValue ); return nValue; }
- /** Stream operator for integral and floating-point types. */
+
+ /** Stream operator for all data types supported by the readValue() function. */
template< typename Type >
inline BinaryInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
@@ -78,46 +109,135 @@ public:
inline float readFloat() { return readValue< float >(); }
inline double readDouble() { return readValue< double >(); }
- /** Reads a NUL-terminated byte character array and returns the string. */
+ /** Reads a (preallocated!) C array of values from the stream.
+
+ Converts all values in the array to platform byte order. All data types
+ supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to read (NOT byte count).
+
+ @return
+ Number of array elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( Type* opnArray, sal_Int32 nElemCount );
+
+ /** Reads a sequence of values from the stream.
+
+ The sequence will be reallocated internally. Converts all values in the
+ array to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the sequence (NOT byte count).
+
+ @return
+ Number of sequence elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount );
+
+ /** Reads a vector of values from the stream.
+
+ The vector will be resized internally. Converts all values in the
+ vector to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the vector (NOT byte count).
+
+ @return
+ Number of vector elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount );
+
+ /** Skips an array of values of a certain type in the stream.
+
+ All data types supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to skip (NOT byte count).
+ */
+ template< typename Type >
+ void skipArray( sal_Int32 nElemCount );
+
+ /** Reads a NUL-terminated byte character array and returns the string.
+ */
::rtl::OString readNulCharArray();
/** Reads a NUL-terminated byte character array and returns a Unicode string.
- @param eTextEnc The text encoding used to create the Unicode string. */
+
+ @param eTextEnc
+ The text encoding used to create the Unicode string.
+ */
::rtl::OUString readNulCharArrayUC( rtl_TextEncoding eTextEnc );
- /** Reads a NUL-terminated Unicode character array and returns the string. */
+ /** Reads a NUL-terminated Unicode character array and returns the string.
+ */
::rtl::OUString readNulUnicodeArray();
- /** Reads nChar byte characters and returns the string.
- @param nChars Number of characters (bytes) to read from the stream.
+ /** Reads a byte character array and returns the string.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+
@param bAllowNulChars
True = NUL characters are inserted into the imported string.
- False = NUL characters are replaced by question marks (default). */
+ False = NUL characters are replaced by question marks (default).
+ */
::rtl::OString readCharArray( sal_Int32 nChars, bool bAllowNulChars = false );
- /** Reads nChar byte characters and returns a Unicode string.
- @param nChars Number of characters (bytes) to read from the stream.
- @param eTextEnc The text encoding used to create the Unicode string.
+ /** Reads a byte character array and returns a Unicode string.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+
+ @param eTextEnc
+ The text encoding used to create the Unicode string.
+
@param bAllowNulChars
True = NUL characters are inserted into the imported string.
- False = NUL characters are replaced by question marks (default). */
+ False = NUL characters are replaced by question marks (default).
+ */
::rtl::OUString readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bAllowNulChars = false );
- /** Reads nChars Unicode characters and returns the string.
- @param nChars Number of 16-bit characters to read from the stream.
+ /** Reads a Unicode character array and returns the string.
+
+ @param nChars
+ Number of 16-bit characters to read from the stream.
+
@param bAllowNulChars
True = NUL characters are inserted into the imported string.
- False = NUL characters are replaced by question marks (default). */
+ False = NUL characters are replaced by question marks (default).
+ */
::rtl::OUString readUnicodeArray( sal_Int32 nChars, bool bAllowNulChars = false );
- /** Copies nBytes bytes from the current position to the passed output stream. */
- void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64 );
+ /** Reads a Unicode character array (may be compressed) and returns the
+ string.
-private:
- /** Used by the readValue() template functions to read built-in types.
- @descr Derived classes may overwrite this default implementation which
- simply calls readMemory() with something own. */
- virtual void readAtom( void* opMem, sal_uInt8 nSize );
+ @param nChars
+ Number of 8-bit or 16-bit characters to read from the stream.
+
+ @param bCompressed
+ True = Character array is compressed (stored as 8-bit characters).
+ False = Character array is not compressed (stored as 16-bit characters).
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ ::rtl::OUString readCompressedUnicodeArray( sal_Int32 nChars, bool bCompressed, bool bAllowNulChars = false );
+
+ /** Copies nBytes bytes from the current position to the passed output stream.
+ */
+ void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64, sal_Int32 nAtomSize = 1 );
+
+protected:
+ /** This dummy default c'tor will never call the c'tor of the virtual base
+ class BinaryStreamBase as this class cannot be instanciated directly. */
+ inline explicit BinaryInputStream() : BinaryStreamBase( false ) {}
};
typedef ::boost::shared_ptr< BinaryInputStream > BinaryInputStreamRef;
@@ -127,14 +247,47 @@ typedef ::boost::shared_ptr< BinaryInputStream > BinaryInputStreamRef;
template< typename Type >
void BinaryInputStream::readValue( Type& ornValue )
{
- // can be instanciated for all types supported in class ByteOrderConverter
- readAtom( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ) );
+ readMemory( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) );
ByteOrderConverter::convertLittleEndian( ornValue );
}
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( Type* opnArray, sal_Int32 nElemCount )
+{
+ sal_Int32 nRet = 0;
+ if( !mbEof )
+ {
+ sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ nRet = readMemory( opnArray, nReadSize, sizeof( Type ) ) / sizeof( Type );
+ ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nRet ) );
+ }
+ return nRet;
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount )
+{
+ orSequence.reallocate( nElemCount );
+ return orSequence.hasElements() ? readArray( orSequence.getArray(), nElemCount ) : 0;
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount )
+{
+ orVector.resize( static_cast< size_t >( nElemCount ) );
+ return orVector.empty() ? 0 : readArray( &orVector.front(), nElemCount );
+}
+
+template< typename Type >
+void BinaryInputStream::skipArray( sal_Int32 nElemCount )
+{
+ sal_Int32 nSkipSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ skip( nSkipSize, sizeof( Type ) );
+}
+
// ============================================================================
-/** Wraps a com.sun.star.io.XInputStream and provides convenient access functions.
+/** Wraps a UNO input stream and provides convenient access functions.
The binary data in the stream is assumed to be in little-endian format.
*/
@@ -143,10 +296,13 @@ class BinaryXInputStream : public BinaryXSeekableStream, public BinaryInputStrea
public:
/** Constructs the wrapper object for the passed input stream.
- @param rxInStream The com.sun.star.io.XInputStream interface of the
- input stream to be wrapped.
- @param bAutoClose True = automatically close the wrapped input stream
- on destruction of this wrapper.
+ @param rxInStream
+ The com.sun.star.io.XInputStream interface of the UNO input stream
+ to be wrapped.
+
+ @param bAutoClose
+ True = automatically close the wrapped input stream on destruction
+ of this wrapper or when close() is called.
*/
explicit BinaryXInputStream(
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
@@ -154,26 +310,26 @@ public:
virtual ~BinaryXInputStream();
+ /** Closes the input stream. Does also close the wrapped UNO input stream
+ if bAutoClose has been set to true in the constructor. */
+ virtual void close();
+
/** Reads nBytes bytes to the passed sequence.
@return Number of bytes really read. */
- virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes );
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
/** Reads nBytes bytes to the (existing) buffer opMem.
@return Number of bytes really read. */
- virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes );
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
/** Seeks the stream forward by the passed number of bytes. This works for
non-seekable streams too. */
- virtual void skip( sal_Int32 nBytes );
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
- /** Stream operator for integral and floating-point types. */
+ /** Stream operator for all data types supported by the readValue() function. */
template< typename Type >
inline BinaryXInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
- /** Returns the XInputStream interface of the wrapped input stream. */
- inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
- getXInputStream() const { return mxInStrm; }
- /** Closes the wrapped XInputStream. */
- void close();
-
private:
StreamDataSequence maBuffer; /// Data buffer used in readMemory() function.
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
@@ -181,8 +337,6 @@ private:
bool mbAutoClose; /// True = automatically close stream on destruction.
};
-typedef ::boost::shared_ptr< BinaryXInputStream > BinaryXInputStreamRef;
-
// ============================================================================
/** Wraps a StreamDataSequence and provides convenient access functions.
@@ -203,86 +357,97 @@ public:
/** Reads nBytes bytes to the passed sequence.
@return Number of bytes really read. */
- virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes );
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
/** Reads nBytes bytes to the (existing) buffer opMem.
@return Number of bytes really read. */
- virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes );
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
/** Seeks the stream forward by the passed number of bytes. This works for
non-seekable streams too. */
- virtual void skip( sal_Int32 nBytes );
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
- /** Stream operator for integral and floating-point types. */
+ /** Stream operator for all data types supported by the readValue() function. */
template< typename Type >
inline SequenceInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
-};
-typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef;
+private:
+ /** Returns the number of bytes available in the sequence for the passed byte count. */
+ inline sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
+ { return getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mpData->getLength() - mnPos ); }
+};
// ============================================================================
/** Wraps a BinaryInputStream and provides access to a specific part of the
stream data.
- @descr
- Provides access to the stream data block starting at the current
- position of the stream, and with a specific length. If the wrapped
- stream is seekable, this wrapper will treat the position the wrapped
- has at construction time as position "0" (therefore the class name).
+ Provides access to the stream data block starting at the current position
+ of the stream, and with a specific length. If the wrapped stream is
+ seekable, this wrapper will treat the position of the wrapped stream at
+ construction time as position "0" (therefore the class name).
+
+ The passed input stream MUST live at least as long as this stream wrapper.
+ The stream MUST NOT be changed from outside as long as this stream wrapper
+ is used to read from it.
*/
class RelativeInputStream : public BinaryInputStream
{
public:
/** Constructs the wrapper object for the passed stream.
- @attention
- The passed input stream MUST live at least as long as this stream
- wrapper. The stream MUST NOT be changed from outside as long as
- this stream wrapper is used to read from it.
-
- @param nLength
+ @param nSize
If specified, restricts the amount of data that can be read from
the passed input stream.
*/
explicit RelativeInputStream(
BinaryInputStream& rInStrm,
- sal_Int64 nLength = SAL_MAX_INT64 );
+ sal_Int64 nSize = SAL_MAX_INT64 );
- /** Returns whether the wrapped stream is seekable. */
- virtual bool isSeekable() const;
/** Returns the size of the data block in the wrapped stream offered by
this wrapper. */
- virtual sal_Int64 getLength() const;
+ virtual sal_Int64 size() const;
+
/** Returns the current relative stream position. */
virtual sal_Int64 tell() const;
+
/** Seeks the stream to the passed relative position, if the wrapped stream
is seekable. */
virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
/** Reads nBytes bytes to the passed sequence. Does not read out of the
data block whose size has been specified on construction.
@return Number of bytes really read. */
- virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes );
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
/** Reads nBytes bytes to the (existing) buffer opMem. Does not read out of
the data block whose size has been specified on construction.
@return Number of bytes really read. */
- virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes );
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
/** Seeks the stream forward by the passed number of bytes. This works for
non-seekable streams too. Does not seek out of the data block. */
- virtual void skip( sal_Int32 nBytes );
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
- /** Stream operator for integral and floating-point types. */
+ /** Stream operator for all data types supported by the readValue() function. */
template< typename Type >
inline RelativeInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
private:
- BinaryInputStream& mrInStrm;
+ /** Returns the number of bytes available in the sequence for the passed byte count. */
+ inline sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
+ { return getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnSize - mnRelPos ); }
+
+private:
+ BinaryInputStream* mpInStrm;
sal_Int64 mnStartPos;
sal_Int64 mnRelPos;
- sal_Int64 mnLength;
+ sal_Int64 mnSize;
};
-typedef ::boost::shared_ptr< RelativeInputStream > RelativeInputStreamRef;
-
// ============================================================================
} // namespace oox
diff --git a/oox/inc/oox/helper/binaryoutputstream.hxx b/oox/inc/oox/helper/binaryoutputstream.hxx
index e24777c4f296..362c7fbdea87 100644
--- a/oox/inc/oox/helper/binaryoutputstream.hxx
+++ b/oox/inc/oox/helper/binaryoutputstream.hxx
@@ -28,10 +28,12 @@
#ifndef OOX_HELPER_BINARYOUTPUTSTREAM_HXX
#define OOX_HELPER_BINARYOUTPUTSTREAM_HXX
-#include <boost/shared_ptr.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
#include "oox/helper/binarystreambase.hxx"
+namespace com { namespace sun { namespace star {
+ namespace io { class XOutputStream; }
+} } }
+
namespace oox {
// ============================================================================
@@ -43,24 +45,38 @@ namespace oox {
class BinaryOutputStream : public virtual BinaryStreamBase
{
public:
- /** Derived classes implement writing the passed data sequence. */
- virtual void writeData( const StreamDataSequence& rData ) = 0;
- /** Derived classes implement writing from the (existing) buffer pMem. */
- virtual void writeMemory( const void* pMem, sal_Int32 nBytes ) = 0;
+ /** Derived classes implement writing the contents of the passed data
+ sequence.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement writing the contents of the (preallocated!)
+ memory buffer pMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
/** Writes a value to the stream and converts it to platform byte order.
- Supported types: SAL integers (8 to 64 bit), float, double. */
+ All data types supported by the ByteOrderConverter class can be used.
+ */
template< typename Type >
void writeValue( Type nValue );
- /** Stream operator for integral and floating-point types. */
+
+ /** Stream operator for all data types supported by the writeValue() function. */
template< typename Type >
inline BinaryOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
-private:
- /** Used by the writeValue() template function to write built-in types.
- @descr Derived classes may overwrite this default implementation which
- simply calls writeMemory() with something own. */
- virtual void writeAtom( const void* pMem, sal_uInt8 nSize );
+protected:
+ /** This dummy default c'tor will never call the c'tor of the virtual base
+ class BinaryStreamBase as this class cannot be instanciated directly. */
+ inline explicit BinaryOutputStream() : BinaryStreamBase( false ) {}
};
typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef;
@@ -70,14 +86,13 @@ typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef;
template< typename Type >
void BinaryOutputStream::writeValue( Type nValue )
{
- // can be instanciated for all types supported in class ByteOrderConverter
ByteOrderConverter::convertLittleEndian( nValue );
- writeMemory( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ) );
+ writeMemory( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) );
}
// ============================================================================
-/** Wraps a com.sun.star.io.XOutputStream and provides convenient access functions.
+/** Wraps a UNO output stream and provides convenient access functions.
The binary data in the stream is written in little-endian format.
*/
@@ -86,10 +101,13 @@ class BinaryXOutputStream : public BinaryXSeekableStream, public BinaryOutputStr
public:
/** Constructs the wrapper object for the passed output stream.
- @param rxOutStream The com.sun.star.io.XOutputStream interface of the
- output stream to be wrapped.
- @param bAutoClose True = automatically close the wrapped output stream
- on destruction of this wrapper.
+ @param rxOutStream
+ The com.sun.star.io.XOutputStream interface of the output stream to
+ be wrapped.
+
+ @param bAutoClose
+ True = automatically close the wrapped output stream on destruction
+ of this wrapper or when close() is called.
*/
explicit BinaryXOutputStream(
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
@@ -97,20 +115,23 @@ public:
virtual ~BinaryXOutputStream();
+ /** Flushes and closes the output stream. Does also close the wrapped UNO
+ output stream if bAutoClose has been set to true in the constructor. */
+ void close();
+
/** Writes the passed data sequence. */
- virtual void writeData( const StreamDataSequence& rData );
- /** Write nBytes bytes from the (existing) buffer pMem. */
- virtual void writeMemory( const void* pMem, sal_Int32 nBytes );
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 );
+
+ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
- /** Stream operator for integral and floating-point types. */
+ /** Stream operator for all data types supported by the writeValue() function. */
template< typename Type >
inline BinaryXOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
/** Returns the XOutputStream interface of the wrapped output stream. */
inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
getXOutputStream() const { return mxOutStrm; }
- /** Flushes and closes the wrapped XOutputStream. */
- void close();
private:
StreamDataSequence maBuffer; /// Data buffer used in writeMemory() function.
@@ -119,8 +140,6 @@ private:
bool mbAutoClose; /// True = automatically close stream on destruction.
};
-typedef ::boost::shared_ptr< BinaryXOutputStream > BinaryXOutputStreamRef;
-
// ============================================================================
/** Wraps a StreamDataSequence and provides convenient access functions.
@@ -142,17 +161,16 @@ public:
explicit SequenceOutputStream( StreamDataSequence& rData );
/** Writes the passed data sequence. */
- virtual void writeData( const StreamDataSequence& rData );
- /** Write nBytes bytes from the (existing) buffer pMem. */
- virtual void writeMemory( const void* pMem, sal_Int32 nBytes );
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 );
- /** Stream operator for integral and floating-point types. */
+ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the writeValue() function. */
template< typename Type >
inline SequenceOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
};
-typedef ::boost::shared_ptr< SequenceOutputStream > SequenceOutputStreamRef;
-
// ============================================================================
} // namespace oox
diff --git a/oox/inc/oox/helper/binarystreambase.hxx b/oox/inc/oox/helper/binarystreambase.hxx
index ba0f34b21f40..0088b29208b0 100644
--- a/oox/inc/oox/helper/binarystreambase.hxx
+++ b/oox/inc/oox/helper/binarystreambase.hxx
@@ -29,75 +29,123 @@
#define OOX_HELPER_BINARYSTREAMBASE_HXX
#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/io/XSeekable.hpp>
+#include <boost/shared_ptr.hpp>
#include "oox/helper/helper.hxx"
+namespace com { namespace sun { namespace star {
+ namespace io { class XSeekable; }
+} } }
+
namespace oox {
typedef ::com::sun::star::uno::Sequence< sal_Int8 > StreamDataSequence;
// ============================================================================
-/** Base interface for binary stream classes. Implemenetations may or may not
- support seeking the stream. */
+/** Base class for binary stream classes.
+ */
class BinaryStreamBase
{
public:
virtual ~BinaryStreamBase();
- /** Derived classes return whether the stream is seekable. Default: false. */
- virtual bool isSeekable() const;
- /** Derived classes return the size of the stream, if possible,
- otherwise/default: -1. May return something for unseekable streams. */
- virtual sal_Int64 getLength() const;
- /** Derived classes return the current stream position, if possible,
- otherwise/default: -1. May return something for unseekable streams. */
- virtual sal_Int64 tell() const;
- /** Derived classes implement seeking the stream to the passed position, if
- the stream is seekable. */
- virtual void seek( sal_Int64 nPos );
+ /** Implementations return the size of the stream, if possible.
+
+ This function may be implemented for some types of unseekable streams,
+ and MUST be implemented for all seekable streams.
+
+ @return
+ The size of the stream in bytes, or -1, if not implemented.
+ */
+ virtual sal_Int64 size() const = 0;
+
+ /** Implementations return the current stream position, if possible.
+
+ This function may be implemented for some types of unseekable streams,
+ and MUST be implemented for all seekable streams.
+
+ @return
+ The current position in the stream, or -1, if not implemented.
+ */
+ virtual sal_Int64 tell() const = 0;
+
+ /** Implementations seek the stream to the passed position, if
+ the stream is seekable.
+ */
+ virtual void seek( sal_Int64 nPos ) = 0;
+
+ /** Implementations close the stream.
+ */
+ virtual void close() = 0;
+
+ /** Returns true, if the implementation supports the seek() operation.
+
+ Implementations may still implement size() and tell() even if the
+ stream is not seekable.
+ */
+ inline bool isSeekable() const { return mbSeekable; }
/** Returns true, if the stream position is invalid (EOF). This flag turns
- true *after* the first attempt to seek/read beyond the stream end. */
+ true *after* the first attempt to seek/read beyond the stream end.
+ */
inline bool isEof() const { return mbEof; }
- /** Returns the size of the remaining data, if stream is seekable, otherwise -1. */
+ /** Returns the size of the remaining data available in the stream, if
+ stream supports size() and tell(), otherwise -1.
+ */
sal_Int64 getRemaining() const;
- /** Seeks the stream to the beginning, if stream is seekable. */
+
+ /** Seeks the stream to the beginning, if stream is seekable.
+ */
inline void seekToStart() { seek( 0 ); }
- /** Seeks the stream to the end, if stream is seekable. */
- inline void seekToEnd() { seek( getLength() ); }
+
+ /** Seeks the stream to the end, if stream is seekable.
+ */
+ inline void seekToEnd() { seek( size() ); }
+
/** Seeks the stream forward to a position that is a multiple of the passed
- block size, relative to the passed stream position, if stream is seekable. */
+ block size, if stream is seekable.
+
+ @param nBlockSize
+ The size of the data blocks the streams needs to be aligned to.
+
+ @param nAnchorPos
+ Position in the stream the data blocks are aligned to.
+ */
void alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos = 0 );
protected:
- inline explicit BinaryStreamBase() : mbEof( false ) {}
+ inline explicit BinaryStreamBase( bool bSeekable ) : mbEof( false ), mbSeekable( bSeekable ) {}
private:
BinaryStreamBase( const BinaryStreamBase& );
BinaryStreamBase& operator=( const BinaryStreamBase& );
protected:
- bool mbEof;
+ bool mbEof; /// End of stream flag.
+
+private:
+ const bool mbSeekable; /// True = implementation supports seeking.
};
// ============================================================================
-/** Base class for binary input and output streams wrapping an API stream,
+/** Base class for binary input and output streams wrapping a UNO stream,
seekable via the com.sun.star.io.XSeekable interface.
*/
class BinaryXSeekableStream : public virtual BinaryStreamBase
{
public:
- /** Returns true, if the wrapped stream is seekable. */
- virtual bool isSeekable() const;
- /** Returns the size of the stream, if stream is seekable, otherwise -1. */
- virtual sal_Int64 getLength() const;
- /** Returns the current stream position, if stream is seekable, otherwise -1. */
+ virtual ~BinaryXSeekableStream();
+
+ /** Returns the size of the stream, if wrapped stream is seekable, otherwise -1. */
+ virtual sal_Int64 size() const;
+ /** Returns the current stream position, if wrapped stream is seekable, otherwise -1. */
virtual sal_Int64 tell() const;
- /** Seeks the stream to the passed position, if stream is seekable. */
+ /** Seeks the stream to the passed position, if wrapped stream is seekable. */
virtual void seek( sal_Int64 nPos );
+ /** Releases the reference to the UNO XSeekable interface. */
+ virtual void close();
protected:
explicit BinaryXSeekableStream(
@@ -111,31 +159,29 @@ private:
// ============================================================================
/** Base class for binary input and output streams wrapping a
- StreamDataSequence, which is always seekable. */
+ StreamDataSequence, which is always seekable.
+
+ The wrapped data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long as this
+ stream wrapper is used to modify it.
+ */
class SequenceSeekableStream : public virtual BinaryStreamBase
{
public:
- /** Returns true (data sequence streams are always seekable). */
- virtual bool isSeekable() const;
/** Returns the size of the wrapped data sequence. */
- virtual sal_Int64 getLength() const;
+ virtual sal_Int64 size() const;
/** Returns the current stream position. */
virtual sal_Int64 tell() const;
/** Seeks the stream to the passed position. */
virtual void seek( sal_Int64 nPos );
+ /** Releases the reference to the data sequence. */
+ virtual void close();
protected:
- /** Constructs the wrapper object for the passed data sequence.
-
- @attention
- The passed data sequence MUST live at least as long as this stream
- wrapper. The data sequence MUST NOT be changed from outside as long
- as this stream wrapper is used to modify it.
- */
- inline explicit SequenceSeekableStream( const StreamDataSequence& rData ) : mrData( rData ), mnPos( 0 ) {}
+ explicit SequenceSeekableStream( const StreamDataSequence& rData );
protected:
- const StreamDataSequence& mrData; /// Wrapped data sequence.
+ const StreamDataSequence* mpData; /// Wrapped data sequence.
sal_Int32 mnPos; /// Current position in the sequence.
};
diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx
index 96b9feeffe07..1f5874070a7b 100644
--- a/oox/inc/oox/helper/containerhelper.hxx
+++ b/oox/inc/oox/helper/containerhelper.hxx
@@ -28,8 +28,8 @@
#ifndef OOX_HELPER_CONTAINERHELPER_HXX
#define OOX_HELPER_CONTAINERHELPER_HXX
-#include <vector>
#include <map>
+#include <vector>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
@@ -40,13 +40,59 @@ namespace com { namespace sun { namespace star {
namespace container { class XIndexContainer; }
namespace container { class XNameAccess; }
namespace container { class XNameContainer; }
- namespace lang { class XMultiServiceFactory; }
+ namespace uno { class XComponentContext; }
} } }
namespace oox {
// ============================================================================
+/** A range of signed 32-bit integer values. */
+struct ValueRange
+{
+ sal_Int32 mnFirst;
+ sal_Int32 mnLast;
+
+ inline explicit ValueRange( sal_Int32 nValue = 0 ) : mnFirst( nValue ), mnLast( nValue ) {}
+ inline explicit ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {}
+
+ inline bool operator==( const ValueRange& rRange ) const { return (mnFirst == rRange.mnFirst) && (mnLast == rRange.mnLast); }
+ inline bool operator!=( const ValueRange& rRange ) const { return !(*this == rRange); }
+ inline bool contains( sal_Int32 nValue ) const { return (mnFirst <= nValue) && (nValue <= mnLast); }
+ inline bool contains( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnFirst) && (rRange.mnLast <= mnLast); }
+ inline bool intersects( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnLast) && (rRange.mnFirst <= mnLast); }
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ::std::vector< ValueRange > ValueRangeVector;
+
+// ----------------------------------------------------------------------------
+
+/** An ordered list of value ranges. The insertion operation will merge
+ consecutive value ranges.
+ */
+class ValueRangeSet
+{
+public:
+ inline explicit ValueRangeSet() {}
+
+ /** Inserts the passed value into the range list. */
+ inline void insert( sal_Int32 nValue ) { insert( ValueRange( nValue ) ); }
+ /** Inserts the passed value range into the range list. */
+ void insert( const ValueRange& rRange );
+
+ /** Returns the ordered list of all value ranges. */
+ inline const ValueRangeVector& getRanges() const { return maRanges; }
+ /** Returns an intersection of the range list and the passed range. */
+ ValueRangeVector getIntersection( const ValueRange& rRange ) const;
+
+private:
+ ValueRangeVector maRanges;
+};
+
+// ============================================================================
+
/** Template for a 2-dimensional array of objects.
This class template provides a similar interface to the ::std::vector
@@ -124,7 +170,7 @@ public:
/** Creates a new index container object from scratch. */
static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
- createIndexContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
+ createIndexContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
/** Inserts an object into an indexed container.
@@ -146,7 +192,7 @@ public:
/** Creates a new name container object from scratch. */
static ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
- createNameContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
+ createNameContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
/** Returns a name that is not used in the passed name container.
diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx
index b2b9e1cd133b..a8544196d790 100644
--- a/oox/inc/oox/helper/graphichelper.hxx
+++ b/oox/inc/oox/helper/graphichelper.hxx
@@ -157,7 +157,7 @@ private:
typedef ::std::deque< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > > GraphicObjectDeque;
typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > EmbeddedGraphicMap;
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCompContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicProvider > mxGraphicProvider;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnitConversion > mxUnitConversion;
::com::sun::star::awt::DeviceInfo maDeviceInfo; /// Current output device info.
diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx
index 84c501fae2e5..bb9877008e89 100644
--- a/oox/inc/oox/helper/helper.hxx
+++ b/oox/inc/oox/helper/helper.hxx
@@ -236,9 +236,9 @@ private:
class ByteOrderConverter
{
public:
+#ifdef OSL_BIGENDIAN
inline static void convertLittleEndian( sal_Int8& ) {} // present for usage in templates
inline static void convertLittleEndian( sal_uInt8& ) {} // present for usage in templates
-#ifdef OSL_BIGENDIAN
inline static void convertLittleEndian( sal_Int16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
inline static void convertLittleEndian( sal_uInt16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
inline static void convertLittleEndian( sal_Int32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
@@ -247,15 +247,20 @@ public:
inline static void convertLittleEndian( sal_uInt64& rnValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
inline static void convertLittleEndian( float& rfValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rfValue ) ); }
inline static void convertLittleEndian( double& rfValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rfValue ) ); }
+
+ template< typename Type >
+ inline static void convertLittleEndianArray( Type* pnArray, size_t nElemCount );
+
+ inline static void convertLittleEndianArray( sal_Int8*, size_t ) {}
+ inline static void convertLittleEndianArray( sal_uInt8*, size_t ) {}
+
#else
- inline static void convertLittleEndian( sal_Int16& ) {}
- inline static void convertLittleEndian( sal_uInt16& ) {}
- inline static void convertLittleEndian( sal_Int32& ) {}
- inline static void convertLittleEndian( sal_uInt32& ) {}
- inline static void convertLittleEndian( sal_Int64& ) {}
- inline static void convertLittleEndian( sal_uInt64& ) {}
- inline static void convertLittleEndian( float& ) {}
- inline static void convertLittleEndian( double& ) {}
+ template< typename Type >
+ inline static void convertLittleEndian( Type& ) {}
+
+ template< typename Type >
+ inline static void convertLittleEndianArray( Type*, size_t ) {}
+
#endif
/** Reads a value from memory, assuming memory buffer in little-endian.
@@ -297,6 +302,13 @@ inline void ByteOrderConverter::writeLittleEndian( void* pDstBuffer, Type nValue
}
#ifdef OSL_BIGENDIAN
+template< typename Type >
+inline void ByteOrderConverter::convertLittleEndianArray( Type* pnArray, size_t nElemCount )
+{
+ for( Type* pnArrayEnd = pnArray + nElemCount; pnArray != pnArrayEnd; ++pnArray )
+ convertLittleEndian( *pnArray );
+}
+
inline void ByteOrderConverter::swap2( sal_uInt8* pnData )
{
::std::swap( pnData[ 0 ], pnData[ 1 ] );
diff --git a/oox/inc/oox/helper/modelobjecthelper.hxx b/oox/inc/oox/helper/modelobjecthelper.hxx
index e36e7001e613..b25035dd7107 100644
--- a/oox/inc/oox/helper/modelobjecthelper.hxx
+++ b/oox/inc/oox/helper/modelobjecthelper.hxx
@@ -48,7 +48,7 @@ class ObjectContainer
{
public:
explicit ObjectContainer(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory,
const ::rtl::OUString& rServiceName );
~ObjectContainer();
@@ -68,8 +68,8 @@ private:
void createContainer() const;
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- mxFactory; /// Factory to create the container.
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ mxModelFactory; /// Factory to create the container.
mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
mxContainer; /// Container for the objects.
::rtl::OUString maServiceName; /// Service name to create the container.
@@ -81,9 +81,9 @@ private:
/** Contains tables for named drawing objects for a document model.
Contains tables for named line markers, line dashes, fill gradients, and
- fill bitmaps. The class is needed to handle different document models in
- the same filter (e.g. embedded charts) which carry their own drawing object
- tables.
+ fill bitmap URLs. The class is needed to handle different document models
+ in the same filter (e.g. embedded charts) which carry their own drawing
+ object tables.
*/
class ModelObjectHelper
{
@@ -108,18 +108,18 @@ public:
an internal constant name with a new unused index appended. */
::rtl::OUString insertFillGradient( const ::com::sun::star::awt::Gradient& rGradient );
- /** Inserts a new named fill bitmap, returns the bitmap name, based on an
- internal constant name with a new unused index appended. */
- ::rtl::OUString insertFillBitmap( const ::rtl::OUString& rGraphicUrl );
+ /** Inserts a new named fill bitmap URL, returns the bitmap name, based on
+ an internal constant name with a new unused index appended. */
+ ::rtl::OUString insertFillBitmapUrl( const ::rtl::OUString& rGraphicUrl );
private:
ObjectContainer maMarkerContainer; /// Contains all named line markers (line end polygons).
ObjectContainer maDashContainer; /// Contains all named line dsahes.
ObjectContainer maGradientContainer; /// Contains all named fill gradients.
- ObjectContainer maBitmapContainer; /// Contains all named fill bitmaps.
+ ObjectContainer maBitmapUrlContainer; /// Contains all named fill bitmap URLs.
const ::rtl::OUString maDashNameBase; /// Base name for all named line dashes.
const ::rtl::OUString maGradientNameBase; /// Base name for all named fill gradients.
- const ::rtl::OUString maBitmapNameBase; /// Base name for all named fill bitmaps.
+ const ::rtl::OUString maBitmapUrlNameBase; /// Base name for all named fill bitmap URLs.
};
// ============================================================================
diff --git a/oox/inc/oox/helper/propertymap.hxx b/oox/inc/oox/helper/propertymap.hxx
index 9e7196381002..7177a7f95cef 100644
--- a/oox/inc/oox/helper/propertymap.hxx
+++ b/oox/inc/oox/helper/propertymap.hxx
@@ -59,7 +59,6 @@ class PropertyMap : public PropertyMapBase
{
public:
explicit PropertyMap();
- ~PropertyMap();
/** Returns the name of the passed property identifier. */
static const ::rtl::OUString& getPropertyName( sal_Int32 nPropId );
@@ -73,9 +72,18 @@ public:
/** Sets the specified property to the passed value. Does nothing, if the
identifier is invalid. */
+ inline bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue )
+ { if( nPropId < 0 ) return false; (*this)[ nPropId ] = rValue; return true; }
+
+ /** Sets the specified property to the passed value. Does nothing, if the
+ identifier is invalid. */
template< typename Type >
- inline void setProperty( sal_Int32 nPropId, const Type& rValue )
- { if( nPropId >= 0 ) (*this)[ nPropId ] <<= rValue; }
+ inline bool setProperty( sal_Int32 nPropId, const Type& rValue )
+ { if( nPropId < 0 ) return false; (*this)[ nPropId ] <<= rValue; return true; }
+
+ /** Inserts all properties contained in the passed property map. */
+ inline void assignUsed( const PropertyMap& rPropMap )
+ { insert( rPropMap.begin(), rPropMap.end() ); }
/** Returns a sequence of property values, filled with all contained properties. */
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
@@ -86,7 +94,7 @@ public:
::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames,
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) const;
- /** Creates and fills a new instance supporting the XPropertySet interface. */
+ /** Creates a property set supporting the XPropertySet interface and inserts all properties. */
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
makePropertySet() const;
diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx
index 9a49bb48cf92..8b5b562e84f2 100644
--- a/oox/inc/oox/helper/propertyset.hxx
+++ b/oox/inc/oox/helper/propertyset.hxx
@@ -28,8 +28,9 @@
#ifndef OOX_HELPER_PROPERTYSET_HXX
#define OOX_HELPER_PROPERTYSET_HXX
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include "oox/token/properties.hxx"
namespace oox {
@@ -82,24 +83,25 @@ public:
inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
getXPropertySet() const { return mxPropSet; }
+ /** Returns true, if the specified property is supported by the property set. */
+ bool hasProperty( sal_Int32 nPropId ) const;
+
// Get properties ---------------------------------------------------------
/** Gets the specified property from the property set.
- @return true, if the any could be filled with the property value. */
- bool getAnyProperty( ::com::sun::star::uno::Any& orValue, sal_Int32 nPropId ) const;
+ @return the property value, or an empty Any, if the property is missing. */
+ ::com::sun::star::uno::Any getAnyProperty( sal_Int32 nPropId ) const;
/** Gets the specified property from the property set.
@return true, if the passed variable could be filled with the property value. */
template< typename Type >
- inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const;
-
- /** Gets the specified property from the property set.
- @return the property value, or an empty Any, if the property is missing. */
- ::com::sun::star::uno::Any getAnyProperty( sal_Int32 nPropId ) const;
+ inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const
+ { return getAnyProperty( nPropId ) >>= orValue; }
/** Gets the specified boolean property from the property set.
@return true = property contains true; false = property contains false or error occured. */
- bool getBoolProperty( sal_Int32 nPropId ) const;
+ inline bool getBoolProperty( sal_Int32 nPropId ) const
+ { bool bValue = false; return getProperty( bValue, nPropId ) && bValue; }
/** Gets the specified properties from the property set. Tries to use the XMultiPropertySet interface.
@param orValues (out-parameter) The related property values.
@@ -111,11 +113,12 @@ public:
// Set properties ---------------------------------------------------------
/** Puts the passed any into the property set. */
- void setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
/** Puts the passed value into the property set. */
template< typename Type >
- inline void setProperty( sal_Int32 nPropId, const Type& rValue );
+ inline bool setProperty( sal_Int32 nPropId, const Type& rValue )
+ { return setAnyProperty( nPropId, ::com::sun::star::uno::Any( rValue ) ); }
/** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface.
@param rPropNames The property names. MUST be ordered alphabetically.
@@ -132,33 +135,20 @@ public:
private:
/** Gets the specified property from the property set.
@return true, if the any could be filled with the property value. */
- bool getAnyProperty( ::com::sun::star::uno::Any& orValue, const ::rtl::OUString& rPropName ) const;
+ bool implGetPropertyValue( ::com::sun::star::uno::Any& orValue, const ::rtl::OUString& rPropName ) const;
/** Puts the passed any into the property set. */
- void setAnyProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
+ bool implSetPropertyValue( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
private:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
mxPropSet; /// The mandatory property set interface.
::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet >
mxMultiPropSet; /// The optional multi property set interface.
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ mxPropSetInfo; /// Property information.
};
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-inline bool PropertySet::getProperty( Type& orValue, sal_Int32 nPropId ) const
-{
- ::com::sun::star::uno::Any aAny;
- return getAnyProperty( aAny, nPropId ) && (aAny >>= orValue);
-}
-
-template< typename Type >
-inline void PropertySet::setProperty( sal_Int32 nPropId, const Type& rValue )
-{
- setAnyProperty( nPropId, ::com::sun::star::uno::Any( rValue ) );
-}
-
// ============================================================================
} // namespace oox
diff --git a/oox/inc/oox/helper/textinputstream.hxx b/oox/inc/oox/helper/textinputstream.hxx
index 2e98d3fc8c84..1c8ef471c587 100644..100755
--- a/oox/inc/oox/helper/textinputstream.hxx
+++ b/oox/inc/oox/helper/textinputstream.hxx
@@ -25,29 +25,100 @@
*
************************************************************************/
-#ifndef OOX_HELPER_RECORDINPUTSTREAM_HXX
-#define OOX_HELPER_RECORDINPUTSTREAM_HXX
+#ifndef OOX_HELPER_TEXTINPUTSTREAM_HXX
+#define OOX_HELPER_TEXTINPUTSTREAM_HXX
-#include "oox/helper/binaryinputstream.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace io { class XTextInputStream; }
+ namespace uno { class XComponentContext; }
+} } }
namespace oox {
+class BinaryInputStream;
+
// ============================================================================
class TextInputStream
{
public:
- explicit TextInputStream( BinaryInputStream& rInStrm, rtl_TextEncoding eTextEnc );
+ explicit TextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ explicit TextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ BinaryInputStream& rInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ ~TextInputStream();
- /** Returns true, if the wrapped input stream is in EOF state. */
+ /** Returns true, if no more text is available in the stream.
+ */
bool isEof() const;
- /** Reads a text line from the stream. */
+
+ /** Reads a text line from the stream.
+
+ If the last line in the stream is not terminated with line-end
+ character(s), the stream will immediately go into EOF state and return
+ the text line. Otherwise, if the last character in the stream is a
+ line-end character, the next call to this function will turn the stream
+ into EOF state and return an empty string.
+ */
::rtl::OUString readLine();
+ /** Reads a text portion from the stream until the specified character is
+ found.
+
+ If the end of the stream is not terminated with the specified
+ character, the stream will immediately go into EOF state and return the
+ remaining text portion. Otherwise, if the last character in the stream
+ is the specified character (and caller specifies to read and return it,
+ see parameter bIncludeChar), the next call to this function will turn
+ the stream into EOF state and return an empty string.
+
+ @param cChar
+ The separator character to be read to.
+
+ @param bIncludeChar
+ True = if found, the specified character will be read from stream
+ and included in the returned string.
+ False = the specified character will neither be read from the
+ stream nor included in the returned string, but will be
+ returned as first character in the next call of this function
+ or readLine().
+ */
+ ::rtl::OUString readToChar( sal_Unicode cChar, bool bIncludeChar );
+
+ // ------------------------------------------------------------------------
+
+ /** Creates a UNO text input stream object from the passed UNO input stream.
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
+ createXTextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ // ------------------------------------------------------------------------
+private:
+ void init(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ /** Adds the pending character in front of the passed string, if existing. */
+ ::rtl::OUString createFinalString( const ::rtl::OUString& rString );
+
private:
- BinaryInputStream& mrInStrm;
- rtl_TextEncoding meTextEnc;
- sal_Unicode mcLastEolChar;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
+ mxTextStrm;
+ sal_Unicode mcPendingChar;
};
// ============================================================================
diff --git a/oox/inc/oox/helper/zipstorage.hxx b/oox/inc/oox/helper/zipstorage.hxx
index 0c9a15c10077..26eeebc47979 100644
--- a/oox/inc/oox/helper/zipstorage.hxx
+++ b/oox/inc/oox/helper/zipstorage.hxx
@@ -31,7 +31,7 @@
#include "oox/helper/storagebase.hxx"
namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
+ namespace uno { class XComponentContext; }
} } }
namespace oox {
@@ -43,11 +43,11 @@ class ZipStorage : public StorageBase
{
public:
explicit ZipStorage(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream );
explicit ZipStorage(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream );
virtual ~ZipStorage();
@@ -83,9 +83,8 @@ private:
virtual void implCommit() const;
private:
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > XStorageRef;
-
- XStorageRef mxStorage; /// Storage based on input or output stream.
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ mxStorage; /// Storage based on input or output stream.
};
// ============================================================================
diff --git a/oox/inc/oox/ole/axbinaryreader.hxx b/oox/inc/oox/ole/axbinaryreader.hxx
index f26075ff52eb..b986fc8065c6 100644
--- a/oox/inc/oox/ole/axbinaryreader.hxx
+++ b/oox/inc/oox/ole/axbinaryreader.hxx
@@ -40,7 +40,7 @@ namespace ole {
/** A wrapper for a binary input stream that supports aligned read operations.
The implementation does not support seeking back the wrapped stream. All
- seeking operations (tell, seek, align) are performed relative to the
+ seeking operations (tell, seekTo, align) are performed relative to the
position of the wrapped stream at construction time of this wrapper. It is
possible to construct this wrapper with an unseekable input stream without
loosing any functionality.
@@ -50,21 +50,26 @@ class AxAlignedInputStream : public BinaryInputStream
public:
explicit AxAlignedInputStream( BinaryInputStream& rInStrm );
+ /** Returns the size of the data this stream represents, if the wrapped
+ stream supports the size() operation. */
+ virtual sal_Int64 size() const;
/** Return the current relative stream position (relative to position of
the wrapped stream at construction time). */
virtual sal_Int64 tell() const;
/** Seeks the stream to the passed relative position, if it is behind the
current position. */
virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
/** Reads nBytes bytes to the passed sequence.
@return Number of bytes really read. */
- virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes );
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Reads nBytes bytes to the (existing) buffer opMem.
@return Number of bytes really read. */
- virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes );
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Seeks the stream forward by the passed number of bytes. */
- virtual void skip( sal_Int32 nBytes );
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Aligns the stream to a multiple of the passed size (relative to the
position of the wrapped stream at construction time). */
@@ -78,8 +83,9 @@ public:
inline void skipAligned() { align( sizeof( Type ) ); skip( sizeof( Type ) ); }
private:
- BinaryInputStream& mrInStrm; /// The wrapped input stream.
+ BinaryInputStream* mpInStrm; /// The wrapped input stream.
sal_Int64 mnStrmPos; /// Tracks relative position in the stream.
+ sal_Int64 mnStrmSize; /// Size of the wrapped stream data.
};
// ============================================================================
diff --git a/oox/inc/oox/ole/oleobjecthelper.hxx b/oox/inc/oox/ole/oleobjecthelper.hxx
index c3a58213abc9..159384b0fcab 100644
--- a/oox/inc/oox/ole/oleobjecthelper.hxx
+++ b/oox/inc/oox/ole/oleobjecthelper.hxx
@@ -63,7 +63,7 @@ class OleObjectHelper
{
public:
explicit OleObjectHelper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory );
~OleObjectHelper();
bool importOleObject(
diff --git a/oox/inc/oox/ole/olestorage.hxx b/oox/inc/oox/ole/olestorage.hxx
index eabcfd4d0f87..5ea9d023257b 100644..100755
--- a/oox/inc/oox/ole/olestorage.hxx
+++ b/oox/inc/oox/ole/olestorage.hxx
@@ -32,7 +32,7 @@
namespace com { namespace sun { namespace star {
namespace container { class XNameContainer; }
- namespace lang { class XMultiServiceFactory; }
+ namespace uno { class XComponentContext; }
} } }
namespace oox {
@@ -45,12 +45,12 @@ class OleStorage : public StorageBase
{
public:
explicit OleStorage(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
bool bBaseStreamAccess );
explicit OleStorage(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
bool bBaseStreamAccess );
@@ -101,8 +101,8 @@ private:
virtual void implCommit() const;
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- mxFactory; /// Factory for storage/stream creation.
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext; /// Component context with service manager.
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
mxStorage; /// Access to elements of this sub storage.
const OleStorage* mpParentStorage; /// Parent OLE storage that contains this storage.
diff --git a/oox/inc/oox/ole/vbacontrol.hxx b/oox/inc/oox/ole/vbacontrol.hxx
index 8c4274ffda7e..941b7d06d95a 100644
--- a/oox/inc/oox/ole/vbacontrol.hxx
+++ b/oox/inc/oox/ole/vbacontrol.hxx
@@ -206,7 +206,7 @@ public:
rtl_TextEncoding eTextEnc );
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCompContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
ControlConverter maConverter;
};
diff --git a/oox/inc/oox/ole/vbainputstream.hxx b/oox/inc/oox/ole/vbainputstream.hxx
index 858698518968..bc73eb3b2ce2 100644
--- a/oox/inc/oox/ole/vbainputstream.hxx
+++ b/oox/inc/oox/ole/vbainputstream.hxx
@@ -42,14 +42,23 @@ class VbaInputStream : public BinaryInputStream
public:
explicit VbaInputStream( BinaryInputStream& rInStrm );
+ /** Returns -1, stream size is not determinable. */
+ virtual sal_Int64 size() const;
+ /** Returns -1, stream position is not tracked. */
+ virtual sal_Int64 tell() const;
+ /** Does nothing, stream is not seekable. */
+ virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
/** Reads nBytes bytes to the passed sequence.
@return Number of bytes really read. */
- virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes );
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Reads nBytes bytes to the (existing) buffer opMem.
@return Number of bytes really read. */
- virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes );
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Seeks the stream forward by the passed number of bytes. */
- virtual void skip( sal_Int32 nBytes );
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
private:
/** If no data left in chunk buffer, reads the next chunk from stream. */
@@ -58,7 +67,7 @@ private:
private:
typedef ::std::vector< sal_uInt8 > ChunkBuffer;
- BinaryInputStream& mrInStrm;
+ BinaryInputStream* mpInStrm;
ChunkBuffer maChunk;
size_t mnChunkPos;
};
diff --git a/oox/inc/oox/ole/vbamodule.hxx b/oox/inc/oox/ole/vbamodule.hxx
index 52b2261e55b5..57a1de3169a3 100644..100755
--- a/oox/inc/oox/ole/vbamodule.hxx
+++ b/oox/inc/oox/ole/vbamodule.hxx
@@ -35,6 +35,7 @@ namespace com { namespace sun { namespace star {
namespace container { class XNameAccess; }
namespace container { class XNameContainer; }
namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
} } }
namespace oox {
@@ -51,6 +52,7 @@ class VbaModule
{
public:
explicit VbaModule(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
const ::rtl::OUString& rName,
rtl_TextEncoding eTextEnc,
@@ -90,6 +92,8 @@ private:
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext; /// Component context with service manager.
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
mxDocModel; /// Document model used to import/export the VBA project.
::rtl::OUString maName;
diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx
index 40e81c923d25..c5446e86dace 100644
--- a/oox/inc/oox/ole/vbaproject.hxx
+++ b/oox/inc/oox/ole/vbaproject.hxx
@@ -189,7 +189,7 @@ private:
typedef ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
- mxCompContext; /// Component context with service manager.
+ mxContext; /// Component context with service manager.
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
mxDocModel; /// Document model used to import/export the VBA project.
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx
index a6561772ed3a..8bc961e59f00 100644
--- a/oox/inc/oox/ppt/slidepersist.hxx
+++ b/oox/inc/oox/ppt/slidepersist.hxx
@@ -90,7 +90,7 @@ public:
void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr pFillPropertiesPtr ){ mpBackgroundPropertiesPtr = pFillPropertiesPtr; }
oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; }
- oox::drawingml::Color& getBackgroundColorRef() { return maBackgroundColorRef; }
+ oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; }
sal_Bool isMasterPage() const { return mbMaster; }
sal_Bool isNotesPage() const { return mbNotes; }
@@ -130,7 +130,7 @@ private:
SlidePersistPtr mpMasterPagePtr;
oox::drawingml::ShapePtr maShapesPtr;
- oox::drawingml::Color maBackgroundColorRef;
+ oox::drawingml::Color maBackgroundColor;
oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr;
::std::list< boost::shared_ptr< TimeNode > > maTimeNodeList;
diff --git a/oox/inc/oox/vml/vmldrawing.hxx b/oox/inc/oox/vml/vmldrawing.hxx
index 0d87dae3138b..c61c25461aa4 100644
--- a/oox/inc/oox/vml/vmldrawing.hxx
+++ b/oox/inc/oox/vml/vmldrawing.hxx
@@ -132,7 +132,7 @@ public:
/** Final processing after import of the fragment. */
void finalizeFragmentImport();
- /** Creates and inserts all UNO shapes into the passed container. The virtual
+ /** Creates and inserts all UNO shapes into the draw page. The virtual
function notifyXShapeInserted() will be called for each new shape. */
void convertAndInsert() const;
diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx
index 934be61e5a65..887ab8bb0f22 100644
--- a/oox/inc/oox/vml/vmlformatting.hxx
+++ b/oox/inc/oox/vml/vmlformatting.hxx
@@ -32,9 +32,8 @@
namespace oox {
class GraphicHelper;
- class ModelObjectHelper;
- class PropertyMap;
namespace drawingml { class Color; }
+ namespace drawingml { class ShapePropertyMap; }
}
namespace oox {
@@ -91,7 +90,7 @@ public:
@param bDefaultAsPixel Set to true if omitted measure unit means
pixel. Set to false if omitted measure unit means EMU.
*/
- static sal_Int32 decodeMeasureToEmu(
+ static sal_Int64 decodeMeasureToEmu(
const GraphicHelper& rGraphicHelper,
const ::rtl::OUString& rValue,
sal_Int32 nRefValue,
@@ -179,8 +178,7 @@ struct StrokeModel
/** Writes the properties to the passed property map. */
void pushToPropMap(
- PropertyMap& rPropMap,
- ModelObjectHelper& rModelObjectHelper,
+ ::oox::drawingml::ShapePropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper ) const;
};
@@ -206,8 +204,7 @@ struct FillModel
/** Writes the properties to the passed property map. */
void pushToPropMap(
- PropertyMap& rPropMap,
- ModelObjectHelper& rModelObjectHelper,
+ ::oox::drawingml::ShapePropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper ) const;
};
diff --git a/oox/inc/oox/vml/vmlinputstream.hxx b/oox/inc/oox/vml/vmlinputstream.hxx
index a425425cd0cb..d0121f8d85e2 100644
--- a/oox/inc/oox/vml/vmlinputstream.hxx
+++ b/oox/inc/oox/vml/vmlinputstream.hxx
@@ -28,36 +28,72 @@
#ifndef OOX_VML_VMLINPUTSTREAM_HXX
#define OOX_VML_VMLINPUTSTREAM_HXX
-#include <comphelper/seqstream.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/string.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XTextInputStream; }
+ namespace uno { class XComponentContext; }
+} } }
namespace oox {
namespace vml {
// ============================================================================
-struct StreamDataContainer
-{
- ::comphelper::ByteSequence maDataSeq;
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::io::XInputStream > InputStream_BASE;
- explicit StreamDataContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm );
-};
+/** An input stream class for VML streams, implementing the UNO interface
+ com.sun.star.io.XInputStream needed by the Expat XML parsers.
-// ============================================================================
+ This stream reads the data from the input stream passed to the constructor,
+ and parses all XML elements for features unsupported by the current Expat
+ XML parser:
-/** An input stream class for VML streams.
+ 1) All elements that have the form '<![inst]>' where 'inst' is any string
+ not containing the characters '<' and '>' are stripped from the input
+ stream.
- This stream reads the entire data from the input stream passed to the
- constructor, and parses all XML elements for features unsupported by the
- current Expat parser.
+ 2) Multiple occurences of the same attribute in an element but the last
+ are removed.
- All elements that have the form '<![inst]>' where 'inst' is any string not
- containing the characters '<' and '>' are stripped from the input stream.
+ 3) Line breaks represented by a single <br> element (without matching
+ </br> element) are replaced by a literal LF character.
*/
-class InputStream : private StreamDataContainer, public ::comphelper::SequenceInputStream
+class InputStream : public InputStream_BASE
{
public:
- explicit InputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm );
+ explicit InputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm );
virtual ~InputStream();
+
+ virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available()
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL closeInput()
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ void updateBuffer() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ ::rtl::OString readToElementBegin() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ ::rtl::OString readToElementEnd() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
+ mxTextStrm;
+ ::com::sun::star::uno::Sequence< sal_Unicode > maOpeningBracket;
+ ::com::sun::star::uno::Sequence< sal_Unicode > maClosingBracket;
+ const ::rtl::OString maOpeningCData;
+ const ::rtl::OString maClosingCData;
+ ::rtl::OString maBuffer;
+ sal_Int32 mnBufferPos;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx
index 5552a5e5ce52..7c34fc346010 100644
--- a/oox/inc/oox/xls/biffhelper.hxx
+++ b/oox/inc/oox/xls/biffhelper.hxx
@@ -442,6 +442,7 @@ const sal_uInt16 BIFF_ID_MTHREADSETTINGS = 0x089A;
const sal_uInt16 BIFF_ID_MULTBLANK = 0x00BE;
const sal_uInt16 BIFF_ID_MULTRK = 0x00BD;
const sal_uInt16 BIFF_ID_NOTE = 0x001C;
+const sal_uInt16 BIFF_ID_NOTESOUND = 0x0096;
const sal_uInt16 BIFF2_ID_NUMBER = 0x0003;
const sal_uInt16 BIFF3_ID_NUMBER = 0x0203;
const sal_uInt16 BIFF_ID_OBJ = 0x005D;
@@ -620,7 +621,7 @@ public:
// BIFF12 import ----------------------------------------------------------
/** Reads a BIFF12 string with leading 16-bit or 32-bit length field. */
- static ::rtl::OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true );
+ static ::rtl::OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true, bool bAllowNulChars = false );
// BIFF2-BIFF8 import -----------------------------------------------------
diff --git a/oox/inc/oox/xls/biffinputstream.hxx b/oox/inc/oox/xls/biffinputstream.hxx
index 003ab28be34f..9f0ffa853ebc 100644
--- a/oox/inc/oox/xls/biffinputstream.hxx
+++ b/oox/inc/oox/xls/biffinputstream.hxx
@@ -242,30 +242,30 @@ public:
// BinaryStreamBase interface (seeking) -----------------------------------
- /** Returns true, as the BIFF input stream is required to be seekable. */
- virtual bool isSeekable() const;
+ /** Returns the data size of the whole record without record headers. */
+ virtual sal_Int64 size() const;
/** Returns the position inside of the whole record content. */
virtual sal_Int64 tell() const;
- /** Returns the data size of the whole record without record headers. */
- virtual sal_Int64 getLength() const;
/** Seeks in record content to the specified position. */
virtual void seek( sal_Int64 nRecPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
/** Returns the absolute position in the wrapped binary stream. */
sal_Int64 tellBase() const;
/** Returns the total size of the wrapped binary stream. */
- sal_Int64 getBaseLength() const;
+ sal_Int64 sizeBase() const;
// BinaryInputStream interface (stream read access) -----------------------
/** Reads nBytes bytes to the passed sequence.
@return Number of bytes really read. */
- virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes );
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Reads nBytes bytes and copies them to the passed buffer opMem.
@return Number of bytes really read. */
- virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes );
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Seeks forward inside the current record. */
- virtual void skip( sal_Int32 nBytes );
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Stream operator for integral and floating-point types. */
template< typename Type >
@@ -352,9 +352,6 @@ public:
// ------------------------------------------------------------------------
private:
- /** Forwards calls of readValue() template functions to the record buffer. */
- virtual void readAtom( void* opMem, sal_uInt8 nSize );
-
/** Initializes all members after base stream has been seeked to new record. */
void setupRecord();
/** Restarts the current record from the beginning. */
@@ -383,16 +380,9 @@ private:
records, stores the length in mnComplRecSize. */
void calcRecordLength();
- /** Ensures that reading nBytes bytes is possible with next stream access.
- @descr Stream must be located at the end of a raw record, and handling
- of CONTINUE records must be enabled.
- @return True if nBytes can be read from stream. */
- bool ensureRawReadSize( sal_uInt16 nBytes );
/** Returns the maximum size of raw data possible to read in one block. */
- sal_uInt16 getMaxRawReadSize( sal_Int32 nBytes ) const;
+ sal_uInt16 getMaxRawReadSize( sal_Int32 nBytes, size_t nAtomSize ) const;
- /** Reads an array of Unicode characters and appends them to the passed buffer. */
- void appendUnicodeArray( ::rtl::OUStringBuffer& orBuffer, sal_uInt16 nChars, bool b16BitChars, bool bAllowNulChars );
/** Reads the BIFF8 Unicode string header fields. */
void readUniStringHeader( bool& orb16BitChars, sal_Int32& ornAddSize );
diff --git a/oox/inc/oox/xls/biffoutputstream.hxx b/oox/inc/oox/xls/biffoutputstream.hxx
index ada646bd879a..7d03572be5ec 100644
--- a/oox/inc/oox/xls/biffoutputstream.hxx
+++ b/oox/inc/oox/xls/biffoutputstream.hxx
@@ -94,9 +94,6 @@ private:
CONTINUE record, use setPortionSize(). Example: To write a sequence of
16-bit values where 4 values form a unit and cannot be split, call
setPortionSize(8) first (4*2 bytes == 8).
-
- To write unicode character arrays, call writeUnicodeBuffer(). It creates
- CONTINUE records and repeats the unicode string flag byte automatically.
*/
class BiffOutputStream : public BinaryOutputStream
{
@@ -113,47 +110,44 @@ public:
/** Finishes the current record. Must be called for every started record. */
void endRecord();
- /** Sets size of data portion in bytes. 0 means no portions are used. */
- void setPortionSize( sal_uInt16 nSize );
+ /** Sets size of data portion in bytes. 0 or 1 means no portions are used. */
+ void setPortionSize( sal_uInt8 nSize );
// BinaryStreamBase interface (seeking) -----------------------------------
/** Returns the absolute position in the wrapped binary stream. */
sal_Int64 tellBase() const;
/** Returns the total size of the wrapped binary stream. */
- sal_Int64 getBaseLength() const;
+ sal_Int64 sizeBase() const;
// BinaryOutputStream interface (stream write access) ---------------------
/** Writes the passed data sequence. */
- virtual void writeData( const StreamDataSequence& rData );
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 );
/** Writes nBytes bytes from the passed buffer pMem. */
- virtual void writeMemory( const void* pMem, sal_Int32 nBytes );
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
/** Writes a sequence of nBytes bytes with the passed value. */
- void fill( sal_uInt8 nValue, sal_Int32 nBytes );
- /** Writes a block of memory, ensures that it is not split to a CONTINUE record. */
- void writeBlock( const void* pMem, sal_uInt16 nBytes );
+ void fill( sal_uInt8 nValue, sal_Int32 nBytes, size_t nAtomSize = 1 );
- /** Stream operator for integral and floating-point types. */
+ /** Stream operator for all data types supported by the writeValue() function. */
template< typename Type >
inline BiffOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
// ------------------------------------------------------------------------
private:
- /** Forwards calls of writeValue() template functions to the record buffer. */
- virtual void writeAtom( const void* pMem, sal_uInt8 nSize );
-
/** Checks the remaining size in the current record, creates CONTINUE record if needed. */
void ensureRawBlock( sal_uInt16 nSize );
- /** Checks the remaining size in the current record and creates CONTINUE record if needed.
+
+ /** Checks the remaining size in the current record and creates a CONTINUE
+ record if needed.
@return Maximum size left for writing to current record. */
- sal_uInt16 prepareRawBlock( sal_Int32 nTotalSize );
+ sal_uInt16 prepareWriteBlock( sal_Int32 nTotalSize, size_t nAtomSize );
private:
prv::BiffOutputRecordBuffer maRecBuffer; /// Raw record data buffer.
- sal_uInt16 mnPortionSize; /// Size of data portions.
- sal_uInt16 mnPortionPos; /// Position in current portion.
+ sal_uInt8 mnPortionSize; /// Size of data portions.
+ sal_uInt8 mnPortionPos; /// Position in current portion.
};
// ============================================================================
diff --git a/oox/inc/oox/xls/chartsheetfragment.hxx b/oox/inc/oox/xls/chartsheetfragment.hxx
index 8dfedc5ba48e..2ff482ccd960 100644
--- a/oox/inc/oox/xls/chartsheetfragment.hxx
+++ b/oox/inc/oox/xls/chartsheetfragment.hxx
@@ -39,10 +39,8 @@ class ChartsheetFragment : public WorksheetFragmentBase
{
public:
explicit ChartsheetFragment(
- const WorkbookHelper& rHelper,
- const ::rtl::OUString& rFragmentPath,
- const ISegmentProgressBarRef& rxProgressBar,
- sal_Int16 nSheet );
+ const WorksheetHelper& rHelper,
+ const ::rtl::OUString& rFragmentPath );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -67,9 +65,8 @@ class BiffChartsheetFragment : public BiffWorksheetFragmentBase
{
public:
explicit BiffChartsheetFragment(
- const BiffWorkbookFragmentBase& rParent,
- const ISegmentProgressBarRef& rxProgressBar,
- sal_Int16 nSheet );
+ const WorksheetHelper& rHelper,
+ const BiffWorkbookFragmentBase& rParent );
/** Imports the entire sheet fragment, returns true, if EOF record has been reached. */
virtual bool importFragment();
diff --git a/oox/inc/oox/xls/commentsbuffer.hxx b/oox/inc/oox/xls/commentsbuffer.hxx
index e87d52ff03a2..406a03534584 100644
--- a/oox/inc/oox/xls/commentsbuffer.hxx
+++ b/oox/inc/oox/xls/commentsbuffer.hxx
@@ -40,8 +40,11 @@ struct CommentModel
{
::com::sun::star::table::CellRangeAddress
maRange; /// Position of the comment in the worksheet.
- RichStringRef mxText; /// Formatted text of the comment.
- sal_Int32 mnAuthorId; /// Identifier of the comment's author.
+ RichStringRef mxText; /// Formatted text of the comment (not used in BIFF8).
+ ::rtl::OUString maAuthor; /// Comment author (BIFF8 only).
+ sal_Int32 mnAuthorId; /// Identifier of the comment's author (OOXML and BIFF12 only).
+ sal_uInt16 mnObjId; /// Drawing object identifier (BIFF8 only).
+ bool mbVisible; /// True = comment is always shown (BIFF2-BIFF8 only).
explicit CommentModel();
};
@@ -57,6 +60,8 @@ public:
void importComment( const AttributeList& rAttribs );
/** Imports a cell comment from the passed stream of a COMMENT record. */
void importComment( SequenceInputStream& rStrm );
+ /** Imports a cell comment from the passed stream of a NOTE record. */
+ void importNote( BiffInputStream& rStrm );
/** Creates and returns a new rich-string object for the comment text. */
RichStringRef createText();
@@ -65,6 +70,14 @@ public:
void finalizeImport();
private:
+ /** Reads a BIFF2-BIFF5 NOTE record. */
+ void importNoteBiff2( BiffInputStream& rStrm );
+ /** Reads a BIFF8 NOTE record. */
+ void importNoteBiff8( BiffInputStream& rStrm );
+ /** Reads a NOTESOUND record. */
+ void importNoteSound( BiffInputStream& rStrm );
+
+private:
CommentModel maModel;
};
diff --git a/oox/inc/oox/xls/condformatbuffer.hxx b/oox/inc/oox/xls/condformatbuffer.hxx
index fae6381f6402..7b651856036d 100644
--- a/oox/inc/oox/xls/condformatbuffer.hxx
+++ b/oox/inc/oox/xls/condformatbuffer.hxx
@@ -44,9 +44,9 @@ namespace xls {
/** Model for a single rule in a conditional formatting. */
struct CondFormatRuleModel
{
- typedef ::std::vector< TokensFormulaContext > ContextVector;
+ typedef ::std::vector< ApiTokenSequence > ApiTokenSequenceVector;
- ContextVector maFormulas; /// Formulas for rule conditions.
+ ApiTokenSequenceVector maFormulas; /// Formulas for rule conditions.
::rtl::OUString maText; /// Text for 'contains' rules.
sal_Int32 mnPriority; /// Priority of this rule.
sal_Int32 mnType; /// Type of the rule.
diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx
index 5374c47f6a07..f26a51a1f04c 100644
--- a/oox/inc/oox/xls/defnamesbuffer.hxx
+++ b/oox/inc/oox/xls/defnamesbuffer.hxx
@@ -37,7 +37,6 @@ namespace com { namespace sun { namespace star {
namespace oox {
namespace xls {
-class FormulaContext;
class BiffInputStreamPos;
// ============================================================================
@@ -91,15 +90,15 @@ public:
/** Returns the original name as imported from or exported to the file. */
const ::rtl::OUString& getUpcaseModelName() const;
/** Returns an Any with a SingleReference or ComplexReference, or an empty Any. */
- ::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddress ) const;
+ ::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddr ) const;
protected:
- /** Imports the OOXML formula string, using the passed formula context. */
- void importOoxFormula( FormulaContext& rContext, sal_Int16 nBaseSheet );
- /** Imports the BIFF12 formula, using the passed formula context. */
- void importBiff12Formula( FormulaContext& rContext, sal_Int16 nBaseSheet, SequenceInputStream& rStrm );
- /** Imports the BIFF formula, using the passed formula context. */
- void importBiffFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 );
+ /** Converts the OOXML formula string stored in the own model. */
+ ApiTokenSequence importOoxFormula( sal_Int16 nBaseSheet );
+ /** Imports the BIFF12 formula from the passed stream. */
+ ApiTokenSequence importBiff12Formula( sal_Int16 nBaseSheet, SequenceInputStream& rStrm );
+ /** Imports the BIFF formula from the passed stream. */
+ ApiTokenSequence importBiffFormula( sal_Int16 nBaseSheet, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 );
/** Tries to convert the passed token sequence to a SingleReference or ComplexReference. */
void extractReference( const ApiTokenSequence& rTokens );
@@ -151,10 +150,10 @@ public:
bool getAbsoluteRange( ::com::sun::star::table::CellRangeAddress& orRange ) const;
private:
- /** Imports the OOXML or BIFF12 formula, using the passed formula context. */
- void implImportOoxFormula( FormulaContext& rContext );
- /** Imports the BIFF formula, using the passed formula context. */
- void implImportBiffFormula( FormulaContext& rContext );
+ /** Imports the OOXML or BIFF12 definition of the name. */
+ void implImportOoxFormula();
+ /** Imports the BIFF definition of the name. */
+ void implImportBiffFormula();
private:
typedef ::std::auto_ptr< StreamDataSequence > StreamDataSeqPtr;
diff --git a/oox/inc/oox/xls/drawingbase.hxx b/oox/inc/oox/xls/drawingbase.hxx
new file mode 100755
index 000000000000..01bf43a6434f
--- /dev/null
+++ b/oox/inc/oox/xls/drawingbase.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_XLS_DRAWINGBASE_HXX
+#define OOX_XLS_DRAWINGBASE_HXX
+
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/xls/worksheethelper.hxx"
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+/** Absolute position in a spreadsheet (in EMUs) independent from cells. */
+struct AnchorPointModel : public ::oox::drawingml::EmuPoint
+{
+ inline explicit AnchorPointModel() : ::oox::drawingml::EmuPoint( -1, -1 ) {}
+ inline bool isValid() const { return (X >= 0) && (Y >= 0); }
+};
+
+// ----------------------------------------------------------------------------
+
+/** Absolute size in a spreadsheet (in EMUs). */
+struct AnchorSizeModel : public ::oox::drawingml::EmuSize
+{
+ inline explicit AnchorSizeModel() : ::oox::drawingml::EmuSize( -1, -1 ) {}
+ inline bool isValid() const { return (Width >= 0) && (Height >= 0); }
+};
+
+// ----------------------------------------------------------------------------
+
+/** Position in spreadsheet (cell position and offset inside cell). */
+struct CellAnchorModel
+{
+ sal_Int32 mnCol; /// Column index.
+ sal_Int32 mnRow; /// Row index.
+ sal_Int64 mnColOffset; /// X offset inside the column.
+ sal_Int64 mnRowOffset; /// Y offset inside the row.
+
+ explicit CellAnchorModel();
+ inline bool isValid() const { return (mnCol >= 0) && (mnRow >= 0); }
+};
+
+// ----------------------------------------------------------------------------
+
+/** Application-specific client data of a shape. */
+struct AnchorClientDataModel
+{
+ bool mbLocksWithSheet;
+ bool mbPrintsWithSheet;
+
+ explicit AnchorClientDataModel();
+};
+
+// ============================================================================
+
+/** Contains the position of a shape in the spreadsheet. Supports different
+ shape anchor modes (absolute, one-cell, two-cell). */
+class ShapeAnchor : public WorksheetHelper
+{
+public:
+ explicit ShapeAnchor( const WorksheetHelper& rHelper );
+
+ /** Imports the shape anchor (one of the elements xdr:absoluteAnchor, xdr:oneCellAnchor, xdr:twoCellAnchor). */
+ void importAnchor( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Imports the absolute anchor position from the xdr:pos element. */
+ void importPos( const AttributeList& rAttribs );
+ /** Imports the absolute anchor size from the xdr:ext element. */
+ void importExt( const AttributeList& rAttribs );
+ /** Imports the shape client data from the xdr:clientData element. */
+ void importClientData( const AttributeList& rAttribs );
+ /** Sets an attribute of the cell-dependent anchor position from xdr:from and xdr:to elements. */
+ void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue );
+ /** Imports the client anchor settings from a VML element. */
+ void importVmlAnchor( const ::rtl::OUString& rAnchor );
+ /** Imports the client anchor settings from a BIFF or DFF stream. */
+ void importBiffAnchor( BinaryInputStream& rStrm );
+
+ /** Calculates the resulting shape anchor in EMUs. */
+ ::oox::drawingml::EmuRectangle calcAnchorRectEmu(
+ const ::com::sun::star::awt::Size& rPageSizeHmm ) const;
+ /** Calculates the resulting shape anchor in 1/100 mm. */
+ ::com::sun::star::awt::Rectangle calcAnchorRectHmm(
+ const ::com::sun::star::awt::Size& rPageSizeHmm ) const;
+
+private:
+ /** Converts the passed anchor to an absolute position in EMUs. */
+ ::oox::drawingml::EmuPoint calcCellAnchorEmu( const CellAnchorModel& rModel ) const;
+
+private:
+ enum AnchorType
+ {
+ ANCHOR_INVALID, /// Anchor type is unknown.
+ ANCHOR_ABSOLUTE, /// Absolute anchor (top-left corner and size in absolute units).
+ ANCHOR_ONECELL, /// One-cell anchor (top-left corner at cell, size in absolute units).
+ ANCHOR_TWOCELL /// Two-cell anchor (top-left and bottom-right corner at cell).
+ };
+
+ /** Specifies how cell positions from CellAnchorModel have to be processed. */
+ enum CellAnchorType
+ {
+ CELLANCHOR_EMU, /// Offsets are given in EMUs.
+ CELLANCHOR_PIXEL, /// Offsets are given in screen pixels.
+ CELLANCHOR_COLROW /// Offsets are given in fractions of column width or row height.
+ };
+
+ AnchorType meAnchorType; /// Type of this shape anchor.
+ CellAnchorType meCellAnchorType; /// Type of the cell anchor models.
+ AnchorPointModel maPos; /// Top-left position, if anchor is of type absolute.
+ AnchorSizeModel maSize; /// Anchor size, if anchor is not of type two-cell.
+ CellAnchorModel maFrom; /// Top-left position, if anchor is not of type absolute.
+ CellAnchorModel maTo; /// Bottom-right position, if anchor is of type two-cell.
+ AnchorClientDataModel maClientData; /// Shape client data.
+ sal_Int32 mnEditAs; /// Anchor mode as shown in the UI.
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx
index 0d3360323a94..d71c1a25b436 100644
--- a/oox/inc/oox/xls/drawingfragment.hxx
+++ b/oox/inc/oox/xls/drawingfragment.hxx
@@ -37,6 +37,7 @@
#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmldrawingfragment.hxx"
#include "oox/vml/vmltextbox.hxx"
+#include "oox/xls/drawingbase.hxx"
#include "oox/xls/excelhandlers.hxx"
namespace oox { namespace ole {
@@ -51,98 +52,6 @@ namespace xls {
// DrawingML
// ============================================================================
-/** Absolute position in spreadsheet (in EMUs) independent from cells. */
-struct AnchorPosModel : public ::oox::drawingml::EmuPoint
-{
- inline explicit AnchorPosModel() : ::oox::drawingml::EmuPoint( -1, -1 ) {}
- inline bool isValid() const { return (X >= 0) && (Y >= 0); }
-};
-
-// ----------------------------------------------------------------------------
-
-/** Absolute size in spreadsheet (in EMUs). */
-struct AnchorSizeModel : public ::oox::drawingml::EmuSize
-{
- inline explicit AnchorSizeModel() : ::oox::drawingml::EmuSize( -1, -1 ) {}
- inline bool isValid() const { return (Width >= 0) && (Height >= 0); }
-};
-
-// ----------------------------------------------------------------------------
-
-/** Position in spreadsheet (cell position and offset inside cell in EMUs). */
-struct AnchorCellModel
-{
- sal_Int32 mnCol; /// Column index.
- sal_Int32 mnRow; /// Row index.
- sal_Int64 mnColOffset; /// X offset in column mnCol (EMUs).
- sal_Int64 mnRowOffset; /// Y offset in row mnRow (EMUs).
-
- explicit AnchorCellModel();
- inline bool isValid() const { return (mnCol >= 0) && (mnRow >= 0); }
-};
-
-// ----------------------------------------------------------------------------
-
-/** Application-specific client data of a shape. */
-struct AnchorClientDataModel
-{
- bool mbLocksWithSheet;
- bool mbPrintsWithSheet;
-
- explicit AnchorClientDataModel();
-};
-
-// ============================================================================
-
-/** Contains the position of a shape in the spreadsheet. Supports different
- shape anchor modes (absolute, one-cell, two-cell). */
-class ShapeAnchor : public WorksheetHelper
-{
-public:
- explicit ShapeAnchor( const WorksheetHelper& rHelper );
-
- /** Imports the shape anchor (one of the elements xdr:absoluteAnchor, xdr:oneCellAnchor, xdr:twoCellAnchor). */
- void importAnchor( sal_Int32 nElement, const AttributeList& rAttribs );
- /** Imports the absolute anchor position from the xdr:pos element. */
- void importPos( const AttributeList& rAttribs );
- /** Imports the absolute anchor size from the xdr:ext element. */
- void importExt( const AttributeList& rAttribs );
- /** Imports the shape client data from the xdr:clientData element. */
- void importClientData( const AttributeList& rAttribs );
- /** Sets an attribute of the cell-dependent anchor position from xdr:from and xdr:to elements. */
- void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue );
- /** Imports and converts the VML specific client anchor. */
- void importVmlAnchor( const ::rtl::OUString& rAnchor );
-
- /** Returns true, if the anchor contains valid position and size settings. */
- bool isValidAnchor() const;
-
- /** Calculates the resulting shape anchor in 1/100 mm. */
- ::com::sun::star::awt::Rectangle
- calcApiLocation(
- const ::com::sun::star::awt::Size& rApiSheetSize,
- const AnchorSizeModel& rEmuSheetSize ) const;
-
- /** Calculates the resulting shape anchor in EMUs. */
- ::com::sun::star::awt::Rectangle
- calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) const;
-
-private:
- enum AnchorType { ANCHOR_ABSOLUTE, ANCHOR_ONECELL, ANCHOR_TWOCELL, ANCHOR_VML, ANCHOR_INVALID };
-
- AnchorType meType; /// Type of this shape anchor.
- AnchorPosModel maPos; /// Top-left position, if anchor is of type absolute.
- AnchorSizeModel maSize; /// Anchor size, if anchor is not of type two-cell.
- AnchorCellModel maFrom; /// Top-left position, if anchor is not of type absolute.
- AnchorCellModel maTo; /// Bottom-right position, if anchor is of type two-cell.
- AnchorClientDataModel maClientData; /// Shape client data.
- sal_Int32 mnEditAs; /// Anchor mode as shown in the UI.
-};
-
-typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef;
-
-// ============================================================================
-
class ShapeMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
{
public:
@@ -220,10 +129,10 @@ protected:
virtual void onEndElement();
private:
+ typedef ::std::auto_ptr< ShapeAnchor > ShapeAnchorRef;
+
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
mxDrawPage; /// Drawing page of this sheet.
- ::com::sun::star::awt::Size maApiSheetSize; /// Sheet size in 1/100 mm.
- AnchorSizeModel maEmuSheetSize; /// Sheet size in EMU.
::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
};
diff --git a/oox/inc/oox/xls/drawingmanager.hxx b/oox/inc/oox/xls/drawingmanager.hxx
new file mode 100755
index 000000000000..91fba91ee271
--- /dev/null
+++ b/oox/inc/oox/xls/drawingmanager.hxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_XLS_DRAWINGMANAGER_HXX
+#define OOX_XLS_DRAWINGMANAGER_HXX
+
+#include "oox/xls/drawingbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace drawing { class XDrawPage; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox { namespace drawingml { class ShapePropertyMap; } }
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+const sal_uInt16 BIFF_OBJ_INVALID_ID = 0;
+
+// ============================================================================
+// Model structures for BIFF OBJ record data
+// ============================================================================
+
+/** This structure contains line formatting attributes from an OBJ record. */
+struct BiffObjLineModel
+{
+ sal_uInt8 mnColorIdx; /// Index into color palette.
+ sal_uInt8 mnStyle; /// Line dash style.
+ sal_uInt8 mnWidth; /// Line width.
+ bool mbAuto; /// True = automatic line format.
+
+ explicit BiffObjLineModel();
+
+ /** Returns true, if the line formatting is visible (automatic or explicit). */
+ bool isVisible() const;
+};
+
+// ============================================================================
+
+/** This structure contains fill formatting attributes from an OBJ record. */
+struct BiffObjFillModel
+{
+ sal_uInt8 mnBackColorIdx; /// Index to color palette for background color.
+ sal_uInt8 mnPattColorIdx; /// Index to color palette for pattern foreground color.
+ sal_uInt8 mnPattern; /// Fill pattern.
+ bool mbAuto; /// True = automatic fill format.
+
+ explicit BiffObjFillModel();
+
+ /** Returns true, if the fill formatting is visible (automatic or explicit). */
+ bool isFilled() const;
+};
+
+// ============================================================================
+
+/** This structure contains text formatting attributes from an OBJ record. */
+struct BiffObjTextModel
+{
+ sal_uInt16 mnTextLen; /// Length of the text (characters).
+ sal_uInt16 mnFormatSize; /// Size of the formatting array (bytes).
+ sal_uInt16 mnLinkSize; /// Size of the linked text formula (bytes).
+ sal_uInt16 mnDefFontId; /// Font index for default font formatting.
+ sal_uInt16 mnFlags; /// Additional flags.
+ sal_uInt16 mnOrientation; /// Text orientation.
+ sal_uInt16 mnButtonFlags; /// Additional flags for push buttons.
+ sal_uInt16 mnShortcut; /// Shortcut character.
+ sal_uInt16 mnShortcutEA; /// East-asian shortcut character.
+
+ explicit BiffObjTextModel();
+
+ /** Reads text data from a BIFF3/BIFF4 OBJ record. */
+ void readObj3( BiffInputStream& rStrm );
+ /** Reads text data from a BIFF5 OBJ record. */
+ void readObj5( BiffInputStream& rStrm );
+ /** Reads text data from a BIFF8 TXO record. */
+ void readTxo8( BiffInputStream& rStrm );
+
+ /** Returns the horizontal alignment of the text. */
+ sal_uInt8 getHorAlign() const;
+ /** Returns the vertical alignment of the text. */
+ sal_uInt8 getVerAlign() const;
+};
+
+// ============================================================================
+// BIFF drawing objects
+// ============================================================================
+
+class BiffDrawingBase;
+class BiffDrawingObjectBase;
+typedef ::boost::shared_ptr< BiffDrawingObjectBase > BiffDrawingObjectRef;
+
+// ----------------------------------------------------------------------------
+
+class BiffDrawingObjectContainer
+{
+public:
+ explicit BiffDrawingObjectContainer();
+
+ /** Returns true, if the object list is empty. */
+ inline bool empty() const { return maObjects.empty(); }
+
+ /** Appends the passed object to the list of objects. */
+ void append( const BiffDrawingObjectRef& rxDrawingObj );
+ /** Tries to insert the passed object into the last group or appends it. */
+ void insertGrouped( const BiffDrawingObjectRef& rxDrawingObj );
+
+ /** Creates and inserts all UNO shapes into the passed shape container. */
+ void convertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle* pParentRect = 0 ) const;
+
+private:
+ typedef RefVector< BiffDrawingObjectBase > BiffDrawingObjectVector;
+ BiffDrawingObjectVector maObjects;
+};
+
+// ============================================================================
+
+/** Base class for all BIFF drawing objects (OBJ records). */
+class BiffDrawingObjectBase : public WorksheetHelper
+{
+public:
+ explicit BiffDrawingObjectBase( const WorksheetHelper& rHelper );
+ virtual ~BiffDrawingObjectBase();
+
+ /** Reads the BIFF3 OBJ record, returns a new drawing object. */
+ static BiffDrawingObjectRef importObjBiff3( const WorksheetHelper& rHelper, BiffInputStream& rStrm );
+ /** Reads the BIFF4 OBJ record, returns a new drawing object. */
+ static BiffDrawingObjectRef importObjBiff4( const WorksheetHelper& rHelper, BiffInputStream& rStrm );
+ /** Reads the BIFF5 OBJ record, returns a new drawing object. */
+ static BiffDrawingObjectRef importObjBiff5( const WorksheetHelper& rHelper, BiffInputStream& rStrm );
+ /** Reads the BIFF8 OBJ record, returns a new drawing object. */
+ static BiffDrawingObjectRef importObjBiff8( const WorksheetHelper& rHelper, BiffInputStream& rStrm );
+
+ /** Sets whether this is an area object (then its width and height must be greater than 0). */
+ inline void setAreaObj( bool bAreaObj ) { mbAreaObj = bAreaObj; }
+ /** If set to true, the object supports a simple on-click macro and/or hyperlink. */
+ inline void setSimpleMacro( bool bMacro ) { mbSimpleMacro = bMacro; }
+
+ /** If set to false, the UNO shape will not be created, processed, or inserted into the draw page. */
+ inline void setProcessShape( bool bProcess ) { mbProcessShape = bProcess; }
+ /** If set to false, the UNO shape will be created or processed, but not be inserted into the draw page. */
+ inline void setInsertShape( bool bInsert ) { mbInsertShape = bInsert; }
+ /** If set to true, a new custom UNO shape will be created while in DFF import (BIFF8 only). */
+ inline void setCustomDffObj( bool bCustom ) { mbCustomDff = bCustom; }
+
+ /** Returns the object identifier from the OBJ record. */
+ inline sal_uInt16 getObjId() const { return mnObjId; }
+ /** Returns the object type from the OBJ record. */
+ inline sal_uInt16 getObjType() const { return mnObjType; }
+
+ /** Returns true, if the object is hidden. */
+ inline bool isHidden() const { return mbHidden; }
+ /** Returns true, if the object is visible. */
+ inline bool isVisible() const { return mbVisible; }
+ /** Returns true, if the object is printable. */
+ inline bool isPrintable() const { return mbPrintable; }
+
+ /** Creates the UNO shape and inserts it into the passed shape container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ convertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle* pParentRect = 0 ) const;
+
+protected:
+ /** Reads the object name in a BIFF5 OBJ record. */
+ void readNameBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen );
+ /** Reads the macro link in a BIFF3 OBJ record. */
+ void readMacroBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the macro link in a BIFF4 OBJ record. */
+ void readMacroBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the macro link in a BIFF5 OBJ record. */
+ void readMacroBiff5( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the ftMacro sub structure in an OBJ record. */
+ void readMacroBiff8( BiffInputStream& rStrm );
+
+ /** Converts the passed line formatting to the passed property map. */
+ void convertLineProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows = 0 ) const;
+ /** Converts the passed fill formatting to the passed property map. */
+ void convertFillProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const;
+ /** Converts the passed frame flags to the passed property map. */
+ void convertFrameProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, sal_uInt16 nFrameFlags ) const;
+
+ /** Derived classes read the contents of the a BIFF3 OBJ record from the passed stream. */
+ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Derived classes read the contents of the a BIFF4 OBJ record from the passed stream. */
+ virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Derived classes read the contents of the a BIFF5 OBJ record from the passed stream. */
+ virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
+ /** Derived classes read the contents of the specified subrecord of a BIFF8 OBJ record from stream. */
+ virtual void implReadObjBiff8SubRec( BiffInputStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize );
+
+ /** Derived classes create the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const = 0;
+
+private:
+ /** Reads the contents of a BIFF3 OBJ record. */
+ void importObjBiff3( BiffInputStream& rStrm );
+ /** Reads the contents of a BIFF4 OBJ record. */
+ void importObjBiff4( BiffInputStream& rStrm );
+ /** Reads the contents of a BIFF5 OBJ record. */
+ void importObjBiff5( BiffInputStream& rStrm );
+ /** Reads the contents of a BIFF8 OBJ record. */
+ void importObjBiff8( BiffInputStream& rStrm );
+
+private:
+ ShapeAnchor maAnchor; /// Position of the drawing object.
+ ::rtl::OUString maObjName; /// Name of the object.
+ ::rtl::OUString maMacroName; /// Name of an attached macro.
+ ::rtl::OUString maHyperlink; /// On-click hyperlink URL.
+ sal_uInt32 mnDffShapeId; /// Shape identifier from DFF stream (BIFF8 only).
+ sal_uInt32 mnDffFlags; /// Shape flags from DFF stream.
+ sal_uInt16 mnObjId; /// The object identifier (unique per drawing).
+ sal_uInt16 mnObjType; /// The object type from OBJ record.
+ bool mbHasAnchor; /// True = anchor has been initialized.
+ bool mbHidden; /// True = object is hidden.
+ bool mbVisible; /// True = object is visible (form controls).
+ bool mbPrintable; /// True = object is printable.
+ bool mbAreaObj; /// True = width and height must be greater than 0.
+ bool mbAutoMargin; /// True = set automatic text margin.
+ bool mbSimpleMacro; /// True = create simple macro link and hyperlink.
+ bool mbProcessShape; /// True = object is valid, do processing and insertion.
+ bool mbInsertShape; /// True = insert the UNO shape into the draw page.
+ bool mbCustomDff; /// True = recreate UNO shape in DFF import (BIFF8 only).
+};
+
+// ============================================================================
+
+/** A placeholder object for unknown/unsupported object types. */
+class BiffPlaceholderObject : public BiffDrawingObjectBase
+{
+public:
+ explicit BiffPlaceholderObject( const WorksheetHelper& rHelper );
+
+protected:
+ /** Creates the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+// ============================================================================
+
+/** A group object that is able to contain other child objects. */
+class BiffGroupObject : public BiffDrawingObjectBase
+{
+public:
+ explicit BiffGroupObject( const WorksheetHelper& rHelper );
+
+ /** Tries to insert the passed drawing object into this or a nested group. */
+ bool tryInsert( const BiffDrawingObjectRef& rxDrawingObj );
+
+protected:
+ /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
+ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
+ virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
+ virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
+
+ /** Creates the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+protected:
+ BiffDrawingObjectContainer maChildren; /// All child objects contained in this group object.
+ sal_uInt16 mnFirstUngrouped; /// Object identfier of first object not grouped into this group.
+};
+
+// ============================================================================
+
+/** A simple line object. */
+class BiffLineObject : public BiffDrawingObjectBase
+{
+public:
+ explicit BiffLineObject( const WorksheetHelper& rHelper );
+
+protected:
+ /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
+ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
+ virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
+ virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
+
+ /** Creates the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+protected:
+ BiffObjLineModel maLineModel; /// Line formatting.
+ sal_uInt16 mnArrows; /// Line arrows.
+ sal_uInt8 mnStartPoint; /// Starting point.
+};
+
+// ============================================================================
+
+/** A simple rectangle object (used as base class for oval objects). */
+class BiffRectObject : public BiffDrawingObjectBase
+{
+public:
+ explicit BiffRectObject( const WorksheetHelper& rHelper );
+
+protected:
+ /** Reads the fill model, the line model, and frame flags. */
+ void readFrameData( BiffInputStream& rStrm );
+
+ /** Converts fill formatting, line formatting, and frame style. */
+ void convertRectProperties( ::oox::drawingml::ShapePropertyMap& rPropMap ) const;
+
+ /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
+ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
+ virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
+ virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
+
+ /** Creates the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+protected:
+ BiffObjFillModel maFillModel; /// Fill formatting.
+ BiffObjLineModel maLineModel; /// Line formatting.
+ sal_uInt16 mnFrameFlags; /// Additional flags.
+};
+
+// ============================================================================
+
+/** A simple oval object. */
+class BiffOvalObject : public BiffRectObject
+{
+public:
+ explicit BiffOvalObject( const WorksheetHelper& rHelper );
+
+protected:
+ /** Creates the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+// ============================================================================
+
+/** A simple arc object. */
+class BiffArcObject : public BiffDrawingObjectBase
+{
+public:
+ explicit BiffArcObject( const WorksheetHelper& rHelper );
+
+protected:
+ /** Reads the contents of the a BIFF3 OBJ record from the passed stream. */
+ virtual void implReadObjBiff3( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
+ virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
+ virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
+
+ /** Creates the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+protected:
+ BiffObjFillModel maFillModel; /// Fill formatting.
+ BiffObjLineModel maLineModel; /// Line formatting.
+ sal_uInt8 mnQuadrant; /// Visible quadrant of the circle.
+};
+
+// ============================================================================
+
+/** A simple polygon object. */
+class BiffPolygonObject : public BiffRectObject
+{
+public:
+ explicit BiffPolygonObject( const WorksheetHelper& rHelper );
+
+protected:
+ /** Reads the contents of the a BIFF4 OBJ record from the passed stream. */
+ virtual void implReadObjBiff4( BiffInputStream& rStrm, sal_uInt16 nMacroSize );
+ /** Reads the contents of the a BIFF5 OBJ record from the passed stream. */
+ virtual void implReadObjBiff5( BiffInputStream& rStrm, sal_uInt16 nNameLen, sal_uInt16 nMacroSize );
+
+ /** Creates the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert( BiffDrawingBase& rDrawing,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+private:
+ /** Reads the COORDLIST record following the OBJ record. */
+ void importCoordList( BiffInputStream& rStrm );
+
+protected:
+ typedef ::std::vector< ::com::sun::star::awt::Point > PointVector;
+ PointVector maCoords; /// Coordinates relative to bounding rectangle.
+ sal_uInt16 mnPolyFlags; /// Additional flags.
+ sal_uInt16 mnPointCount; /// Polygon point count.
+};
+
+// ============================================================================
+// BIFF drawing page
+// ============================================================================
+
+/** Base class for a container for all objects on a drawing page (in a
+ spreadsheet or in an embedded chart object).
+
+ For BIFF import, it is needed to load all drawing objects before converting
+ them to UNO shapes. There might be some dummy drawing objects (e.g. the
+ dropdown buttons of autofilters) which have to be skipped. The information,
+ that a drawing object is a dummy object, may be located after the drawing
+ objects themselves.
+
+ The BIFF8 format stores drawing objects in the DFF stream (stored
+ fragmented in MSODRAWING records), and in the OBJ records. The DFF stream
+ fragments are collected in a single stream, and the complete stream will be
+ processed afterwards.
+ */
+class BiffDrawingBase : public WorksheetHelper
+{
+public:
+ explicit BiffDrawingBase( const WorksheetHelper& rHelper,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage );
+
+ /** Imports a plain OBJ record (without leading DFF data). */
+ void importObj( BiffInputStream& rStrm );
+ /** Sets the object with the passed identifier to be skipped on import. */
+ void setSkipObj( sal_uInt16 nObjId );
+
+ /** Final processing after import of the all drawing objects. */
+ void finalizeImport();
+
+ /** Creates a new UNO shape object, inserts it into the passed UNO shape
+ container, and sets the shape position and size. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertXShape(
+ const ::rtl::OUString& rService,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+ /** Derived classes may want to know that a shape has been inserted. Will
+ be called from the convertAndInsert() implementation. */
+ virtual void notifyShapeInserted(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) = 0;
+
+protected:
+ /** Appends a new drawing object to the list of raw objects (without DFF data). */
+ void appendRawObject( const BiffDrawingObjectRef& rxDrawingObj );
+
+private:
+ typedef RefMap< sal_uInt16, BiffDrawingObjectBase > BiffDrawingObjectMapById;
+ typedef ::std::vector< sal_uInt16 > BiffObjIdVector;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
+ mxDrawPage; /// UNO draw page used to insert the shapes.
+ BiffDrawingObjectContainer maRawObjs; /// Drawing objects without DFF data.
+ BiffDrawingObjectMapById maObjMapId; /// Maps drawing objects by their object identifiers.
+ BiffObjIdVector maSkipObjs; /// Identifiers of all objects to be skipped.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Drawing manager of a single sheet. */
+class BiffSheetDrawing : public BiffDrawingBase
+{
+public:
+ explicit BiffSheetDrawing( const WorksheetHelper& rHelper );
+
+ /** Called when a new UNO shape has been inserted into the draw page. */
+ virtual void notifyShapeInserted(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ const ::com::sun::star::awt::Rectangle& rShapeRect );
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx
index 789cbc99cb07..1e10a91e25c2 100644
--- a/oox/inc/oox/xls/excelfilter.hxx
+++ b/oox/inc/oox/xls/excelfilter.hxx
@@ -34,23 +34,23 @@
namespace oox {
namespace xls {
-class WorkbookData;
+class WorkbookGlobals;
// ============================================================================
class ExcelFilterBase
{
public:
- void registerWorkbookData( WorkbookData& rData );
- WorkbookData& getWorkbookData() const;
- void unregisterWorkbookData();
+ void registerWorkbookGlobals( WorkbookGlobals& rBookGlob );
+ WorkbookGlobals& getWorkbookGlobals() const;
+ void unregisterWorkbookGlobals();
protected:
explicit ExcelFilterBase();
virtual ~ExcelFilterBase();
private:
- WorkbookData* mpData;
+ WorkbookGlobals* mpBookGlob;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx
index 864f5f9a9e44..deaa5244b0d0 100644
--- a/oox/inc/oox/xls/excelhandlers.hxx
+++ b/oox/inc/oox/xls/excelhandlers.hxx
@@ -45,55 +45,24 @@ class WorkbookContextBase : public ::oox::core::ContextHandler2, public Workbook
{
public:
template< typename ParentType >
- explicit WorkbookContextBase( ParentType& rParent );
+ inline explicit WorkbookContextBase( ParentType& rParent ) :
+ ::oox::core::ContextHandler2( rParent ), WorkbookHelper( rParent ) {}
};
-// ----------------------------------------------------------------------------
-
-template< typename ParentType >
-WorkbookContextBase::WorkbookContextBase( ParentType& rParent ) :
- ::oox::core::ContextHandler2( rParent ),
- WorkbookHelper( rParent )
-{
-}
-
// ============================================================================
/** Context handler derived from the WorksheetHelper helper class.
Used to import contexts in sheet fragments.
*/
-class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelperRoot
+class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelper
{
public:
template< typename ParentType >
- explicit WorksheetContextBase(
- ParentType& rParent,
- const ISegmentProgressBarRef& rxProgressBar,
- WorksheetType eSheetType,
- sal_Int16 nSheet );
-
- template< typename ParentType >
- explicit WorksheetContextBase( ParentType& rParent );
+ inline explicit WorksheetContextBase( ParentType& rParent ) :
+ ::oox::core::ContextHandler2( rParent ), WorksheetHelper( rParent ) {}
};
-// ----------------------------------------------------------------------------
-
-template< typename ParentType >
-WorksheetContextBase::WorksheetContextBase( ParentType& rParent,
- const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
- ::oox::core::ContextHandler2( rParent ),
- WorksheetHelperRoot( rParent, rxProgressBar, eSheetType, nSheet )
-{
-}
-
-template< typename ParentType >
-WorksheetContextBase::WorksheetContextBase( ParentType& rParent ) :
- ::oox::core::ContextHandler2( rParent ),
- WorksheetHelperRoot( rParent )
-{
-}
-
// ============================================================================
/** Fragment handler derived from the WorkbookHelper helper class.
@@ -114,17 +83,10 @@ public:
Used to import sheet fragments.
*/
-class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelperRoot
+class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelper
{
public:
explicit WorksheetFragmentBase(
- const WorkbookHelper& rHelper,
- const ::rtl::OUString& rFragmentPath,
- const ISegmentProgressBarRef& rxProgressBar,
- WorksheetType eSheetType,
- sal_Int16 nSheet );
-
- explicit WorksheetFragmentBase(
const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
};
@@ -164,15 +126,9 @@ protected:
Used to import contexts in sheet fragments.
*/
-class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelperRoot
+class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelper
{
protected:
- explicit BiffWorksheetContextBase(
- const WorkbookHelper& rHelper,
- const ISegmentProgressBarRef& rxProgressBar,
- WorksheetType eSheetType,
- sal_Int16 nSheet );
-
explicit BiffWorksheetContextBase( const WorksheetHelper& rHelper );
};
@@ -220,17 +176,6 @@ protected:
*/
BiffFragmentType startFragment( BiffType eBiff );
- /** Starts a new fragment at a specific position in the workbbok stream and
- returns the fragment type.
-
- The passed record handle must specify the stream position of the BOF
- record of the fragment substream. The function will try to start the
- next record and read the contents of the BOF record, if extant.
-
- @return Fragment type according to the imported BOF record.
- */
- BiffFragmentType startFragment( BiffType eBiff, sal_Int64 nRecHandle );
-
/** Skips the current fragment up to its trailing EOF record.
Skips all records until next EOF record. When this function returns,
@@ -273,14 +218,12 @@ protected:
Used to import sheet fragments.
*/
-class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHelperRoot
+class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHelper
{
protected:
explicit BiffWorksheetFragmentBase(
- const BiffWorkbookFragmentBase& rParent,
- const ISegmentProgressBarRef& rxProgressBar,
- WorksheetType eSheetType,
- sal_Int16 nSheet );
+ const WorksheetHelper& rHelper,
+ const BiffWorkbookFragmentBase& rParent );
};
// ----------------------------------------------------------------------------
@@ -291,9 +234,8 @@ class BiffSkipWorksheetFragment : public BiffWorksheetFragmentBase
{
public:
explicit BiffSkipWorksheetFragment(
- const BiffWorkbookFragmentBase& rParent,
- const ISegmentProgressBarRef& rxProgressBar,
- sal_Int16 nSheet );
+ const WorksheetHelper& rHelper,
+ const BiffWorkbookFragmentBase& rParent );
virtual bool importFragment();
};
diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx
index 013e63f3bf30..f7891c0ba940 100644
--- a/oox/inc/oox/xls/formulabase.hxx
+++ b/oox/inc/oox/xls/formulabase.hxx
@@ -28,6 +28,7 @@
#ifndef OOX_XLS_FORMULABASE_HXX
#define OOX_XLS_FORMULABASE_HXX
+#include <com/sun/star/beans/Pair.hpp>
#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
#include <com/sun/star/sheet/FormulaToken.hpp>
#include <com/sun/star/table/CellAddress.hpp>
@@ -40,7 +41,6 @@
namespace com { namespace sun { namespace star {
namespace sheet { class XFormulaOpCodeMapper; }
namespace sheet { class XFormulaParser; }
- namespace sheet { class XFormulaTokens; }
} } }
namespace oox { template< typename Type > class Matrix; }
@@ -216,7 +216,20 @@ const sal_uInt16 BIFF_FUNC_CEILING = 288; /// Function identif
const sal_uInt16 BIFF_FUNC_HYPERLINK = 359; /// Function identifier of the HYPERLINK function.
const sal_uInt16 BIFF_FUNC_WEEKNUM = 465; /// Function identifier of the WEEKNUM function.
-// reference helpers ==========================================================
+// Formula type ===============================================================
+
+/** Enumerates all possible types of a formula. */
+enum FormulaType
+{
+ FORMULATYPE_CELL, /// Simple cell formula, or reference to a shared formula name.
+ FORMULATYPE_ARRAY, /// Array (matrix) formula.
+ FORMULATYPE_SHAREDFORMULA, /// Shared formula definition.
+ FORMULATYPE_CONDFORMAT, /// Condition of a conditional format rule.
+ FORMULATYPE_VALIDATION, /// Condition of a data validation.
+ FORMULATYPE_DEFINEDNAME /// Definition of a defined name.
+};
+
+// Reference helpers ==========================================================
/** A 2D formula cell reference struct with relative flags. */
struct BinSingleRef2d
@@ -250,11 +263,15 @@ struct BinComplexRef2d
void readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset );
};
-// token vector, sequence =====================================================
+// Token vector, token sequence ===============================================
typedef ::com::sun::star::sheet::FormulaToken ApiToken;
typedef ::com::sun::star::uno::Sequence< ApiToken > ApiTokenSequence;
+/** Contains the base address and type of a special token representing an array
+ formula or a shared formula (sal_False), or a table operation (sal_True). */
+typedef ::com::sun::star::beans::Pair< ::com::sun::star::table::CellAddress, sal_Bool > ApiSpecialTokenInfo;
+
/** A vector of formula tokens with additional convenience functions. */
class ApiTokenVector : public ::std::vector< ApiToken >
{
@@ -270,7 +287,7 @@ public:
inline void append( sal_Int32 nOpCode, const Type& rData ) { append( nOpCode ) <<= rData; }
};
-// token sequence iterator ====================================================
+// Token sequence iterator ====================================================
/** Token sequence iterator that is able to skip space tokens. */
class ApiTokenIterator
@@ -297,7 +314,7 @@ private:
const bool mbSkipSpaces; /// true = Skip whitespace tokens.
};
-// list of API op-codes =======================================================
+// List of API op-codes =======================================================
/** Contains all API op-codes needed to build formulas with tokens. */
struct ApiOpCodes
@@ -456,23 +473,23 @@ struct FunctionParamInfo
bool mbValType; /// Data type (false = REFTYPE, true = VALTYPE).
};
-// function data ==============================================================
+// Function data ==============================================================
/** This enumeration contains constants for all known external libraries
containing supported sheet functions. */
enum FunctionLibraryType
{
- FUNCLIB_EUROTOOL, /// EuroTool add-in with EUROCONVERT function.
- FUNCLIB_UNKNOWN /// Unknown library.
+ FUNCLIB_UNKNOWN = 0, /// Unknown library (must be zero).
+ FUNCLIB_EUROTOOL /// EuroTool add-in with EUROCONVERT function.
};
// ----------------------------------------------------------------------------
/** Represents information for a spreadsheet function.
- The member mpParamInfos points to an array of type information structures
+ The member mpParamInfos points to a C-array of type information structures
for all parameters of the function. The last initialized structure
- describing a regular parameter (member meValid == EXC_PARAMVALID_ALWAYS) in
+ describing a regular parameter (member meValid == FUNC_PARAM_REGULAR) in
this array is used repeatedly for all following parameters supported by a
function.
*/
@@ -490,7 +507,7 @@ struct FunctionInfo
sal_uInt8 mnMaxParamCount; /// Maximum number of parameters.
sal_uInt8 mnRetClass; /// BIFF token class of the return value.
const FunctionParamInfo* mpParamInfos; /// Information about all parameters.
- bool mbParamPairs; /// true = optional parameters are expected to appear in pairs.
+ bool mbParamPairs; /// True = optional parameters are expected to appear in pairs.
bool mbVolatile; /// True = volatile function.
bool mbExternal; /// True = external function in Calc.
bool mbMacroFunc; /// True = macro sheet function or command.
@@ -499,7 +516,7 @@ struct FunctionInfo
typedef RefVector< FunctionInfo > FunctionInfoVector;
-// function info parameter class iterator =====================================
+// Function info parameter class iterator =====================================
/** Iterator working on the mpParamInfos member of the FunctionInfo struct.
@@ -525,7 +542,7 @@ private:
bool mbParamPairs;
};
-// base function provider =====================================================
+// Base function provider =====================================================
struct FunctionProviderImpl;
@@ -566,7 +583,7 @@ private:
FunctionProviderImplRef mxFuncImpl; /// Shared implementation between all copies of the provider.
};
-// op-code and function provider ==============================================
+// Op-code and function provider ==============================================
struct OpCodeProviderImpl;
@@ -577,7 +594,7 @@ class OpCodeProvider : public FunctionProvider // not derived from WorkbookHelpe
{
public:
explicit OpCodeProvider(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory,
FilterType eFilter, BiffType eBiff, bool bImportFilter );
virtual ~OpCodeProvider();
@@ -604,7 +621,7 @@ class ApiParserWrapper : public OpCodeProvider
{
public:
explicit ApiParserWrapper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory,
const OpCodeProvider& rOpCodeProv );
/** Returns read/write access to the formula parser property set. */
@@ -621,74 +638,7 @@ private:
PropertySet maParserProps;
};
-// formula contexts ===========================================================
-
-class FormulaContext
-{
-public:
- inline void setBaseAddress( const ::com::sun::star::table::CellAddress& rBaseAddress )
- { maBaseAddress = rBaseAddress; }
-
- inline const ::com::sun::star::table::CellAddress& getBaseAddress() const { return maBaseAddress; }
- inline bool isRelativeAsOffset() const { return mbRelativeAsOffset; }
- inline bool is2dRefsAs3dRefs() const { return mb2dRefsAs3dRefs; }
- inline bool isNulCharsAllowed() const { return mbAllowNulChars; }
-
- virtual void setTokens( const ApiTokenSequence& rTokens ) = 0;
- virtual void setSharedFormula( const ::com::sun::star::table::CellAddress& rBaseAddr );
-
-protected:
- explicit FormulaContext(
- bool bRelativeAsOffset,
- bool b2dRefsAs3dRefs,
- bool bAllowNulChars = false );
- virtual ~FormulaContext();
-
-private:
- ::com::sun::star::table::CellAddress maBaseAddress;
- bool mbRelativeAsOffset;
- bool mb2dRefsAs3dRefs;
- bool mbAllowNulChars;
-};
-
-// ----------------------------------------------------------------------------
-
-/** Stores the converted formula token sequence in a class member. */
-class TokensFormulaContext : public FormulaContext
-{
-public:
- explicit TokensFormulaContext(
- bool bRelativeAsOffset,
- bool b2dRefsAs3dRefs,
- bool bAllowNulChars = false );
-
- inline const ApiTokenSequence& getTokens() const { return maTokens; }
-
- virtual void setTokens( const ApiTokenSequence& rTokens );
-
-private:
- ApiTokenSequence maTokens;
-};
-
-// ----------------------------------------------------------------------------
-
-/** Uses the com.sun.star.sheet.XFormulaTokens interface to set a token sequence. */
-class SimpleFormulaContext : public FormulaContext
-{
-public:
- explicit SimpleFormulaContext(
- const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaTokens >& rxTokens,
- bool bRelativeAsOffset,
- bool b2dRefsAs3dRefs,
- bool bAllowNulChars = false );
-
- virtual void setTokens( const ApiTokenSequence& rTokens );
-
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaTokens > mxTokens;
-};
-
-// formula parser/printer base class for filters ==============================
+// Formula parser/printer base class for filters ==============================
/** Base class for import formula parsers and export formula compilers. */
class FormulaProcessorBase : public OpCodeProvider, protected ApiOpCodes, public WorkbookHelper
@@ -896,6 +846,24 @@ public:
::rtl::OUString& orString,
const ApiTokenSequence& rTokens ) const;
+ /** Tries to extract information about a special token used for array
+ formulas, shared formulas, or table operations.
+
+ @param orTokenInfo (output parameter) The extracted information about
+ the token. Contains the base address and the token type (sal_False
+ for array or shared formulas, sal_True for table operations).
+
+ @param rTokens The token sequence to be parsed. If it contains exactly
+ one OPCODE_BAD token with special token information, this
+ information will be extracted.
+
+ @return True = token sequence is valid, output parameter orTokenInfo
+ contains the token information extracted from the token sequence.
+ */
+ bool extractSpecialTokenInfo(
+ ApiSpecialTokenInfo& orTokenInfo,
+ const ApiTokenSequence& rTokens ) const;
+
/** Converts a single string with separators in the passed formula token
sequence to a list of string tokens.
diff --git a/oox/inc/oox/xls/formulaparser.hxx b/oox/inc/oox/xls/formulaparser.hxx
index c595993264d9..26752951abe4 100644
--- a/oox/inc/oox/xls/formulaparser.hxx
+++ b/oox/inc/oox/xls/formulaparser.hxx
@@ -87,6 +87,7 @@ private:
const ApiToken* getSingleToken( const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
const ApiToken* skipParentheses( const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
const ApiToken* findParameters( ParameterPosVector& rParams, const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
+ void appendEmptyParameter( const FunctionInfo& rFuncInfo, size_t nParam );
void appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam );
void appendRequiredParameters( const FunctionInfo& rFuncInfo, size_t nParamCount );
@@ -113,38 +114,36 @@ public:
virtual ~FormulaParser();
/** Converts an OOXML formula string. */
- void importFormula(
- FormulaContext& rContext,
+ ApiTokenSequence importFormula(
+ const ::com::sun::star::table::CellAddress& rBaseAddr,
const ::rtl::OUString& rFormulaString ) const;
/** Imports and converts a BIFF12 token array from the passed stream. */
- void importFormula(
- FormulaContext& rContext,
+ ApiTokenSequence importFormula(
+ const ::com::sun::star::table::CellAddress& rBaseAddr,
+ FormulaType eType,
SequenceInputStream& rStrm ) const;
/** Imports and converts a BIFF2-BIFF8 token array from the passed stream.
@param pnFmlaSize Size of the token array. If null is passed, reads
it from stream (1 byte in BIFF2, 2 bytes otherwise) first. */
- void importFormula(
- FormulaContext& rContext,
+ ApiTokenSequence importFormula(
+ const ::com::sun::star::table::CellAddress& rBaseAddr,
+ FormulaType eType,
BiffInputStream& rStrm,
const sal_uInt16* pnFmlaSize = 0 ) const;
+ /** Converts the passed Boolean value to a similar formula. */
+ ApiTokenSequence convertBoolToFormula( bool bValue ) const;
+
/** Converts the passed BIFF error code to a similar formula. */
- void convertErrorToFormula(
- FormulaContext& rContext,
- sal_uInt8 nErrorCode ) const;
+ ApiTokenSequence convertErrorToFormula( sal_uInt8 nErrorCode ) const;
/** Converts the passed token index of a defined name to a formula calling that name. */
- void convertNameToFormula(
- FormulaContext& rContext,
- sal_Int32 nTokenIndex ) const;
+ ApiTokenSequence convertNameToFormula( sal_Int32 nTokenIndex ) const;
/** Converts the passed number into a HYPERLINK formula with the passed URL. */
- void convertNumberToHyperlink(
- FormulaContext& rContext,
- const ::rtl::OUString& rUrl,
- double fValue ) const;
+ ApiTokenSequence convertNumberToHyperlink( const ::rtl::OUString& rUrl, double fValue ) const;
/** Converts the passed XML formula to an OLE link target. */
::rtl::OUString importOleTargetLink( const ::rtl::OUString& rFormulaString );
@@ -153,9 +152,7 @@ public:
::rtl::OUString importOleTargetLink( SequenceInputStream& rStrm );
/** Imports and converts an OLE link target from the passed stream. */
- ::rtl::OUString importOleTargetLink(
- BiffInputStream& rStrm,
- const sal_uInt16* pnFmlaSize = 0 ) const;
+ ::rtl::OUString importOleTargetLink( BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize = 0 ) const;
/** Converts the passed formula to a macro name for a drawing shape. */
::rtl::OUString importMacroName( const ::rtl::OUString& rFormulaString );
diff --git a/oox/inc/oox/xls/ooxformulaparser.hxx b/oox/inc/oox/xls/ooxformulaparser.hxx
index 7bc1bbdd4909..f74a6ddf455b 100644
--- a/oox/inc/oox/xls/ooxformulaparser.hxx
+++ b/oox/inc/oox/xls/ooxformulaparser.hxx
@@ -46,10 +46,10 @@ class OOXMLFormulaPrinterImpl;
typedef ::cppu::WeakImplHelper3<
::com::sun::star::lang::XServiceInfo,
::com::sun::star::lang::XInitialization,
- ::com::sun::star::sheet::XFilterFormulaParser > OOXMLFormulaParserBase;
+ ::com::sun::star::sheet::XFilterFormulaParser > OOXMLFormulaParser_BASE;
/** OOXML formula parser/compiler service for usage in ODF filters. */
-class OOXMLFormulaParser : public OOXMLFormulaParserBase
+class OOXMLFormulaParser : public OOXMLFormulaParser_BASE
{
public:
explicit OOXMLFormulaParser();
diff --git a/oox/inc/oox/xls/pivotcachebuffer.hxx b/oox/inc/oox/xls/pivotcachebuffer.hxx
index 2e32d0faa7e5..eeb2d7a02dd9 100644
--- a/oox/inc/oox/xls/pivotcachebuffer.hxx
+++ b/oox/inc/oox/xls/pivotcachebuffer.hxx
@@ -31,6 +31,7 @@
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/util/DateTime.hpp>
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/refvector.hxx"
#include "oox/xls/workbookhelper.hxx"
@@ -430,15 +431,15 @@ public:
void writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const;
/** Writes a source field item value into the passed sheet. */
void writeSourceDataCell( WorksheetHelper& rSheetHelper,
- sal_Int32 nCol, sal_Int32 nRow,
+ sal_Int32 nColIdx, sal_Int32 nRowIdx,
const PivotCacheItem& rItem ) const;
/** Reads a PCRECORD record and writes all item values to the passed sheet. */
void importPCRecord( SequenceInputStream& rStrm,
- WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const;
+ WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const;
/** Reads a PCITEM_INDEXLIST record and writes all item values to the passed sheet. */
void importPCItemIndexList( BiffInputStream& rStrm,
- WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const;
+ WorksheetHelper& rSheetHelper, sal_Int32 nRowIdx ) const;
private:
/** Reads the worksheet source range from the DCONREF record. */
@@ -456,6 +457,8 @@ private:
void finalizeExternalSheetSource();
/** Creates a dummy sheet that will be filled with the pivot cache data. */
void prepareSourceDataSheet();
+ /** Checks, if the row index has changed since last call, and initializes the sheet data buffer. */
+ void updateSourceDataRow( WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const;
private:
typedef RefVector< PivotCacheField > PivotCacheFieldVector;
@@ -467,7 +470,9 @@ private:
PCDefinitionModel maDefModel; /// Global pivot cache settings.
PCSourceModel maSourceModel; /// Pivot cache source settings.
PCWorksheetSourceModel maSheetSrcModel; /// Sheet source data if cache type is sheet.
+ ValueRangeSet maColSpans; /// Column spans used by SheetDataBuffer for optimized cell import.
::rtl::OUString maTargetUrl; /// URL of an external source document.
+ mutable sal_Int32 mnCurrRow; /// Current row index in dummy sheet.
bool mbValidSource; /// True = pivot cache is based on supported data source.
bool mbDummySheet; /// True = pivot cache is based on a dummy sheet.
};
diff --git a/oox/inc/oox/xls/pivotcachefragment.hxx b/oox/inc/oox/xls/pivotcachefragment.hxx
index 34a833e26525..8cb72b31a39c 100644
--- a/oox/inc/oox/xls/pivotcachefragment.hxx
+++ b/oox/inc/oox/xls/pivotcachefragment.hxx
@@ -81,7 +81,7 @@ class PivotCacheRecordsFragment : public WorksheetFragmentBase
{
public:
explicit PivotCacheRecordsFragment(
- const WorkbookHelper& rHelper,
+ const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath,
const PivotCache& rPivotCache );
@@ -97,8 +97,8 @@ private:
private:
const PivotCache& mrPivotCache;
- sal_Int32 mnCol;
- sal_Int32 mnRow;
+ sal_Int32 mnColIdx; /// Relative column index in source data.
+ sal_Int32 mnRowIdx; /// Relative row index in source data.
bool mbInRecord;
};
@@ -126,7 +126,7 @@ class BiffPivotCacheRecordsContext : public BiffWorksheetContextBase
{
public:
explicit BiffPivotCacheRecordsContext(
- const WorkbookHelper& rHelper,
+ const WorksheetHelper& rHelper,
const PivotCache& rPivotCache );
/** Reads the current record from stream and tries to insert a cell into
@@ -142,7 +142,7 @@ private:
const PivotCache& mrPivotCache;
ColumnIndexVector maUnsharedCols; /// Column indexes of all unshared cache fields.
size_t mnColIdx; /// Current index into maUnsharedCols.
- sal_Int32 mnRow; /// Current row in source data (0-based).
+ sal_Int32 mnRowIdx; /// Current row in source data (0-based).
bool mbHasShared; /// True = pivot cache contains fields with shared items.
bool mbInRow; /// True = a data row has been started.
};
diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx
index f21e2a021111..ab8313c35373 100644
--- a/oox/inc/oox/xls/richstring.hxx
+++ b/oox/inc/oox/xls/richstring.hxx
@@ -70,11 +70,13 @@ public:
/** Returns the text data of this portion. */
inline const ::rtl::OUString& getText() const { return maText; }
+ /** Returns true, if the portion fontains font formatting. */
+ inline bool hasFont() const { return mxFont.get() != 0; }
- /** Converts the portion and appends it to the passed XText. */
+ /** Converts the portion and replaces or appends to the passed XText. */
void convert(
const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText,
- sal_Int32 nXfId );
+ const Font* pFont, bool bReplace );
private:
::rtl::OUString maText; /// Portion text.
@@ -246,21 +248,30 @@ public:
/** Imports a Unicode rich-string from the passed record stream. */
void importString( SequenceInputStream& rStrm, bool bRich );
- /** Imports a byte string from the passed BIFF stream. */
- void importByteString( BiffInputStream& rStrm, rtl_TextEncoding eDefaultTextEnc, BiffStringFlags nFlags = BIFF_STR_DEFAULT );
- /** Imports a Unicode rich-string from the passed BIFF stream. */
+ /** Imports nChars byte characters from the passed BIFF stream and appends a new text portion. */
+ void importCharArray( BiffInputStream& rStrm, sal_uInt16 nChars, rtl_TextEncoding eTextEnc );
+ /** Imports a byte string from the passed BIFF stream and appends new text portions. */
+ void importByteString( BiffInputStream& rStrm, rtl_TextEncoding eTextEnc, BiffStringFlags nFlags = BIFF_STR_DEFAULT );
+ /** Imports a Unicode rich-string from the passed BIFF stream and appends new text portions. */
void importUniString( BiffInputStream& rStrm, BiffStringFlags nFlags = BIFF_STR_DEFAULT );
/** Final processing after import of all strings. */
void finalizeImport();
- /** Returns the plain text concatenated from all string portions. */
- ::rtl::OUString getPlainText() const;
-
- /** Converts the string and writes it into the passed XText. */
+ /** Tries to extract a plain string from this object. Returns the string,
+ if there is only one unformatted portion. */
+ bool extractPlainString(
+ ::rtl::OUString& orString,
+ const Font* pFirstPortionFont = 0 ) const;
+
+ /** Converts the string and writes it into the passed XText.
+ @param rxText The XText interface of the target object.
+ @param bReplaceOld True = replace old contents of the text object.
+ @param pFirstPortionFont Optional font providing additional rich-text
+ formatting for the first text portion, e.g. font escapement. */
void convert(
const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText,
- sal_Int32 nXfId ) const;
+ const Font* pFirstPortionFont = 0 ) const;
private:
/** Creates, appends, and returns a new empty string portion. */
@@ -269,19 +280,19 @@ private:
RichStringPhoneticRef createPhonetic();
/** Create base text portions from the passed string and character formatting. */
- void createFontPortions( const ::rtl::OString& rText, rtl_TextEncoding eDefaultTextEnc, FontPortionModelList& rPortions );
+ void createTextPortions( const ::rtl::OString& rText, rtl_TextEncoding eTextEnc, FontPortionModelList& rPortions );
/** Create base text portions from the passed string and character formatting. */
- void createFontPortions( const ::rtl::OUString& rText, FontPortionModelList& rPortions );
+ void createTextPortions( const ::rtl::OUString& rText, FontPortionModelList& rPortions );
/** Create phonetic text portions from the passed string and portion data. */
void createPhoneticPortions( const ::rtl::OUString& rText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen );
private:
- typedef RefVector< RichStringPortion > PortionVec;
- typedef RefVector< RichStringPhonetic > PhoneticVec;
+ typedef RefVector< RichStringPortion > PortionVector;
+ typedef RefVector< RichStringPhonetic > PhoneticVector;
- PortionVec maFontPortions; /// String portions with font data.
+ PortionVector maTextPortions; /// String portions with font data.
PhoneticSettings maPhonSettings; /// Phonetic settings for this string.
- PhoneticVec maPhonPortions; /// Phonetic text portions.
+ PhoneticVector maPhonPortions; /// Phonetic text portions.
};
typedef ::boost::shared_ptr< RichString > RichStringRef;
diff --git a/oox/inc/oox/xls/sharedformulabuffer.hxx b/oox/inc/oox/xls/sharedformulabuffer.hxx
deleted file mode 100644
index 94b7572dcfd9..000000000000
--- a/oox/inc/oox/xls/sharedformulabuffer.hxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_XLS_SHAREDFORMULABUFFER_HXX
-#define OOX_XLS_SHAREDFORMULABUFFER_HXX
-
-#include <map>
-#include <memory>
-#include "oox/xls/worksheethelper.hxx"
-
-namespace com { namespace sun { namespace star {
- namespace sheet { class XFormulaTokens; }
- namespace sheet { class XNamedRange; }
-} } }
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-/** Formula context that supports shared formulas. */
-class ExtCellFormulaContext : public SimpleFormulaContext, public WorksheetHelper
-{
-public:
- explicit ExtCellFormulaContext(
- const WorksheetHelper& rHelper,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaTokens >& rxTokens,
- const ::com::sun::star::table::CellAddress& rCellPos );
-
- virtual void setSharedFormula( const ::com::sun::star::table::CellAddress& rBaseAddr );
-};
-
-// ============================================================================
-
-class SharedFormulaBuffer : public WorksheetHelper
-{
-public:
- explicit SharedFormulaBuffer( const WorksheetHelper& rHelper );
-
- /** Imports a shared formula from a OOXML formula string. */
- void importSharedFmla( const ::rtl::OUString& rFormula,
- const ::rtl::OUString& rSharedRange, sal_Int32 nId,
- const ::com::sun::star::table::CellAddress& rBaseAddr );
- /** Imports a shared formula from a SHAREDFORMULA record in the passed stream */
- void importSharedFmla( SequenceInputStream& rStrm,
- const ::com::sun::star::table::CellAddress& rBaseAddr );
- /** Imports a shared formula from a SHAREDFMLA record in the passed stream. */
- void importSharedFmla( BiffInputStream& rStrm,
- const ::com::sun::star::table::CellAddress& rBaseAddr );
-
- /** Inserts a shared formula with the passed base address into a cell
- described by the passed formula context. */
- void setSharedFormulaCell(
- ExtCellFormulaContext& rContext,
- const ::com::sun::star::table::CellAddress& rBaseAddr );
- /** Inserts a shared formula with the passed base address into a cell
- described by the passed formula context. */
- void setSharedFormulaCell(
- ExtCellFormulaContext& rContext,
- sal_Int32 nSharedId );
-
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >
- createDefinedName( const BinAddress& rMapKey );
-
- bool implSetSharedFormulaCell(
- ExtCellFormulaContext& rContext,
- const BinAddress& rMapKey );
-
- void updateCachedCell(
- const ::com::sun::star::table::CellAddress& rBaseAddr,
- const BinAddress& rMapKey );
-
-private:
- typedef ::std::map< BinAddress, sal_Int32 > TokenIndexMap;
- typedef ::std::auto_ptr< ExtCellFormulaContext > ContextPtr;
-
- TokenIndexMap maIndexMap; /// Maps shared formula base address to defined name identifier.
- ContextPtr mxLastContext; /// Cached formula context for leading formula cell.
-};
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
-#endif
diff --git a/oox/inc/oox/xls/sharedstringsbuffer.hxx b/oox/inc/oox/xls/sharedstringsbuffer.hxx
index eff8ab4e7738..936eb6766ef4 100644
--- a/oox/inc/oox/xls/sharedstringsbuffer.hxx
+++ b/oox/inc/oox/xls/sharedstringsbuffer.hxx
@@ -49,15 +49,12 @@ public:
/** Final processing after import of all strings. */
void finalizeImport();
- /** Converts the specified string table entry. */
- void convertString(
- const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText,
- sal_Int32 nStringId,
- sal_Int32 nXfId ) const;
+ /** Returns the specified string. */
+ RichStringRef getString( sal_Int32 nStringId ) const;
private:
- typedef RefVector< RichString > StringVec;
- StringVec maStrings;
+ typedef RefVector< RichString > StringVector;
+ StringVector maStrings;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/sheetdatabuffer.hxx b/oox/inc/oox/xls/sheetdatabuffer.hxx
new file mode 100755
index 000000000000..6f61c8432e15
--- /dev/null
+++ b/oox/inc/oox/xls/sheetdatabuffer.hxx
@@ -0,0 +1,354 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_XLS_SHEETDATABUFFER_HXX
+#define OOX_XLS_SHEETDATABUFFER_HXX
+
+#include <list>
+#include <map>
+#include "oox/xls/richstring.hxx"
+#include "oox/xls/worksheethelper.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace sheet { class XNamedRange; }
+ namespace util { struct DateTime; }
+} } }
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+/** Stores basic data about cell values and formatting. */
+struct CellModel
+{
+ ::com::sun::star::table::CellAddress
+ maCellAddr; /// The address of the current cell.
+ sal_Int32 mnCellType; /// Data type of the cell value.
+ sal_Int32 mnXfId; /// XF (cell formatting) identifier.
+ bool mbShowPhonetic; /// True = show phonetic text.
+
+ explicit CellModel();
+};
+
+// ----------------------------------------------------------------------------
+
+/** Stores data about cell formulas. */
+struct CellFormulaModel
+{
+ ::com::sun::star::table::CellRangeAddress
+ maFormulaRef; /// Formula range for array/shared formulas and data tables.
+ sal_Int32 mnFormulaType; /// Type of the formula (regular, array, shared, table).
+ sal_Int32 mnSharedId; /// Identifier of a shared formula (OOXML only).
+
+ explicit CellFormulaModel();
+
+ /** Returns true, if the passed cell address is valid for an array formula. */
+ bool isValidArrayRef( const ::com::sun::star::table::CellAddress& rCellAddr );
+ /** Returns true, if the passed cell address is valid for a shared formula. */
+ bool isValidSharedRef( const ::com::sun::star::table::CellAddress& rCellAddr );
+};
+
+// ----------------------------------------------------------------------------
+
+/** Stores data about table operations. */
+struct DataTableModel
+{
+ ::rtl::OUString maRef1; /// First reference cell for table operations.
+ ::rtl::OUString maRef2; /// Second reference cell for table operations.
+ bool mb2dTable; /// True = 2-dimensional data table.
+ bool mbRowTable; /// True = row oriented data table.
+ bool mbRef1Deleted; /// True = first reference cell deleted.
+ bool mbRef2Deleted; /// True = second reference cell deleted.
+
+ explicit DataTableModel();
+};
+
+// ============================================================================
+
+/** Stores position and contents of a range of cells for optimized import. */
+class CellBlock : public WorksheetHelper
+{
+public:
+ explicit CellBlock( const WorksheetHelper& rHelper, const ValueRange& rColSpan, sal_Int32 nRow );
+
+ /** Returns true, if the end index of the passed colspan is greater than
+ the own column end index, or if the passed range has the same end index
+ but the start indexes do not match. */
+ bool isBefore( const ValueRange& rColSpan ) const;
+ /** Returns true, if the cell block can be expanded with the passed colspan. */
+ bool isExpandable( const ValueRange& rColSpan ) const;
+ /** Returns true, if the own colspan contains the passed column. */
+ bool contains( sal_Int32 nCol ) const;
+
+ /** Returns the specified cell from the last row in the cell buffer array. */
+ ::com::sun::star::uno::Any& getCellAny( sal_Int32 nCol );
+ /** Inserts a rich-string into the cell block. */
+ void insertRichString(
+ const ::com::sun::star::table::CellAddress& rAddress,
+ const RichStringRef& rxString,
+ const Font* pFirstPortionFont );
+
+ /** Appends a new row to the cell buffer array. */
+ void startNextRow();
+ /** Writes all buffered cells into the Calc sheet. */
+ void finalizeImport();
+
+private:
+ /** Fills unused cells before passed index with empty strings. */
+ void fillUnusedCells( sal_Int32 nIndex );
+
+private:
+ /** Stores position and string data of a rich-string cell. */
+ struct RichStringCell
+ {
+ ::com::sun::star::table::CellAddress
+ maCellAddr; /// The address of the rich-string cell.
+ RichStringRef mxString; /// The string with rich formatting.
+ const Font* mpFirstPortionFont; /// Font information from cell for first text portion.
+
+ explicit RichStringCell(
+ const ::com::sun::star::table::CellAddress& rCellAddr,
+ const RichStringRef& rxString,
+ const Font* pFirstPortionFont );
+ };
+ typedef ::std::list< RichStringCell > RichStringCellList;
+
+ ::com::sun::star::table::CellRangeAddress
+ maRange; /// Cell range covered by this cell block.
+ RichStringCellList maRichStrings; /// Cached rich-string cells.
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >
+ maCellArray; /// The array of cells of this cell block.
+ ::com::sun::star::uno::Any*
+ mpCurrCellRow; /// Pointer to first cell of current row (last row in maCellArray).
+ const sal_Int32 mnRowLength; /// Number of cells covered by row of this cell block.
+ sal_Int32 mnFirstFreeIndex; /// Relative index of first unused cell in current row.
+};
+
+// ============================================================================
+
+/** Manages all cell blocks currently in use. */
+class CellBlockBuffer : public WorksheetHelper
+{
+public:
+ explicit CellBlockBuffer( const WorksheetHelper& rHelper );
+
+ /** Sets column span information for a row. */
+ void setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpans );
+
+ /** Tries to find a cell block. Recalculates the map of cell blocks, if the
+ passed cell address is located in another row than the last cell. */
+ CellBlock* getCellBlock( const ::com::sun::star::table::CellAddress& rCellAddr );
+
+ /** Inserts all cells of all open cell blocks into the Calc document. */
+ void finalizeImport();
+
+private:
+ typedef ::std::map< sal_Int32, ValueRangeVector > ColSpanVectorMap;
+ typedef RefMap< sal_Int32, CellBlock > CellBlockMap;
+
+ ColSpanVectorMap maColSpans; /// Buffereed column spans, mapped by row index.
+ CellBlockMap maCellBlocks; /// All open cell blocks, mapped by last (!) column of the block span.
+ CellBlockMap::iterator maCellBlockIt; /// Pointer to cell block currently in use.
+ sal_Int32 mnCurrRow; /// Current row index used for buffered cell import.
+};
+
+// ============================================================================
+
+/** Manages the cell contents and cell formatting of a sheet.
+ */
+class SheetDataBuffer : public WorksheetHelper
+{
+public:
+ explicit SheetDataBuffer( const WorksheetHelper& rHelper );
+
+ /** Sets column span information for a row. */
+ void setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpans );
+
+ /** Inserts a blank cell (with formatting) into the sheet. */
+ void setBlankCell( const CellModel& rModel );
+ /** Inserts a value cell into the sheet. */
+ void setValueCell( const CellModel& rModel, double fValue );
+ /** Inserts a simple string cell into the sheet. */
+ void setStringCell( const CellModel& rModel, const ::rtl::OUString& rText );
+ /** Inserts a rich-string cell into the sheet. */
+ void setStringCell( const CellModel& rModel, const RichStringRef& rxString );
+ /** Inserts a shared string cell into the sheet. */
+ void setStringCell( const CellModel& rModel, sal_Int32 nStringId );
+ /** Inserts a date/time cell into the sheet and adjusts number format. */
+ void setDateTimeCell( const CellModel& rModel, const ::com::sun::star::util::DateTime& rDateTime );
+ /** Inserts a boolean cell into the sheet and adjusts number format. */
+ void setBooleanCell( const CellModel& rModel, bool bValue );
+ /** Inserts an error cell from the passed error code into the sheet. */
+ void setErrorCell( const CellModel& rModel, const ::rtl::OUString& rErrorCode );
+ /** Inserts an error cell from the passed BIFF error code into the sheet. */
+ void setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCode );
+ /** Inserts a formula cell into the sheet. */
+ void setFormulaCell( const CellModel& rModel, const ApiTokenSequence& rTokens );
+ /** Inserts a shared formula cell into the sheet (OOXML only). */
+ void setFormulaCell( const CellModel& rModel, sal_Int32 nSharedId );
+
+ /** Inserts the passed token array as array formula. */
+ void createArrayFormula(
+ const ::com::sun::star::table::CellRangeAddress& rRange,
+ const ApiTokenSequence& rTokens );
+ /** Sets a multiple table operation to the passed range. */
+ void createTableOperation(
+ const ::com::sun::star::table::CellRangeAddress& rRange,
+ const DataTableModel& rModel );
+ /** Creates a named range with a special name for a shared formula with the
+ specified identifier and formula definition (OOXML only). */
+ void createSharedFormula(
+ sal_Int32 nSharedId,
+ const ApiTokenSequence& rTokens );
+ /** Creates a named range with a special name for a shared formula with the
+ specified base address and formula definition (BIFF only). */
+ void createSharedFormula(
+ const ::com::sun::star::table::CellAddress& rCellAddr,
+ const ApiTokenSequence& rTokens );
+
+ /** Sets default cell formatting for the specified range of rows. */
+ void setRowFormat( sal_Int32 nRow, sal_Int32 nXfId, bool bCustomFormat );
+ /** Merges the cells in the passed cell range. */
+ void setMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange );
+ /** Sets a standard number format (constant from com.sun.star.util.NumberFormat) to the specified cell. */
+ void setStandardNumFmt(
+ const ::com::sun::star::table::CellAddress& rCellAddr,
+ sal_Int16 nStdNumFmt );
+
+ /** Final processing after the sheet has been imported. */
+ void finalizeImport();
+
+private:
+ struct XfIdRowRange;
+ struct XfIdRange;
+
+ /** Sets the passed formula token array into a cell. */
+ void setCellFormula(
+ const ::com::sun::star::table::CellAddress& rCellAddr,
+ const ApiTokenSequence& rTokens );
+
+ /** Creates a named range with a special name for a shared formula with the
+ specified base address and formula definition. */
+ void createSharedFormula( const BinAddress& rMapKey, const ApiTokenSequence& rTokens );
+ /** Creates a formula token array representing the shared formula with the
+ passed identifier. */
+ ApiTokenSequence resolveSharedFormula( const BinAddress& rMapKey ) const;
+
+ /** Inserts the passed array formula into the sheet. */
+ void finalizeArrayFormula(
+ const ::com::sun::star::table::CellRangeAddress& rRange,
+ const ApiTokenSequence& rTokens ) const;
+ /** Inserts the passed table operation into the sheet. */
+ void finalizeTableOperation(
+ const ::com::sun::star::table::CellRangeAddress& rRange,
+ const DataTableModel& rModel ) const;
+
+ /** Processes the cell formatting data of the passed cell.
+ @param nNumFmtId If set, overrides number format of the cell XF. */
+ void setCellFormat( const CellModel& rModel, sal_Int32 nNumFmtId = -1 );
+
+ /** Writes all cell formatting attributes to the passed row range. */
+ void writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const;
+ /** Writes all cell formatting attributes to the passed cell range. */
+ void writeXfIdRangeProperties( const XfIdRange& rXfIdRange ) const;
+ /** Tries to merge the ranges last inserted in maXfIdRanges with existing ranges. */
+ void mergeXfIdRanges();
+
+ /** Merges the passed merged range and updates right/bottom cell borders. */
+ void finalizeMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange );
+
+private:
+ /** Stores cell range address and formula token array of an array formula. */
+ typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, ApiTokenSequence > ArrayFormula;
+ typedef ::std::list< ArrayFormula > ArrayFormulaList;
+
+ /** Stores cell range address and settings of a table operation. */
+ typedef ::std::pair< ::com::sun::star::table::CellRangeAddress, DataTableModel > TableOperation;
+ typedef ::std::list< TableOperation > TableOperationList;
+
+ typedef ::std::map< BinAddress, sal_Int32 > SharedFormulaMap;
+
+ /** Stores information about a range of rows with equal cell formatting. */
+ struct XfIdRowRange
+ {
+ ValueRange maRowRange; /// Indexes of first and last row.
+ sal_Int32 mnXfId; /// XF identifier for the row range.
+
+ explicit XfIdRowRange();
+ bool intersects( const ::com::sun::star::table::CellRangeAddress& rRange ) const;
+ void set( sal_Int32 nRow, sal_Int32 nXfId );
+ bool tryExpand( sal_Int32 nRow, sal_Int32 nXfId );
+ };
+
+ /** Stores information about a range of cells with equal formatting. */
+ struct XfIdRange
+ {
+ ::com::sun::star::table::CellRangeAddress
+ maRange; /// The formatted cell range.
+ sal_Int32 mnXfId; /// XF identifier for the range.
+ sal_Int32 mnNumFmtId; /// Number format overriding the XF.
+
+ void set( const ::com::sun::star::table::CellAddress& rCellAddr, sal_Int32 nXfId, sal_Int32 nNumFmtId );
+ bool tryExpand( const ::com::sun::star::table::CellAddress& rCellAddr, sal_Int32 nXfId, sal_Int32 nNumFmtId );
+ bool tryMerge( const XfIdRange& rXfIdRange );
+ };
+ typedef ::std::map< BinAddress, XfIdRange > XfIdRangeMap;
+
+ /** Stores information about a merged cell range. */
+ struct MergedRange
+ {
+ ::com::sun::star::table::CellRangeAddress
+ maRange; /// The formatted cell range.
+ sal_Int32 mnHorAlign; /// Horizontal alignment in the range.
+
+ explicit MergedRange( const ::com::sun::star::table::CellRangeAddress& rRange );
+ explicit MergedRange( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign );
+ bool tryExpand( const ::com::sun::star::table::CellAddress& rAddress, sal_Int32 nHorAlign );
+ };
+ typedef ::std::list< MergedRange > MergedRangeList;
+
+ CellBlockBuffer maCellBlocks; /// Manages all open cell blocks.
+ ArrayFormulaList maArrayFormulas; /// All array formulas in the sheet.
+ TableOperationList maTableOperations; /// All table operations in the sheet.
+ SharedFormulaMap maSharedFormulas; /// Maps shared formula base address to defined name token index.
+ ::com::sun::star::table::CellAddress
+ maSharedFmlaAddr; /// Address of a cell containing a pending shared formula.
+ BinAddress maSharedBaseAddr; /// Base address of the pending shared formula.
+ XfIdRowRange maXfIdRowRange; /// Cached XF identifier for a range of rows.
+ XfIdRangeMap maXfIdRanges; /// Collected XF identifiers for cell ranges.
+ MergedRangeList maMergedRanges; /// Merged cell ranges.
+ MergedRangeList maCenterFillRanges; /// Merged cell ranges from 'center across' or 'fill' alignment.
+ bool mbPendingSharedFmla; /// True = maSharedFmlaAddr and maSharedBaseAddr are valid.
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx
index fdbc0ba21231..c5104dec8e8b 100644
--- a/oox/inc/oox/xls/sheetdatacontext.hxx
+++ b/oox/inc/oox/xls/sheetdatacontext.hxx
@@ -30,22 +30,37 @@
#include "oox/xls/excelhandlers.hxx"
#include "oox/xls/richstring.hxx"
-
-namespace com { namespace sun { namespace star {
- namespace table { class XCell; }
-} } }
+#include "oox/xls/sheetdatabuffer.hxx"
namespace oox {
namespace xls {
// ============================================================================
+/** Used as base for sheet data context classes. Provides fast access to often
+ used converter objects and sheet index, to improve performance.
+ */
+struct SheetDataContextBase
+{
+ AddressConverter& mrAddressConv; /// The address converter.
+ FormulaParser& mrFormulaParser; /// The formula parser.
+ SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting.
+ CellModel maCellData; /// Position, contents, formatting of current imported cell.
+ CellFormulaModel maFmlaData; /// Settings for a cell formula.
+ sal_Int16 mnSheet; /// Index of the current sheet.
+
+ explicit SheetDataContextBase( const WorksheetHelper& rHelper );
+ virtual ~SheetDataContextBase();
+};
+
+// ============================================================================
+
/** This class implements importing the sheetData element.
The sheetData element contains all row settings and all cells in a single
sheet of a spreadsheet document.
*/
-class SheetDataContext : public WorksheetContextBase
+class SheetDataContext : public WorksheetContextBase, private SheetDataContextBase
{
public:
explicit SheetDataContext( WorksheetFragmentBase& rFragment );
@@ -64,12 +79,20 @@ private:
/** Imports row settings from a row element. */
void importRow( const AttributeList& rAttribs );
/** Imports cell settings from a c element. */
- void importCell( const AttributeList& rAttribs );
+ bool importCell( const AttributeList& rAttribs );
/** Imports cell settings from an f element. */
void importFormula( const AttributeList& rAttribs );
- /** Imports a cell address and the following XF identifier. */
- void importCellHeader( SequenceInputStream& rStrm, CellType eCellType );
+ /** Imports row settings from a ROW record. */
+ void importRow( SequenceInputStream& rStrm );
+
+ /** Reads a cell address and the following XF identifier. */
+ bool readCellHeader( SequenceInputStream& rStrm, CellType eCellType );
+ /** Reads a cell formula for the current cell. */
+ ApiTokenSequence readCellFormula( SequenceInputStream& rStrm );
+ /** Reads the formula range used by shared formulas, arrays, and data tables. */
+ bool readFormulaRef( SequenceInputStream& rStrm );
+
/** Imports an empty cell from a CELL_BLANK or MULTCELL_BLANK record. */
void importCellBlank( SequenceInputStream& rStrm, CellType eCellType );
/** Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record. */
@@ -87,30 +110,28 @@ private:
/** Imports a string cell from a CELL_STRING, MULTCELL_STRING, or FORMULA_STRING record. */
void importCellString( SequenceInputStream& rStrm, CellType eCellType );
- /** Imports a cell formula for the current cell. */
- void importCellFormula( SequenceInputStream& rStrm );
-
- /** Imports row settings from a ROW record. */
- void importRow( SequenceInputStream& rStrm );
/** Imports an array formula from an ARRAY record. */
void importArray( SequenceInputStream& rStrm );
- /** Imports a shared formula from a SHAREDFORMULA record. */
- void importSharedFmla( SequenceInputStream& rStrm );
/** Imports table operation from a DATATABLE record. */
void importDataTable( SequenceInputStream& rStrm );
+ /** Imports a shared formula from a SHAREDFORMULA record. */
+ void importSharedFmla( SequenceInputStream& rStrm );
private:
- CellModel maCurrCell; /// Position and formatting of current imported cell.
- DataTableModel maTableData; /// Additional data for table operation ranges.
- BinAddress maCurrPos; /// Current position for binary import.
- RichStringRef mxInlineStr; /// Inline rich string from 'is' element.
+ ::rtl::OUString maCellValue; /// Cell value string (OOXML only).
+ RichStringRef mxInlineStr; /// Inline rich string (OOXML only).
+ ApiTokenSequence maTokens; /// Formula token array (OOXML only).
+ DataTableModel maTableData; /// Settings for table operations.
+ BinAddress maCurrPos; /// Current cell position (BIFF12 only).
+ bool mbHasFormula; /// True = current cell has formula data (OOXML only).
+ bool mbValidRange; /// True = maFmlaData.maFormulaRef is valid (OOXML only).
};
// ============================================================================
/** This class implements importing row settings and all cells of a sheet.
*/
-class BiffSheetDataContext : public BiffWorksheetContextBase
+class BiffSheetDataContext : public BiffWorksheetContextBase, private SheetDataContextBase
{
public:
explicit BiffSheetDataContext( const WorksheetHelper& rHelper );
@@ -119,13 +140,15 @@ public:
virtual void importRecord( BiffInputStream& rStrm );
private:
- /** Sets current cell according to the passed address. */
- void setCurrCell( const BinAddress& rAddr );
+ /** Imports row settings from a ROW record. */
+ void importRow( BiffInputStream& rStrm );
- /** Imports an XF identifier and sets the mnXfId member. */
- void importXfId( BiffInputStream& rStrm, bool bBiff2 );
- /** Imports a BIFF cell address and the following XF identifier. */
- void importCellHeader( BiffInputStream& rStrm, bool bBiff2 );
+ /** Reads an XF identifier and initializes a new cell. */
+ bool readCellXfId( BiffInputStream& rStrm, const BinAddress& rAddr, bool bBiff2 );
+ /** Reads a BIFF cell address and the following XF identifier. */
+ bool readCellHeader( BiffInputStream& rStrm, bool bBiff2 );
+ /** Reads the formula range used by shared formulas, arrays, and data tables. */
+ bool readFormulaRef( BiffInputStream& rStrm );
/** Imports a BLANK record describing a blank but formatted cell. */
void importBlank( BiffInputStream& rStrm );
@@ -148,20 +171,18 @@ private:
/** Imports an RK record describing a numeric cell. */
void importRk( BiffInputStream& rStrm );
- /** Imports row settings from a ROW record. */
- void importRow( BiffInputStream& rStrm );
/** Imports an ARRAY record describing an array formula of a cell range. */
void importArray( BiffInputStream& rStrm );
- /** Imports a SHAREDFMLA record describing a shared formula in a cell range. */
- void importSharedFmla( BiffInputStream& rStrm );
/** Imports table operation from a DATATABLE or DATATABLE2 record. */
void importDataTable( BiffInputStream& rStrm );
+ /** Imports a SHAREDFMLA record describing a shared formula in a cell range. */
+ void importSharedFmla( BiffInputStream& rStrm );
private:
- CellModel maCurrCell; /// Position and formatting of current imported cell.
- sal_uInt32 mnFormulaIgnoreSize; /// Number of bytes to be ignored in FORMULA record.
- sal_uInt32 mnArrayIgnoreSize; /// Number of bytes to be ignored in ARRAY record.
- sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record.
+ sal_uInt32 mnFormulaSkipSize; /// Number of bytes to be ignored in FORMULA record.
+ sal_uInt32 mnArraySkipSize; /// Number of bytes to be ignored in ARRAY record.
+ sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record.
+ OptValue< bool > mobBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2.
};
// ============================================================================
diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx
index 64a56968aa37..468476449cc3 100644
--- a/oox/inc/oox/xls/stylesbuffer.hxx
+++ b/oox/inc/oox/xls/stylesbuffer.hxx
@@ -790,6 +790,11 @@ public:
/** Writes all formatting attributes to the passed property set. */
void writeToPropertySet( PropertySet& rPropSet ) const;
+ /** Converts formatting information from BIFF2 cell record data directly. */
+ static void writeBiff2CellFormatToPropertySet(
+ const WorkbookHelper& rHelper, PropertySet& rPropSet,
+ sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 );
+
private:
/** Sets 'attribute used' flags from the passed BIFF bit field. */
void setBiffUsedFlags( sal_uInt8 nUsedFlags );
diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx
index ecf824076ef5..049120aaaf40 100644
--- a/oox/inc/oox/xls/workbookhelper.hxx
+++ b/oox/inc/oox/xls/workbookhelper.hxx
@@ -108,47 +108,49 @@ class TableBuffer;
class ThemeBuffer;
class UnitConverter;
class ViewSettings;
-class WorkbookData;
class WorkbookSettings;
class WorksheetBuffer;
+class WorkbookGlobals;
+typedef ::boost::shared_ptr< WorkbookGlobals > WorkbookGlobalsRef;
+
/** Helper class to provice access to global workbook data.
All classes derived from this helper class will have access to a singleton
- object of type WorkbookData containing global workbook settings, buffers,
- converters, etc. Nearly all classes in this filter implementation are
- derived directly or indirectly from this class.
+ object of type WorkbookGlobals containing global workbook settings,
+ buffers, converters, etc. Nearly all classes in this filter implementation
+ are derived directly or indirectly from this class.
- This class contains just a simple reference to the WorkbookData object to
- prevent circular references, as the WorkbookData object contains a lot of
- objects derived from this class.
+ This class contains just a simple reference to the WorkbookGlobals object
+ to prevent circular references, as the WorkbookGlobals object contains a
+ lot of objects derived from this class.
*/
class WorkbookHelper
{
public:
- inline /*implicit*/ WorkbookHelper( WorkbookData& rBookData ) : mrBookData( rBookData ) {}
+ inline /*implicit*/ WorkbookHelper( WorkbookGlobals& rBookGlob ) : mrBookGlob( rBookGlob ) {}
virtual ~WorkbookHelper();
+ static WorkbookGlobalsRef constructGlobals( ExcelFilter& rFilter );
+ static WorkbookGlobalsRef constructGlobals( ExcelBiffFilter& rFilter, BiffType eBiff );
+
// filter -----------------------------------------------------------------
/** Returns the base filter object (base class of all filters). */
::oox::core::FilterBase& getBaseFilter() const;
- /** Returns a reference to the global service factory. */
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- getGlobalFactory() const;
/** Returns the file type of the current filter. */
FilterType getFilterType() const;
/** Returns the filter progress bar. */
SegmentProgressBar& getProgressBar() const;
/** Returns true, if the file is a multi-sheet document, or false if single-sheet. */
bool isWorkbookFile() const;
- /** Returns the index of the current sheet in the Calc document. */
+ /** Returns the index of the current Calc sheet, if filter currently processes a sheet. */
sal_Int16 getCurrentSheetIndex() const;
- /** Sets the index of the current sheet in the Calc document. */
- void setCurrentSheetIndex( sal_Int16 nSheet );
- /** Sets the VBA project storage. */
+ /** Sets the VBA project storage used to import VBA source code and forms. */
void setVbaProjectStorage( const StorageRef& rxVbaPrjStrg );
+ /** Sets the index of the current Calc sheet, if filter currently processes a sheet. */
+ void setCurrentSheetIndex( sal_Int16 nSheet );
/** Final conversion after importing the workbook. */
void finalizeWorkbookImport();
@@ -157,9 +159,6 @@ public:
/** Returns a reference to the source/target spreadsheet document model. */
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >
getDocument() const;
- /** Returns a reference to the service factory of the spreadsheet document model. */
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- getDocumentFactory() const;
/** Returns a reference to the specified spreadsheet in the document model. */
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >
@@ -283,38 +282,7 @@ public:
BiffCodecHelper& getCodecHelper() const;
private:
- WorkbookData& mrBookData;
-};
-
-// ============================================================================
-
-namespace prv {
-
-typedef ::boost::shared_ptr< WorkbookData > WorkbookDataRef;
-
-struct WorkbookDataOwner
-{
- explicit WorkbookDataOwner( WorkbookDataRef xBookData );
- virtual ~WorkbookDataOwner();
- WorkbookDataRef mxBookData;
-};
-
-} // namespace prv
-
-// ----------------------------------------------------------------------------
-
-class WorkbookHelperRoot : private prv::WorkbookDataOwner, public WorkbookHelper
-{
-public:
- explicit WorkbookHelperRoot( ExcelFilter& rFilter );
- explicit WorkbookHelperRoot( ExcelBiffFilter& rFilter, BiffType eBiff );
-
- /** Returns true, if this helper refers to a valid document. */
- bool isValid() const;
-
-private:
- WorkbookHelperRoot( const WorkbookHelperRoot& );
- WorkbookHelperRoot& operator=( const WorkbookHelperRoot& );
+ WorkbookGlobals& mrBookGlob;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/worksheetfragment.hxx b/oox/inc/oox/xls/worksheetfragment.hxx
index 4fe3bf4240dd..d9cedee7b5e6 100644
--- a/oox/inc/oox/xls/worksheetfragment.hxx
+++ b/oox/inc/oox/xls/worksheetfragment.hxx
@@ -63,11 +63,8 @@ class WorksheetFragment : public WorksheetFragmentBase
{
public:
explicit WorksheetFragment(
- const WorkbookHelper& rHelper,
- const ::rtl::OUString& rFragmentPath,
- const ISegmentProgressBarRef& rxProgressBar,
- WorksheetType eSheetType,
- sal_Int16 nSheet );
+ const WorksheetHelper& rHelper,
+ const ::rtl::OUString& rFragmentPath );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -134,10 +131,8 @@ class BiffWorksheetFragment : public BiffWorksheetFragmentBase
{
public:
explicit BiffWorksheetFragment(
- const BiffWorkbookFragmentBase& rParent,
- const ISegmentProgressBarRef& rxProgressBar,
- WorksheetType eSheetType,
- sal_Int16 nSheet );
+ const WorksheetHelper& rHelper,
+ const BiffWorkbookFragmentBase& rParent );
virtual ~BiffWorksheetFragment();
/** Imports the entire worksheet fragment, returns true, if EOF record has been reached. */
@@ -168,6 +163,8 @@ private:
void importLabelRanges( BiffInputStream& rStrm );
/** Imports the MEREDCELLS record and merges all cells in the document. */
void importMergedCells( BiffInputStream& rStrm );
+ /** Imports the NOTE record containing a cell note. */
+ void importNote( BiffInputStream& rStrm );
/** Imports the HORPAGEBREAKS or VERPAGEBREAKS record and inserts page breaks. */
void importPageBreaks( BiffInputStream& rStrm, bool bRowBreak );
/** Imports a pivot table. */
diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx
index 55bf1c044e30..e87599409528 100644
--- a/oox/inc/oox/xls/worksheethelper.hxx
+++ b/oox/inc/oox/xls/worksheethelper.hxx
@@ -28,6 +28,7 @@
#ifndef OOX_XLS_WORKSHEETHELPER_HXX
#define OOX_XLS_WORKSHEETHELPER_HXX
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/progressbar.hxx"
#include "oox/ole/olehelper.hxx"
#include "oox/xls/addressconverter.hxx"
@@ -44,7 +45,6 @@ namespace com { namespace sun { namespace star {
namespace table { class XCellRange; }
namespace table { class XTableColumns; }
namespace table { class XTableRows; }
- namespace util { struct DateTime; }
} } }
namespace oox {
@@ -53,12 +53,15 @@ namespace xls {
class AutoFilterBuffer;
struct BinAddress;
struct BinRange;
+class BiffSheetDrawing;
class BinRangeList;
class CommentsBuffer;
class CondFormatBuffer;
+class Font;
class PageSettings;
class QueryTableBuffer;
-class SharedFormulaBuffer;
+class RichString;
+class SheetDataBuffer;
class SheetViewSettings;
class VmlDrawing;
class WorksheetSettings;
@@ -79,47 +82,10 @@ enum WorksheetType
// ============================================================================
-/** Stores some data about a cell. */
-struct CellModel
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > mxCell;
- ::com::sun::star::table::CellAddress maAddress;
- ::rtl::OUString maValueStr; /// String containing cell value data.
- ::rtl::OUString maFormulaRef; /// String containing formula range for array/shared formulas.
- sal_Int32 mnCellType; /// Data type of the cell.
- sal_Int32 mnFormulaType; /// Type of the imported formula.
- sal_Int32 mnSharedId; /// Shared formula identifier for current cell.
- sal_Int32 mnXfId; /// XF identifier for the cell.
- sal_Int32 mnNumFmtId; /// Forced number format for the cell.
- bool mbHasValueStr; /// True = contents of maValueStr are valid.
- bool mbShowPhonetic; /// True = show phonetic text.
-
- inline explicit CellModel() { reset(); }
- void reset();
-};
-
-// ----------------------------------------------------------------------------
-
-/** Stores data about a data table a.k.a. multiple operation range. */
-struct DataTableModel
-{
- ::rtl::OUString maRef1; /// String containing first reference cell for data table formulas.
- ::rtl::OUString maRef2; /// String containing second reference cell for data table formulas.
- bool mb2dTable; /// True = 2-dimensional data table.
- bool mbRowTable; /// True = row oriented data table.
- bool mbRef1Deleted; /// True = first reference cell deleted.
- bool mbRef2Deleted; /// True = second reference cell deleted.
-
- explicit DataTableModel();
-};
-
-// ----------------------------------------------------------------------------
-
-/** Stores formatting data about a range of columns. */
+/** Stores settings and formatting data about a range of sheet columns. */
struct ColumnModel
{
- sal_Int32 mnFirstCol; /// 1-based (!) index of first column.
- sal_Int32 mnLastCol; /// 1-based (!) index of last column.
+ ValueRange maRange; /// 1-based (!) range of the described columns.
double mfWidth; /// Column width in number of characters.
sal_Int32 mnXfId; /// Column default formatting.
sal_Int32 mnLevel; /// Column outline level.
@@ -129,17 +95,17 @@ struct ColumnModel
explicit ColumnModel();
- /** Expands this entry with the passed column range, if column settings are equal. */
- bool tryExpand( const ColumnModel& rModel );
+ /** Returns true, if this entry can be merged with the passed column range (column settings are equal). */
+ bool isMergeable( const ColumnModel& rModel ) const;
};
// ----------------------------------------------------------------------------
-/** Stores formatting data about a range of rows. */
+/** Stores settings and formatting data about a sheet row. */
struct RowModel
{
- sal_Int32 mnFirstRow; /// 1-based (!) index of first row.
- sal_Int32 mnLastRow; /// 1-based (!) index of last row.
+ sal_Int32 mnRow; /// 1-based (!) index of the described row.
+ ValueRangeSet maColSpans; /// 0-based (!) column ranges of used cells.
double mfHeight; /// Row height in points.
sal_Int32 mnXfId; /// Row default formatting (see mbIsFormatted).
sal_Int32 mnLevel; /// Row outline level.
@@ -153,8 +119,10 @@ struct RowModel
explicit RowModel();
- /** Expands this entry with the passed row range, if row settings are equal. */
- bool tryExpand( const RowModel& rModel );
+ /** Inserts the passed column span into the row model. */
+ void insertColSpan( const ValueRange& rColSpan );
+ /** Returns true, if this entry can be merged with the passed row range (row settings are equal). */
+ bool isMergeable( const RowModel& rModel ) const;
};
// ----------------------------------------------------------------------------
@@ -215,12 +183,21 @@ struct ValidationModel
// ============================================================================
// ============================================================================
-class WorksheetData;
+class WorksheetGlobals;
+typedef ::boost::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef;
class WorksheetHelper : public WorkbookHelper
{
public:
- /*implicit*/ WorksheetHelper( WorksheetData& rSheetData );
+ /*implicit*/ WorksheetHelper( WorksheetGlobals& rSheetGlob );
+
+ static WorksheetGlobalsRef constructGlobals(
+ const WorkbookHelper& rHelper,
+ const ISegmentProgressBarRef& rxProgressBar,
+ WorksheetType eSheetType,
+ sal_Int16 nSheet );
+
+ // ------------------------------------------------------------------------
/** Returns the type of this sheet. */
WorksheetType getSheetType() const;
@@ -232,47 +209,13 @@ public:
/** Returns the XCell interface for the passed cell address. */
::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >
- getCell(
- const ::com::sun::star::table::CellAddress& rAddress ) const;
- /** Returns the XCell interface for the passed cell address string. */
- ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >
- getCell(
- const ::rtl::OUString& rAddressStr,
- ::com::sun::star::table::CellAddress* opAddress = 0 ) const;
- /** Returns the XCell interface for the passed cell address. */
- ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >
- getCell(
- const BinAddress& rBinAddress,
- ::com::sun::star::table::CellAddress* opAddress = 0 ) const;
-
+ getCell( const ::com::sun::star::table::CellAddress& rAddress ) const;
/** Returns the XCellRange interface for the passed cell range address. */
::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange >
- getCellRange(
- const ::com::sun::star::table::CellRangeAddress& rRange ) const;
- /** Returns the XCellRange interface for the passed range address string. */
- ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange >
- getCellRange(
- const ::rtl::OUString& rRangeStr,
- ::com::sun::star::table::CellRangeAddress* opRange = 0 ) const;
- /** Returns the XCellRange interface for the passed range address. */
- ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange >
- getCellRange(
- const BinRange& rBinRange,
- ::com::sun::star::table::CellRangeAddress* opRange = 0 ) const;
-
+ getCellRange( const ::com::sun::star::table::CellRangeAddress& rRange ) const;
/** Returns the XSheetCellRanges interface for the passed cell range addresses. */
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges >
getCellRangeList( const ApiCellRangeList& rRanges ) const;
- /** Returns the XSheetCellRanges interface for the passed space-separated range list. */
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges >
- getCellRangeList(
- const ::rtl::OUString& rRangesStr,
- ApiCellRangeList* opRanges = 0 ) const;
- /** Returns the XSheetCellRanges interface for the passed range list. */
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges >
- getCellRangeList(
- const BinRangeList& rBinRanges,
- ApiCellRangeList* opRanges = 0 ) const;
/** Returns the address of the passed cell. The cell reference must be valid. */
static ::com::sun::star::table::CellAddress
@@ -292,10 +235,10 @@ public:
/** Returns the XTableColumns interface for a range of columns. */
::com::sun::star::uno::Reference< ::com::sun::star::table::XTableColumns >
- getColumns( sal_Int32 nFirstCol, sal_Int32 nLastCol ) const;
+ getColumns( const ValueRange& rColRange ) const;
/** Returns the XTableRows interface for a range of rows. */
::com::sun::star::uno::Reference< ::com::sun::star::table::XTableRows >
- getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const;
+ getRows( const ValueRange& rRowRange ) const;
/** Returns the XDrawPage interface of the draw page of the current sheet. */
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
@@ -308,10 +251,8 @@ public:
/** Returns the size of the entire drawing page in 1/100 mm. */
::com::sun::star::awt::Size getDrawPageSize() const;
- /** Returns the worksheet settings object. */
- WorksheetSettings& getWorksheetSettings() const;
- /** Returns the buffer containing all shared formulas in this sheet. */
- SharedFormulaBuffer& getSharedFormulas() const;
+ /** Returns the buffer for cell contents and cell formatting. */
+ SheetDataBuffer& getSheetData() const;
/** Returns the conditional formattings in this sheet. */
CondFormatBuffer& getCondFormats() const;
/** Returns the buffer for all cell comments in this sheet. */
@@ -320,66 +261,27 @@ public:
AutoFilterBuffer& getAutoFilters() const;
/** Returns the buffer for all web query tables in this sheet. */
QueryTableBuffer& getQueryTables() const;
+ /** Returns the worksheet settings object. */
+ WorksheetSettings& getWorksheetSettings() const;
/** Returns the page/print settings for this sheet. */
PageSettings& getPageSettings() const;
/** Returns the view settings for this sheet. */
SheetViewSettings& getSheetViewSettings() const;
- /** Returns the VML drawing page for this sheet. */
+ /** Returns the VML drawing page for this sheet (OOXML/BIFF12 only). */
VmlDrawing& getVmlDrawing() const;
-
- /** Sets the passed string to the cell. */
- void setStringCell(
- const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
- const ::rtl::OUString& rText ) const;
- /** Sets the shared string with the passed identifier to the cell. */
- void setSharedStringCell(
- const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
- sal_Int32 nStringId,
- sal_Int32 nXfId ) const;
- /** Sets the passed date/time value to the cell and adjusts number format. */
- void setDateTimeCell(
- const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
- const ::com::sun::star::util::DateTime& rDateTime ) const;
- /** Sets the passed boolean value to the cell and adjusts number format. */
- void setBooleanCell(
- const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
- bool bValue ) const;
- /** Sets the passed BIFF error code to the cell (by converting it to a formula). */
- void setErrorCell(
- const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
- const ::rtl::OUString& rErrorCode ) const;
- /** Sets the passed BIFF error code to the cell (by converting it to a formula). */
- void setErrorCell(
- const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
- sal_uInt8 nErrorCode ) const;
- /** Sets cell contents to the cell specified in the passed cell model. */
- void setCell( CellModel& orModel ) const;
-
- /** Sets a standard number format (constant from com.sun.star.util.NumberFormat) to the passed cell. */
- void setStandardNumFmt(
- const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
- sal_Int16 nStdNumFmt ) const;
+ /** Returns the BIFF drawing page for this sheet (BIFF2-BIFF8 only). */
+ BiffSheetDrawing& getBiffDrawing() const;
/** Changes the current sheet type. */
void setSheetType( WorksheetType eSheetType );
- /** Stores the cell formatting data of the current cell. */
- void setCellFormat( const CellModel& rModel );
- /** Merges the cells in the passed cell range. */
- void setMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange );
/** Sets a column or row page break described in the passed struct. */
void setPageBreak( const PageBreakModel& rModel, bool bRowBreak );
/** Inserts the hyperlink URL into the spreadsheet. */
void setHyperlink( const HyperlinkModel& rModel );
/** Inserts the data validation settings into the spreadsheet. */
void setValidation( const ValidationModel& rModel );
- /** Sets a multiple table operation to the passed range. */
- void setTableOperation(
- const ::com::sun::star::table::CellRangeAddress& rRange,
- const DataTableModel& rModel ) const;
/** Sets the passed label ranges to the current sheet. */
- void setLabelRanges(
- const ApiCellRangeList& rColRanges,
- const ApiCellRangeList& rRowRanges );
+ void setLabelRanges( const ApiCellRangeList& rColRanges, const ApiCellRangeList& rRowRanges );
/** Sets the path to the DrawingML fragment of this sheet. */
void setDrawingPath( const ::rtl::OUString& rDrawingPath );
/** Sets the path to the legacy VML drawing fragment of this sheet. */
@@ -413,6 +315,26 @@ public:
@descr Row default formatting is converted directly, other settings
are cached and converted in the finalizeWorksheetImport() call. */
void setRowModel( const RowModel& rModel );
+ /** Specifies that the passed row needs to set its height manually. */
+ void setManualRowHeight( sal_Int32 nRow );
+
+ /** Inserts a value cell directly into the Calc sheet. */
+ void putValue(
+ const ::com::sun::star::table::CellAddress& rAddress,
+ double fValue ) const;
+ /** Inserts a string cell directly into the Calc sheet. */
+ void putString(
+ const ::com::sun::star::table::CellAddress& rAddress,
+ const ::rtl::OUString& rText ) const;
+ /** Inserts a rich-string cell directly into the Calc sheet. */
+ void putRichString(
+ const ::com::sun::star::table::CellAddress& rAddress,
+ const RichString& rString,
+ const Font* pFirstPortionFont ) const;
+ /** Inserts a formula cell directly into the Calc sheet. */
+ void putFormulaTokens(
+ const ::com::sun::star::table::CellAddress& rAddress,
+ const ApiTokenSequence& rTokens ) const;
</