summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/core/binarycodec.hxx1
-rw-r--r--oox/inc/oox/core/binaryfilterbase.hxx4
-rw-r--r--oox/inc/oox/core/contexthandler.hxx13
-rw-r--r--oox/inc/oox/core/contexthandler2.hxx145
-rwxr-xr-xoox/inc/oox/core/fastparser.hxx93
-rw-r--r--oox/inc/oox/core/fasttokenhandler.hxx14
-rw-r--r--oox/inc/oox/core/filterbase.hxx46
-rw-r--r--oox/inc/oox/core/filterdetect.hxx11
-rw-r--r--oox/inc/oox/core/fragmenthandler.hxx1
-rw-r--r--oox/inc/oox/core/fragmenthandler2.hxx14
-rw-r--r--oox/inc/oox/core/recordparser.hxx2
-rwxr-xr-x[-rw-r--r--]oox/inc/oox/core/relations.hxx14
-rw-r--r--oox/inc/oox/core/relationshandler.hxx1
-rw-r--r--oox/inc/oox/core/xmlfilterbase.hxx24
-rw-r--r--oox/inc/oox/drawingml/chart/axiscontext.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/axisconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/axismodel.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/chartcontextbase.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/chartconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx4
-rw-r--r--oox/inc/oox/drawingml/chart/chartspaceconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/chartspacefragment.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/chartspacemodel.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/converterbase.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/datasourcecontext.hxx5
-rw-r--r--oox/inc/oox/drawingml/chart/datasourceconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/datasourcemodel.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/modelbase.hxx5
-rw-r--r--oox/inc/oox/drawingml/chart/objectformatter.hxx2
-rw-r--r--oox/inc/oox/drawingml/chart/plotareacontext.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/plotareaconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/plotareamodel.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/seriescontext.hxx7
-rw-r--r--oox/inc/oox/drawingml/chart/seriesconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/seriesmodel.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/titlecontext.hxx3
-rw-r--r--oox/inc/oox/drawingml/chart/titleconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/titlemodel.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/typegroupcontext.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/typegroupconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/typegroupmodel.hxx1
-rw-r--r--oox/inc/oox/drawingml/clrscheme.hxx1
-rw-r--r--oox/inc/oox/drawingml/customshapeproperties.hxx14
-rw-r--r--oox/inc/oox/drawingml/graphicshapecontext.hxx4
-rw-r--r--oox/inc/oox/drawingml/shape.hxx79
-rw-r--r--oox/inc/oox/drawingml/textbody.hxx1
-rw-r--r--oox/inc/oox/drawingml/textliststyle.hxx6
-rw-r--r--oox/inc/oox/drawingml/textparagraph.hxx1
-rw-r--r--oox/inc/oox/drawingml/textparagraphproperties.hxx4
-rw-r--r--oox/inc/oox/drawingml/theme.hxx1
-rw-r--r--oox/inc/oox/dump/biffdumper.hxx5
-rw-r--r--oox/inc/oox/dump/oledumper.hxx12
-rw-r--r--oox/inc/oox/dump/xlsbdumper.hxx5
-rw-r--r--oox/inc/oox/helper/attributelist.hxx7
-rw-r--r--oox/inc/oox/helper/binaryinputstream.hxx1
-rw-r--r--oox/inc/oox/helper/binaryoutputstream.hxx1
-rw-r--r--oox/inc/oox/helper/binarystreambase.hxx1
-rw-r--r--oox/inc/oox/helper/containerhelper.hxx473
-rw-r--r--oox/inc/oox/helper/graphichelper.hxx4
-rw-r--r--oox/inc/oox/helper/helper.hxx1
-rw-r--r--oox/inc/oox/helper/modelobjecthelper.hxx55
-rw-r--r--oox/inc/oox/helper/progressbar.hxx1
-rw-r--r--oox/inc/oox/helper/propertymap.hxx13
-rw-r--r--oox/inc/oox/helper/propertyset.hxx6
-rwxr-xr-xoox/inc/oox/helper/refmap.hxx181
-rwxr-xr-xoox/inc/oox/helper/refvector.hxx201
-rw-r--r--oox/inc/oox/helper/storagebase.hxx4
-rwxr-xr-xoox/inc/oox/helper/textinputstream.hxx1
-rw-r--r--[-rwxr-xr-x]oox/inc/oox/ole/axbinaryreader.hxx6
-rw-r--r--oox/inc/oox/ole/axcontrol.hxx155
-rw-r--r--oox/inc/oox/ole/axcontrolfragment.hxx1
-rw-r--r--oox/inc/oox/ole/olehelper.hxx5
-rw-r--r--oox/inc/oox/ole/oleobjecthelper.hxx3
-rw-r--r--[-rwxr-xr-x]oox/inc/oox/ole/olestorage.hxx2
-rwxr-xr-xoox/inc/oox/ole/vbacontrol.hxx20
-rw-r--r--oox/inc/oox/ole/vbahelper.hxx1
-rw-r--r--oox/inc/oox/ole/vbainputstream.hxx1
-rw-r--r--oox/inc/oox/ole/vbamodule.hxx2
-rw-r--r--oox/inc/oox/ole/vbaproject.hxx70
-rwxr-xr-xoox/inc/oox/ole/vbaprojectfilter.hxx76
-rw-r--r--oox/inc/oox/ppt/pptimport.hxx5
-rw-r--r--oox/inc/oox/ppt/pptshape.hxx2
-rw-r--r--oox/inc/oox/ppt/slidepersist.hxx3
-rwxr-xr-x[-rw-r--r--]oox/inc/oox/token/namespacemap.hxx (renamed from oox/source/token/propertylist.cxx)29
-rw-r--r--oox/inc/oox/token/propertynames.hxx (renamed from oox/inc/oox/token/propertylist.hxx)15
-rw-r--r--oox/inc/oox/token/tokenmap.hxx1
-rw-r--r--oox/inc/oox/vml/vmldrawing.hxx71
-rw-r--r--oox/inc/oox/vml/vmldrawingfragment.hxx1
-rw-r--r--oox/inc/oox/vml/vmlformatting.hxx31
-rw-r--r--oox/inc/oox/vml/vmlinputstream.hxx1
-rw-r--r--oox/inc/oox/vml/vmlshape.hxx69
-rw-r--r--oox/inc/oox/vml/vmlshapecontainer.hxx7
-rw-r--r--oox/inc/oox/vml/vmlshapecontext.hxx51
-rwxr-xr-xoox/inc/oox/vml/vmltextbox.hxx95
-rwxr-xr-xoox/inc/oox/vml/vmltextboxcontext.hxx82
-rw-r--r--oox/inc/oox/xls/addressconverter.hxx15
-rwxr-xr-xoox/inc/oox/xls/autofilterbuffer.hxx279
-rw-r--r--oox/inc/oox/xls/autofiltercontext.hxx130
-rw-r--r--oox/inc/oox/xls/biffcodec.hxx1
-rw-r--r--oox/inc/oox/xls/biffdetector.hxx14
-rw-r--r--oox/inc/oox/xls/biffhelper.hxx476
-rw-r--r--oox/inc/oox/xls/biffinputstream.hxx1
-rw-r--r--oox/inc/oox/xls/biffoutputstream.hxx1
-rw-r--r--oox/inc/oox/xls/chartsheetfragment.hxx19
-rw-r--r--oox/inc/oox/xls/commentsbuffer.hxx3
-rw-r--r--oox/inc/oox/xls/commentsfragment.hxx16
-rw-r--r--oox/inc/oox/xls/condformatbuffer.hxx18
-rw-r--r--oox/inc/oox/xls/condformatcontext.hxx13
-rwxr-xr-xoox/inc/oox/xls/connectionsbuffer.hxx186
-rw-r--r--oox/inc/oox/xls/connectionsfragment.hxx37
-rw-r--r--oox/inc/oox/xls/defnamesbuffer.hxx80
-rw-r--r--oox/inc/oox/xls/drawingfragment.hxx152
-rw-r--r--oox/inc/oox/xls/excelchartconverter.hxx1
-rw-r--r--oox/inc/oox/xls/excelfilter.hxx26
-rw-r--r--oox/inc/oox/xls/excelhandlers.hxx191
-rwxr-xr-xoox/inc/oox/xls/excelvbaproject.hxx5
-rw-r--r--oox/inc/oox/xls/externallinkbuffer.hxx53
-rw-r--r--oox/inc/oox/xls/externallinkfragment.hxx76
-rw-r--r--oox/inc/oox/xls/formulabase.hxx110
-rw-r--r--oox/inc/oox/xls/formulaparser.hxx18
-rw-r--r--oox/inc/oox/xls/numberformatsbuffer.hxx4
-rw-r--r--oox/inc/oox/xls/ooxformulaparser.hxx1
-rw-r--r--oox/inc/oox/xls/pagesettings.hxx17
-rw-r--r--oox/inc/oox/xls/pivotcachebuffer.hxx55
-rw-r--r--oox/inc/oox/xls/pivotcachefragment.hxx31
-rw-r--r--oox/inc/oox/xls/pivottablebuffer.hxx49
-rw-r--r--oox/inc/oox/xls/pivottablefragment.hxx31
-rw-r--r--oox/inc/oox/xls/querytablebuffer.hxx109
-rw-r--r--oox/inc/oox/xls/querytablefragment.hxx31
-rw-r--r--oox/inc/oox/xls/richstring.hxx19
-rw-r--r--oox/inc/oox/xls/richstringcontext.hxx15
-rw-r--r--oox/inc/oox/xls/scenariobuffer.hxx10
-rw-r--r--oox/inc/oox/xls/scenariocontext.hxx17
-rw-r--r--oox/inc/oox/xls/sharedformulabuffer.hxx5
-rw-r--r--oox/inc/oox/xls/sharedstringsbuffer.hxx2
-rw-r--r--oox/inc/oox/xls/sharedstringsfragment.hxx12
-rw-r--r--oox/inc/oox/xls/sheetdatacontext.hxx76
-rw-r--r--oox/inc/oox/xls/stylesbuffer.hxx126
-rw-r--r--oox/inc/oox/xls/stylesfragment.hxx47
-rw-r--r--oox/inc/oox/xls/tablebuffer.hxx24
-rw-r--r--oox/inc/oox/xls/tablefragment.hxx16
-rw-r--r--oox/inc/oox/xls/themebuffer.hxx1
-rw-r--r--oox/inc/oox/xls/unitconverter.hxx3
-rw-r--r--oox/inc/oox/xls/viewsettings.hxx17
-rw-r--r--oox/inc/oox/xls/webquerybuffer.hxx127
-rw-r--r--oox/inc/oox/xls/workbookfragment.hxx17
-rw-r--r--oox/inc/oox/xls/workbookhelper.hxx91
-rw-r--r--oox/inc/oox/xls/workbooksettings.hxx11
-rw-r--r--oox/inc/oox/xls/worksheetbuffer.hxx14
-rw-r--r--oox/inc/oox/xls/worksheetfragment.hxx90
-rw-r--r--oox/inc/oox/xls/worksheethelper.hxx42
-rw-r--r--oox/inc/oox/xls/worksheetsettings.hxx15
-rw-r--r--oox/prj/d.lst10
-rw-r--r--oox/source/core/binarycodec.cxx2
-rw-r--r--oox/source/core/binaryfilterbase.cxx24
-rw-r--r--oox/source/core/contexthandler.cxx21
-rw-r--r--oox/source/core/contexthandler2.cxx120
-rw-r--r--oox/source/core/facreg.cxx137
-rwxr-xr-xoox/source/core/fastparser.cxx136
-rw-r--r--oox/source/core/fasttokenhandler.cxx61
-rw-r--r--oox/source/core/filterbase.cxx167
-rw-r--r--oox/source/core/filterdetect.cxx179
-rw-r--r--oox/source/core/fragmenthandler.cxx19
-rw-r--r--oox/source/core/fragmenthandler2.cxx38
-rw-r--r--oox/source/core/makefile.mk3
-rw-r--r--oox/source/core/recordparser.cxx23
-rw-r--r--oox/source/core/relations.cxx14
-rw-r--r--oox/source/core/relationshandler.cxx19
-rw-r--r--oox/source/core/services.cxx97
-rw-r--r--oox/source/core/xmlfilterbase.cxx161
-rw-r--r--oox/source/docprop/docprophandler.cxx138
-rw-r--r--oox/source/docprop/docprophandler.hxx10
-rw-r--r--oox/source/docprop/ooxmldocpropimport.cxx260
-rw-r--r--oox/source/docprop/ooxmldocpropimport.hxx40
-rw-r--r--oox/source/drawingml/chart/axiscontext.cxx12
-rw-r--r--oox/source/drawingml/chart/axisconverter.cxx31
-rw-r--r--oox/source/drawingml/chart/axismodel.cxx1
-rw-r--r--oox/source/drawingml/chart/chartcontextbase.cxx12
-rw-r--r--oox/source/drawingml/chart/chartconverter.cxx24
-rw-r--r--oox/source/drawingml/chart/chartdrawingfragment.cxx57
-rw-r--r--oox/source/drawingml/chart/chartspaceconverter.cxx27
-rw-r--r--oox/source/drawingml/chart/chartspacefragment.cxx12
-rw-r--r--oox/source/drawingml/chart/chartspacemodel.cxx1
-rw-r--r--oox/source/drawingml/chart/converterbase.cxx48
-rw-r--r--oox/source/drawingml/chart/datasourcecontext.cxx16
-rw-r--r--oox/source/drawingml/chart/datasourceconverter.cxx14
-rw-r--r--oox/source/drawingml/chart/datasourcemodel.cxx1
-rw-r--r--oox/source/drawingml/chart/modelbase.cxx8
-rw-r--r--oox/source/drawingml/chart/objectformatter.cxx42
-rw-r--r--oox/source/drawingml/chart/plotareacontext.cxx10
-rw-r--r--oox/source/drawingml/chart/plotareaconverter.cxx27
-rw-r--r--oox/source/drawingml/chart/seriescontext.cxx50
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx27
-rw-r--r--oox/source/drawingml/chart/seriesmodel.cxx1
-rw-r--r--oox/source/drawingml/chart/titlecontext.cxx124
-rw-r--r--oox/source/drawingml/chart/titleconverter.cxx28
-rw-r--r--oox/source/drawingml/chart/titlemodel.cxx1
-rw-r--r--oox/source/drawingml/chart/typegroupcontext.cxx10
-rw-r--r--oox/source/drawingml/chart/typegroupconverter.cxx29
-rw-r--r--oox/source/drawingml/chart/typegroupmodel.cxx1
-rw-r--r--oox/source/drawingml/clrscheme.cxx2
-rw-r--r--oox/source/drawingml/clrschemecontext.cxx4
-rw-r--r--oox/source/drawingml/color.cxx8
-rw-r--r--oox/source/drawingml/colorchoicecontext.cxx1
-rw-r--r--oox/source/drawingml/connectorshapecontext.cxx4
-rw-r--r--oox/source/drawingml/customshapegeometry.cxx57
-rw-r--r--oox/source/drawingml/customshapeproperties.cxx3
-rw-r--r--oox/source/drawingml/diagram/datamodelcontext.cxx43
-rw-r--r--oox/source/drawingml/diagram/diagram.cxx2
-rw-r--r--oox/source/drawingml/diagram/diagramdefinitioncontext.cxx18
-rw-r--r--oox/source/drawingml/diagram/diagramfragmenthandler.cxx10
-rw-r--r--oox/source/drawingml/diagram/layoutnodecontext.cxx41
-rw-r--r--oox/source/drawingml/drawingmltypes.cxx2
-rw-r--r--oox/source/drawingml/embeddedwavaudiofile.cxx5
-rw-r--r--oox/source/drawingml/fillproperties.cxx3
-rw-r--r--oox/source/drawingml/fillpropertiesgroupcontext.cxx19
-rw-r--r--oox/source/drawingml/graphicshapecontext.cxx160
-rw-r--r--oox/source/drawingml/guidcontext.cxx3
-rw-r--r--oox/source/drawingml/hyperlinkcontext.cxx15
-rw-r--r--oox/source/drawingml/lineproperties.cxx5
-rw-r--r--oox/source/drawingml/linepropertiescontext.cxx4
-rw-r--r--oox/source/drawingml/objectdefaultcontext.cxx8
-rw-r--r--oox/source/drawingml/shape.cxx163
-rw-r--r--oox/source/drawingml/shapecontext.cxx4
-rw-r--r--oox/source/drawingml/shapegroupcontext.cxx6
-rw-r--r--oox/source/drawingml/shapepropertiescontext.cxx20
-rw-r--r--oox/source/drawingml/shapestylecontext.cxx12
-rw-r--r--oox/source/drawingml/spdefcontext.cxx10
-rw-r--r--oox/source/drawingml/table/tablebackgroundstylecontext.cxx11
-rw-r--r--oox/source/drawingml/table/tablecell.cxx3
-rw-r--r--oox/source/drawingml/table/tablecellcontext.cxx21
-rw-r--r--oox/source/drawingml/table/tablecontext.cxx16
-rw-r--r--oox/source/drawingml/table/tablepartstylecontext.cxx7
-rw-r--r--oox/source/drawingml/table/tableproperties.cxx2
-rw-r--r--oox/source/drawingml/table/tablerow.cxx2
-rw-r--r--oox/source/drawingml/table/tablerowcontext.cxx6
-rw-r--r--oox/source/drawingml/table/tablestylecellstylecontext.cxx33
-rw-r--r--oox/source/drawingml/table/tablestylecontext.cxx33
-rw-r--r--oox/source/drawingml/table/tablestylelistfragmenthandler.cxx4
-rw-r--r--oox/source/drawingml/table/tablestylepart.cxx2
-rw-r--r--oox/source/drawingml/table/tablestyletextstylecontext.cxx17
-rw-r--r--oox/source/drawingml/textbodycontext.cxx28
-rw-r--r--oox/source/drawingml/textbodyproperties.cxx3
-rw-r--r--oox/source/drawingml/textbodypropertiescontext.cxx19
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx3
-rw-r--r--oox/source/drawingml/textcharacterpropertiescontext.cxx52
-rw-r--r--oox/source/drawingml/textfieldcontext.cxx10
-rw-r--r--oox/source/drawingml/textfont.cxx1
-rw-r--r--oox/source/drawingml/textliststyle.cxx11
-rw-r--r--oox/source/drawingml/textliststylecontext.cxx26
-rw-r--r--oox/source/drawingml/textparagraphproperties.cxx3
-rw-r--r--oox/source/drawingml/textparagraphpropertiescontext.cxx35
-rw-r--r--oox/source/drawingml/textrun.cxx1
-rw-r--r--oox/source/drawingml/textspacingcontext.cxx9
-rw-r--r--oox/source/drawingml/texttabstoplistcontext.cxx4
-rw-r--r--oox/source/drawingml/theme.cxx1
-rw-r--r--oox/source/drawingml/themeelementscontext.cxx46
-rw-r--r--oox/source/drawingml/themefragmenthandler.cxx14
-rw-r--r--oox/source/drawingml/transform2dcontext.cxx9
-rw-r--r--oox/source/dump/biffdumper.cxx255
-rw-r--r--oox/source/dump/biffdumper.ini178
-rw-r--r--oox/source/dump/dffdumper.cxx7
-rw-r--r--oox/source/dump/dffdumper.ini1
-rw-r--r--oox/source/dump/dumperbase.cxx54
-rw-r--r--oox/source/dump/dumperbase.ini1
-rw-r--r--oox/source/dump/oledumper.cxx163
-rw-r--r--oox/source/dump/oledumper.ini1
-rw-r--r--oox/source/dump/pptxdumper.cxx23
-rw-r--r--oox/source/dump/pptxdumper.ini1
-rw-r--r--oox/source/dump/xlsbdumper.cxx440
-rw-r--r--oox/source/dump/xlsbdumper.ini123
-rw-r--r--oox/source/export/drawingml.cxx1
-rw-r--r--oox/source/export/shapes.cxx1
-rw-r--r--oox/source/helper/attributelist.cxx22
-rw-r--r--oox/source/helper/binaryinputstream.cxx18
-rw-r--r--oox/source/helper/binaryoutputstream.cxx16
-rw-r--r--oox/source/helper/binarystreambase.cxx11
-rw-r--r--oox/source/helper/containerhelper.cxx83
-rwxr-xr-x[-rw-r--r--]oox/source/helper/graphichelper.cxx83
-rw-r--r--oox/source/helper/makefile.mk1
-rw-r--r--oox/source/helper/modelobjecthelper.cxx79
-rw-r--r--oox/source/helper/progressbar.cxx11
-rw-r--r--oox/source/helper/propertymap.cxx120
-rw-r--r--oox/source/helper/propertyset.cxx28
-rw-r--r--oox/source/helper/storagebase.cxx21
-rwxr-xr-xoox/source/helper/textinputstream.cxx8
-rw-r--r--oox/source/helper/zipstorage.cxx26
-rw-r--r--[-rwxr-xr-x]oox/source/ole/axbinaryreader.cxx15
-rw-r--r--oox/source/ole/axcontrol.cxx419
-rw-r--r--oox/source/ole/axcontrolfragment.cxx26
-rw-r--r--oox/source/ole/makefile.mk3
-rw-r--r--oox/source/ole/olehelper.cxx25
-rw-r--r--oox/source/ole/oleobjecthelper.cxx33
-rw-r--r--[-rwxr-xr-x]oox/source/ole/olestorage.cxx38
-rw-r--r--oox/source/ole/vbacontrol.cxx63
-rw-r--r--oox/source/ole/vbahelper.cxx5
-rw-r--r--oox/source/ole/vbainputstream.cxx2
-rw-r--r--oox/source/ole/vbamodule.cxx12
-rw-r--r--oox/source/ole/vbaproject.cxx156
-rwxr-xr-xoox/source/ole/vbaprojectfilter.cxx106
-rw-r--r--oox/source/ppt/animationspersist.cxx4
-rw-r--r--oox/source/ppt/animationtypes.cxx2
-rw-r--r--oox/source/ppt/animvariantcontext.cxx12
-rw-r--r--oox/source/ppt/backgroundproperties.cxx4
-rw-r--r--oox/source/ppt/buildlistcontext.cxx15
-rw-r--r--oox/source/ppt/commonbehaviorcontext.cxx18
-rw-r--r--oox/source/ppt/commontimenodecontext.cxx20
-rw-r--r--oox/source/ppt/conditioncontext.cxx12
-rw-r--r--oox/source/ppt/customshowlistcontext.cxx9
-rw-r--r--oox/source/ppt/headerfootercontext.cxx2
-rw-r--r--oox/source/ppt/layoutfragmenthandler.cxx6
-rw-r--r--oox/source/ppt/pptimport.cxx29
-rw-r--r--oox/source/ppt/pptshape.cxx4
-rw-r--r--oox/source/ppt/pptshapecontext.cxx15
-rw-r--r--oox/source/ppt/pptshapegroupcontext.cxx22
-rw-r--r--oox/source/ppt/pptshapepropertiescontext.cxx5
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx38
-rw-r--r--oox/source/ppt/slidefragmenthandler.cxx45
-rw-r--r--oox/source/ppt/slidemastertextstylescontext.cxx10
-rw-r--r--oox/source/ppt/slidepersist.cxx4
-rw-r--r--oox/source/ppt/slidetimingcontext.cxx8
-rw-r--r--oox/source/ppt/slidetransition.cxx45
-rw-r--r--oox/source/ppt/slidetransitioncontext.cxx49
-rw-r--r--oox/source/ppt/soundactioncontext.cxx11
-rw-r--r--oox/source/ppt/timeanimvaluecontext.cxx10
-rw-r--r--oox/source/ppt/timenode.cxx2
-rw-r--r--oox/source/ppt/timenodelistcontext.cxx122
-rw-r--r--oox/source/ppt/timetargetelementcontext.cxx28
-rw-r--r--oox/source/shape/FastTokenHandlerService.cxx116
-rw-r--r--oox/source/shape/FastTokenHandlerService.hxx81
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx73
-rw-r--r--oox/source/shape/ShapeContextHandler.hxx22
-rw-r--r--oox/source/shape/ShapeFilterBase.cxx14
-rw-r--r--oox/source/shape/ShapeFilterBase.hxx8
-rw-r--r--oox/source/shape/makefile.mk3
-rw-r--r--oox/source/token/gennamespaces.pl66
-rw-r--r--oox/source/token/genproperties.pl46
-rw-r--r--oox/source/token/gentoken.pl61
-rw-r--r--oox/source/token/makefile.mk44
-rwxr-xr-x[-rw-r--r--]oox/source/token/namespacemap.cxx (renamed from oox/inc/oox/helper/recordinputstream.hxx)31
-rwxr-xr-xoox/source/token/namespaces.hxx.head36
-rwxr-xr-xoox/source/token/namespaces.hxx.tail35
-rw-r--r--oox/source/token/namespaces.pl79
-rw-r--r--oox/source/token/namespaces.txt101
-rw-r--r--oox/source/token/parsexsd.pl27
-rwxr-xr-xoox/source/token/properties.hxx.head36
-rwxr-xr-xoox/source/token/properties.hxx.tail6
-rw-r--r--oox/source/token/properties.pl67
-rw-r--r--oox/source/token/properties.txt22
-rw-r--r--oox/source/token/propertynames.cxx51
-rw-r--r--oox/source/token/tokenmap.cxx45
-rwxr-xr-xoox/source/token/tokens.hxx.head36
-rwxr-xr-xoox/source/token/tokens.hxx.tail8
-rw-r--r--oox/source/token/tokens.pl80
-rw-r--r--oox/source/token/tokens.txt15
-rw-r--r--oox/source/vml/makefile.mk16
-rw-r--r--oox/source/vml/vmldrawing.cxx146
-rw-r--r--oox/source/vml/vmldrawingfragment.cxx23
-rw-r--r--oox/source/vml/vmlformatting.cxx112
-rw-r--r--oox/source/vml/vmlinputstream.cxx65
-rw-r--r--oox/source/vml/vmlshape.cxx237
-rw-r--r--oox/source/vml/vmlshapecontainer.cxx15
-rw-r--r--oox/source/vml/vmlshapecontext.cxx148
-rwxr-xr-x[-rw-r--r--]oox/source/vml/vmltextbox.cxx (renamed from oox/source/helper/recordinputstream.cxx)68
-rwxr-xr-xoox/source/vml/vmltextboxcontext.cxx146
-rw-r--r--oox/source/xls/addressconverter.cxx41
-rwxr-xr-xoox/source/xls/autofilterbuffer.cxx853
-rw-r--r--oox/source/xls/autofiltercontext.cxx734
-rw-r--r--oox/source/xls/biffcodec.cxx51
-rw-r--r--oox/source/xls/biffdetector.cxx88
-rw-r--r--oox/source/xls/biffhelper.cxx59
-rw-r--r--oox/source/xls/biffinputstream.cxx10
-rw-r--r--oox/source/xls/biffoutputstream.cxx1
-rw-r--r--oox/source/xls/chartsheetfragment.cxx163
-rw-r--r--oox/source/xls/commentsbuffer.cxx34
-rw-r--r--oox/source/xls/commentsfragment.cxx93
-rw-r--r--oox/source/xls/condformatbuffer.cxx283
-rw-r--r--oox/source/xls/condformatcontext.cxx41
-rwxr-xr-xoox/source/xls/connectionsbuffer.cxx501
-rw-r--r--oox/source/xls/connectionsfragment.cxx142
-rw-r--r--oox/source/xls/defnamesbuffer.cxx244
-rw-r--r--oox/source/xls/drawingfragment.cxx687
-rw-r--r--oox/source/xls/excelchartconverter.cxx27
-rw-r--r--oox/source/xls/excelfilter.cxx136
-rw-r--r--oox/source/xls/excelhandlers.cxx174
-rwxr-xr-xoox/source/xls/excelvbaproject.cxx18
-rw-r--r--oox/source/xls/externallinkbuffer.cxx186
-rw-r--r--oox/source/xls/externallinkfragment.cxx357
-rwxr-xr-x[-rw-r--r--]oox/source/xls/formulabase.cxx107
-rw-r--r--oox/source/xls/formulaparser.cxx406
-rw-r--r--oox/source/xls/makefile.mk6
-rw-r--r--oox/source/xls/numberformatsbuffer.cxx47
-rw-r--r--oox/source/xls/ooxformulaparser.cxx30
-rw-r--r--oox/source/xls/pagesettings.cxx161
-rw-r--r--oox/source/xls/pivotcachebuffer.cxx339
-rw-r--r--oox/source/xls/pivotcachefragment.cxx189
-rw-r--r--oox/source/xls/pivottablebuffer.cxx414
-rw-r--r--oox/source/xls/pivottablefragment.cxx190
-rw-r--r--oox/source/xls/querytablebuffer.cxx390
-rw-r--r--oox/source/xls/querytablefragment.cxx68
-rw-r--r--oox/source/xls/richstring.cxx55
-rw-r--r--oox/source/xls/richstringcontext.cxx50
-rw-r--r--oox/source/xls/scenariobuffer.cxx35
-rw-r--r--oox/source/xls/scenariocontext.cxx42
-rw-r--r--oox/source/xls/sharedformulabuffer.cxx27
-rw-r--r--oox/source/xls/sharedstringsbuffer.cxx10
-rw-r--r--oox/source/xls/sharedstringsfragment.cxx40
-rw-r--r--oox/source/xls/sheetdatacontext.cxx460
-rw-r--r--oox/source/xls/stylesbuffer.cxx460
-rw-r--r--oox/source/xls/stylesfragment.cxx158
-rw-r--r--oox/source/xls/tablebuffer.cxx81
-rw-r--r--oox/source/xls/tablefragment.cxx56
-rw-r--r--oox/source/xls/themebuffer.cxx11
-rw-r--r--oox/source/xls/unitconverter.cxx27
-rw-r--r--oox/source/xls/viewsettings.cxx223
-rw-r--r--oox/source/xls/webquerybuffer.cxx199
-rw-r--r--oox/source/xls/workbookfragment.cxx335
-rw-r--r--oox/source/xls/workbookhelper.cxx236
-rw-r--r--oox/source/xls/workbooksettings.cxx80
-rw-r--r--oox/source/xls/worksheetbuffer.cxx33
-rw-r--r--oox/source/xls/worksheetfragment.cxx692
-rw-r--r--oox/source/xls/worksheethelper.cxx326
-rw-r--r--oox/source/xls/worksheetsettings.cxx66
-rw-r--r--oox/util/oox.component41
424 files changed, 14506 insertions, 10643 deletions
diff --git a/oox/inc/oox/core/binarycodec.hxx b/oox/inc/oox/core/binarycodec.hxx
index ce57e190f088..ced63250f3e1 100644
--- a/oox/inc/oox/core/binarycodec.hxx
+++ b/oox/inc/oox/core/binarycodec.hxx
@@ -319,4 +319,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/binaryfilterbase.hxx b/oox/inc/oox/core/binaryfilterbase.hxx
index bf249cdfab9b..4cd9cd1db62f 100644
--- a/oox/inc/oox/core/binaryfilterbase.hxx
+++ b/oox/inc/oox/core/binaryfilterbase.hxx
@@ -40,7 +40,8 @@ class BinaryFilterBase : public FilterBase
{
public:
explicit BinaryFilterBase(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~BinaryFilterBase();
@@ -59,4 +60,3 @@ typedef ::rtl::Reference< BinaryFilterBase > BinaryFilterRef;
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/contexthandler.hxx b/oox/inc/oox/core/contexthandler.hxx
index dd9ac686ff46..b1f24d051c70 100644
--- a/oox/inc/oox/core/contexthandler.hxx
+++ b/oox/inc/oox/core/contexthandler.hxx
@@ -28,16 +28,18 @@
#ifndef OOX_CORE_CONTEXTHANDLER_HXX
#define OOX_CORE_CONTEXTHANDLER_HXX
+#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
#include <boost/shared_ptr.hpp>
-#include <rtl/ref.hxx>
#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <rtl/ref.hxx>
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XLocator; } }
} } }
-namespace oox { class RecordInputStream; }
+namespace oox { class SequenceInputStream; }
namespace oox {
namespace core {
@@ -91,8 +93,8 @@ public:
// record context interface -----------------------------------------------
- virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void startRecord( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual void endRecord( sal_Int32 nRecId );
protected:
@@ -114,4 +116,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/contexthandler2.hxx b/oox/inc/oox/core/contexthandler2.hxx
index 48f11c962e38..0c9ac794e94b 100644
--- a/oox/inc/oox/core/contexthandler2.hxx
+++ b/oox/inc/oox/core/contexthandler2.hxx
@@ -30,39 +30,43 @@
#include <vector>
#include <boost/shared_ptr.hpp>
-#include "tokens.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/helper/recordinputstream.hxx"
+#include "oox/helper/binaryinputstream.hxx"
#include "oox/core/contexthandler.hxx"
-#include "oox/core/namespaces.hxx"
namespace oox {
namespace core {
// ============================================================================
-struct ContextInfo;
+const sal_Int32 XML_ROOT_CONTEXT = SAL_MAX_INT32;
-/** Helper class that provides a context identifier stack.
+// ============================================================================
+
+struct ElementInfo;
+
+/** Helper class that provides a context stack.
Fragment handlers and context handlers derived from this helper class will
- track the identifiers of the current context in a stack. The idea is to use
- the same instance of a fragment handler or context handler to process
+ track the identifiers of the visited elements in a stack. The idea is to
+ use the same instance of a fragment handler or context handler to process
several nested elements in an XML stream. For that, the abstract function
- onCreateContext() has to return 'true' for the passed element.
+ onCreateContext() has to return 'this' for the passed element.
Derived classes have to implement the createFastChildContext(),
startFastElement(), characters(), and endFastElement() functions from the
com.sun.star.xml.sax.XFastContextHandler interface by simply forwarding
- them to the respective implCreateChildContext(), implStartCurrentContext(),
- implCharacters(), and implEndCurrentContext() functions of this helper. The
- new abstract functions have to be implemented according to the elements to
- be processed.
+ them to the respective implCreateChildContext(), implStartElement(),
+ implCharacters(), and implEndElement() functions of this helper. This is
+ implemented already in the classes ContextHandler2 and FragmentHandler2.
+ The new abstract functions have to be implemented according to the elements
+ to be processed.
Similarly, for binary import, derived classes have to forward the
createRecordContext(), startRecord(), and endRecord() functions from the
ContextHandler class to the implCreateRecordContext(), implStartRecord(),
- and implEndRecord() functions of this helper.
+ and implEndRecord() functions of this helper. Again, this is implemented
+ already in the classes ContextHandler2 and FragmentHandler2.
*/
class ContextHandler2Helper
{
@@ -71,78 +75,97 @@ public:
explicit ContextHandler2Helper( const ContextHandler2Helper& rParent );
virtual ~ContextHandler2Helper();
+ // allow instances to be stored in ::rtl::Reference
virtual void SAL_CALL acquire() throw() = 0;
virtual void SAL_CALL release() throw() = 0;
- virtual ContextHandler& queryContextHandler() = 0;
-
// interface --------------------------------------------------------------
- /** Will be called if a new context can be created for the passed element.
+ /** Will be called to create a context handler for the passed element.
- Usually 'true' should be returned to improve performance by reusing the
+ Usually 'this' can be returned to improve performance by reusing the
same instance to process several elements. Used by OOXML import only.
*/
virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) = 0;
- /** Will be called if a new context element has been started.
+ /** Will be called when a new element has been started.
+
+ This function is called at the context handler returned from
+ onCreateContext(), or, for root elements of an XML stream, at the
+ fragment handler itself.
- The current element identifier can be accessed by using
- getCurrentContext() or isCurrentContext(). Used by OOXML import only.
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
*/
virtual void onStartElement( const AttributeList& rAttribs ) = 0;
- /** Will be called if the current context element is about to be left.
+ /** Will be called before a new child element starts, or if the current
+ element is about to be left.
- The current element identifier can be accessed by using
- getCurrentContext() or isCurrentContext(). Used by OOXML import only.
+ This helper function collects all text fragments received by the
+ characters() function (such as encoded characters which are passed in
+ separate calls to the characters() function), and passes the
+ concatenated and trimmed string.
- @param rChars The characters collected in this element.
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
*/
- virtual void onEndElement( const ::rtl::OUString& rChars ) = 0;
+ virtual void onCharacters( const ::rtl::OUString& rChars ) = 0;
- /** Will be called if a new context can be created for the passed element.
+ /** Will be called when the current element is about to be left.
- Usually 'true' should be returned to improve performance by reusing the
- same instance to process several elements. Used by OOBIN import only.
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
*/
- virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ) = 0;
+ virtual void onEndElement() = 0;
- /** Will be called if a new record in a binary stream has been started.
+ /** Will be called to create a context handler for the passed record.
- The current record identifier can be accessed by using
- getCurrentContext() or isCurrentContext(). Used by OOBIN import only.
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several records. Used by BIFF import only.
*/
- virtual void onStartRecord( RecordInputStream& rStrm ) = 0;
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) = 0;
- /** Will be called if the current context record is about to be left.
+ /** Will be called when a new record block in a binary stream has been
+ started.
- The current record identifier can be accessed by using
- getCurrentContext() or isCurrentContext(). Used by OOBIN import only.
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onStartRecord( SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when the current record block is about to be left.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
*/
virtual void onEndRecord() = 0;
// helpers ----------------------------------------------------------------
- /** Returns the element identifier of the current topmost context. */
+ /** Returns the identifier of the currently processed element. */
sal_Int32 getCurrentElement() const;
- /** Returns true, if nElement contains the current topmost context. */
+ /** Returns true, if nElement contains the identifier of the currently
+ processed element. */
inline bool isCurrentElement( sal_Int32 nElement ) const
{ return getCurrentElement() == nElement; }
- /** Returns true, if either nElement1 or nElement2 contain the current topmost context. */
+ /** Returns true, if either nElement1 or nElement2 contain the identifier
+ of the currently processed element. */
inline bool isCurrentElement( sal_Int32 nElement1, sal_Int32 nElement2 ) const
{ return isCurrentElement( nElement1 ) || isCurrentElement( nElement2 ); }
- /** Returns the element identifier of the specified parent context. */
- sal_Int32 getPreviousElement( sal_Int32 nCountBack = 1 ) const;
+ /** Returns the identifier of the specified parent element. */
+ sal_Int32 getParentElement( sal_Int32 nCountBack = 1 ) const;
- /** Returns the element identifier of the specified parent context. */
- inline sal_Int32 isPreviousElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const
- { return getPreviousElement( nCountBack ) == nElement; }
+ /** Returns true, if nElement contains the identifier of the specified
+ parent element. */
+ inline sal_Int32 isParentElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const
+ { return getParentElement( nCountBack ) == nElement; }
- /** Returns true, if the current element is the root element. */
+ /** Returns true, if the element currently processed is the root element of
+ the context or fragment handler. */
bool isRootElement() const;
// implementation ---------------------------------------------------------
@@ -155,7 +178,7 @@ protected:
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
/** Must be called from startFastElement() in derived classes. */
- void implStartCurrentContext(
+ void implStartElement(
sal_Int32 nElement,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
@@ -163,13 +186,13 @@ protected:
void implCharacters( const ::rtl::OUString& rChars );
/** Must be called from endFastElement() in derived classes. */
- void implEndCurrentContext( sal_Int32 nElement );
+ void implEndElement( sal_Int32 nElement );
/** Must be called from createRecordContext() in derived classes. */
- ContextHandlerRef implCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ ContextHandlerRef implCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
/** Must be called from startRecord() in derived classes. */
- void implStartRecord( sal_Int32 nRecId, RecordInputStream& rStrm );
+ void implStartRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
/** Must be called from endRecord() in derived classes. */
void implEndRecord( sal_Int32 nRecId );
@@ -177,15 +200,15 @@ protected:
private:
ContextHandler2Helper& operator=( const ContextHandler2Helper& );
- ContextInfo& pushContextInfo( sal_Int32 nElement );
- void popContextInfo();
- void appendCollectedChars();
+ ElementInfo& pushElementInfo( sal_Int32 nElement );
+ void popElementInfo();
+ void processCollectedChars();
private:
- typedef ::std::vector< ContextInfo > ContextStack;
+ typedef ::std::vector< ElementInfo > ContextStack;
typedef ::boost::shared_ptr< ContextStack > ContextStackRef;
- ContextStackRef mxContextStack; /// Stack of processed contexts.
+ ContextStackRef mxContextStack; /// Stack of all processed elements.
size_t mnRootStackSize; /// Stack size on construction time.
bool mbEnableTrimSpace; /// True = trim whitespace in characters().
};
@@ -202,8 +225,6 @@ public:
virtual void SAL_CALL acquire() throw() { ContextHandler::acquire(); }
virtual void SAL_CALL release() throw() { ContextHandler::release(); }
- virtual ContextHandler& queryContextHandler();
-
// com.sun.star.xml.sax.XFastContextHandler interface ---------------------
virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
@@ -229,18 +250,19 @@ public:
// oox.core.ContextHandler interface --------------------------------------
- virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void startRecord( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual void endRecord( sal_Int32 nRecId );
// oox.core.ContextHandler2Helper interface -------------------------------
virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
- virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
virtual void onEndRecord();
};
@@ -250,4 +272,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/fastparser.hxx b/oox/inc/oox/core/fastparser.hxx
new file mode 100755
index 000000000000..967c42474dcc
--- /dev/null
+++ b/oox/inc/oox/core/fastparser.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_CORE_FASTPARSER_HXX
+#define OOX_CORE_FASTPARSER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/xml/sax/XFastParser.hpp>
+
+namespace oox {
+ struct NamespaceMap;
+ class StorageBase;
+}
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Wrapper for a fast SAX parser that works on automatically generated OOXML
+ token and namespace identifiers.
+ */
+class FastParser
+{
+public:
+ explicit FastParser(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~FastParser();
+
+ /** Registers an OOXML namespace at the parser. */
+ void registerNamespace( sal_Int32 nNamespaceId )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ /** Sets the passed document handler that will receive the SAX parser events. */
+ void setDocumentHandler(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& rxDocHandler )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ /** Parses the passed SAX input source.
+ @param bCloseStream True = closes the stream in the input source after parsing. */
+ void parseStream( const ::com::sun::star::xml::sax::InputSource& rInputSource, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ /** Parses the passed input stream.
+ @param bCloseStream True = closes the passed stream after parsing. */
+ void parseStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
+ const ::rtl::OUString& rStreamName, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ /** Parses a stream from the passed storage with the specified name.
+ @param bCloseStream True = closes the stream after parsing. */
+ void parseStream( StorageBase& rStorage, const ::rtl::OUString& rStreamName, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastParser >
+ mxParser;
+ const NamespaceMap& mrNamespaceMap;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/core/fasttokenhandler.hxx b/oox/inc/oox/core/fasttokenhandler.hxx
index 84baccabdc67..a6c73de9842b 100644
--- a/oox/inc/oox/core/fasttokenhandler.hxx
+++ b/oox/inc/oox/core/fasttokenhandler.hxx
@@ -28,8 +28,9 @@
#ifndef OOX_CORE_FASTTOKENHANDLER_HXX
#define OOX_CORE_FASTTOKENHANDLER_HXX
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
namespace oox { class TokenMap; }
@@ -38,15 +39,23 @@ namespace core {
// ============================================================================
+typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandlerBase;
+
/** 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 ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastTokenHandler >
+class FastTokenHandler : public FastTokenHandlerBase
{
public:
explicit FastTokenHandler();
virtual ~FastTokenHandler();
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XFastTokenHandler
virtual sal_Int32 SAL_CALL getToken( const ::rtl::OUString& rIdentifier ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getIdentifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
@@ -62,4 +71,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx
index 9d9b8dcca515..80dc233491d4 100644
--- a/oox/inc/oox/core/filterbase.hxx
+++ b/oox/inc/oox/core/filterbase.hxx
@@ -29,15 +29,15 @@
#define OOX_CORE_FILTERBASE_HXX
#include <memory>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/implbase5.hxx>
#include "oox/helper/binarystreambase.hxx"
@@ -45,16 +45,18 @@
#include "oox/dllapi.h"
namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
namespace awt { struct DeviceInfo; }
- namespace frame { class XModel; }
- namespace task { class XStatusIndicator; }
- namespace task { class XInteractionHandler; }
namespace frame { class XFrame; }
+ namespace frame { class XModel; }
+ namespace graphic { class XGraphic; }
namespace io { class XInputStream; }
namespace io { class XOutputStream; }
namespace io { class XStream; }
- namespace graphic { class XGraphic; }
+ namespace lang { class XMultiComponentFactory; }
+ namespace lang { class XMultiServiceFactory; }
+ namespace task { class XInteractionHandler; }
+ namespace task { class XStatusIndicator; }
+ namespace uno { class XComponentContext; }
} } }
namespace comphelper {
@@ -69,6 +71,7 @@ namespace oox {
namespace oox { namespace ole {
class OleObjectHelper;
+ class VbaProject;
} }
namespace oox {
@@ -90,7 +93,8 @@ class OOX_DLLPUBLIC FilterBase : public FilterBaseBase, public ::cppu::BaseMutex
{
public:
explicit FilterBase(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~FilterBase();
@@ -110,9 +114,17 @@ public:
/** Returns the specified argument passed through the XInitialization interface. */
::com::sun::star::uno::Any getArgument( const ::rtl::OUString& rArgName ) const;
- /** Returns the global service factory passed in the filter constructor (always existing). */
+ /** Returns the component context passed in the filter constructor (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
+ getComponentContext() const;
+
+ /** Returns the component service factory (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory >&
+ getComponentFactory() const;
+
+ /** Returns the multi service factory of the component (always existing). */
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
- getGlobalFactory() const;
+ getServiceFactory() const;
/** Returns the document model (always existing). */
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
@@ -122,7 +134,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
getModelFactory() const;
- /** Returns the frame that will contain the document model. */
+ /** Returns the frame that will contain the document model (may be null). */
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
getTargetFrame() const;
@@ -195,9 +207,13 @@ public:
/** Returns a helper for the handling of OLE obejcts. */
::oox::ole::OleObjectHelper& getOleObjectHelper() const;
+ /** Returns the VBA project manager. */
+ ::oox::ole::VbaProject& getVbaProject() const;
+
/** Requests the encryption data from the media descriptor or from the user. On
success, the encryption data will be inserted into the media descriptor. */
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >
+ requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const;
/** Imports the raw binary data from the specified stream.
@return True, if the data could be imported from the stream. */
@@ -272,6 +288,9 @@ private:
resolving palette colors. */
virtual GraphicHelper* implCreateGraphicHelper() const;
+ /** Derived classes create a VBA project manager object. */
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const = 0;
+
virtual ::rtl::OUString implGetImplementationName() const = 0;
virtual StorageRef implCreateStorage(
@@ -289,4 +308,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/filterdetect.hxx b/oox/inc/oox/core/filterdetect.hxx
index 76e46050c24a..7eb283f5056b 100644
--- a/oox/inc/oox/core/filterdetect.hxx
+++ b/oox/inc/oox/core/filterdetect.hxx
@@ -38,6 +38,7 @@
namespace com { namespace sun { namespace star {
namespace io { class XInputStream; }
+ namespace uno { class XComponentContext; }
} } }
namespace comphelper { class MediaDescriptor; }
@@ -96,7 +97,8 @@ private:
class OOX_DLLPUBLIC FilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
{
public:
- explicit FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
+ explicit FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~FilterDetect();
/** Tries to extract an unencrypted ZIP package from the passed media
@@ -149,12 +151,12 @@ public:
interface of the temporary file will be stored in the 'ComponentData'
property of the passed media descriptor.
*/
- virtual ::rtl::OUString SAL_CALL detect(
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
+ virtual ::rtl::OUString SAL_CALL
+ detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
throw( ::com::sun::star::uno::RuntimeException );
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
};
// ============================================================================
@@ -163,4 +165,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/fragmenthandler.hxx b/oox/inc/oox/core/fragmenthandler.hxx
index 26d2ac540a7a..ba3164a74da8 100644
--- a/oox/inc/oox/core/fragmenthandler.hxx
+++ b/oox/inc/oox/core/fragmenthandler.hxx
@@ -134,4 +134,3 @@ typedef ::rtl::Reference< FragmentHandler > FragmentHandlerRef;
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/fragmenthandler2.hxx b/oox/inc/oox/core/fragmenthandler2.hxx
index 9b864260b853..51408005ecdd 100644
--- a/oox/inc/oox/core/fragmenthandler2.hxx
+++ b/oox/inc/oox/core/fragmenthandler2.hxx
@@ -49,8 +49,6 @@ public:
virtual void SAL_CALL acquire() throw() { FragmentHandler::acquire(); }
virtual void SAL_CALL release() throw() { FragmentHandler::release(); }
- virtual ContextHandler& queryContextHandler();
-
// com.sun.star.xml.sax.XFastContextHandler interface ---------------------
virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
@@ -86,18 +84,19 @@ public:
// oox.core.ContextHandler interface --------------------------------------
- virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void startRecord( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual void endRecord( sal_Int32 nRecId );
// oox.core.ContextHandler2Helper interface -------------------------------
virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
- virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
virtual void onEndRecord();
// oox.core.FragmentHandler2 interface ------------------------------------
@@ -112,4 +111,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/recordparser.hxx b/oox/inc/oox/core/recordparser.hxx
index e499195c52f8..4600be3ff832 100644
--- a/oox/inc/oox/core/recordparser.hxx
+++ b/oox/inc/oox/core/recordparser.hxx
@@ -29,7 +29,6 @@
#define OOX_CORE_RECORDPARSER_HXX
#include <map>
-#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
#include <rtl/ref.hxx>
@@ -95,4 +94,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/core/relations.hxx b/oox/inc/oox/core/relations.hxx
index 4ca8ca3899e7..285c4ed947e4 100644..100755
--- a/oox/inc/oox/core/relations.hxx
+++ b/oox/inc/oox/core/relations.hxx
@@ -35,14 +35,21 @@
namespace oox {
namespace core {
-/** Expands to an OUString containing an officeDocument relation type created
+// ============================================================================
+
+/** Expands to an OUString containing an 'officeDocument' relation type created
from the passed literal(!) ASCII(!) character array. */
-#define CREATE_OFFICEDOC_RELATIONSTYPE( ascii ) \
+#define CREATE_OFFICEDOC_RELATION_TYPE( ascii ) \
CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
+/** Expands to an OUString containing a 'package' relation type created from
+ the passed literal(!) ASCII(!) character array. */
+#define CREATE_PACKAGE_RELATION_TYPE( ascii ) \
+ CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships/" ascii )
+
/** Expands to an OUString containing an MS Office specific relation type
created from the passed literal(!) ASCII(!) character array. */
-#define CREATE_MSOFFICE_RELATIONSTYPE( ascii ) \
+#define CREATE_MSOFFICE_RELATION_TYPE( ascii ) \
CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/relationships/" ascii )
// ============================================================================
@@ -99,4 +106,3 @@ private:
} // namespace oox
#endif // OOX_CORE_RELATIONS
-
diff --git a/oox/inc/oox/core/relationshandler.hxx b/oox/inc/oox/core/relationshandler.hxx
index 3211888ecc9f..b2da8d59c39f 100644
--- a/oox/inc/oox/core/relationshandler.hxx
+++ b/oox/inc/oox/core/relationshandler.hxx
@@ -58,4 +58,3 @@ private:
} // namespace oox
#endif // OOX_CORE_RELATIONSHANDLER
-
diff --git a/oox/inc/oox/core/xmlfilterbase.hxx b/oox/inc/oox/core/xmlfilterbase.hxx
index 30efeb0e9440..11d2d488c8b6 100644
--- a/oox/inc/oox/core/xmlfilterbase.hxx
+++ b/oox/inc/oox/core/xmlfilterbase.hxx
@@ -28,16 +28,16 @@
#ifndef OOX_CORE_XMLFILTERBASE_HXX
#define OOX_CORE_XMLFILTERBASE_HXX
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextField.hpp>
#include <rtl/ref.hxx>
#include <rtl/string.hxx>
#include <rtl/ustring.hxx>
-#include "oox/drawingml/table/tablestylelist.hxx"
#include "oox/core/filterbase.hxx"
#include "oox/core/relations.hxx"
-#include <oox/dllapi.h>
-#include <com/sun/star/text/XTextField.hpp>
-#include <com/sun/star/text/XTextCursor.hpp>
-#include <com/sun/star/text/XText.hpp>
+#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/dllapi.h"
namespace com { namespace sun { namespace star {
namespace container { class XNameContainer; }
@@ -46,9 +46,11 @@ namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XFastDocumentHandler; } }
} } }
-namespace oox { namespace drawingml { class Theme; } }
-namespace oox { namespace drawingml { namespace chart { class ChartConverter; } } }
-namespace oox { namespace vml { class Drawing; } }
+namespace oox {
+ namespace drawingml { class Theme; }
+ namespace drawingml { namespace chart { class ChartConverter; } }
+ namespace vml { class Drawing; }
+}
namespace sax_fastparser {
class FastSerializerHelper;
@@ -61,6 +63,8 @@ namespace core {
class FragmentHandler;
+// ============================================================================
+
struct TextField {
com::sun::star::uno::Reference< com::sun::star::text::XText > xText;
com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > xTextCursor;
@@ -76,7 +80,8 @@ class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
{
public:
explicit XmlFilterBase(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~XmlFilterBase();
@@ -222,4 +227,3 @@ typedef ::rtl::Reference< XmlFilterBase > XmlFilterRef;
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/axiscontext.hxx b/oox/inc/oox/drawingml/chart/axiscontext.hxx
index b80dd2e6f9ef..13c550e881d4 100644
--- a/oox/inc/oox/drawingml/chart/axiscontext.hxx
+++ b/oox/inc/oox/drawingml/chart/axiscontext.hxx
@@ -124,4 +124,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/axisconverter.hxx b/oox/inc/oox/drawingml/chart/axisconverter.hxx
index 925fa1fe8b4f..9e083f69d253 100644
--- a/oox/inc/oox/drawingml/chart/axisconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/axisconverter.hxx
@@ -68,4 +68,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/axismodel.hxx b/oox/inc/oox/drawingml/chart/axismodel.hxx
index 8bab84257eee..23dc96037427 100644
--- a/oox/inc/oox/drawingml/chart/axismodel.hxx
+++ b/oox/inc/oox/drawingml/chart/axismodel.hxx
@@ -109,4 +109,3 @@ struct AxisModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
index f034b4b6e6bb..76ddeafddb80 100644
--- a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
+++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
@@ -99,4 +99,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/chartconverter.hxx b/oox/inc/oox/drawingml/chart/chartconverter.hxx
index f9d10388ce13..de8572ab168b 100644
--- a/oox/inc/oox/drawingml/chart/chartconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/chartconverter.hxx
@@ -108,4 +108,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
index 0b5a7f6374a4..3ff545cda295 100644
--- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
+++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
@@ -101,7 +101,8 @@ public:
virtual ~ChartDrawingFragment();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
private:
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
@@ -119,4 +120,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx
index b4c40015f825..91e622552aa7 100644
--- a/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/chartspaceconverter.hxx
@@ -61,4 +61,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/chartspacefragment.hxx b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx
index 898bc2ea15e8..e51c1c1fcc1b 100644
--- a/oox/inc/oox/drawingml/chart/chartspacefragment.hxx
+++ b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx
@@ -59,4 +59,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/chartspacemodel.hxx b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx
index ddfa57fb919c..37c39e315e3e 100644
--- a/oox/inc/oox/drawingml/chart/chartspacemodel.hxx
+++ b/oox/inc/oox/drawingml/chart/chartspacemodel.hxx
@@ -75,4 +75,3 @@ struct ChartSpaceModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx
index c937c6e94900..aec646d4c610 100644
--- a/oox/inc/oox/drawingml/chart/converterbase.hxx
+++ b/oox/inc/oox/drawingml/chart/converterbase.hxx
@@ -155,4 +155,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/datasourcecontext.hxx b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx
index 9b832a0209ab..1cffa32e382a 100644
--- a/oox/inc/oox/drawingml/chart/datasourcecontext.hxx
+++ b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx
@@ -51,7 +51,7 @@ public:
virtual ~DoubleSequenceContext();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
private:
sal_Int32 mnPtIndex; /// Current data point index.
@@ -69,7 +69,7 @@ public:
virtual ~StringSequenceContext();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
private:
sal_Int32 mnPtIndex; /// Current data point index.
@@ -98,4 +98,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/datasourceconverter.hxx b/oox/inc/oox/drawingml/chart/datasourceconverter.hxx
index 7cdd6ab4a175..9d16f4e85882 100644
--- a/oox/inc/oox/drawingml/chart/datasourceconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/datasourceconverter.hxx
@@ -75,4 +75,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/datasourcemodel.hxx b/oox/inc/oox/drawingml/chart/datasourcemodel.hxx
index 3de2278e5a71..04e79b831049 100644
--- a/oox/inc/oox/drawingml/chart/datasourcemodel.hxx
+++ b/oox/inc/oox/drawingml/chart/datasourcemodel.hxx
@@ -69,4 +69,3 @@ struct DataSourceModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/modelbase.hxx b/oox/inc/oox/drawingml/chart/modelbase.hxx
index d34970025abd..278a8af9fed3 100644
--- a/oox/inc/oox/drawingml/chart/modelbase.hxx
+++ b/oox/inc/oox/drawingml/chart/modelbase.hxx
@@ -28,9 +28,9 @@
#ifndef OOX_DRAWINGML_CHART_MODELBASE_HXX
#define OOX_DRAWINGML_CHART_MODELBASE_HXX
-#include "oox/helper/containerhelper.hxx"
#include "oox/helper/helper.hxx"
-#include "tokens.hxx"
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
namespace oox { class AttributeList; }
@@ -138,4 +138,3 @@ struct LayoutModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/objectformatter.hxx b/oox/inc/oox/drawingml/chart/objectformatter.hxx
index 9f83a6bc0391..c35cd66f65e1 100644
--- a/oox/inc/oox/drawingml/chart/objectformatter.hxx
+++ b/oox/inc/oox/drawingml/chart/objectformatter.hxx
@@ -28,7 +28,6 @@
#ifndef OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
#define OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
-#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/chart/modelbase.hxx"
@@ -170,4 +169,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/plotareacontext.hxx b/oox/inc/oox/drawingml/chart/plotareacontext.hxx
index 75ebed545956..5d3358c1147c 100644
--- a/oox/inc/oox/drawingml/chart/plotareacontext.hxx
+++ b/oox/inc/oox/drawingml/chart/plotareacontext.hxx
@@ -87,4 +87,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx
index e35afb633b92..9089c0180024 100644
--- a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx
@@ -107,4 +107,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/plotareamodel.hxx b/oox/inc/oox/drawingml/chart/plotareamodel.hxx
index c5793717defc..ef29a72f4b09 100644
--- a/oox/inc/oox/drawingml/chart/plotareamodel.hxx
+++ b/oox/inc/oox/drawingml/chart/plotareamodel.hxx
@@ -91,4 +91,3 @@ struct PlotAreaModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/seriescontext.hxx b/oox/inc/oox/drawingml/chart/seriescontext.hxx
index 024e9754781c..ef50bc94866c 100644
--- a/oox/inc/oox/drawingml/chart/seriescontext.hxx
+++ b/oox/inc/oox/drawingml/chart/seriescontext.hxx
@@ -47,7 +47,7 @@ public:
virtual ~DataLabelContext();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
};
// ============================================================================
@@ -63,7 +63,7 @@ public:
virtual ~DataLabelsContext();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
};
// ============================================================================
@@ -124,7 +124,7 @@ public:
virtual ~TrendlineContext();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
};
// ============================================================================
@@ -270,4 +270,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/seriesconverter.hxx b/oox/inc/oox/drawingml/chart/seriesconverter.hxx
index fd3ca207d7c0..6874298487d4 100644
--- a/oox/inc/oox/drawingml/chart/seriesconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/seriesconverter.hxx
@@ -171,4 +171,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/seriesmodel.hxx b/oox/inc/oox/drawingml/chart/seriesmodel.hxx
index 2b72eb0f2bcf..d4b9ab3c9715 100644
--- a/oox/inc/oox/drawingml/chart/seriesmodel.hxx
+++ b/oox/inc/oox/drawingml/chart/seriesmodel.hxx
@@ -241,4 +241,3 @@ struct SeriesModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/titlecontext.hxx b/oox/inc/oox/drawingml/chart/titlecontext.hxx
index b3fec5d93203..45969bf150c2 100644
--- a/oox/inc/oox/drawingml/chart/titlecontext.hxx
+++ b/oox/inc/oox/drawingml/chart/titlecontext.hxx
@@ -47,7 +47,7 @@ public:
virtual ~TextContext();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
};
// ============================================================================
@@ -87,4 +87,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/titleconverter.hxx b/oox/inc/oox/drawingml/chart/titleconverter.hxx
index d153e9f3e760..2a452ae6c96b 100644
--- a/oox/inc/oox/drawingml/chart/titleconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/titleconverter.hxx
@@ -110,4 +110,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/titlemodel.hxx b/oox/inc/oox/drawingml/chart/titlemodel.hxx
index f80837249809..fc47d684c6dc 100644
--- a/oox/inc/oox/drawingml/chart/titlemodel.hxx
+++ b/oox/inc/oox/drawingml/chart/titlemodel.hxx
@@ -93,4 +93,3 @@ struct LegendModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
index aa5f2a47c4a0..d58cb7e1c4f7 100644
--- a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
+++ b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
@@ -168,4 +168,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/typegroupconverter.hxx b/oox/inc/oox/drawingml/chart/typegroupconverter.hxx
index 46018696baef..58375a4c2b1f 100644
--- a/oox/inc/oox/drawingml/chart/typegroupconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/typegroupconverter.hxx
@@ -202,4 +202,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/chart/typegroupmodel.hxx b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx
index b51b8e5d4a7c..9af01210d585 100644
--- a/oox/inc/oox/drawingml/chart/typegroupmodel.hxx
+++ b/oox/inc/oox/drawingml/chart/typegroupmodel.hxx
@@ -100,4 +100,3 @@ struct TypeGroupModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/drawingml/clrscheme.hxx b/oox/inc/oox/drawingml/clrscheme.hxx
index 22eab1a892a1..5f13f54b705d 100644
--- a/oox/inc/oox/drawingml/clrscheme.hxx
+++ b/oox/inc/oox/drawingml/clrscheme.hxx
@@ -31,7 +31,6 @@
#include <boost/shared_ptr.hpp>
#include <map>
#include <vector>
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/color.hxx"
namespace oox { namespace drawingml {
diff --git a/oox/inc/oox/drawingml/customshapeproperties.hxx b/oox/inc/oox/drawingml/customshapeproperties.hxx
index 282e0c6009b5..985507d22265 100644
--- a/oox/inc/oox/drawingml/customshapeproperties.hxx
+++ b/oox/inc/oox/drawingml/customshapeproperties.hxx
@@ -28,13 +28,7 @@
#ifndef OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
#define OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
-#include "oox/helper/propertymap.hxx"
-#include "oox/drawingml/color.hxx"
-#include "oox/core/xmlfilterbase.hxx"
-#include <com/sun/star/graphic/XGraphic.hpp>
#include <boost/shared_ptr.hpp>
-#include "oox/helper/helper.hxx"
-#include "tokens.hxx"
#include <vector>
#include <map>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
@@ -45,11 +39,15 @@
#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
-#ifndef __com_sun_star_beans_PropertyValues_hpp__
#include <com/sun/star/beans/PropertyValues.hpp>
-#endif
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/token/tokens.hxx"
namespace oox { namespace drawingml {
diff --git a/oox/inc/oox/drawingml/graphicshapecontext.hxx b/oox/inc/oox/drawingml/graphicshapecontext.hxx
index d515a4553936..5f27efdf15e7 100644
--- a/oox/inc/oox/drawingml/graphicshapecontext.hxx
+++ b/oox/inc/oox/drawingml/graphicshapecontext.hxx
@@ -68,7 +68,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
private:
- ::boost::shared_ptr< ::oox::vml::OleObjectInfo > mxOleObjectInfo;
+ ::oox::vml::OleObjectInfo& mrOleObjectInfo;
};
// ====================================================================
@@ -106,7 +106,7 @@ public:
throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
private:
- bool mbEmbedShapes;
+ ChartShapeInfo& mrChartShapeInfo;
};
// ====================================================================
diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx
index d6cab48f6bb5..2114f8d9cf02 100644
--- a/oox/inc/oox/drawingml/shape.hxx
+++ b/oox/inc/oox/drawingml/shape.hxx
@@ -40,6 +40,10 @@
#include <vector>
#include <map>
+namespace oox { namespace vml {
+ struct OleObjectInfo;
+} }
+
namespace oox { namespace drawingml {
class CustomShapeProperties;
@@ -57,37 +61,15 @@ typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap;
// ============================================================================
-/** A callback that will be called before and after the API shape is created
- from the imported shape.
-
- An instance of a derived class of this callback can be set at every
- ::oox::drawingml::Shape instance to implement anything that needs a created
- and inserted XShape.
- */
-class CreateShapeCallback
+/** Additional information for a chart embedded in a drawing shape. */
+struct ChartShapeInfo
{
-public:
- virtual ::rtl::OUString onCreateXShape(
- const ::rtl::OUString& rServiceName,
- const ::com::sun::star::awt::Rectangle& rShapeRect );
+ ::rtl::OUString maFragmentPath; /// Path to related XML stream, e.g. for charts.
+ bool mbEmbedShapes; /// True = load chart shapes into chart, false = load into parent drawpage.
- virtual void onXShapeCreated(
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ) const;
-
- inline const PropertyMap& getShapeProperties() const { return maShapeProps; }
-
-protected:
- explicit CreateShapeCallback( ::oox::core::XmlFilterBase& rFilter );
- virtual ~CreateShapeCallback();
-
-protected:
- ::oox::core::XmlFilterBase& mrFilter;
- PropertyMap maShapeProps;
+ inline explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( bEmbedShapes ) {}
};
-typedef ::boost::shared_ptr< CreateShapeCallback > CreateShapeCallbackRef;
-
// ============================================================================
class Shape
@@ -95,7 +77,7 @@ class Shape
{
public:
- Shape( const sal_Char* pServiceType = NULL );
+ explicit Shape( const sal_Char* pServiceType = 0 );
virtual ~Shape();
rtl::OUString& getServiceName(){ return msServiceName; }
@@ -136,6 +118,11 @@ public:
// setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value)
void setDefaults();
+ ::oox::vml::OleObjectInfo& setOleObjectType();
+ ChartShapeInfo& setChartType( bool bEmbedShapes );
+ void setDiagramType();
+ void setTableType();
+
void setTextBody(const TextBodyPtr & pTextBody);
TextBodyPtr getTextBody();
void setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle );
@@ -145,11 +132,9 @@ public:
inline const ShapeStyleRefMap& getShapeStyleRefs() const { return maShapeStyleRefs; }
const ShapeStyleRef* getShapeStyleRef( sal_Int32 nRefType ) const;
- inline void setCreateShapeCallback( CreateShapeCallbackRef xCallback ) { mxCreateCallback = xCallback; }
-
// addShape is creating and inserting the corresponding XShape.
void addShape(
- const oox::core::XmlFilterBase& rFilterBase,
+ ::oox::core::XmlFilterBase& rFilterBase,
const Theme* pTheme,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
@@ -166,7 +151,7 @@ protected:
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createAndInsert(
- const ::oox::core::XmlFilterBase& rFilterBase,
+ ::oox::core::XmlFilterBase& rFilterBase,
const ::rtl::OUString& rServiceName,
const Theme* pTheme,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
@@ -174,13 +159,22 @@ protected:
sal_Bool bClearText );
void addChildren(
- const ::oox::core::XmlFilterBase& rFilterBase,
+ ::oox::core::XmlFilterBase& rFilterBase,
Shape& rMaster,
const Theme* pTheme,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
const ::com::sun::star::awt::Rectangle& rClientRect,
ShapeIdMap* pShapeMap );
+ virtual ::rtl::OUString finalizeServiceName(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::rtl::OUString& rServiceName,
+ const ::com::sun::star::awt::Rectangle& rShapeRect );
+
+ virtual void finalizeXShape(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+
std::vector< ShapePtr > maChildren; // only used for group shapes
TextBodyPtr mpTextBody;
LinePropertiesPtr mpLinePropertiesPtr;
@@ -204,7 +198,22 @@ protected:
com::sun::star::awt::Point maPosition;
private:
- CreateShapeCallbackRef mxCreateCallback;
+ enum FrameType
+ {
+ FRAMETYPE_GENERIC, /// Generic shape, no special type.
+ FRAMETYPE_OLEOBJECT, /// OLE object embedded in a shape.
+ FRAMETYPE_CHART, /// Chart embedded in a shape.
+ FRAMETYPE_DIAGRAM, /// Complex diagram drawing shape.
+ FRAMETYPE_TABLE /// A table embedded in a shape.
+ };
+
+ typedef ::boost::shared_ptr< ::oox::vml::OleObjectInfo > OleObjectInfoRef;
+ typedef ::boost::shared_ptr< ChartShapeInfo > ChartShapeInfoRef;
+
+ FrameType meFrameType; /// Type for graphic frame shapes.
+ OleObjectInfoRef mxOleObjectInfo; /// Additional data for OLE objects.
+ ChartShapeInfoRef mxChartShapeInfo; /// Additional data for chart shapes.
+
sal_Int32 mnRotation;
sal_Bool mbFlipH;
sal_Bool mbFlipV;
@@ -213,6 +222,8 @@ private:
::rtl::OUString GetShapeType( sal_Int32 nType );
+// ============================================================================
+
} }
#endif // OOX_DRAWINGML_SHAPE_HXX
diff --git a/oox/inc/oox/drawingml/textbody.hxx b/oox/inc/oox/drawingml/textbody.hxx
index a2eb6106e651..ce747c62bdbb 100644
--- a/oox/inc/oox/drawingml/textbody.hxx
+++ b/oox/inc/oox/drawingml/textbody.hxx
@@ -28,7 +28,6 @@
#ifndef OOX_DRAWINGML_TEXTBODY_HXX
#define OOX_DRAWINGML_TEXTBODY_HXX
-#include "oox/helper/containerhelper.hxx"
#include "oox/drawingml/textbodyproperties.hxx"
#include "oox/drawingml/textliststyle.hxx"
diff --git a/oox/inc/oox/drawingml/textliststyle.hxx b/oox/inc/oox/drawingml/textliststyle.hxx
index 1a8fca45bf25..cafcc951504b 100644
--- a/oox/inc/oox/drawingml/textliststyle.hxx
+++ b/oox/inc/oox/drawingml/textliststyle.hxx
@@ -28,8 +28,8 @@
#ifndef OOX_DRAWINGML_TEXTLISTSTYLE_HXX
#define OOX_DRAWINGML_TEXTLISTSTYLE_HXX
-#include "oox/helper/containerhelper.hxx"
#include "oox/drawingml/textparagraphproperties.hxx"
+#include "oox/helper/refvector.hxx"
namespace oox { namespace drawingml {
@@ -50,10 +50,6 @@ public:
inline const TextParagraphPropertiesVector& getAggregationListStyle() const { return maAggregationListStyle; };
inline TextParagraphPropertiesVector& getAggregationListStyle() { return maAggregationListStyle; };
-#if OSL_DEBUG_LEVEL > 0
- void dump( int nLevels=9 );
-#endif
-
protected:
TextParagraphPropertiesVector maListStyle;
diff --git a/oox/inc/oox/drawingml/textparagraph.hxx b/oox/inc/oox/drawingml/textparagraph.hxx
index d8c97cbfa114..c059edc73f43 100644
--- a/oox/inc/oox/drawingml/textparagraph.hxx
+++ b/oox/inc/oox/drawingml/textparagraph.hxx
@@ -31,7 +31,6 @@
#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/text/XText.hpp>
-#include "oox/helper/containerhelper.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/textrun.hxx"
#include "oox/drawingml/textliststyle.hxx"
diff --git a/oox/inc/oox/drawingml/textparagraphproperties.hxx b/oox/inc/oox/drawingml/textparagraphproperties.hxx
index 310df83212a0..ef80af2d1c11 100644
--- a/oox/inc/oox/drawingml/textparagraphproperties.hxx
+++ b/oox/inc/oox/drawingml/textparagraphproperties.hxx
@@ -112,10 +112,6 @@ public:
size can be zero and the default value is returned. */
float getCharHeightPoints( float fDefault ) const;
-#if OSL_DEBUG_LEVEL > 0
- void dump() { maTextParagraphPropertyMap.dump(); OSL_TRACE("character height: %f", maTextCharacterProperties.getCharHeightPoints(-1)); }
-#endif
-
protected:
TextCharacterProperties maTextCharacterProperties;
diff --git a/oox/inc/oox/drawingml/theme.hxx b/oox/inc/oox/drawingml/theme.hxx
index 15f5ce82ce12..7f982a1eec71 100644
--- a/oox/inc/oox/drawingml/theme.hxx
+++ b/oox/inc/oox/drawingml/theme.hxx
@@ -28,7 +28,6 @@
#ifndef OOX_DRAWINGML_THEME_HXX
#define OOX_DRAWINGML_THEME_HXX
-#include "oox/helper/containerhelper.hxx"
#include "oox/drawingml/clrscheme.hxx"
#include "oox/drawingml/shape.hxx"
#include "oox/drawingml/textfont.hxx"
diff --git a/oox/inc/oox/dump/biffdumper.hxx b/oox/inc/oox/dump/biffdumper.hxx
index e3e712a52a25..a3bdc4a87c73 100644
--- a/oox/inc/oox/dump/biffdumper.hxx
+++ b/oox/inc/oox/dump/biffdumper.hxx
@@ -190,6 +190,9 @@ protected:
::oox::xls::BiffStringFlags nUniFlags = ::oox::xls::BIFF_STR_DEFAULT,
rtl_TextEncoding eDefaultTextEnc = RTL_TEXTENCODING_DONTKNOW );
+ ::rtl::OUString dumpSegmentedUniString( const String& rName );
+ void dumpSegmentedUniStringArray( const String& rName );
+
sal_uInt8 dumpBoolean( const String& rName = EMPTY_STRING );
sal_uInt8 dumpErrorCode( const String& rName = EMPTY_STRING );
@@ -440,6 +443,8 @@ private:
void dumpExtCfColor( const String& rName = EMPTY_STRING );
void dumpExtGradientHead();
+ sal_uInt8 dumpFilterColumnOperator( const String& rName );
+
::rtl::OUString dumpPivotString( const String& rName, sal_uInt16 nStrLen );
::rtl::OUString dumpPivotString( const String& rName );
diff --git a/oox/inc/oox/dump/oledumper.hxx b/oox/inc/oox/dump/oledumper.hxx
index a0e9cd55e337..8f706f4c40f1 100644
--- a/oox/inc/oox/dump/oledumper.hxx
+++ b/oox/inc/oox/dump/oledumper.hxx
@@ -141,15 +141,19 @@ private:
void dumpCodePageProperty( sal_uInt32 nStartPos );
void dumpDictionaryProperty( sal_uInt32 nStartPos );
- void dumpPropertyContents( sal_Int32 nPropId );
- void dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType );
+ sal_uInt16 dumpPropertyContents( sal_Int32 nPropId );
+ void dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyArray( sal_Int32 nPropId, sal_uInt16 nBaseType );
- sal_Int32 dumpPropertyType();
- void dumpBlob( const String& rName );
+ sal_uInt16 dumpPropertyType();
+ void dumpBlob( sal_Int32 nPropId, const String& rName );
::rtl::OUString dumpString8( const String& rName );
::rtl::OUString dumpCharArray8( const String& rName, sal_Int32 nLen );
::rtl::OUString dumpString16( const String& rName );
::rtl::OUString dumpCharArray16( const String& rName, sal_Int32 nLen );
+ bool dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType );
+ void dumpHlinks( sal_Int32 nSize );
bool startElement( sal_uInt32 nStartPos );
void writeSectionHeader( const ::rtl::OUString& rGuid, sal_uInt32 nStartPos );
diff --git a/oox/inc/oox/dump/xlsbdumper.hxx b/oox/inc/oox/dump/xlsbdumper.hxx
index 345202f67a4a..6fa1c9bd7e45 100644
--- a/oox/inc/oox/dump/xlsbdumper.hxx
+++ b/oox/inc/oox/dump/xlsbdumper.hxx
@@ -29,7 +29,6 @@
#define OOX_DUMP_XLSBDUMPER_HXX
#include "oox/dump/dumperbase.hxx"
-#include "oox/helper/recordinputstream.hxx"
#if OOX_INCLUDE_DUMPER
@@ -96,9 +95,9 @@ private:
bool readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue );
private:
- typedef ::boost::shared_ptr< RecordInputStream > RecordInputStreamRef;
+ typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef;
- RecordInputStreamRef mxBiffStrm;
+ SequenceInputStreamRef mxBiffStrm;
NameListRef mxErrCodes;
};
diff --git a/oox/inc/oox/helper/attributelist.hxx b/oox/inc/oox/helper/attributelist.hxx
index 631d7ec4b66e..87e21e553c2d 100644
--- a/oox/inc/oox/helper/attributelist.hxx
+++ b/oox/inc/oox/helper/attributelist.hxx
@@ -31,7 +31,8 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
#include "oox/helper/helper.hxx"
-#include "tokens.hxx"
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
namespace oox {
@@ -43,6 +44,9 @@ namespace oox {
class AttributeConversion
{
public:
+ /** Returns the XML token identifier from the passed string. */
+ static sal_Int32 decodeToken( const ::rtl::OUString& rValue );
+
/** Returns the decoded string value. All characters in the format
'_xHHHH_' (H being a hexadecimal digit), will be decoded. */
static ::rtl::OUString decodeXString( const ::rtl::OUString& rValue );
@@ -189,4 +193,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/binaryinputstream.hxx b/oox/inc/oox/helper/binaryinputstream.hxx
index 8f58e2de4d9e..52a3a4de9f0f 100644
--- a/oox/inc/oox/helper/binaryinputstream.hxx
+++ b/oox/inc/oox/helper/binaryinputstream.hxx
@@ -288,4 +288,3 @@ typedef ::boost::shared_ptr< RelativeInputStream > RelativeInputStreamRef;
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/binaryoutputstream.hxx b/oox/inc/oox/helper/binaryoutputstream.hxx
index d2f0f8b36ffa..e24777c4f296 100644
--- a/oox/inc/oox/helper/binaryoutputstream.hxx
+++ b/oox/inc/oox/helper/binaryoutputstream.hxx
@@ -158,4 +158,3 @@ typedef ::boost::shared_ptr< SequenceOutputStream > SequenceOutputStreamRef;
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/binarystreambase.hxx b/oox/inc/oox/helper/binarystreambase.hxx
index abe4c5f1c274..ba0f34b21f40 100644
--- a/oox/inc/oox/helper/binarystreambase.hxx
+++ b/oox/inc/oox/helper/binarystreambase.hxx
@@ -144,4 +144,3 @@ protected:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx
index f4f3717eac3f..96b9feeffe07 100644
--- a/oox/inc/oox/helper/containerhelper.hxx
+++ b/oox/inc/oox/helper/containerhelper.hxx
@@ -30,8 +30,6 @@
#include <vector>
#include <map>
-#include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
@@ -49,304 +47,6 @@ namespace oox {
// ============================================================================
-/** Template for a vector of ref-counted objects with additional accessor functions.
-
- An instance of the class RefVector< Type > stores elements of the type
- ::boost::shared_ptr< Type >. The new accessor functions has() and get()
- work correctly for indexes out of the current range, there is no need to
- check the passed index before.
- */
-template< typename ObjType >
-class RefVector : public ::std::vector< ::boost::shared_ptr< ObjType > >
-{
-public:
- typedef ::std::vector< ::boost::shared_ptr< ObjType > > container_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::size_type size_type;
-
-public:
- /** Returns true, if the object with the passed index exists. Returns
- false, if the vector element exists but is an empty reference. */
- inline bool has( sal_Int32 nIndex ) const
- {
- const value_type* pxRef = getRef( nIndex );
- return pxRef && pxRef->get();
- }
-
- /** Returns a reference to the object with the passed index, or 0 on error. */
- inline value_type get( sal_Int32 nIndex ) const
- {
- if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef;
- return value_type();
- }
-
- /** Returns the index of the last element, or -1, if the vector is empty.
- Does *not* check whether the last element is an empty reference. */
- inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; }
-
- /** Calls the passed functor for every contained object, automatically
- skips all elements that are empty references. */
- template< typename FunctorType >
- inline void forEach( FunctorType aFunctor ) const
- {
- ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType >
- inline void forEachMem( FuncType pFunc ) const
- {
- forEach( ::boost::bind( pFunc, _1 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType >
- inline void forEachMem( FuncType pFunc, ParamType aParam ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
- }
-
- /** Calls the passed functor for every contained object. Passes the index as
- first argument and the object reference as second argument to rFunctor. */
- template< typename FunctorType >
- inline void forEachWithIndex( const FunctorType& rFunctor ) const
- {
- ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the vector index to the member function. */
- template< typename FuncType >
- inline void forEachMemWithIndex( FuncType pFunc ) const
- {
- forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the vector index as first argument to the member function. */
- template< typename FuncType, typename ParamType >
- inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const
- {
- forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the vector index as first argument to the member function. */
- template< typename FuncType, typename ParamType1, typename ParamType2 >
- inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
- {
- forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the vector index as first argument to the member function. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
- inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
- {
- forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
- }
-
- /** Searches for an element by using the passed functor that takes a
- constant reference of the object type (const ObjType&). */
- template< typename FunctorType >
- inline value_type findIf( const FunctorType& rFunctor ) const
- {
- typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) );
- return (aIt == this->end()) ? value_type() : *aIt;
- }
-
-private:
- template< typename FunctorType >
- struct ForEachFunctor
- {
- FunctorType maFunctor;
- inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
- inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); }
- };
-
- template< typename FunctorType >
- struct ForEachFunctorWithIndex
- {
- FunctorType maFunctor;
- sal_Int32 mnIndex;
- inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {}
- inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; }
- };
-
- template< typename FunctorType >
- struct FindFunctor
- {
- FunctorType maFunctor;
- inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
- inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); }
- };
-
- inline const value_type* getRef( sal_Int32 nIndex ) const
- {
- return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ?
- &(*this)[ static_cast< size_type >( nIndex ) ] : 0;
- }
-};
-
-// ============================================================================
-
-/** Template for a map of ref-counted objects with additional accessor functions.
-
- An instance of the class RefMap< Type > stores elements of the type
- ::boost::shared_ptr< Type >. The new accessor functions has() and get()
- work correctly for nonexisting keys, there is no need to check the passed
- key before.
- */
-template< typename KeyType, typename ObjType, typename CompType = ::std::less< KeyType > >
-class RefMap : public ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType >
-{
-public:
- typedef ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > container_type;
- typedef typename container_type::key_type key_type;
- typedef typename container_type::mapped_type mapped_type;
- typedef typename container_type::value_type value_type;
- typedef typename container_type::key_compare key_compare;
-
-public:
- /** Returns true, if the object accossiated to the passed key exists.
- Returns false, if the key exists but points to an empty reference. */
- inline bool has( key_type nKey ) const
- {
- const mapped_type* pxRef = getRef( nKey );
- return pxRef && pxRef->get();
- }
-
- /** Returns a reference to the object accossiated to the passed key, or an
- empty reference on error. */
- inline mapped_type get( key_type nKey ) const
- {
- if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef;
- return mapped_type();
- }
-
- /** Calls the passed functor for every contained object, automatically
- skips all elements that are empty references. */
- template< typename FunctorType >
- inline void forEach( const FunctorType& rFunctor ) const
- {
- ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType >
- inline void forEachMem( FuncType pFunc ) const
- {
- forEach( ::boost::bind( pFunc, _1 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType >
- inline void forEachMem( FuncType pFunc, ParamType aParam ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object,
- automatically skips all elements that are empty references. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
- inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
- }
- /** Calls the passed functor for every contained object. Passes the key as
- first argument and the object reference as second argument to rFunctor. */
- template< typename FunctorType >
- inline void forEachWithKey( const FunctorType& rFunctor ) const
- {
- ::std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the object key as argument to the member function. */
- template< typename FuncType >
- inline void forEachMemWithKey( FuncType pFunc ) const
- {
- forEachWithKey( ::boost::bind( pFunc, _2, _1 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the object key as first argument to the member function. */
- template< typename FuncType, typename ParamType >
- inline void forEachMemWithKey( FuncType pFunc, ParamType aParam ) const
- {
- forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the object key as first argument to the member function. */
- template< typename FuncType, typename ParamType1, typename ParamType2 >
- inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
- {
- forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
- }
-
- /** Calls the passed member function of ObjType on every contained object.
- Passes the object key as first argument to the member function. */
- template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
- inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
- {
- forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
- }
-
-private:
- template< typename FunctorType >
- struct ForEachFunctor
- {
- FunctorType maFunctor;
- inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
- inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); }
- };
-
- template< typename FunctorType >
- struct ForEachFunctorWithKey
- {
- FunctorType maFunctor;
- inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
- inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); }
- };
-
- inline const mapped_type* getRef( key_type nKey ) const
- {
- typename container_type::const_iterator aIt = find( nKey );
- return (aIt == this->end()) ? 0 : &aIt->second;
- }
-};
-
-// ============================================================================
-
/** Template for a 2-dimensional array of objects.
This class template provides a similar interface to the ::std::vector
@@ -518,45 +218,53 @@ public:
/** Returns the pointer to an existing element of the passed vector, or a
null pointer, if the passed index is out of bounds. */
- template< typename Type >
- static const Type* getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex );
+ template< typename VectorType >
+ static const typename VectorType::value_type*
+ getVectorElement( const VectorType& rVector, sal_Int32 nIndex );
/** Returns the pointer to an existing element of the passed vector, or a
null pointer, if the passed index is out of bounds. */
- template< typename Type >
- static Type* getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex );
+ template< typename VectorType >
+ static typename VectorType::value_type*
+ getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex );
/** Returns the reference to an existing element of the passed vector, or
the passed default value, if the passed index is out of bounds. */
- template< typename Type >
- static const Type& getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, const Type& rDefault );
+ template< typename VectorType >
+ static const typename VectorType::value_type&
+ getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault );
/** Returns the reference to an existing element of the passed vector, or
the passed default value, if the passed index is out of bounds. */
- template< typename Type >
- static Type& getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault );
+ template< typename VectorType >
+ static typename VectorType::value_type&
+ getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault );
/** Returns the pointer to an existing element of the passed map, or a null
pointer, if an element with the passed key does not exist. */
- template< typename Type, typename KeyType >
- static const Type* getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey );
+ template< typename MapType >
+ static const typename MapType::mapped_type*
+ getMapElement( const MapType& rMap, const typename MapType::key_type& rKey );
/** Returns the pointer to an existing element of the passed map, or a null
pointer, if an element with the passed key does not exist. */
- template< typename Type, typename KeyType >
- static Type* getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey );
+ template< typename MapType >
+ static typename MapType::mapped_type*
+ getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey );
/** Returns the reference to an existing element of the passed map, or the
passed default value, if an element with the passed key does not exist. */
- template< typename Type, typename KeyType >
- static const Type& getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey, const Type& rDefault );
+ template< typename MapType >
+ static const typename MapType::mapped_type&
+ getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault );
/** Returns the reference to an existing element of the passed map, or the
passed default value, if an element with the passed key does not exist. */
- template< typename Type, typename KeyType >
- static Type& getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey, Type& rDefault );
+ template< typename MapType >
+ static typename MapType::mapped_type&
+ getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault );
- // vector/matrix to Sequence ----------------------------------------------
+ // vector/map/matrix to UNO sequence --------------------------------------
/** Creates a UNO sequence from a std::vector with copies of all elements.
@@ -565,9 +273,20 @@ public:
@return A com.sun.star.uno.Sequence object with copies of all objects
contained in the passed vector.
*/
- template< typename Type >
- static ::com::sun::star::uno::Sequence< Type >
- vectorToSequence( const ::std::vector< Type >& rVector );
+ template< typename VectorType >
+ static ::com::sun::star::uno::Sequence< typename VectorType::value_type >
+ vectorToSequence( const VectorType& rVector );
+
+ /** Creates a UNO sequence from a std::map with copies of all elements.
+
+ @param rMap The map to be converted to a sequence.
+
+ @return A com.sun.star.uno.Sequence object with copies of all objects
+ contained in the passed map.
+ */
+ template< typename MapType >
+ static ::com::sun::star::uno::Sequence< typename MapType::mapped_type >
+ mapToSequence( const MapType& rMap );
/** Creates a UNO sequence of sequences from a matrix with copies of all elements.
@@ -577,126 +296,104 @@ public:
com.sun.star.uno.Sequence objects with copies of all objects
contained in the passed matrix.
*/
- template< typename Type >
- static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > >
- matrixToSequenceSequence( const Matrix< Type >& rMatrix );
+ template< typename MatrixType >
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > >
+ matrixToSequenceSequence( const MatrixType& rMatrix );
};
// ----------------------------------------------------------------------------
-template< typename Type >
-const Type* ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex )
+template< typename VectorType >
+/*static*/ const typename VectorType::value_type* ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex )
{
return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
}
-template< typename Type >
-Type* ContainerHelper::getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex )
+template< typename VectorType >
+/*static*/ typename VectorType::value_type* ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex )
{
return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
}
-template< typename Type >
-const Type& ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, const Type& rDefault )
+template< typename VectorType >
+/*static*/ const typename VectorType::value_type& ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault )
{
return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
}
-template< typename Type >
-Type& ContainerHelper::getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault )
+template< typename VectorType >
+/*static*/ typename VectorType::value_type& ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault )
{
return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
}
-template< typename Type, typename KeyType >
-const Type* ContainerHelper::getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey )
+template< typename MapType >
+/*static*/ const typename MapType::mapped_type* ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey )
{
- typename ::std::map< KeyType, Type >::const_iterator aIt = rMap.find( nKey );
+ typename MapType::const_iterator aIt = rMap.find( rKey );
return (aIt == rMap.end()) ? 0 : &aIt->second;
}
-template< typename Type, typename KeyType >
-Type* ContainerHelper::getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey )
+template< typename MapType >
+/*static*/ typename MapType::mapped_type* ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey )
{
- typename ::std::map< KeyType, Type >::iterator aIt = rMap.find( nKey );
+ typename MapType::iterator aIt = rMap.find( rKey );
return (aIt == rMap.end()) ? 0 : &aIt->second;
}
-template< typename Type, typename KeyType >
-const Type& ContainerHelper::getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey, const Type& rDefault )
+template< typename MapType >
+/*static*/ const typename MapType::mapped_type& ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault )
{
- typename ::std::map< KeyType, Type >::const_iterator aIt = rMap.find( nKey );
+ typename MapType::const_iterator aIt = rMap.find( rKey );
return (aIt == rMap.end()) ? rDefault : aIt->second;
}
-template< typename Type, typename KeyType >
-Type& ContainerHelper::getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey, Type& rDefault )
+template< typename MapType >
+/*static*/ typename MapType::mapped_type& ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault )
{
- typename ::std::map< KeyType, Type >::iterator aIt = rMap.find( nKey );
+ typename MapType::iterator aIt = rMap.find( rKey );
return (aIt == rMap.end()) ? rDefault : aIt->second;
}
-template< typename Type >
-::com::sun::star::uno::Sequence< Type > ContainerHelper::vectorToSequence( const ::std::vector< Type >& rVector )
+template< typename VectorType >
+/*static*/ ::com::sun::star::uno::Sequence< typename VectorType::value_type > ContainerHelper::vectorToSequence( const VectorType& rVector )
{
+ typedef typename VectorType::value_type ValueType;
if( rVector.empty() )
- return ::com::sun::star::uno::Sequence< Type >();
- return ::com::sun::star::uno::Sequence< Type >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) );
+ return ::com::sun::star::uno::Sequence< ValueType >();
+ return ::com::sun::star::uno::Sequence< ValueType >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) );
}
-template< typename Type >
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > > ContainerHelper::matrixToSequenceSequence( const Matrix< Type >& rMatrix )
+template< typename MapType >
+/*static*/ ::com::sun::star::uno::Sequence< typename MapType::mapped_type > ContainerHelper::mapToSequence( const MapType& rMap )
+{
+ typedef typename MapType::mapped_type ValueType;
+ if( rMap.empty() )
+ return ::com::sun::star::uno::Sequence< ValueType >();
+ ::com::sun::star::uno::Sequence< ValueType > aSeq( static_cast< sal_Int32 >( rMap.size() ) );
+ sal_Int32 nIndex = 0;
+ for( typename MapType::const_iterator aIt = rMap.begin(), aEnd = rMap.end(); aIt != aEnd; ++aIt, ++nIndex )
+ aSeq[ nIndex ] = *aIt;
+ return aSeq;
+}
+
+template< typename MatrixType >
+/*static*/ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > > ContainerHelper::matrixToSequenceSequence( const MatrixType& rMatrix )
{
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > > aSeq;
+ typedef typename MatrixType::value_type ValueType;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ValueType > > aSeq;
if( !rMatrix.empty() )
{
aSeq.realloc( static_cast< sal_Int32 >( rMatrix.height() ) );
for( size_t nRow = 0, nHeight = rMatrix.height(); nRow < nHeight; ++nRow )
aSeq[ static_cast< sal_Int32 >( nRow ) ] =
- ::com::sun::star::uno::Sequence< Type >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) );
+ ::com::sun::star::uno::Sequence< ValueType >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) );
}
return aSeq;
}
// ============================================================================
-/** This helper manages named objects in a container, which is created on demand.
- */
-class ObjectContainer
-{
-public:
- explicit ObjectContainer(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
- const ::rtl::OUString& rServiceName );
- ~ObjectContainer();
-
- /** Returns true, if the object with the passed name exists in the container. */
- bool hasObject( const ::rtl::OUString& rObjName ) const;
-
- /** Returns the object with the passed name from the container. */
- ::com::sun::star::uno::Any getObject( const ::rtl::OUString& rObjName ) const;
-
- /** Inserts the passed object into the container, returns its final name. */
- ::rtl::OUString insertObject(
- const ::rtl::OUString& rObjName,
- const ::com::sun::star::uno::Any& rObj,
- bool bInsertByUnusedName );
-
-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::container::XNameContainer >
- mxContainer; /// Container for the objects.
- ::rtl::OUString maServiceName; /// Service name to create the container.
- sal_Int32 mnIndex; /// Index to create unique identifiers.
-};
-
-// ============================================================================
-
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx
index 1c112efcf923..b2b9e1cd133b 100644
--- a/oox/inc/oox/helper/graphichelper.hxx
+++ b/oox/inc/oox/helper/graphichelper.hxx
@@ -45,7 +45,6 @@ namespace com { namespace sun { namespace star {
namespace graphic { class XGraphic; }
namespace graphic { class XGraphicObject; }
namespace graphic { class XGraphicProvider; }
- namespace lang { class XMultiServiceFactory; }
namespace uno { class XComponentContext; }
} } }
@@ -68,7 +67,7 @@ class GraphicHelper
{
public:
explicit GraphicHelper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxTargetFrame,
const StorageRef& rxStorage );
virtual ~GraphicHelper();
@@ -176,4 +175,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx
index c68fe9ce83f8..84c501fae2e5 100644
--- a/oox/inc/oox/helper/helper.hxx
+++ b/oox/inc/oox/helper/helper.hxx
@@ -322,4 +322,3 @@ inline void ByteOrderConverter::swap8( sal_uInt8* pnData )
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/modelobjecthelper.hxx b/oox/inc/oox/helper/modelobjecthelper.hxx
index a9ef27e8cb98..e36e7001e613 100644
--- a/oox/inc/oox/helper/modelobjecthelper.hxx
+++ b/oox/inc/oox/helper/modelobjecthelper.hxx
@@ -29,19 +29,55 @@
#define OOX_HELPER_MODELOBJECTHELPER_HXX
#include <com/sun/star/uno/Reference.hxx>
-#include "oox/helper/containerhelper.hxx"
namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
namespace awt { struct Gradient; }
+ namespace container { class XNameContainer; }
namespace drawing { struct LineDash; }
namespace drawing { struct PolyPolygonBezierCoords; }
+ namespace lang { class XMultiServiceFactory; }
} } }
namespace oox {
// ============================================================================
+/** This helper manages named objects in a container, which is created on demand.
+ */
+class ObjectContainer
+{
+public:
+ explicit ObjectContainer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+ const ::rtl::OUString& rServiceName );
+ ~ObjectContainer();
+
+ /** Returns true, if the object with the passed name exists in the container. */
+ bool hasObject( const ::rtl::OUString& rObjName ) const;
+
+ /** Returns the object with the passed name from the container. */
+ ::com::sun::star::uno::Any getObject( const ::rtl::OUString& rObjName ) const;
+
+ /** Inserts the passed object into the container, returns its final name. */
+ ::rtl::OUString insertObject(
+ const ::rtl::OUString& rObjName,
+ const ::com::sun::star::uno::Any& rObj,
+ bool bInsertByUnusedName );
+
+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::container::XNameContainer >
+ mxContainer; /// Container for the objects.
+ ::rtl::OUString maServiceName; /// Service name to create the container.
+ sal_Int32 mnIndex; /// Index to create unique identifiers.
+};
+
+// ============================================================================
+
/** Contains tables for named drawing objects for a document model.
Contains tables for named line markers, line dashes, fill gradients, and
@@ -77,13 +113,13 @@ public:
::rtl::OUString insertFillBitmap( const ::rtl::OUString& rGraphicUrl );
private:
- ObjectContainer maMarkerContainer;
- ObjectContainer maDashContainer;
- ObjectContainer maGradientContainer;
- ObjectContainer maBitmapContainer;
- const ::rtl::OUString maDashNameBase;
- const ::rtl::OUString maGradientNameBase;
- const ::rtl::OUString maBitmapNameBase;
+ 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.
+ 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.
};
// ============================================================================
@@ -91,4 +127,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/progressbar.hxx b/oox/inc/oox/helper/progressbar.hxx
index f5ea98816915..847d16ea9231 100644
--- a/oox/inc/oox/helper/progressbar.hxx
+++ b/oox/inc/oox/helper/progressbar.hxx
@@ -142,4 +142,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/propertymap.hxx b/oox/inc/oox/helper/propertymap.hxx
index 150f5c3d9364..9e7196381002 100644
--- a/oox/inc/oox/helper/propertymap.hxx
+++ b/oox/inc/oox/helper/propertymap.hxx
@@ -30,9 +30,10 @@
#include <vector>
#include <map>
-#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/token/properties.hxx"
namespace com { namespace sun { namespace star { namespace beans {
struct PropertyValue;
@@ -41,7 +42,7 @@ namespace com { namespace sun { namespace star { namespace beans {
namespace oox {
-struct PropertyList;
+struct PropertyNameVector;
// ============================================================================
@@ -89,13 +90,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
makePropertySet() const;
-#if OSL_DEBUG_LEVEL > 0
- static void dump( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet);
- void dump();
-#endif
-
private:
- const PropertyList* mpPropNames;
+ const PropertyNameVector* mpPropNames;
};
// ============================================================================
@@ -103,4 +99,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx
index 8ddfaff44421..9a49bb48cf92 100644
--- a/oox/inc/oox/helper/propertyset.hxx
+++ b/oox/inc/oox/helper/propertyset.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include "oox/token/properties.hxx"
namespace oox {
@@ -127,10 +128,6 @@ public:
@param rPropertyMap The property map. */
void setProperties( const PropertyMap& rPropertyMap );
-#if OSL_DEBUG_LEVEL > 0
- void dump();
-#endif
-
// ------------------------------------------------------------------------
private:
/** Gets the specified property from the property set.
@@ -167,4 +164,3 @@ inline void PropertySet::setProperty( sal_Int32 nPropId, const Type& rValue )
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/helper/refmap.hxx b/oox/inc/oox/helper/refmap.hxx
new file mode 100755
index 000000000000..e833e1196c81
--- /dev/null
+++ b/oox/inc/oox/helper/refmap.hxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_HELPER_REFMAP_HXX
+#define OOX_HELPER_REFMAP_HXX
+
+#include <map>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+
+namespace oox {
+
+// ============================================================================
+
+/** Template for a map of ref-counted objects with additional accessor functions.
+
+ An instance of the class RefMap< Type > stores elements of the type
+ ::boost::shared_ptr< Type >. The new accessor functions has() and get()
+ work correctly for nonexisting keys, there is no need to check the passed
+ key before.
+ */
+template< typename KeyType, typename ObjType, typename CompType = ::std::less< KeyType > >
+class RefMap : public ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType >
+{
+public:
+ typedef ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > container_type;
+ typedef typename container_type::key_type key_type;
+ typedef typename container_type::mapped_type mapped_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::key_compare key_compare;
+
+public:
+ /** Returns true, if the object accossiated to the passed key exists.
+ Returns false, if the key exists but points to an empty reference. */
+ inline bool has( key_type nKey ) const
+ {
+ const mapped_type* pxRef = getRef( nKey );
+ return pxRef && pxRef->get();
+ }
+
+ /** Returns a reference to the object accossiated to the passed key, or an
+ empty reference on error. */
+ inline mapped_type get( key_type nKey ) const
+ {
+ if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef;
+ return mapped_type();
+ }
+
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
+ template< typename FunctorType >
+ inline void forEach( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType >
+ inline void forEachMem( FuncType pFunc ) const
+ {
+ forEach( ::boost::bind( pFunc, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMem( FuncType pFunc, ParamType aParam ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
+ }
+ /** Calls the passed functor for every contained object. Passes the key as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ inline void forEachWithKey( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as argument to the member function. */
+ template< typename FuncType >
+ inline void forEachMemWithKey( FuncType pFunc ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType aParam ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+private:
+ template< typename FunctorType >
+ struct ForEachFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithKey
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); }
+ };
+
+ inline const mapped_type* getRef( key_type nKey ) const
+ {
+ typename container_type::const_iterator aIt = find( nKey );
+ return (aIt == this->end()) ? 0 : &aIt->second;
+ }
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/helper/refvector.hxx b/oox/inc/oox/helper/refvector.hxx
new file mode 100755
index 000000000000..0a2d8be62e2f
--- /dev/null
+++ b/oox/inc/oox/helper/refvector.hxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_HELPER_REFVECTOR_HXX
+#define OOX_HELPER_REFVECTOR_HXX
+
+#include <vector>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+
+namespace oox {
+
+// ============================================================================
+
+/** Template for a vector of ref-counted objects with additional accessor functions.
+
+ An instance of the class RefVector< Type > stores elements of the type
+ ::boost::shared_ptr< Type >. The new accessor functions has() and get()
+ work correctly for indexes out of the current range, there is no need to
+ check the passed index before.
+ */
+template< typename ObjType >
+class RefVector : public ::std::vector< ::boost::shared_ptr< ObjType > >
+{
+public:
+ typedef ::std::vector< ::boost::shared_ptr< ObjType > > container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::size_type size_type;
+
+public:
+ /** Returns true, if the object with the passed index exists. Returns
+ false, if the vector element exists but is an empty reference. */
+ inline bool has( sal_Int32 nIndex ) const
+ {
+ const value_type* pxRef = getRef( nIndex );
+ return pxRef && pxRef->get();
+ }
+
+ /** Returns a reference to the object with the passed index, or 0 on error. */
+ inline value_type get( sal_Int32 nIndex ) const
+ {
+ if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef;
+ return value_type();
+ }
+
+ /** Returns the index of the last element, or -1, if the vector is empty.
+ Does *not* check whether the last element is an empty reference. */
+ inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; }
+
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
+ template< typename FunctorType >
+ inline void forEach( FunctorType aFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType >
+ inline void forEachMem( FuncType pFunc ) const
+ {
+ forEach( ::boost::bind( pFunc, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMem( FuncType pFunc, ParamType aParam ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Calls the passed functor for every contained object. Passes the index as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ inline void forEachWithIndex( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index to the member function. */
+ template< typename FuncType >
+ inline void forEachMemWithIndex( FuncType pFunc ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Searches for an element by using the passed functor that takes a
+ constant reference of the object type (const ObjType&). */
+ template< typename FunctorType >
+ inline value_type findIf( const FunctorType& rFunctor ) const
+ {
+ typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) );
+ return (aIt == this->end()) ? value_type() : *aIt;
+ }
+
+private:
+ template< typename FunctorType >
+ struct ForEachFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithIndex
+ {
+ FunctorType maFunctor;
+ sal_Int32 mnIndex;
+ inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {}
+ inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; }
+ };
+
+ template< typename FunctorType >
+ struct FindFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); }
+ };
+
+ inline const value_type* getRef( sal_Int32 nIndex ) const
+ {
+ return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ?
+ &(*this)[ static_cast< size_type >( nIndex ) ] : 0;
+ }
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/helper/storagebase.hxx b/oox/inc/oox/helper/storagebase.hxx
index 5a179e73cf75..d48e5fdd1844 100644
--- a/oox/inc/oox/helper/storagebase.hxx
+++ b/oox/inc/oox/helper/storagebase.hxx
@@ -28,8 +28,10 @@
#ifndef OOX_HELPER_STORAGEBASE_HXX
#define OOX_HELPER_STORAGEBASE_HXX
+#include <vector>
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/helper/refmap.hxx"
#include "oox/dllapi.h"
-#include "oox/helper/containerhelper.hxx"
namespace com { namespace sun { namespace star {
namespace embed { class XStorage; }
diff --git a/oox/inc/oox/helper/textinputstream.hxx b/oox/inc/oox/helper/textinputstream.hxx
index 1e74825ee713..2e98d3fc8c84 100755
--- a/oox/inc/oox/helper/textinputstream.hxx
+++ b/oox/inc/oox/helper/textinputstream.hxx
@@ -55,4 +55,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/axbinaryreader.hxx b/oox/inc/oox/ole/axbinaryreader.hxx
index e3f102716e17..f26075ff52eb 100755..100644
--- a/oox/inc/oox/ole/axbinaryreader.hxx
+++ b/oox/inc/oox/ole/axbinaryreader.hxx
@@ -30,7 +30,7 @@
#include <utility>
#include "oox/helper/binaryinputstream.hxx"
-#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/refvector.hxx"
namespace oox {
namespace ole {
@@ -92,6 +92,8 @@ typedef ::std::vector< ::rtl::OUString > AxStringArray;
// ============================================================================
+const sal_Char* const AX_GUID_CFONT = "{AFC20920-DA4E-11CE-B943-00AA006887B4}";
+
const sal_uInt32 AX_FONTDATA_BOLD = 0x00000001;
const sal_uInt32 AX_FONTDATA_ITALIC = 0x00000002;
const sal_uInt32 AX_FONTDATA_UNDERLINE = 0x00000004;
@@ -111,6 +113,7 @@ struct AxFontData
sal_Int32 mnFontHeight; /// Height of the font (not really twips, see code).
sal_Int32 mnFontCharSet; /// Windows character set of the font.
sal_Int32 mnHorAlign; /// Horizontal text alignment.
+ bool mbDblUnderline; /// True = double underline style (legacy VML drawing controls only).
explicit AxFontData();
@@ -293,4 +296,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx
index 8df45ece6065..8bc9cd622b2b 100644
--- a/oox/inc/oox/ole/axcontrol.hxx
+++ b/oox/inc/oox/ole/axcontrol.hxx
@@ -30,6 +30,7 @@
#include <boost/shared_ptr.hpp>
#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/propertyset.hxx"
#include "oox/ole/axbinaryreader.hxx"
#include "oox/ole/olehelper.hxx"
@@ -37,6 +38,7 @@ namespace com { namespace sun { namespace star {
namespace awt { class XControlModel; }
namespace container { class XIndexContainer; }
namespace drawing { class XDrawPage; }
+ namespace frame { class XModel; }
namespace form { class XFormsSupplier; }
namespace lang { class XMultiServiceFactory; }
} } }
@@ -56,6 +58,9 @@ const sal_Char* const COMCTL_GUID_SCROLLBAR_60 = "{FE38753A-44A3-11D1-B5B7-
const sal_Char* const COMCTL_GUID_PROGRESSBAR_50 = "{0713E8D2-850A-101B-AFC0-4210102A8DA7}";
const sal_Char* const COMCTL_GUID_PROGRESSBAR_60 = "{35053A22-8589-11D1-B16A-00C0F0283628}";
+const sal_uInt16 COMCTL_VERSION_50 = 5;
+const sal_uInt16 COMCTL_VERSION_60 = 6;
+
// ----------------------------------------------------------------------------
const sal_Char* const AX_GUID_COMMANDBUTTON = "{D7053240-CE69-11CD-A777-00DD01143C57}";
@@ -77,6 +82,28 @@ const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008;
const sal_uInt32 AX_SYSCOLOR_BUTTONFACE = 0x8000000F;
const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT = 0x80000012;
+const sal_uInt32 AX_FLAGS_ENABLED = 0x00000002;
+const sal_uInt32 AX_FLAGS_LOCKED = 0x00000004;
+const sal_uInt32 AX_FLAGS_OPAQUE = 0x00000008;
+const sal_uInt32 AX_FLAGS_COLUMNHEADS = 0x00000400;
+const sal_uInt32 AX_FLAGS_ENTIREROWS = 0x00000800;
+const sal_uInt32 AX_FLAGS_EXISTINGENTRIES = 0x00001000;
+const sal_uInt32 AX_FLAGS_CAPTIONLEFT = 0x00002000;
+const sal_uInt32 AX_FLAGS_EDITABLE = 0x00004000;
+const sal_uInt32 AX_FLAGS_IMEMODE_MASK = 0x00078000;
+const sal_uInt32 AX_FLAGS_DRAGENABLED = 0x00080000;
+const sal_uInt32 AX_FLAGS_ENTERASNEWLINE = 0x00100000;
+const sal_uInt32 AX_FLAGS_KEEPSELECTION = 0x00200000;
+const sal_uInt32 AX_FLAGS_TABASCHARACTER = 0x00400000;
+const sal_uInt32 AX_FLAGS_WORDWRAP = 0x00800000;
+const sal_uInt32 AX_FLAGS_BORDERSSUPPRESSED = 0x02000000;
+const sal_uInt32 AX_FLAGS_SELECTLINE = 0x04000000;
+const sal_uInt32 AX_FLAGS_SINGLECHARSELECT = 0x08000000;
+const sal_uInt32 AX_FLAGS_AUTOSIZE = 0x10000000;
+const sal_uInt32 AX_FLAGS_HIDESELECTION = 0x20000000;
+const sal_uInt32 AX_FLAGS_MAXLENAUTOTAB = 0x40000000;
+const sal_uInt32 AX_FLAGS_MULTILINE = 0x80000000;
+
const sal_Int32 AX_BORDERSTYLE_NONE = 0;
const sal_Int32 AX_BORDERSTYLE_SINGLE = 1;
@@ -96,6 +123,26 @@ const sal_Int32 AX_PICALIGN_CENTER = 2;
const sal_Int32 AX_PICALIGN_BOTTOMLEFT = 3;
const sal_Int32 AX_PICALIGN_BOTTOMRIGHT = 4;
+const sal_Int32 AX_DISPLAYSTYLE_TEXT = 1;
+const sal_Int32 AX_DISPLAYSTYLE_LISTBOX = 2;
+const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX = 3;
+const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX = 4;
+const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON = 5;
+const sal_Int32 AX_DISPLAYSTYLE_TOGGLE = 6;
+const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN = 7;
+
+const sal_Int32 AX_SELCTION_SINGLE = 0;
+const sal_Int32 AX_SELCTION_MULTI = 1;
+const sal_Int32 AX_SELCTION_EXTENDED = 2;
+
+const sal_Int32 AX_SHOWDROPBUTTON_NEVER = 0;
+const sal_Int32 AX_SHOWDROPBUTTON_FOCUS = 1;
+const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS = 2;
+
+const sal_Int32 AX_SCROLLBAR_NONE = 0x00;
+const sal_Int32 AX_SCROLLBAR_HORIZONTAL = 0x01;
+const sal_Int32 AX_SCROLLBAR_VERTICAL = 0x02;
+
// ----------------------------------------------------------------------------
/** Enumerates all UNO API control types supported by these filters. */
@@ -107,6 +154,7 @@ enum ApiControlType
API_CONTROL_CHECKBOX,
API_CONTROL_RADIOBUTTON,
API_CONTROL_EDIT,
+ API_CONTROL_NUMERIC,
API_CONTROL_LISTBOX,
API_CONTROL_COMBOBOX,
API_CONTROL_SPINBUTTON,
@@ -147,6 +195,7 @@ class ControlConverter
{
public:
explicit ControlConverter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
const GraphicHelper& rGraphicHelper,
bool bDefaultColorBgr = true );
virtual ~ControlConverter();
@@ -179,12 +228,25 @@ public:
PropertyMap& rPropMap,
bool bHorizontal ) const;
+ /** Converts the vertical alignment to UNO properties. */
+ void convertVerticalAlign(
+ PropertyMap& rPropMap,
+ sal_Int32 nVerticalAlign ) const;
+
/** Converts common scrollbar settings to UNO properties. */
void convertScrollBar(
PropertyMap& rPropMap,
sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const;
+ /** Binds the passed control model to the passed data sources. The
+ implementation will check which source types are supported. */
+ void bindToSources(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ::rtl::OUString& rCtrlSource,
+ const ::rtl::OUString& rRowSource,
+ sal_Int32 nRefSheet = 0 ) const;
+
// ActiveX (Forms 2.0) specific conversion --------------------------------
/** Converts the Forms 2.0 background formatting to UNO properties. */
@@ -238,7 +300,10 @@ public:
sal_Int32 nOrientation ) const;
private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
const GraphicHelper& mrGraphicHelper;
+ mutable PropertySet maAddressConverter;
+ mutable PropertySet maRangeConverter;
bool mbDefaultColorBgr;
};
@@ -275,8 +340,10 @@ public:
/** Converts the control size to UNO properties. */
void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
-protected:
+public: // direct access needed for legacy VML drawing controls
AxPairData maSize; /// Size of the control in 1/100 mm.
+
+protected:
bool mbAwtModel; /// True = AWT control model, false = form component.
};
@@ -396,8 +463,10 @@ public:
/** Returns the font height in points. */
inline sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); }
-protected:
+public: // direct access needed for legacy VML drawing controls
AxFontData maFontData; /// The font settings.
+
+private:
bool mbSupportsAlign; /// True = UNO model supports Align property.
};
@@ -416,13 +485,14 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
-private:
+public: // direct access needed for legacy VML drawing controls
StreamDataSequence maPictureData; /// Binary picture stream.
::rtl::OUString maCaption; /// Visible caption of the button.
sal_uInt32 mnTextColor; /// Text color.
sal_uInt32 mnBackColor; /// Fill color.
sal_uInt32 mnFlags; /// Various flags.
sal_uInt32 mnPicturePos; /// Position of the picture relative to text.
+ sal_Int32 mnVerticalAlign; /// Vertical alignment (legacy VML drawing controls only).
bool mbFocusOnClick; /// True = take focus on click.
};
@@ -440,7 +510,7 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
-private:
+public: // direct access needed for legacy VML drawing controls
::rtl::OUString maCaption; /// Visible caption of the button.
sal_uInt32 mnTextColor; /// Text color.
sal_uInt32 mnBackColor; /// Fill color.
@@ -448,6 +518,7 @@ private:
sal_uInt32 mnBorderColor; /// Flat border color.
sal_Int32 mnBorderStyle; /// Flat border style.
sal_Int32 mnSpecialEffect; /// 3D border effect.
+ sal_Int32 mnVerticalAlign; /// Vertical alignment (legacy VML drawing controls only).
};
// ============================================================================
@@ -490,7 +561,7 @@ public:
virtual bool importBinaryModel( BinaryInputStream& rInStrm );
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
-protected:
+public: // direct access needed for legacy VML drawing controls
StreamDataSequence maPictureData; /// Binary picture stream.
::rtl::OUString maCaption; /// Visible caption of the button.
::rtl::OUString maValue; /// Current value of the control.
@@ -510,6 +581,7 @@ protected:
sal_Int32 mnMaxLength; /// Maximum character count.
sal_Int32 mnPasswordChar; /// Password character in edit fields.
sal_Int32 mnListRows; /// Number of rows in dropdown box.
+ sal_Int32 mnVerticalAlign; /// Vertical alignment (legacy VML drawing controls only).
};
// ============================================================================
@@ -565,6 +637,18 @@ public:
// ============================================================================
+/** Model for a numeric field (legacy drawing controls only). */
+class AxNumericFieldModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxNumericFieldModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+// ============================================================================
+
/** Model for a Forms 2.0 list box. */
class AxListBoxModel : public AxMorphDataModelBase
{
@@ -601,7 +685,7 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
-private:
+public: // direct access needed for legacy VML drawing controls
sal_uInt32 mnArrowColor; /// Button arrow color.
sal_uInt32 mnBackColor; /// Fill color.
sal_uInt32 mnFlags; /// Various flags.
@@ -627,7 +711,7 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
-private:
+public: // direct access needed for legacy VML drawing controls
sal_uInt32 mnArrowColor; /// Button arrow color.
sal_uInt32 mnBackColor; /// Fill color.
sal_uInt32 mnFlags; /// Various flags.
@@ -691,7 +775,7 @@ public:
model from the 'f' stream. */
bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable );
-protected:
+public: // direct access needed for legacy VML drawing controls
StreamDataSequence maPictureData; /// Binary picture stream.
::rtl::OUString maCaption; /// Visible caption of the form.
AxPairData maLogicalSize; /// Logical form size (scroll area).
@@ -776,14 +860,27 @@ class EmbeddedControl
{
public:
explicit EmbeddedControl( const ::rtl::OUString& rName );
- ~EmbeddedControl();
+ virtual ~EmbeddedControl();
+
+ /** Creates and returns the internal control model of the specified type. */
+ template< typename ModelType >
+ inline ModelType& createModel();
+
+ /** Creates and returns the internal control model of the specified type. */
+ template< typename ModelType, typename ParamType >
+ inline ModelType& createModel( const ParamType& rParam );
/** Creates and returns the internal control model according to the passed
MS class identifier. */
- ControlModelRef createModel( const ::rtl::OUString& rClassId );
+ ControlModelBase* createModelFromGuid( const ::rtl::OUString& rClassId );
/** Returns true, if the internal control model exists. */
inline bool hasModel() const { return mxModel.get() != 0; }
+ /** Returns read-only access to the internal control model. */
+ inline const ControlModelBase* getModel() const { return mxModel.get(); }
+ /** Returns read/write access to the internal control model. */
+ inline ControlModelBase* getModel() { return mxModel.get(); }
+
/** Returns the UNO service name needed to construct the control model. */
::rtl::OUString getServiceName() const;
@@ -797,32 +894,54 @@ private:
::rtl::OUString maName; /// Name of the control.
};
+// ----------------------------------------------------------------------------
+
+template< typename ModelType >
+inline ModelType& EmbeddedControl::createModel()
+{
+ ::boost::shared_ptr< ModelType > xModel( new ModelType );
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
+template< typename ModelType, typename ParamType >
+inline ModelType& EmbeddedControl::createModel( const ParamType& rParam )
+{
+ ::boost::shared_ptr< ModelType > xModel( new ModelType( rParam ) );
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
// ============================================================================
/** A wrapper for a control form embedded directly in a draw page. */
-class EmbeddedForm : public ControlConverter
+class EmbeddedForm
{
public:
explicit EmbeddedForm(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
const GraphicHelper& rGraphicHelper,
bool bDefaultColorBgr = true );
- /** Converts the passed ActiveX control and inserts it into the form.
+ /** Converts the passed control and inserts the control model into the form.
@return The API control model, if conversion was successful. */
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
- convertAndInsert( const EmbeddedControl& rControl );
+ convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex );
-private:
- /** Tries to insert the passed control model into the form. */
- bool insertControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel );
+ /** Returns the XIndexContainer interface of the UNO control form, if existing. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
+ getXForm() const { return mxFormIC; }
+private:
/** Creates the form that will hold the form controls. */
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
- createForm();
+ createXForm();
private:
+ ControlConverter maControlConv;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxModelFactory;
::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier > mxFormsSupp;
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxFormIC;
diff --git a/oox/inc/oox/ole/axcontrolfragment.hxx b/oox/inc/oox/ole/axcontrolfragment.hxx
index 3c9aed61bd3e..a5273070ba8f 100644
--- a/oox/inc/oox/ole/axcontrolfragment.hxx
+++ b/oox/inc/oox/ole/axcontrolfragment.hxx
@@ -78,4 +78,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/olehelper.hxx b/oox/inc/oox/ole/olehelper.hxx
index ba46d3baf6df..98085e66cfd8 100644
--- a/oox/inc/oox/ole/olehelper.hxx
+++ b/oox/inc/oox/ole/olehelper.hxx
@@ -100,6 +100,10 @@ public:
sal_uInt32 nOleColor,
bool bDefaultColorBgr = true );
+ /** Returns the OLE color from the passed UNO RGB color.
+ */
+ static sal_uInt32 encodeOleColor( sal_Int32 nRgbColor );
+
/** Imports a GUID from the passed binary stream and returns its string
representation (in uppercase characters).
*/
@@ -140,4 +144,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/oleobjecthelper.hxx b/oox/inc/oox/ole/oleobjecthelper.hxx
index ef3570c4fa20..c3a58213abc9 100644
--- a/oox/inc/oox/ole/oleobjecthelper.hxx
+++ b/oox/inc/oox/ole/oleobjecthelper.hxx
@@ -32,8 +32,8 @@
namespace com { namespace sun { namespace star {
namespace awt { struct Size; }
- namespace lang { class XMultiServiceFactory; }
namespace document { class XEmbeddedObjectResolver; }
+ namespace lang { class XMultiServiceFactory; }
} } }
namespace oox { class PropertyMap; }
@@ -83,4 +83,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/olestorage.hxx b/oox/inc/oox/ole/olestorage.hxx
index a84fadfadc92..eabcfd4d0f87 100755..100644
--- a/oox/inc/oox/ole/olestorage.hxx
+++ b/oox/inc/oox/ole/olestorage.hxx
@@ -31,8 +31,8 @@
#include "oox/helper/storagebase.hxx"
namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
namespace container { class XNameContainer; }
+ namespace lang { class XMultiServiceFactory; }
} } }
namespace oox {
diff --git a/oox/inc/oox/ole/vbacontrol.hxx b/oox/inc/oox/ole/vbacontrol.hxx
index c2490b3506bf..8c4274ffda7e 100755
--- a/oox/inc/oox/ole/vbacontrol.hxx
+++ b/oox/inc/oox/ole/vbacontrol.hxx
@@ -32,6 +32,7 @@
namespace com { namespace sun { namespace star {
namespace container { class XNameContainer; }
+ namespace uno { class XComponentContext; }
} } }
namespace oox { class StorageBase; }
@@ -82,12 +83,18 @@ public:
ApiControlType eCtrlType,
sal_Int32 nCtrlIndex ) const;
+ /** Binds the passed control model to the data sources. The implementation
+ will check which source types are supported. */
+ void bindToSources(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv ) const;
+
protected:
::rtl::OUString maName; /// Name of the control.
::rtl::OUString maTag; /// User defined tag.
::rtl::OUString maToolTip; /// Tool tip for the control.
- ::rtl::OUString maLinkedCell; /// Linked cell for the control value in a spreadsheet.
- ::rtl::OUString maSourceRange; /// Source data for the control in a spreadsheet.
+ ::rtl::OUString maControlSource; /// Linked cell for the control value in a spreadsheet.
+ ::rtl::OUString maRowSource; /// Source data for the control in a spreadsheet.
AxPairData maPos; /// Position in parent container.
sal_Int32 mnId; /// Control identifier.
sal_Int32 mnHelpContextId; /// Help context identifier.
@@ -181,11 +188,12 @@ private:
// ============================================================================
-class VbaUserForm : public VbaFormControl, public ControlConverter
+class VbaUserForm : public VbaFormControl
{
public:
explicit VbaUserForm(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ 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 GraphicHelper& rGraphicHelper,
bool bDefaultColorBgr = true );
@@ -198,7 +206,9 @@ public:
rtl_TextEncoding eTextEnc );
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxGlobalFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCompContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
+ ControlConverter maConverter;
};
// ============================================================================
diff --git a/oox/inc/oox/ole/vbahelper.hxx b/oox/inc/oox/ole/vbahelper.hxx
index c1e7297d0c5b..aa7b3a081c8d 100644
--- a/oox/inc/oox/ole/vbahelper.hxx
+++ b/oox/inc/oox/ole/vbahelper.hxx
@@ -54,6 +54,7 @@ const sal_uInt16 VBA_ID_MODULETYPEPROCEDURAL = 0x0021;
const sal_uInt16 VBA_ID_PROJECTCODEPAGE = 0x0003;
const sal_uInt16 VBA_ID_PROJECTEND = 0x0010;
const sal_uInt16 VBA_ID_PROJECTMODULES = 0x000F;
+const sal_uInt16 VBA_ID_PROJECTNAME = 0x0004;
const sal_uInt16 VBA_ID_PROJECTVERSION = 0x0009;
// ============================================================================
diff --git a/oox/inc/oox/ole/vbainputstream.hxx b/oox/inc/oox/ole/vbainputstream.hxx
index 4de0a91a622f..858698518968 100644
--- a/oox/inc/oox/ole/vbainputstream.hxx
+++ b/oox/inc/oox/ole/vbainputstream.hxx
@@ -69,4 +69,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/ole/vbamodule.hxx b/oox/inc/oox/ole/vbamodule.hxx
index 377c7abc335a..52b2261e55b5 100644
--- a/oox/inc/oox/ole/vbamodule.hxx
+++ b/oox/inc/oox/ole/vbamodule.hxx
@@ -28,8 +28,8 @@
#ifndef OOX_OLE_VBAMODULE_HXX
#define OOX_OLE_VBAMODULE_HXX
-#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
namespace com { namespace sun { namespace star {
namespace container { class XNameAccess; }
diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx
index e8d9aa7c0f5d..40e81c923d25 100644
--- a/oox/inc/oox/ole/vbaproject.hxx
+++ b/oox/inc/oox/ole/vbaproject.hxx
@@ -28,8 +28,10 @@
#ifndef OOX_OLE_VBAPROJECT_HXX
#define OOX_OLE_VBAPROJECT_HXX
-#include "oox/helper/storagebase.hxx"
+#include <map>
#include <com/sun/star/uno/XInterface.hpp>
+#include "oox/helper/refvector.hxx"
+#include "oox/helper/storagebase.hxx"
#include "oox/dllapi.h"
namespace com { namespace sun { namespace star {
@@ -37,7 +39,8 @@ namespace com { namespace sun { namespace star {
namespace document { class XEventsSupplier; }
namespace frame { class XModel; }
namespace script { class XLibraryContainer; }
- namespace lang { class XMultiServiceFactory; }
+ namespace script { namespace vba { class XVBAMacroResolver; } }
+ namespace uno { class XComponentContext; }
} } }
namespace oox { class GraphicHelper; }
@@ -51,7 +54,7 @@ class OOX_DLLPUBLIC VbaFilterConfig
{
public:
explicit VbaFilterConfig(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::rtl::OUString& rConfigCompName );
~VbaFilterConfig();
@@ -69,11 +72,52 @@ private:
// ============================================================================
+/** Base class for objects that attach a amcro to a specific action.
+
+ Purpose is to collect objects that need to attach a VBA macro to an action.
+ The VBA project will be loaded at a very late point of the document import
+ process, because it depends on an initialized core document model (e.g.
+ spreadsheet codenames). Some objects that want to attach a VBA macro to an
+ action (e.g. mouse click action for drawing shapes) are loaded long before
+ the VBA project. The drawback is that in most cases macros are specified
+ without module name, or the VBA project name is part of the macro name.
+ In the former case, all code modules have to be scanned for the macro to be
+ able to create a valid script URL.
+
+ The import code will register these requests to attach a VBA macro with an
+ instance of a class derived from this base class. The derived class will
+ store all information needed to finally attach the macro to the action,
+ once the VBA project has been imported.
+ */
+class VbaMacroAttacherBase
+{
+public:
+ explicit VbaMacroAttacherBase( const ::rtl::OUString& rMacroName );
+ virtual ~VbaMacroAttacherBase();
+
+ /** Resolves the internal macro name to the related macro URL, and attaches
+ the macro to the object. */
+ void resolveAndAttachMacro(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAMacroResolver >& rxResolver );
+
+private:
+ /** Called after the VBA project has been imported. Derived classes will
+ attach the passed script to the object represented by this instance. */
+ virtual void attachMacro( const ::rtl::OUString& rScriptUrl ) = 0;
+
+private:
+ ::rtl::OUString maMacroName;
+};
+
+typedef ::boost::shared_ptr< VbaMacroAttacherBase > VbaMacroAttacherRef;
+
+// ============================================================================
+
class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig
{
public:
explicit VbaProject(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ 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& rConfigCompName );
virtual ~VbaProject();
@@ -87,6 +131,10 @@ public:
const GraphicHelper& rGraphicHelper,
bool bDefaultColorBgr = true );
+ /** Registers a macro atatcher object. For details, see description of the
+ VbaMacroAttacherBase class. */
+ void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher );
+
/** Returns true, if the document contains at least one code module. */
bool hasModules() const;
/** Returns true, if the document contains the specified code module. */
@@ -101,8 +149,6 @@ protected:
/** Registers a dummy module that will be created when the VBA project is
imported. */
void addDummyModule( const ::rtl::OUString& rName, sal_Int32 nType );
- /** Creates all dummy modules in the document. */
- void createDummyModules();
/** Called when the import process of the VBA project has been started. */
virtual void prepareImport();
@@ -131,22 +177,28 @@ private:
StorageBase& rVbaPrjStrg,
const GraphicHelper& rGraphicHelper,
bool bDefaultColorBgr );
+
+ /** Attaches VBA macros to objects registered via registerMacroAttacher(). */
+ void attachMacros();
+
/** Copies the entire VBA project storage to the passed document model. */
void copyStorage( StorageBase& rVbaPrjStrg );
private:
+ typedef RefVector< VbaMacroAttacherBase > MacroAttacherVector;
typedef ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- mxGlobalFactory; /// Global service factory.
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxCompContext; /// 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 >
mxBasicLib; /// The Basic library of the document used for import.
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
mxDialogLib; /// The dialog library of the document used for import.
+ MacroAttacherVector maMacroAttachers; /// Objects that want to attach a VBA macro to an action.
DummyModuleMap maDummyModules; /// Additional empty modules created on import.
- const ::rtl::OUString maLibName; /// Name for Basic and dialog library used for import.
+ ::rtl::OUString maPrjName; /// Name of the VBA project.
};
// ============================================================================
diff --git a/oox/inc/oox/ole/vbaprojectfilter.hxx b/oox/inc/oox/ole/vbaprojectfilter.hxx
new file mode 100755
index 000000000000..c8a0a1b0ce74
--- /dev/null
+++ b/oox/inc/oox/ole/vbaprojectfilter.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_OLE_VBAPROJECTFILTER_HXX
+#define OOX_OLE_VBAPROJECTFILTER_HXX
+
+#include "oox/core/binaryfilterbase.hxx"
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+class VbaProjectFilterBase : public ::oox::core::BinaryFilterBase
+{
+public:
+ explicit VbaProjectFilterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::rtl::OUString& rAppName,
+ const ::rtl::OUString& rStorageName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+private:
+ virtual VbaProject* implCreateVbaProject() const;
+
+private:
+ ::rtl::OUString maAppName;
+ ::rtl::OUString maStorageName;
+};
+
+// ============================================================================
+
+class WordVbaProjectFilter : public VbaProjectFilterBase
+{
+public:
+ explicit WordVbaProjectFilter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ virtual ::rtl::OUString implGetImplementationName() const;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/ppt/pptimport.hxx b/oox/inc/oox/ppt/pptimport.hxx
index c4ee29447c64..158584eeb3f5 100644
--- a/oox/inc/oox/ppt/pptimport.hxx
+++ b/oox/inc/oox/ppt/pptimport.hxx
@@ -34,7 +34,6 @@
#include <oox/drawingml/theme.hxx>
#include "oox/ppt/presentationfragmenthandler.hxx"
#include "oox/ppt/slidepersist.hxx"
-#include "tokens.hxx"
#include <vector>
#include <map>
@@ -46,7 +45,8 @@ class PowerPointImport : public oox::core::XmlFilterBase
{
public:
- PowerPointImport( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr );
+ PowerPointImport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~PowerPointImport();
// from FilterBase
@@ -68,6 +68,7 @@ public:
private:
virtual GraphicHelper* implCreateGraphicHelper() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
virtual ::rtl::OUString implGetImplementationName() const;
private:
diff --git a/oox/inc/oox/ppt/pptshape.hxx b/oox/inc/oox/ppt/pptshape.hxx
index 3376e5bb1ace..be200859c6e6 100644
--- a/oox/inc/oox/ppt/pptshape.hxx
+++ b/oox/inc/oox/ppt/pptshape.hxx
@@ -48,7 +48,7 @@ public:
using oox::drawingml::Shape::addShape;
// addShape is creating and inserting the corresponding XShape.
void addShape(
- const oox::core::XmlFilterBase& rFilterBase,
+ oox::core::XmlFilterBase& rFilterBase,
const SlidePersist& rPersist,
const oox::drawingml::Theme* pTheme,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx
index bcb0c5803d61..a6561772ed3a 100644
--- a/oox/inc/oox/ppt/slidepersist.hxx
+++ b/oox/inc/oox/ppt/slidepersist.hxx
@@ -28,7 +28,6 @@
#ifndef OOX_POWERPOINT_SLIDEPERSIST_HXX
#define OOX_POWERPOINT_SLIDEPERSIST_HXX
-#include "tokens.hxx"
#include <boost/shared_ptr.hpp>
#include "oox/drawingml/shape.hxx"
#include "oox/drawingml/theme.hxx"
@@ -112,7 +111,7 @@ public:
oox::vml::Drawing* getDrawing() { return mpDrawingPtr.get(); }
- void createXShapes( const oox::core::XmlFilterBase& rFilterBase );
+ void createXShapes( oox::core::XmlFilterBase& rFilterBase );
void createBackground( const oox::core::XmlFilterBase& rFilterBase );
void applyTextStyles( const oox::core::XmlFilterBase& rFilterBase );
diff --git a/oox/source/token/propertylist.cxx b/oox/inc/oox/token/namespacemap.hxx
index 0ffc902fcdc0..e4daa18f6b56 100644..100755
--- a/oox/source/token/propertylist.cxx
+++ b/oox/inc/oox/token/namespacemap.hxx
@@ -25,32 +25,25 @@
*
************************************************************************/
-#include "oox/token/propertylist.hxx"
-#include "properties.hxx"
+#ifndef OOX_TOKEN_NAMESPACEMAP_HXX
+#define OOX_TOKEN_NAMESPACEMAP_HXX
-namespace oox {
-
-namespace {
+#include <map>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
-// include auto-generated property name lists
-#include "propertywords.inc"
-
-} // namespace
+namespace oox {
// ============================================================================
-PropertyList::PropertyList()
-{
- reserve( static_cast< size_t >( PROP_COUNT ) );
- for( sal_Int32 nIdx = 0; nIdx < PROP_COUNT; ++nIdx )
- push_back( ::rtl::OUString::createFromAscii( propertywordlist[ nIdx ] ) );
-}
+/** A map that contains all XML namespace URLs used in the filters. */
+struct NamespaceMap : public ::std::map< sal_Int32, ::rtl::OUString > { NamespaceMap(); };
-PropertyList::~PropertyList()
-{
-}
+/** Thread-save singleton of a map of all supported XML namespace URLs. */
+struct StaticNamespaceMap : public ::rtl::Static< NamespaceMap, StaticNamespaceMap > {};
// ============================================================================
} // namespace oox
+#endif
diff --git a/oox/inc/oox/token/propertylist.hxx b/oox/inc/oox/token/propertynames.hxx
index 5f75b13e10c4..5f94e74c2b96 100644
--- a/oox/inc/oox/token/propertylist.hxx
+++ b/oox/inc/oox/token/propertynames.hxx
@@ -25,10 +25,11 @@
*
************************************************************************/
-#ifndef OOX_TOKEN_PROPERTYLIST_HXX
-#define OOX_TOKEN_PROPERTYLIST_HXX
+#ifndef OOX_TOKEN_PROPERTYNAMES_HXX
+#define OOX_TOKEN_PROPERTYNAMES_HXX
#include <vector>
+#include <rtl/instance.hxx>
#include <rtl/ustring.hxx>
namespace oox {
@@ -36,15 +37,13 @@ namespace oox {
// ============================================================================
/** A vector that contains all predefined property names used in the filters. */
-struct PropertyList : public ::std::vector< ::rtl::OUString >
-{
- explicit PropertyList();
- ~PropertyList();
-};
+struct PropertyNameVector : public ::std::vector< ::rtl::OUString > { PropertyNameVector(); };
+
+/** Thread-save singleton of a vector of all supported property names. */
+struct StaticPropertyNameVector : public ::rtl::Static< PropertyNameVector, StaticPropertyNameVector > {};
// ============================================================================
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/token/tokenmap.hxx b/oox/inc/oox/token/tokenmap.hxx
index 108feee9a2e8..b197c491ac51 100644
--- a/oox/inc/oox/token/tokenmap.hxx
+++ b/oox/inc/oox/token/tokenmap.hxx
@@ -66,7 +66,6 @@ private:
typedef ::std::vector< TokenName > TokenNameVector;
TokenNameVector maTokenNames;
-
};
// ============================================================================
diff --git a/oox/inc/oox/vml/vmldrawing.hxx b/oox/inc/oox/vml/vmldrawing.hxx
index c2f8432dca6f..0d87dae3138b 100644
--- a/oox/inc/oox/vml/vmldrawing.hxx
+++ b/oox/inc/oox/vml/vmldrawing.hxx
@@ -30,6 +30,7 @@
#include <map>
#include <memory>
+#include <vector>
#include "oox/ole/oleobjecthelper.hxx"
namespace com { namespace sun { namespace star {
@@ -37,17 +38,21 @@ namespace com { namespace sun { namespace star {
namespace awt { class XControlModel; }
namespace drawing { class XDrawPage; }
namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
} } }
-namespace oox { namespace core { class XmlFilterBase; } }
-namespace oox { namespace ole { class EmbeddedForm; } }
+namespace oox {
+ namespace core { class XmlFilterBase; }
+ namespace ole { class EmbeddedControl; }
+ namespace ole { class EmbeddedForm; }
+}
namespace oox {
namespace vml {
class ShapeBase;
class ShapeContainer;
-struct ShapeClientData;
+struct ClientData;
// ============================================================================
@@ -114,6 +119,9 @@ public:
/** Returns the form object used to process ActiveX form controls. */
::oox::ole::EmbeddedForm& getControlForm() const;
+ /** Registers a block of shape identifiers reserved by this drawing. Block
+ size is 1024, shape identifiers are one-based (block 1 => 1025-2048). */
+ void registerBlockId( sal_Int32 nBlockId );
/** Registers the passed embedded OLE object. The related shape will then
load the OLE object data from the specified fragment. */
void registerOleObject( const OleObjectInfo& rOleObject );
@@ -125,36 +133,65 @@ public:
void finalizeFragmentImport();
/** Creates and inserts all UNO shapes into the passed container. The virtual
- function notifyShapeInserted() will be called for each new shape. */
+ function notifyXShapeInserted() will be called for each new shape. */
void convertAndInsert() const;
+ /** Returns the local shape index from the passed global shape identifier. */
+ sal_Int32 getLocalShapeIndex( const ::rtl::OUString& rShapeId ) const;
/** Returns the registered info structure for an OLE object, if extant. */
const OleObjectInfo* getOleObjectInfo( const ::rtl::OUString& rShapeId ) const;
/** Returns the registered info structure for a form control, if extant. */
const ControlInfo* getControlInfo( const ::rtl::OUString& rShapeId ) const;
+ /** 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;
+
+ /** Creates a new UNO shape object for a form control, inserts the control
+ model into the form, and the shape into the passed UNO shape container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertXControlShape(
+ const ::oox::ole::EmbeddedControl& rControl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect,
+ sal_Int32& rnCtrlIndex ) const;
+
/** Derived classes may disable conversion of specific shapes. */
virtual bool isShapeSupported( const ShapeBase& rShape ) const;
+ /** Derived classes may return additional base names for automatic shape
+ name creation. */
+ virtual ::rtl::OUString getShapeBaseName( const ShapeBase& rShape ) const;
+
/** Derived classes may calculate the shape rectangle from a non-standard
anchor information string. */
- virtual bool convertShapeClientAnchor(
+ virtual bool convertClientAnchor(
::com::sun::star::awt::Rectangle& orShapeRect,
const ::rtl::OUString& rShapeAnchor ) const;
- /** Derived classes may convert additional form control properties from the
- passed VML shape client data. */
- virtual void convertControlClientData(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
- const ShapeClientData& rClientData ) const;
-
- /** Derived classes may want to know that a shape has been inserted. Will
- be called from the convertAndInsert() implementation. */
- virtual void notifyShapeInserted(
+ /** Derived classes create a UNO shape according to the passed shape model.
+ Called for shape models that specify being under host control. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertClientXShape(
+ const ShapeBase& rShape,
+ 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 UNO shape has been inserted.
+ Will be called from the convertAndInsert() implementation.
+ @param bGroupChild True = inserted into a group shape,
+ false = inserted directly into this drawing. */
+ virtual void notifyXShapeInserted(
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
- const ::com::sun::star::awt::Rectangle& rShapeRect );
+ const ::com::sun::star::awt::Rectangle& rShapeRect,
+ const ShapeBase& rShape, bool bGroupChild );
private:
+ typedef ::std::vector< sal_Int32 > BlockIdVector;
typedef ::std::auto_ptr< ::oox::ole::EmbeddedForm > EmbeddedFormPtr;
typedef ::std::auto_ptr< ShapeContainer > ShapeContainerPtr;
typedef ::std::map< ::rtl::OUString, OleObjectInfo > OleObjectInfoMap;
@@ -163,7 +200,8 @@ private:
::oox::core::XmlFilterBase& mrFilter; /// Filter object that imports/exports the VML drawing.
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
mxDrawPage; /// UNO draw page used to insert the shapes.
- mutable EmbeddedFormPtr mxCtrlForm; /// The control form used to process ActiveX controls.
+ mutable EmbeddedFormPtr mxCtrlForm; /// The control form used to process embedded controls.
+ mutable BlockIdVector maBlockIds; /// Block identifiers used by this drawing.
ShapeContainerPtr mxShapes; /// All shapes and shape templates.
OleObjectInfoMap maOleObjects; /// Info about all embedded OLE objects, mapped by shape id.
ControlInfoMap maControls; /// Info about all embedded form controls, mapped by control name.
@@ -176,4 +214,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/vml/vmldrawingfragment.hxx b/oox/inc/oox/vml/vmldrawingfragment.hxx
index e0ffcd9c5203..0c961db1aabf 100644
--- a/oox/inc/oox/vml/vmldrawingfragment.hxx
+++ b/oox/inc/oox/vml/vmldrawingfragment.hxx
@@ -63,4 +63,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx
index db67d7a85af4..934be61e5a65 100644
--- a/oox/inc/oox/vml/vmlformatting.hxx
+++ b/oox/inc/oox/vml/vmlformatting.hxx
@@ -34,6 +34,7 @@ namespace oox {
class GraphicHelper;
class ModelObjectHelper;
class PropertyMap;
+ namespace drawingml { class Color; }
}
namespace oox {
@@ -112,6 +113,35 @@ public:
bool bPixelX,
bool bDefaultAsPixel );
+ /** Converts VML color attributes to a DrawingML color.
+
+ @param roVmlColor The VML string representation of the color. If
+ existing, this can be a 3-digit or 6-digit hexadecimal RGB value
+ with leading '#' character, a predefined color name (e.g. 'black',
+ 'red', etc.), the index into an application defined color palette
+ in brackets with leading color name (e.g. 'red [9]' or
+ 'windowColor [64]'), or a color modifier used in one-color
+ gradients (e.g. 'fill darken(128)' or 'fill lighten(0)').
+
+ @param roVmlOpacity The opacity of the color. If existing, this should
+ be a floating-point value in the range [0.0;1.0].
+
+ @param nDefaultRgb Deafult RGB color used if the parameter roVmlColor
+ is empty.
+
+ @param nPrimaryRgb If set to something else than API_RGB_TRANSPARENT,
+ specifies the color to be used to resolve the color modifiers used
+ in one-color gradients.
+
+ @return The resulting DrawingML color.
+ */
+ static ::oox::drawingml::Color decodeColor(
+ const GraphicHelper& rGraphicHelper,
+ const OptValue< ::rtl::OUString >& roVmlColor,
+ const OptValue< double >& roVmlOpacity,
+ sal_Int32 nDefaultRgb,
+ sal_Int32 nPrimaryRgb = API_RGB_TRANSPARENT );
+
private:
ConversionHelper();
~ConversionHelper();
@@ -187,4 +217,3 @@ struct FillModel
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/vml/vmlinputstream.hxx b/oox/inc/oox/vml/vmlinputstream.hxx
index 311fc17df960..a425425cd0cb 100644
--- a/oox/inc/oox/vml/vmlinputstream.hxx
+++ b/oox/inc/oox/vml/vmlinputstream.hxx
@@ -66,4 +66,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 7c770df28477..ee95c6b61e29 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -45,6 +45,19 @@ namespace vml {
class Drawing;
struct ShapeParentAnchor;
class ShapeContainer;
+class TextBox;
+
+// ============================================================================
+
+const sal_Int32 VML_CLIENTDATA_UNCHECKED = 0;
+const sal_Int32 VML_CLIENTDATA_CHECKED = 1;
+const sal_Int32 VML_CLIENTDATA_MIXED = 2;
+
+const sal_Int32 VML_CLIENTDATA_TEXT = 0;
+const sal_Int32 VML_CLIENTDATA_INTEGER = 1;
+const sal_Int32 VML_CLIENTDATA_NUMBER = 2;
+const sal_Int32 VML_CLIENTDATA_REFERENCE = 3;
+const sal_Int32 VML_CLIENTDATA_FORMULA = 4;
// ============================================================================
@@ -52,7 +65,7 @@ class ShapeContainer;
struct ShapeTypeModel
{
::rtl::OUString maShapeId; /// Unique identifier of the shape.
- ::rtl::OUString maName; /// Name of the shape, if present.
+ ::rtl::OUString maShapeName; /// Name of the shape, if present.
OptValue< sal_Int32 > moShapeType; /// Builtin shape type identifier.
OptValue< Int32Pair > moCoordPos; /// Top-left position of coordinate system for children scaling.
@@ -93,6 +106,8 @@ public:
/** Returns the shape identifier (which is unique through the containing drawing). */
inline const ::rtl::OUString& getShapeId() const { return maTypeModel.maShapeId; }
+ /** Returns the application defined shape type. */
+ sal_Int32 getShapeType() const;
/** Returns the fragment path to the embedded graphic used by this shape. */
::rtl::OUString getGraphicPath() const;
@@ -116,19 +131,39 @@ protected:
// ============================================================================
/** Excel specific shape client data (such as cell anchor). */
-struct ShapeClientData
+struct ClientData
{
::rtl::OUString maAnchor; /// Cell anchor as comma-separated string.
- ::rtl::OUString maPictureLink; /// Target cell range of picture links.
- ::rtl::OUString maLinkedCell; /// Link to value cell associated to the control.
- ::rtl::OUString maSourceRange; /// Link to cell range used as data source for the control.
+ ::rtl::OUString maFmlaMacro; /// Link to macro associated to the control.
+ ::rtl::OUString maFmlaPict; /// Target cell range of picture links.
+ ::rtl::OUString maFmlaLink; /// Link to value cell associated to the control.
+ ::rtl::OUString maFmlaRange; /// Link to cell range used as data source for the control.
+ ::rtl::OUString maFmlaGroup; /// Link to value cell associated to a group of option buttons.
sal_Int32 mnObjType; /// Type of the shape.
+ sal_Int32 mnTextHAlign; /// Horizontal text alignment.
+ sal_Int32 mnTextVAlign; /// Vertical text alignment.
sal_Int32 mnCol; /// Column index for spreadsheet cell note.
sal_Int32 mnRow; /// Row index for spreadsheet cell note.
+ sal_Int32 mnChecked; /// State for checkboxes and option buttons.
+ sal_Int32 mnDropStyle; /// Drop down box style (read-only or editable).
+ sal_Int32 mnDropLines; /// Number of lines in drop down box.
+ sal_Int32 mnVal; /// Current value of spin buttons and scroll bars.
+ sal_Int32 mnMin; /// Minimum value of spin buttons and scroll bars.
+ sal_Int32 mnMax; /// Maximum value of spin buttons and scroll bars.
+ sal_Int32 mnInc; /// Small increment of spin buttons and scroll bars.
+ sal_Int32 mnPage; /// Large increment of spin buttons and scroll bars.
+ sal_Int32 mnSelType; /// Listbox selection type.
+ sal_Int32 mnVTEdit; /// Data type of the textbox.
bool mbPrintObject; /// True = print the object.
bool mbVisible; /// True = cell note is visible.
-
- explicit ShapeClientData();
+ bool mbDde; /// True = object is linked through DDE.
+ bool mbNo3D; /// True = flat style, false = 3D style.
+ bool mbNo3D2; /// True = flat style, false = 3D style (listboxes and dropdowns).
+ bool mbMultiLine; /// True = textbox allows line breaks.
+ bool mbVScroll; /// True = textbox has a vertical scrollbar.
+ bool mbSecretEdit; /// True = textbox is a password edit field.
+
+ explicit ClientData();
};
// ----------------------------------------------------------------------------
@@ -136,16 +171,21 @@ struct ShapeClientData
struct ShapeModel
{
typedef ::std::vector< ::com::sun::star::awt::Point > PointVector;
- typedef ::std::auto_ptr< ShapeClientData > ShapeClientDataPtr;
+ typedef ::std::auto_ptr< TextBox > TextBoxPtr;
+ typedef ::std::auto_ptr< ClientData > ClientDataPtr;
::rtl::OUString maType; /// Shape template with default properties.
PointVector maPoints; /// Points for the polyline shape.
- ShapeClientDataPtr mxClientData; /// Excel specific shape client data.
+ TextBoxPtr mxTextBox; /// Text contents and properties.
+ ClientDataPtr mxClientData; /// Excel specific client data.
explicit ShapeModel();
+ ~ShapeModel();
+ /** Creates and returns a new shape textbox structure. */
+ TextBox& createTextBox();
/** Creates and returns a new shape client data structure. */
- ShapeClientData& createClientData();
+ ClientData& createClientData();
};
// ----------------------------------------------------------------------------
@@ -160,9 +200,17 @@ public:
/** Returns read access to the shape model structure. */
inline const ShapeModel& getShapeModel() const { return maShapeModel; }
+ /** Returns read access to the shape textbox. */
+ inline const TextBox* getTextBox() const { return maShapeModel.mxTextBox.get(); }
+ /** Returns read access to the shape client data structure. */
+ inline const ClientData* getClientData() const { return maShapeModel.mxClientData.get(); }
+
/** Final processing after import of the drawing fragment. */
virtual void finalizeFragmentImport();
+ /** Returns the real shape name if existing, or a generated shape name. */
+ ::rtl::OUString getShapeName() const;
+
/** Returns the shape template with the passed identifier from the child shapes. */
virtual const ShapeType* getChildTypeById( const ::rtl::OUString& rShapeId ) const;
/** Returns the shape with the passed identifier from the child shapes. */
@@ -327,4 +375,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/vml/vmlshapecontainer.hxx b/oox/inc/oox/vml/vmlshapecontainer.hxx
index a878fda2b74c..7b13763e0e40 100644
--- a/oox/inc/oox/vml/vmlshapecontainer.hxx
+++ b/oox/inc/oox/vml/vmlshapecontainer.hxx
@@ -29,7 +29,8 @@
#define OOX_VML_VMLSHAPECONTAINER_HXX
#include <com/sun/star/awt/Rectangle.hpp>
-#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
namespace com { namespace sun { namespace star {
namespace drawing { class XShapes; }
@@ -59,6 +60,9 @@ public:
explicit ShapeContainer( Drawing& rDrawing );
~ShapeContainer();
+ /** Returns the drawing this shape container is part of. */
+ inline Drawing& getDrawing() { return mrDrawing; }
+
/** Creates and returns a new shape template object. */
ShapeType& createShapeType();
/** Creates and returns a new shape object of the specified type. */
@@ -136,4 +140,3 @@ const ShapeBase* ShapeContainer::findShape( const Functor& rFunctor ) const
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/vml/vmlshapecontext.hxx b/oox/inc/oox/vml/vmlshapecontext.hxx
index bda7d90f34e2..7236fe7fef2c 100644
--- a/oox/inc/oox/vml/vmlshapecontext.hxx
+++ b/oox/inc/oox/vml/vmlshapecontext.hxx
@@ -33,10 +33,12 @@
namespace oox {
namespace vml {
+class Drawing;
+
struct ShapeTypeModel;
class ShapeType;
-struct ShapeClientData;
+struct ClientData;
struct ShapeModel;
class ShapeBase;
class GroupShape;
@@ -45,20 +47,38 @@ class ShapeContainer;
// ============================================================================
-class ShapeClientDataContext : public ::oox::core::ContextHandler2
+class ShapeLayoutContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit ShapeLayoutContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ Drawing& rDrawing );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ Drawing& mrDrawing;
+};
+
+// ============================================================================
+
+class ClientDataContext : public ::oox::core::ContextHandler2
{
public:
- explicit ShapeClientDataContext(
+ explicit ClientDataContext(
::oox::core::ContextHandler2Helper& rParent,
- const AttributeList& rAttribs,
- ShapeClientData& rClientData );
+ ClientData& rClientData,
+ const AttributeList& rAttribs );
virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
private:
- ShapeClientData& mrClientData;
+ ClientData& mrClientData;
+ ::rtl::OUString maElementText;
};
// ============================================================================
@@ -69,9 +89,9 @@ public:
static ::oox::core::ContextHandlerRef
createShapeContext(
::oox::core::ContextHandler2Helper& rParent,
+ ShapeContainer& rShapes,
sal_Int32 nElement,
- const AttributeList& rAttribs,
- ShapeContainer& rShapes );
+ const AttributeList& rAttribs );
protected:
explicit ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent );
@@ -84,8 +104,8 @@ class ShapeTypeContext : public ShapeContextBase
public:
explicit ShapeTypeContext(
::oox::core::ContextHandler2Helper& rParent,
- const AttributeList& rAttribs,
- ShapeType& rShapeType );
+ ShapeType& rShapeType,
+ const AttributeList& rAttribs );
virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -108,8 +128,8 @@ class ShapeContext : public ShapeTypeContext
public:
explicit ShapeContext(
::oox::core::ContextHandler2Helper& rParent,
- const AttributeList& rAttribs,
- ShapeBase& rShape );
+ ShapeBase& rShape,
+ const AttributeList& rAttribs );
virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -129,8 +149,8 @@ class GroupShapeContext : public ShapeContext
public:
explicit GroupShapeContext(
::oox::core::ContextHandler2Helper& rParent,
- const AttributeList& rAttribs,
- GroupShape& rShape );
+ GroupShape& rShape,
+ const AttributeList& rAttribs );
virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -145,4 +165,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/vml/vmltextbox.hxx b/oox/inc/oox/vml/vmltextbox.hxx
new file mode 100755
index 000000000000..5aedaf86bc74
--- /dev/null
+++ b/oox/inc/oox/vml/vmltextbox.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_VML_VMLTEXTBOX_HXX
+#define OOX_VML_VMLTEXTBOX_HXX
+
+#include <vector>
+#include <rtl/ustring.hxx>
+#include "oox/helper/helper.hxx"
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+/** Font settings for a text portion in a textbox. */
+struct TextFontModel
+{
+ OptValue< ::rtl::OUString > moName; /// Font name.
+ OptValue< ::rtl::OUString > moColor; /// Font color, HTML encoded, sort of.
+ OptValue< sal_Int32 > monSize; /// Font size in twips.
+ OptValue< sal_Int32 > monUnderline; /// Single or double underline.
+ OptValue< sal_Int32 > monEscapement; /// Subscript or superscript.
+ OptValue< bool > mobBold;
+ OptValue< bool > mobItalic;
+ OptValue< bool > mobStrikeout;
+
+ explicit TextFontModel();
+};
+
+// ============================================================================
+
+/** A text portion in a textbox with the same formatting for all characters. */
+struct TextPortionModel
+{
+ TextFontModel maFont;
+ ::rtl::OUString maText;
+
+ explicit TextPortionModel( const TextFontModel& rFont, const ::rtl::OUString& rText );
+};
+
+// ============================================================================
+
+/** The textbox contains all text contents and properties. */
+class TextBox
+{
+public:
+ explicit TextBox();
+
+ /** Appends a new text portion to the textbox. */
+ void appendPortion( const TextFontModel& rFont, const ::rtl::OUString& rText );
+
+ /** Returns the current number of text portions. */
+ inline size_t getPortionCount() const { return maPortions.size(); }
+ /** Returns the font settings of the first text portion. */
+ const TextFontModel* getFirstFont() const;
+ /** Returns the entire text of all text portions. */
+ ::rtl::OUString getText() const;
+
+private:
+ typedef ::std::vector< TextPortionModel > PortionVector;
+
+ PortionVector maPortions;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/vml/vmltextboxcontext.hxx b/oox/inc/oox/vml/vmltextboxcontext.hxx
new file mode 100755
index 000000000000..1dc8832f9cc4
--- /dev/null
+++ b/oox/inc/oox/vml/vmltextboxcontext.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_VML_VMLTEXTBOXCONTEXT_HXX
+#define OOX_VML_VMLTEXTBOXCONTEXT_HXX
+
+#include "oox/core/contexthandler2.hxx"
+#include "oox/vml/vmltextbox.hxx"
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+class TextPortionContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit TextPortionContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ TextBox& rTextBox,
+ const TextFontModel& rParentFont,
+ sal_Int32 nElement,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
+
+private:
+ TextBox& mrTextBox;
+ TextFontModel maFont;
+ size_t mnInitialPortions;
+};
+
+// ============================================================================
+
+class TextBoxContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit TextBoxContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ TextBox& rTextBox,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ TextBox& mrTextBox;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/xls/addressconverter.hxx b/oox/inc/oox/xls/addressconverter.hxx
index c11bd31bbf22..11b5e74ccd5c 100644
--- a/oox/inc/oox/xls/addressconverter.hxx
+++ b/oox/inc/oox/xls/addressconverter.hxx
@@ -69,7 +69,7 @@ struct BinAddress
inline void set( sal_Int32 nCol, sal_Int32 nRow ) { mnCol = nCol; mnRow = nRow; }
inline void set( const ::com::sun::star::table::CellAddress& rAddr ) { mnCol = rAddr.Column; mnRow = rAddr.Row; }
- void read( RecordInputStream& rStrm );
+ void read( SequenceInputStream& rStrm );
void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
void write( BiffOutputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ) const;
};
@@ -86,7 +86,7 @@ inline bool operator<( const BinAddress& rL, const BinAddress& rR )
return (rL.mnCol < rR.mnCol) || ((rL.mnCol == rR.mnCol) && (rL.mnRow < rR.mnRow));
}
-inline RecordInputStream& operator>>( RecordInputStream& rStrm, BinAddress& orPos )
+inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinAddress& orPos )
{
orPos.read( rStrm );
return rStrm;
@@ -134,7 +134,7 @@ struct BinRange
inline sal_Int32 getRowCount() const { return maLast.mnRow - maFirst.mnRow + 1; }
bool contains( const BinAddress& rAddr ) const;
- void read( RecordInputStream& rStrm );
+ void read( SequenceInputStream& rStrm );
void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
void write( BiffOutputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ) const;
};
@@ -151,7 +151,7 @@ inline bool operator<( const BinRange& rL, const BinRange& rR )
return (rL.maFirst < rR.maFirst) || ((rL.maFirst == rR.maFirst) && (rL.maLast < rR.maLast));
}
-inline RecordInputStream& operator>>( RecordInputStream& rStrm, BinRange& orRange )
+inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRange& orRange )
{
orRange.read( rStrm );
return rStrm;
@@ -179,7 +179,7 @@ public:
BinRange getEnclosingRange() const;
- void read( RecordInputStream& rStrm );
+ void read( SequenceInputStream& rStrm );
void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
void write( BiffOutputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ) const;
void writeSubList( BiffOutputStream& rStrm,
@@ -188,7 +188,7 @@ public:
// ----------------------------------------------------------------------------
-inline RecordInputStream& operator>>( RecordInputStream& rStrm, BinRangeList& orRanges )
+inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRangeList& orRanges )
{
orRanges.read( rStrm );
return rStrm;
@@ -221,7 +221,7 @@ enum BiffTargetType
// ============================================================================
// ============================================================================
-/** Converter for cell addresses and cell ranges for OOX and BIFF filters.
+/** Converter for cell addresses and cell ranges for OOXML and BIFF filters.
*/
class AddressConverter : public WorkbookHelper
{
@@ -689,4 +689,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/autofilterbuffer.hxx b/oox/inc/oox/xls/autofilterbuffer.hxx
new file mode 100755
index 000000000000..ddf083c2ea98
--- /dev/null
+++ b/oox/inc/oox/xls/autofilterbuffer.hxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_AUTOFILTERBUFFER_HXX
+#define OOX_XLS_AUTOFILTERBUFFER_HXX
+
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include "oox/helper/refvector.hxx"
+#include "oox/xls/workbookhelper.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace sheet { struct TableFilterField2; }
+ namespace sheet { class XDatabaseRange; }
+ namespace sheet { class XSheetFilterDescriptor2; }
+} } }
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+/** Contains UNO API filter settings for a column in a filtered range. */
+struct ApiFilterSettings
+{
+ typedef ::std::vector< ::com::sun::star::sheet::TableFilterField2 > FilterFieldVector;
+
+ FilterFieldVector maFilterFields; /// List of UNO API filter settings.
+ OptValue< bool > mobNeedsRegExp; /// If set, requires regular expressions to be enabled/disabled.
+
+ explicit ApiFilterSettings();
+
+ void appendField( bool bAnd, sal_Int32 nOperator, double fValue );
+ void appendField( bool bAnd, sal_Int32 nOperator, const ::rtl::OUString& rValue );
+};
+
+// ============================================================================
+
+/** Base class for specific filter settings for a column in a filtered range.
+ */
+class FilterSettingsBase : public WorkbookHelper
+{
+public:
+ explicit FilterSettingsBase( const WorkbookHelper& rHelper );
+
+ /** Derived classes import filter settings from the passed attribute list. */
+ virtual void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Derived classes import filter settings from the passed record. */
+ virtual void importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ /** Derived classes import filter settings from the FILTERCOLUMN record. */
+ virtual void importBiffRecord( BiffInputStream& rStrm, sal_uInt16 nFlags );
+
+ /** Derived classes return converted UNO API filter settings representing all filter settings. */
+ virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount );
+};
+
+typedef ::boost::shared_ptr< FilterSettingsBase > FilterSettingsRef;
+
+// ============================================================================
+
+/** Settings for a discrete filter, specifying a list of values to be shown in
+ the filtered range.
+ */
+class DiscreteFilter : public FilterSettingsBase
+{
+public:
+ explicit DiscreteFilter( const WorkbookHelper& rHelper );
+
+ /** Imports filter settings from the filters and filter elements. */
+ virtual void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Imports filter settings from the FILTERS and FILTER records. */
+ virtual void importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Returns converted UNO API filter settings representing all filter settings. */
+ virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount );
+
+private:
+ typedef ::std::vector< ::rtl::OUString > FilterValueVector;
+
+ FilterValueVector maValues;
+ sal_Int32 mnCalendarType;
+ bool mbShowBlank;
+};
+
+// ============================================================================
+
+/** Settings for a top-10 filter. */
+class Top10Filter : public FilterSettingsBase
+{
+public:
+ explicit Top10Filter( const WorkbookHelper& rHelper );
+
+ /** Imports filter settings from the filters and filter elements. */
+ virtual void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Imports filter settings from the FILTERS and FILTER records. */
+ virtual void importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ /** Imports filter settings from the FILTERCOLUMN record. */
+ virtual void importBiffRecord( BiffInputStream& rStrm, sal_uInt16 nFlags );
+
+ /** Returns converted UNO API filter settings representing all filter settings. */
+ virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount );
+
+private:
+ double mfValue; /// Number of items or percentage.
+ bool mbTop; /// True = show top (greatest) items/percentage.
+ bool mbPercent; /// True = percentage, false = number of items.
+};
+
+// ============================================================================
+
+/** A filter criterion for a custom filter. */
+struct FilterCriterionModel
+{
+ ::com::sun::star::uno::Any maValue; /// Comparison operand.
+ sal_Int32 mnOperator; /// Comparison operator.
+ sal_uInt8 mnDataType; /// Operand data type (BIFF only).
+ sal_uInt8 mnStrLen; /// Length of string operand (BIFF5-BIFF8 only).
+
+ explicit FilterCriterionModel();
+
+ /** Sets the passed BIFF operator constant. */
+ void setBiffOperator( sal_uInt8 nOperator );
+
+ /** Imports the criterion model from the passed BIFF12 stream. */
+ void readBiffData( SequenceInputStream& rStrm );
+ /** Imports the initial criterion data from the passed BIFF5/BIFF8 stream. */
+ void readBiffData( BiffInputStream& rStrm );
+ /** Imports the trailing string data from the passed BIFF5/BIFF8 stream. */
+ void readString( BiffInputStream& rStrm, BiffType eBiff, rtl_TextEncoding eTextEnc );
+};
+
+// ----------------------------------------------------------------------------
+
+/** Settings for a custom filter, specifying one or two comparison operators
+ associated with some values.
+ */
+class CustomFilter : public FilterSettingsBase
+{
+public:
+ explicit CustomFilter( const WorkbookHelper& rHelper );
+
+ /** Imports filter settings from the filters and filter elements. */
+ virtual void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Imports filter settings from the FILTERS and FILTER records. */
+ virtual void importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ /** Imports filter settings from the FILTERCOLUMN record. */
+ virtual void importBiffRecord( BiffInputStream& rStrm, sal_uInt16 nFlags );
+
+ /** Returns converted UNO API filter settings representing all filter settings. */
+ virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount );
+
+private:
+ /** Apeends the passed filter criteriom, if it contains valid settings. */
+ void appendCriterion( const FilterCriterionModel& rCriterion );
+
+private:
+ typedef ::std::vector< FilterCriterionModel > FilterCriterionVector;
+
+ FilterCriterionVector maCriteria;
+ bool mbAnd;
+};
+
+// ============================================================================
+
+/** A column in a filtered range. Contains an object with specific filter
+ settings for the cells in the column.
+ */
+class FilterColumn : public WorkbookHelper
+{
+public:
+ explicit FilterColumn( const WorkbookHelper& rHelper );
+
+ /** Imports auto filter column settings from the filterColumn element. */
+ void importFilterColumn( const AttributeList& rAttribs );
+ /** Imports auto filter column settings from the FILTERCOLUMN record. */
+ void importFilterColumn( SequenceInputStream& rStrm );
+ /** Imports auto filter column settings from the FILTERCOLUMN record. */
+ void importFilterColumn( BiffInputStream& rStrm );
+
+ /** Creates and returns the specified filter settings object. */
+ template< typename FilterSettingsType >
+ inline FilterSettingsBase& createFilterSettings()
+ { mxSettings.reset( new FilterSettingsType( *this ) ); return *mxSettings; }
+
+ /** Returns the index of the column in the filtered range this object is related to. */
+ inline sal_Int32 getColumnId() const { return mnColId; }
+
+ /** Returns converted UNO API filter settings representing all filter
+ settings of this column. */
+ ApiFilterSettings finalizeImport( sal_Int32 nMaxCount );
+
+private:
+ FilterSettingsRef mxSettings;
+ sal_Int32 mnColId;
+ bool mbHiddenButton;
+ bool mbShowButton;
+};
+
+// ============================================================================
+
+class AutoFilter : public WorkbookHelper
+{
+public:
+ explicit AutoFilter( const WorkbookHelper& rHelper );
+
+ /** Imports auto filter settings from the autoFilter element. */
+ void importAutoFilter( const AttributeList& rAttribs, sal_Int16 nSheet );
+ /** Imports auto filter settings from the AUTOFILTER record. */
+ void importAutoFilter( SequenceInputStream& rStrm, sal_Int16 nSheet );
+
+ /** Creates a new auto filter column and stores it internally. */
+ FilterColumn& createFilterColumn();
+
+ /** Applies the filter to the passed filter descriptor. */
+ void finalizeImport( const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor2 >& rxFilterDesc );
+
+private:
+ typedef RefVector< FilterColumn > FilterColumnVector;
+
+ FilterColumnVector maFilterColumns;
+ ::com::sun::star::table::CellRangeAddress maRange;
+};
+
+// ============================================================================
+
+class AutoFilterBuffer : public WorkbookHelper
+{
+public:
+ explicit AutoFilterBuffer( const WorkbookHelper& rHelper );
+
+ /** Creates a new auto filter and stores it internally. */
+ AutoFilter& createAutoFilter();
+
+ /** Applies filter settings to a new database range object (used for sheet
+ autofilter or advanced filter as specified by built-in defined names). */
+ void finalizeImport( sal_Int16 nSheet );
+
+ /** Applies the filters to the passed database range object.
+ @return True = this buffer contains valid auto filter settings. */
+ bool finalizeImport( const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRange >& rxDatabaseRange );
+
+private:
+ /** Returns the auto filter object used to perform auto filtering. */
+ AutoFilter* getActiveAutoFilter();
+
+private:
+ typedef RefVector< AutoFilter > AutoFilterVector;
+ AutoFilterVector maAutoFilters;
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/xls/autofiltercontext.hxx b/oox/inc/oox/xls/autofiltercontext.hxx
index ccef6972e871..13508bbf5e63 100644
--- a/oox/inc/oox/xls/autofiltercontext.hxx
+++ b/oox/inc/oox/xls/autofiltercontext.hxx
@@ -28,126 +28,82 @@
#ifndef OOX_XLS_AUTOFILTERCONTEXT_HXX
#define OOX_XLS_AUTOFILTERCONTEXT_HXX
-#define USE_SC_MULTI_STRING_FILTER_PATCH 0
-
#include "oox/xls/excelhandlers.hxx"
-#include <com/sun/star/table/CellRangeAddress.hpp>
-
-#if USE_SC_MULTI_STRING_FILTER_PATCH
-#include <com/sun/star/sheet/TableFilterFieldBase.hpp>
-#else
-#include <com/sun/star/sheet/TableFilterField.hpp>
-#endif
-
-#include <boost/shared_ptr.hpp>
-#include <list>
-
-namespace com { namespace sun { namespace star { namespace sheet {
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- struct TableFilterFieldBase;
-#else
- struct TableFilterField;
-#endif
- struct TableFilterFieldMultiString;
-}}}}
namespace oox {
namespace xls {
+class AutoFilter;
+class FilterColumn;
+class FilterSettingsBase;
+
// ============================================================================
-struct FilterFieldItem
+class FilterSettingsContext : public WorksheetContextBase
{
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- typedef ::boost::shared_ptr< ::com::sun::star::sheet::TableFilterFieldBase > TableFilterFieldRef;
-#else
- typedef ::boost::shared_ptr< ::com::sun::star::sheet::TableFilterField > TableFilterFieldRef;
-#endif
+public:
+ explicit FilterSettingsContext( WorksheetContextBase& rParent, FilterSettingsBase& rFilterSettings );
- enum Type { NORMAL, MULTI_STRING };
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
- TableFilterFieldRef mpField;
- Type meType;
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
- FilterFieldItem();
- FilterFieldItem(Type eType);
+private:
+ FilterSettingsBase& mrFilterSettings;
};
// ============================================================================
-class OoxAutoFilterContext : public OoxWorksheetContextBase
+class FilterColumnContext : public WorksheetContextBase
{
public:
- explicit OoxAutoFilterContext( OoxWorksheetFragmentBase& rFragment );
+ explicit FilterColumnContext( WorksheetContextBase& rParent, FilterColumn& rFilterColumn );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
-
-private:
- /** Initializes data members to prepare for autofilter parsing. Call this
- method when a new autofilter context starts. */
- void initialize();
-
- /** Commits the imported autofilter data to Calc. */
- void setAutoFilter();
-
- /** Check if the shown blank bit is on, if so, add show blank filter to the
- list. */
- void maybeShowBlank();
-
- /** Packs the collected filter names into a single regex string. */
- void setFilterNames();
- void importAutoFilter( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
- void importFilterColumn( const AttributeList& rAttribs );
-
- void importTop10( const AttributeList& rAttribs );
-
- /** Be sure to check for its 'and' attribute when there are two
- customFilter's. If the attribute is not given, assume OR. */
- void importCustomFilters( const AttributeList& rAttribs );
+private:
+ FilterColumn& mrFilterColumn;
+};
- /** Imports custumFilter element. Note that the standard specifies there
- can be at most two custom filters specified, but no more than two. When
- there are two custom filters, then their relationship (AND or OR) must
- be specified by the parent element <customFilters>. */
- void importCustomFilter( const AttributeList& rAttribs );
+// ============================================================================
- void importFilters( const AttributeList& rAttribs );
+class AutoFilterContext : public WorksheetContextBase
+{
+public:
+ explicit AutoFilterContext( WorksheetFragmentBase& rFragment, AutoFilter& rAutoFilter );
- void importFilter( const AttributeList& rAttribs );
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
- void importDynamicFilter( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
private:
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > XCellRef;
-
- ::std::list< FilterFieldItem > maFields;
-
- ::std::list< ::rtl::OUString > maFilterNames;
- ::com::sun::star::table::CellRangeAddress maAutoFilterRange;
- sal_Int32 mnCurColID;
+ AutoFilter& mrAutoFilter;
+};
- /** If this is false (i.e. the given cell range address is not valid), then
- don't do anything. */
- bool mbValidAddress:1;
+// ============================================================================
- /** We use regex to compensate for Calc's lack of filtering by individual
- names (i.e. <filter> tag). */
- bool mbUseRegex:1;
+class BiffAutoFilterContext : public BiffWorksheetContextBase
+{
+public:
+ explicit BiffAutoFilterContext( const WorksheetHelper& rHelper, AutoFilter& rAutoFilter );
- /** The <filters> tag may have a 'blank' attribute when the blank values
- need to be shown. This flag stores that information. */
- bool mbShowBlank:1;
+protected:
+ /** Imports all records related to the current auto filter. */
+ virtual void importRecord( BiffInputStream& rStrm );
- /** true if FilterConnection_AND, or false if FilterConnection_OR. This
- flag is used to store the relationship of paired customFilter's. */
- bool mbConnectionAnd:1;
+private:
+ AutoFilter& mrAutoFilter;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/biffcodec.hxx b/oox/inc/oox/xls/biffcodec.hxx
index c1c040de095b..9b9157c7e494 100644
--- a/oox/inc/oox/xls/biffcodec.hxx
+++ b/oox/inc/oox/xls/biffcodec.hxx
@@ -185,4 +185,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/biffdetector.hxx b/oox/inc/oox/xls/biffdetector.hxx
index 9ce5d19af3fe..df372c76d7cc 100644
--- a/oox/inc/oox/xls/biffdetector.hxx
+++ b/oox/inc/oox/xls/biffdetector.hxx
@@ -28,15 +28,15 @@
#ifndef OOX_XLS_BIFFDETECTOR_HXX
#define OOX_XLS_BIFFDETECTOR_HXX
-#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase2.hxx>
#include "oox/helper/storagebase.hxx"
#include "oox/xls/biffhelper.hxx"
namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
namespace beans { struct PropertyValue; }
+ namespace uno { class XComponentContext; }
} } }
namespace oox { class BinaryInputStream; }
@@ -53,7 +53,8 @@ class BiffDetector : public ::cppu::WeakImplHelper2<
{
public:
explicit BiffDetector(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~BiffDetector();
@@ -63,7 +64,7 @@ public:
/** Detects the BIFF version and workbook stream name of the passed storage. */
static BiffType detectStorageBiffVersion(
::rtl::OUString& orWorkbookStreamName,
- StorageRef xStorage );
+ const StorageRef& rxStorage );
// com.sun.star.lang.XServiceInfo interface -------------------------------
@@ -84,8 +85,8 @@ public:
throw( ::com::sun::star::uno::RuntimeException );
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- mxFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext;
};
// ============================================================================
@@ -94,4 +95,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx
index ce43e44fb613..9c0a57a83c04 100644
--- a/oox/inc/oox/xls/biffhelper.hxx
+++ b/oox/inc/oox/xls/biffhelper.hxx
@@ -30,217 +30,229 @@
#include "oox/helper/binarystreambase.hxx"
+namespace oox { class SequenceInputStream; }
+
namespace oox {
namespace xls {
class BiffInputStream;
-// OOBIN record identifiers ===================================================
-
-const sal_Int32 OOBIN_ID_ARRAY = 0x01AA;
-const sal_Int32 OOBIN_ID_AUTOFILTER = 0x00A1;
-const sal_Int32 OOBIN_ID_AUTOSORTSCOPE = 0x01CB;
-const sal_Int32 OOBIN_ID_BINARYINDEXBLOCK = 0x002A;
-const sal_Int32 OOBIN_ID_BINARYINDEXROWS = 0x0028;
-const sal_Int32 OOBIN_ID_BOOKVIEWS = 0x0087;
-const sal_Int32 OOBIN_ID_BORDER = 0x002E;
-const sal_Int32 OOBIN_ID_BORDERS = 0x0265;
-const sal_Int32 OOBIN_ID_BRK = 0x018C;
-const sal_Int32 OOBIN_ID_CALCPR = 0x009D;
-const sal_Int32 OOBIN_ID_CELL_BLANK = 0x0001;
-const sal_Int32 OOBIN_ID_CELL_BOOL = 0x0004;
-const sal_Int32 OOBIN_ID_CELL_DOUBLE = 0x0005;
-const sal_Int32 OOBIN_ID_CELL_ERROR = 0x0003;
-const sal_Int32 OOBIN_ID_CELL_RK = 0x0002;
-const sal_Int32 OOBIN_ID_CELL_RSTRING = 0x003E;
-const sal_Int32 OOBIN_ID_CELL_SI = 0x0007;
-const sal_Int32 OOBIN_ID_CELL_STRING = 0x0006;
-const sal_Int32 OOBIN_ID_CELLSTYLE = 0x0030;
-const sal_Int32 OOBIN_ID_CELLSTYLES = 0x026B;
-const sal_Int32 OOBIN_ID_CELLSTYLEXFS = 0x0272;
-const sal_Int32 OOBIN_ID_CELLXFS = 0x0269;
-const sal_Int32 OOBIN_ID_CFCOLOR = 0x0234;
-const sal_Int32 OOBIN_ID_CFRULE = 0x01CF;
-const sal_Int32 OOBIN_ID_CHARTPAGESETUP = 0x028C;
-const sal_Int32 OOBIN_ID_CHARTPROTECTION = 0x029D;
-const sal_Int32 OOBIN_ID_CHARTSHEETPR = 0x028B;
-const sal_Int32 OOBIN_ID_CHARTSHEETVIEW = 0x008D;
-const sal_Int32 OOBIN_ID_CHARTSHEETVIEWS = 0x008B;
-const sal_Int32 OOBIN_ID_COL = 0x003C;
-const sal_Int32 OOBIN_ID_COLBREAKS = 0x018A;
-const sal_Int32 OOBIN_ID_COLOR = 0x023C;
-const sal_Int32 OOBIN_ID_COLORS = 0x01D9;
-const sal_Int32 OOBIN_ID_COLORSCALE = 0x01D5;
-const sal_Int32 OOBIN_ID_COLS = 0x0186;
-const sal_Int32 OOBIN_ID_COMMENT = 0x027B;
-const sal_Int32 OOBIN_ID_COMMENTAUTHOR = 0x0278;
-const sal_Int32 OOBIN_ID_COMMENTAUTHORS = 0x0276;
-const sal_Int32 OOBIN_ID_COMMENTLIST = 0x0279;
-const sal_Int32 OOBIN_ID_COMMENTS = 0x0274;
-const sal_Int32 OOBIN_ID_COMMENTTEXT = 0x027D;
-const sal_Int32 OOBIN_ID_CONDFORMATTING = 0x01CD;
-const sal_Int32 OOBIN_ID_CONTROL = 0x0284;
-const sal_Int32 OOBIN_ID_CONTROLS = 0x0283;
-const sal_Int32 OOBIN_ID_CUSTOMCHARTVIEW = 0x028F;
-const sal_Int32 OOBIN_ID_CUSTOMCHARTVIEWS = 0x028D;
-const sal_Int32 OOBIN_ID_CUSTOMSHEETVIEW = 0x01A7;
-const sal_Int32 OOBIN_ID_CUSTOMSHEETVIEWS = 0x01A6;
-const sal_Int32 OOBIN_ID_CUSTOMWORKBOOKVIEW = 0x018D;
-const sal_Int32 OOBIN_ID_DATABAR = 0x01D3;
-const sal_Int32 OOBIN_ID_DATATABLE = 0x01AC;
-const sal_Int32 OOBIN_ID_DATAVALIDATION = 0x0040;
-const sal_Int32 OOBIN_ID_DATAVALIDATIONS = 0x023D;
-const sal_Int32 OOBIN_ID_DDEITEMVALUES = 0x0242;
-const sal_Int32 OOBIN_ID_DDEITEM_BOOL = 0x0248;
-const sal_Int32 OOBIN_ID_DDEITEM_DOUBLE = 0x0244;
-const sal_Int32 OOBIN_ID_DDEITEM_ERROR = 0x0245;
-const sal_Int32 OOBIN_ID_DDEITEM_STRING = 0x0246;
-const sal_Int32 OOBIN_ID_DEFINEDNAME = 0x0027;
-const sal_Int32 OOBIN_ID_DIMENSION = 0x0094;
-const sal_Int32 OOBIN_ID_DRAWING = 0x0226;
-const sal_Int32 OOBIN_ID_DXF = 0x01FB;
-const sal_Int32 OOBIN_ID_DXFS = 0x01F9;
-const sal_Int32 OOBIN_ID_EXTCELL_BLANK = 0x016F;
-const sal_Int32 OOBIN_ID_EXTCELL_BOOL = 0x0171;
-const sal_Int32 OOBIN_ID_EXTCELL_DOUBLE = 0x0170;
-const sal_Int32 OOBIN_ID_EXTCELL_ERROR = 0x0172;
-const sal_Int32 OOBIN_ID_EXTCELL_STRING = 0x0173;
-const sal_Int32 OOBIN_ID_EXTERNALADDIN = 0x029B;
-const sal_Int32 OOBIN_ID_EXTERNALBOOK = 0x0168;
-const sal_Int32 OOBIN_ID_EXTERNALNAME = 0x0241;
-const sal_Int32 OOBIN_ID_EXTERNALREF = 0x0163;
-const sal_Int32 OOBIN_ID_EXTERNALREFS = 0x0161;
-const sal_Int32 OOBIN_ID_EXTERNALSELF = 0x0165;
-const sal_Int32 OOBIN_ID_EXTERNALSAME = 0x0166;
-const sal_Int32 OOBIN_ID_EXTERNALSHEETS = 0x016A;
-const sal_Int32 OOBIN_ID_EXTROW = 0x016E;
-const sal_Int32 OOBIN_ID_EXTSHEETDATA = 0x016B;
-const sal_Int32 OOBIN_ID_EXTERNALNAMEFLAGS = 0x024A;
-const sal_Int32 OOBIN_ID_EXTSHEETNAMES = 0x0167;
-const sal_Int32 OOBIN_ID_FILESHARING = 0x0224;
-const sal_Int32 OOBIN_ID_FILEVERSION = 0x0080;
-const sal_Int32 OOBIN_ID_FILL = 0x002D;
-const sal_Int32 OOBIN_ID_FILLS = 0x025B;
-const sal_Int32 OOBIN_ID_FILTERCOLUMN = 0x00A3;
-const sal_Int32 OOBIN_ID_FONT = 0x002B;
-const sal_Int32 OOBIN_ID_FONTS = 0x0263;
-const sal_Int32 OOBIN_ID_FORMULA_STRING = 0x0008;
-const sal_Int32 OOBIN_ID_FORMULA_DOUBLE = 0x0009;
-const sal_Int32 OOBIN_ID_FORMULA_BOOL = 0x000A;
-const sal_Int32 OOBIN_ID_FORMULA_ERROR = 0x000B;
-const sal_Int32 OOBIN_ID_FUNCTIONGROUP = 0x0299;
-const sal_Int32 OOBIN_ID_FUNCTIONGROUPS = 0x0298;
-const sal_Int32 OOBIN_ID_HEADERFOOTER = 0x01DF;
-const sal_Int32 OOBIN_ID_HYPERLINK = 0x01EE;
-const sal_Int32 OOBIN_ID_ICONSET = 0x01D1;
-const sal_Int32 OOBIN_ID_INDEXEDCOLORS = 0x0235;
-const sal_Int32 OOBIN_ID_INPUTCELLS = 0x01F8;
-const sal_Int32 OOBIN_ID_LEGACYDRAWING = 0x0227;
-const sal_Int32 OOBIN_ID_MERGECELL = 0x00B0;
-const sal_Int32 OOBIN_ID_MERGECELLS = 0x00B1;
-const sal_Int32 OOBIN_ID_MRUCOLORS = 0x0239;
-const sal_Int32 OOBIN_ID_MULTCELL_BLANK = 0x000C;
-const sal_Int32 OOBIN_ID_MULTCELL_BOOL = 0x000F;
-const sal_Int32 OOBIN_ID_MULTCELL_DOUBLE = 0x0010;
-const sal_Int32 OOBIN_ID_MULTCELL_ERROR = 0x000E;
-const sal_Int32 OOBIN_ID_MULTCELL_RK = 0x000D;
-const sal_Int32 OOBIN_ID_MULTCELL_RSTRING = 0x003D;
-const sal_Int32 OOBIN_ID_MULTCELL_SI = 0x0012;
-const sal_Int32 OOBIN_ID_MULTCELL_STRING = 0x0011;
-const sal_Int32 OOBIN_ID_NUMFMT = 0x002C;
-const sal_Int32 OOBIN_ID_NUMFMTS = 0x0267;
-const sal_Int32 OOBIN_ID_OLEOBJECT = 0x027F;
-const sal_Int32 OOBIN_ID_OLEOBJECTS = 0x027E;
-const sal_Int32 OOBIN_ID_OLESIZE = 0x0225;
-const sal_Int32 OOBIN_ID_PAGEMARGINS = 0x01DC;
-const sal_Int32 OOBIN_ID_PAGESETUP = 0x01DE;
-const sal_Int32 OOBIN_ID_PANE = 0x0097;
-const sal_Int32 OOBIN_ID_PCDEFINITION = 0x00B3;
-const sal_Int32 OOBIN_ID_PCDFDISCRETEPR = 0x00E1;
-const sal_Int32 OOBIN_ID_PCDFGROUPITEMS = 0x00DD;
-const sal_Int32 OOBIN_ID_PCDFIELD = 0x00B7;
-const sal_Int32 OOBIN_ID_PCDFIELDGROUP = 0x00DB;
-const sal_Int32 OOBIN_ID_PCDFIELDS = 0x00B5;
-const sal_Int32 OOBIN_ID_PCDFRANGEPR = 0x00DF;
-const sal_Int32 OOBIN_ID_PCDFSHAREDITEMS = 0x00BD;
-const sal_Int32 OOBIN_ID_PCDSHEETSOURCE = 0x00BB;
-const sal_Int32 OOBIN_ID_PCDSOURCE = 0x00B9;
-const sal_Int32 OOBIN_ID_PCITEM_ARRAY = 0x00BF;
-const sal_Int32 OOBIN_ID_PCITEM_BOOL = 0x0016;
-const sal_Int32 OOBIN_ID_PCITEM_DATE = 0x0019;
-const sal_Int32 OOBIN_ID_PCITEM_DOUBLE = 0x0015;
-const sal_Int32 OOBIN_ID_PCITEM_ERROR = 0x0017;
-const sal_Int32 OOBIN_ID_PCITEM_INDEX = 0x001A;
-const sal_Int32 OOBIN_ID_PCITEM_MISSING = 0x0014;
-const sal_Int32 OOBIN_ID_PCITEM_STRING = 0x0018;
-const sal_Int32 OOBIN_ID_PCITEMA_BOOL = 0x001D;
-const sal_Int32 OOBIN_ID_PCITEMA_DATE = 0x0020;
-const sal_Int32 OOBIN_ID_PCITEMA_DOUBLE = 0x001C;
-const sal_Int32 OOBIN_ID_PCITEMA_ERROR = 0x001E;
-const sal_Int32 OOBIN_ID_PCITEMA_MISSING = 0x001B;
-const sal_Int32 OOBIN_ID_PCITEMA_STRING = 0x001F;
-const sal_Int32 OOBIN_ID_PCRECORD = 0x0021;
-const sal_Int32 OOBIN_ID_PCRECORDDT = 0x0022;
-const sal_Int32 OOBIN_ID_PCRECORDS = 0x00C1;
-const sal_Int32 OOBIN_ID_PHONETICPR = 0x0219;
-const sal_Int32 OOBIN_ID_PICTURE = 0x0232;
-const sal_Int32 OOBIN_ID_PIVOTAREA = 0x00F7;
-const sal_Int32 OOBIN_ID_PIVOTCACHE = 0x0182;
-const sal_Int32 OOBIN_ID_PIVOTCACHES = 0x0180;
-const sal_Int32 OOBIN_ID_PRINTOPTIONS = 0x01DD;
-const sal_Int32 OOBIN_ID_PTCOLFIELDS = 0x0137;
-const sal_Int32 OOBIN_ID_PTDATAFIELD = 0x0125;
-const sal_Int32 OOBIN_ID_PTDATAFIELDS = 0x0127;
-const sal_Int32 OOBIN_ID_PTDEFINITION = 0x0118;
-const sal_Int32 OOBIN_ID_PTFIELD = 0x011D;
-const sal_Int32 OOBIN_ID_PTFIELDS = 0x011F;
-const sal_Int32 OOBIN_ID_PTFILTER = 0x0259;
-const sal_Int32 OOBIN_ID_PTFILTERS = 0x0257;
-const sal_Int32 OOBIN_ID_PTFITEM = 0x011A;
-const sal_Int32 OOBIN_ID_PTFITEMS = 0x011B;
-const sal_Int32 OOBIN_ID_PTLOCATION = 0x013A;
-const sal_Int32 OOBIN_ID_PTPAGEFIELD = 0x0121;
-const sal_Int32 OOBIN_ID_PTPAGEFIELDS = 0x0123;
-const sal_Int32 OOBIN_ID_PTREFERENCE = 0x00FB;
-const sal_Int32 OOBIN_ID_PTREFERENCEITEM = 0x017E;
-const sal_Int32 OOBIN_ID_PTREFERENCES = 0x00F9;
-const sal_Int32 OOBIN_ID_PTROWFIELDS = 0x0135;
-const sal_Int32 OOBIN_ID_RGBCOLOR = 0x01DB;
-const sal_Int32 OOBIN_ID_ROW = 0x0000;
-const sal_Int32 OOBIN_ID_ROWBREAKS = 0x0188;
-const sal_Int32 OOBIN_ID_SCENARIO = 0x01F6;
-const sal_Int32 OOBIN_ID_SCENARIOS = 0x01F4;
-const sal_Int32 OOBIN_ID_SELECTION = 0x0098;
-const sal_Int32 OOBIN_ID_SHAREDFMLA = 0x01AB;
-const sal_Int32 OOBIN_ID_SHEET = 0x009C;
-const sal_Int32 OOBIN_ID_SHEETDATA = 0x0091;
-const sal_Int32 OOBIN_ID_SHEETFORMATPR = 0x01E5;
-const sal_Int32 OOBIN_ID_SHEETPR = 0x0093;
-const sal_Int32 OOBIN_ID_SHEETPROTECTION = 0x0217;
-const sal_Int32 OOBIN_ID_SHEETS = 0x008F;
-const sal_Int32 OOBIN_ID_SHEETVIEW = 0x0089;
-const sal_Int32 OOBIN_ID_SHEETVIEWS = 0x0085;
-const sal_Int32 OOBIN_ID_SI = 0x0013;
-const sal_Int32 OOBIN_ID_SST = 0x009F;
-const sal_Int32 OOBIN_ID_STYLESHEET = 0x0116;
-const sal_Int32 OOBIN_ID_TABLE = 0x0157;
-const sal_Int32 OOBIN_ID_TABLEPART = 0x0295;
-const sal_Int32 OOBIN_ID_TABLEPARTS = 0x0294;
-const sal_Int32 OOBIN_ID_TABLESTYLEINFO = 0x0201;
-const sal_Int32 OOBIN_ID_TABLESTYLES = 0x01FC;
-const sal_Int32 OOBIN_ID_TOP10FILTER = 0x00AA;
-const sal_Int32 OOBIN_ID_VOLTYPE = 0x0204;
-const sal_Int32 OOBIN_ID_VOLTYPEMAIN = 0x0206;
-const sal_Int32 OOBIN_ID_VOLTYPES = 0x0202;
-const sal_Int32 OOBIN_ID_VOLTYPESTP = 0x020A;
-const sal_Int32 OOBIN_ID_VOLTYPETR = 0x020B;
-const sal_Int32 OOBIN_ID_WORKBOOK = 0x0083;
-const sal_Int32 OOBIN_ID_WORKBOOKPR = 0x0099;
-const sal_Int32 OOBIN_ID_WORKBOOKVIEW = 0x009E;
-const sal_Int32 OOBIN_ID_WORKSHEET = 0x0081;
-const sal_Int32 OOBIN_ID_XF = 0x002F;
+// BIFF12 record identifiers ==================================================
-// ============================================================================
+const sal_Int32 BIFF12_ID_ARRAY = 0x01AA;
+const sal_Int32 BIFF12_ID_AUTOFILTER = 0x00A1;
+const sal_Int32 BIFF12_ID_AUTOSORTSCOPE = 0x01CB;
+const sal_Int32 BIFF12_ID_BINARYINDEXBLOCK = 0x002A;
+const sal_Int32 BIFF12_ID_BINARYINDEXROWS = 0x0028;
+const sal_Int32 BIFF12_ID_BOOKVIEWS = 0x0087;
+const sal_Int32 BIFF12_ID_BORDER = 0x002E;
+const sal_Int32 BIFF12_ID_BORDERS = 0x0265;
+const sal_Int32 BIFF12_ID_BRK = 0x018C;
+const sal_Int32 BIFF12_ID_CALCPR = 0x009D;
+const sal_Int32 BIFF12_ID_CELL_BLANK = 0x0001;
+const sal_Int32 BIFF12_ID_CELL_BOOL = 0x0004;
+const sal_Int32 BIFF12_ID_CELL_DOUBLE = 0x0005;
+const sal_Int32 BIFF12_ID_CELL_ERROR = 0x0003;
+const sal_Int32 BIFF12_ID_CELL_RK = 0x0002;
+const sal_Int32 BIFF12_ID_CELL_RSTRING = 0x003E;
+const sal_Int32 BIFF12_ID_CELL_SI = 0x0007;
+const sal_Int32 BIFF12_ID_CELL_STRING = 0x0006;
+const sal_Int32 BIFF12_ID_CELLSTYLE = 0x0030;
+const sal_Int32 BIFF12_ID_CELLSTYLES = 0x026B;
+const sal_Int32 BIFF12_ID_CELLSTYLEXFS = 0x0272;
+const sal_Int32 BIFF12_ID_CELLXFS = 0x0269;
+const sal_Int32 BIFF12_ID_CFCOLOR = 0x0234;
+const sal_Int32 BIFF12_ID_CFRULE = 0x01CF;
+const sal_Int32 BIFF12_ID_CHARTPAGESETUP = 0x028C;
+const sal_Int32 BIFF12_ID_CHARTPROTECTION = 0x029D;
+const sal_Int32 BIFF12_ID_CHARTSHEETPR = 0x028B;
+const sal_Int32 BIFF12_ID_CHARTSHEETVIEW = 0x008D;
+const sal_Int32 BIFF12_ID_CHARTSHEETVIEWS = 0x008B;
+const sal_Int32 BIFF12_ID_COL = 0x003C;
+const sal_Int32 BIFF12_ID_COLBREAKS = 0x018A;
+const sal_Int32 BIFF12_ID_COLOR = 0x023C;
+const sal_Int32 BIFF12_ID_COLORS = 0x01D9;
+const sal_Int32 BIFF12_ID_COLORSCALE = 0x01D5;
+const sal_Int32 BIFF12_ID_COLS = 0x0186;
+const sal_Int32 BIFF12_ID_COMMENT = 0x027B;
+const sal_Int32 BIFF12_ID_COMMENTAUTHOR = 0x0278;
+const sal_Int32 BIFF12_ID_COMMENTAUTHORS = 0x0276;
+const sal_Int32 BIFF12_ID_COMMENTLIST = 0x0279;
+const sal_Int32 BIFF12_ID_COMMENTS = 0x0274;
+const sal_Int32 BIFF12_ID_COMMENTTEXT = 0x027D;
+const sal_Int32 BIFF12_ID_CONDFORMATTING = 0x01CD;
+const sal_Int32 BIFF12_ID_CONNECTION = 0x00C9;
+const sal_Int32 BIFF12_ID_CONNECTIONS = 0x01AD;
+const sal_Int32 BIFF12_ID_CONTROL = 0x0284;
+const sal_Int32 BIFF12_ID_CONTROLS = 0x0283;
+const sal_Int32 BIFF12_ID_CUSTOMCHARTVIEW = 0x028F;
+const sal_Int32 BIFF12_ID_CUSTOMCHARTVIEWS = 0x028D;
+const sal_Int32 BIFF12_ID_CUSTOMFILTER = 0x00AE;
+const sal_Int32 BIFF12_ID_CUSTOMFILTERS = 0x00AC;
+const sal_Int32 BIFF12_ID_CUSTOMSHEETVIEW = 0x01A7;
+const sal_Int32 BIFF12_ID_CUSTOMSHEETVIEWS = 0x01A6;
+const sal_Int32 BIFF12_ID_CUSTOMWORKBOOKVIEW= 0x018D;
+const sal_Int32 BIFF12_ID_DATABAR = 0x01D3;
+const sal_Int32 BIFF12_ID_DATATABLE = 0x01AC;
+const sal_Int32 BIFF12_ID_DATAVALIDATION = 0x0040;
+const sal_Int32 BIFF12_ID_DATAVALIDATIONS = 0x023D;
+const sal_Int32 BIFF12_ID_DDEITEMVALUES = 0x0242;
+const sal_Int32 BIFF12_ID_DDEITEM_BOOL = 0x0248;
+const sal_Int32 BIFF12_ID_DDEITEM_DOUBLE = 0x0244;
+const sal_Int32 BIFF12_ID_DDEITEM_ERROR = 0x0245;
+const sal_Int32 BIFF12_ID_DDEITEM_STRING = 0x0246;
+const sal_Int32 BIFF12_ID_DEFINEDNAME = 0x0027;
+const sal_Int32 BIFF12_ID_DIMENSION = 0x0094;
+const sal_Int32 BIFF12_ID_DISCRETEFILTER = 0x00A7;
+const sal_Int32 BIFF12_ID_DISCRETEFILTERS = 0x00A5;
+const sal_Int32 BIFF12_ID_DRAWING = 0x0226;
+const sal_Int32 BIFF12_ID_DXF = 0x01FB;
+const sal_Int32 BIFF12_ID_DXFS = 0x01F9;
+const sal_Int32 BIFF12_ID_EXTCELL_BLANK = 0x016F;
+const sal_Int32 BIFF12_ID_EXTCELL_BOOL = 0x0171;
+const sal_Int32 BIFF12_ID_EXTCELL_DOUBLE = 0x0170;
+const sal_Int32 BIFF12_ID_EXTCELL_ERROR = 0x0172;
+const sal_Int32 BIFF12_ID_EXTCELL_STRING = 0x0173;
+const sal_Int32 BIFF12_ID_EXTERNALADDIN = 0x029B;
+const sal_Int32 BIFF12_ID_EXTERNALBOOK = 0x0168;
+const sal_Int32 BIFF12_ID_EXTERNALNAME = 0x0241;
+const sal_Int32 BIFF12_ID_EXTERNALREF = 0x0163;
+const sal_Int32 BIFF12_ID_EXTERNALREFS = 0x0161;
+const sal_Int32 BIFF12_ID_EXTERNALSELF = 0x0165;
+const sal_Int32 BIFF12_ID_EXTERNALSAME = 0x0166;
+const sal_Int32 BIFF12_ID_EXTERNALSHEETS = 0x016A;
+const sal_Int32 BIFF12_ID_EXTROW = 0x016E;
+const sal_Int32 BIFF12_ID_EXTSHEETDATA = 0x016B;
+const sal_Int32 BIFF12_ID_EXTERNALNAMEFLAGS = 0x024A;
+const sal_Int32 BIFF12_ID_EXTSHEETNAMES = 0x0167;
+const sal_Int32 BIFF12_ID_FILESHARING = 0x0224;
+const sal_Int32 BIFF12_ID_FILEVERSION = 0x0080;
+const sal_Int32 BIFF12_ID_FILL = 0x002D;
+const sal_Int32 BIFF12_ID_FILLS = 0x025B;
+const sal_Int32 BIFF12_ID_FILTERCOLUMN = 0x00A3;
+const sal_Int32 BIFF12_ID_FONT = 0x002B;
+const sal_Int32 BIFF12_ID_FONTS = 0x0263;
+const sal_Int32 BIFF12_ID_FORMULA_STRING = 0x0008;
+const sal_Int32 BIFF12_ID_FORMULA_DOUBLE = 0x0009;
+const sal_Int32 BIFF12_ID_FORMULA_BOOL = 0x000A;
+const sal_Int32 BIFF12_ID_FORMULA_ERROR = 0x000B;
+const sal_Int32 BIFF12_ID_FUNCTIONGROUP = 0x0299;
+const sal_Int32 BIFF12_ID_FUNCTIONGROUPS = 0x0298;
+const sal_Int32 BIFF12_ID_HEADERFOOTER = 0x01DF;
+const sal_Int32 BIFF12_ID_HYPERLINK = 0x01EE;
+const sal_Int32 BIFF12_ID_ICONSET = 0x01D1;
+const sal_Int32 BIFF12_ID_INDEXEDCOLORS = 0x0235;
+const sal_Int32 BIFF12_ID_INPUTCELLS = 0x01F8;
+const sal_Int32 BIFF12_ID_LEGACYDRAWING = 0x0227;
+const sal_Int32 BIFF12_ID_MERGECELL = 0x00B0;
+const sal_Int32 BIFF12_ID_MERGECELLS = 0x00B1;
+const sal_Int32 BIFF12_ID_MRUCOLORS = 0x0239;
+const sal_Int32 BIFF12_ID_MULTCELL_BLANK = 0x000C;
+const sal_Int32 BIFF12_ID_MULTCELL_BOOL = 0x000F;
+const sal_Int32 BIFF12_ID_MULTCELL_DOUBLE = 0x0010;
+const sal_Int32 BIFF12_ID_MULTCELL_ERROR = 0x000E;
+const sal_Int32 BIFF12_ID_MULTCELL_RK = 0x000D;
+const sal_Int32 BIFF12_ID_MULTCELL_RSTRING = 0x003D;
+const sal_Int32 BIFF12_ID_MULTCELL_SI = 0x0012;
+const sal_Int32 BIFF12_ID_MULTCELL_STRING = 0x0011;
+const sal_Int32 BIFF12_ID_NUMFMT = 0x002C;
+const sal_Int32 BIFF12_ID_NUMFMTS = 0x0267;
+const sal_Int32 BIFF12_ID_OLEOBJECT = 0x027F;
+const sal_Int32 BIFF12_ID_OLEOBJECTS = 0x027E;
+const sal_Int32 BIFF12_ID_OLESIZE = 0x0225;
+const sal_Int32 BIFF12_ID_PAGEMARGINS = 0x01DC;
+const sal_Int32 BIFF12_ID_PAGESETUP = 0x01DE;
+const sal_Int32 BIFF12_ID_PANE = 0x0097;
+const sal_Int32 BIFF12_ID_PCDEFINITION = 0x00B3;
+const sal_Int32 BIFF12_ID_PCDFDISCRETEPR = 0x00E1;
+const sal_Int32 BIFF12_ID_PCDFGROUPITEMS = 0x00DD;
+const sal_Int32 BIFF12_ID_PCDFIELD = 0x00B7;
+const sal_Int32 BIFF12_ID_PCDFIELDGROUP = 0x00DB;
+const sal_Int32 BIFF12_ID_PCDFIELDS = 0x00B5;
+const sal_Int32 BIFF12_ID_PCDFRANGEPR = 0x00DF;
+const sal_Int32 BIFF12_ID_PCDFSHAREDITEMS = 0x00BD;
+const sal_Int32 BIFF12_ID_PCDSHEETSOURCE = 0x00BB;
+const sal_Int32 BIFF12_ID_PCDSOURCE = 0x00B9;
+const sal_Int32 BIFF12_ID_PCITEM_ARRAY = 0x00BF;
+const sal_Int32 BIFF12_ID_PCITEM_BOOL = 0x0016;
+const sal_Int32 BIFF12_ID_PCITEM_DATE = 0x0019;
+const sal_Int32 BIFF12_ID_PCITEM_DOUBLE = 0x0015;
+const sal_Int32 BIFF12_ID_PCITEM_ERROR = 0x0017;
+const sal_Int32 BIFF12_ID_PCITEM_INDEX = 0x001A;
+const sal_Int32 BIFF12_ID_PCITEM_MISSING = 0x0014;
+const sal_Int32 BIFF12_ID_PCITEM_STRING = 0x0018;
+const sal_Int32 BIFF12_ID_PCITEMA_BOOL = 0x001D;
+const sal_Int32 BIFF12_ID_PCITEMA_DATE = 0x0020;
+const sal_Int32 BIFF12_ID_PCITEMA_DOUBLE = 0x001C;
+const sal_Int32 BIFF12_ID_PCITEMA_ERROR = 0x001E;
+const sal_Int32 BIFF12_ID_PCITEMA_MISSING = 0x001B;
+const sal_Int32 BIFF12_ID_PCITEMA_STRING = 0x001F;
+const sal_Int32 BIFF12_ID_PCRECORD = 0x0021;
+const sal_Int32 BIFF12_ID_PCRECORDDT = 0x0022;
+const sal_Int32 BIFF12_ID_PCRECORDS = 0x00C1;
+const sal_Int32 BIFF12_ID_PHONETICPR = 0x0219;
+const sal_Int32 BIFF12_ID_PICTURE = 0x0232;
+const sal_Int32 BIFF12_ID_PIVOTAREA = 0x00F7;
+const sal_Int32 BIFF12_ID_PIVOTCACHE = 0x0182;
+const sal_Int32 BIFF12_ID_PIVOTCACHES = 0x0180;
+const sal_Int32 BIFF12_ID_PRINTOPTIONS = 0x01DD;
+const sal_Int32 BIFF12_ID_PTCOLFIELDS = 0x0137;
+const sal_Int32 BIFF12_ID_PTDATAFIELD = 0x0125;
+const sal_Int32 BIFF12_ID_PTDATAFIELDS = 0x0127;
+const sal_Int32 BIFF12_ID_PTDEFINITION = 0x0118;
+const sal_Int32 BIFF12_ID_PTFIELD = 0x011D;
+const sal_Int32 BIFF12_ID_PTFIELDS = 0x011F;
+const sal_Int32 BIFF12_ID_PTFILTER = 0x0259;
+const sal_Int32 BIFF12_ID_PTFILTERS = 0x0257;
+const sal_Int32 BIFF12_ID_PTFITEM = 0x011A;
+const sal_Int32 BIFF12_ID_PTFITEMS = 0x011B;
+const sal_Int32 BIFF12_ID_PTLOCATION = 0x013A;
+const sal_Int32 BIFF12_ID_PTPAGEFIELD = 0x0121;
+const sal_Int32 BIFF12_ID_PTPAGEFIELDS = 0x0123;
+const sal_Int32 BIFF12_ID_PTREFERENCE = 0x00FB;
+const sal_Int32 BIFF12_ID_PTREFERENCEITEM = 0x017E;
+const sal_Int32 BIFF12_ID_PTREFERENCES = 0x00F9;
+const sal_Int32 BIFF12_ID_PTROWFIELDS = 0x0135;
+const sal_Int32 BIFF12_ID_QUERYTABLE = 0x01BF;
+const sal_Int32 BIFF12_ID_QUERYTABLEREFRESH = 0x01C1;
+const sal_Int32 BIFF12_ID_RGBCOLOR = 0x01DB;
+const sal_Int32 BIFF12_ID_ROW = 0x0000;
+const sal_Int32 BIFF12_ID_ROWBREAKS = 0x0188;
+const sal_Int32 BIFF12_ID_SCENARIO = 0x01F6;
+const sal_Int32 BIFF12_ID_SCENARIOS = 0x01F4;
+const sal_Int32 BIFF12_ID_SELECTION = 0x0098;
+const sal_Int32 BIFF12_ID_SHAREDFMLA = 0x01AB;
+const sal_Int32 BIFF12_ID_SHEET = 0x009C;
+const sal_Int32 BIFF12_ID_SHEETDATA = 0x0091;
+const sal_Int32 BIFF12_ID_SHEETFORMATPR = 0x01E5;
+const sal_Int32 BIFF12_ID_SHEETPR = 0x0093;
+const sal_Int32 BIFF12_ID_SHEETPROTECTION = 0x0217;
+const sal_Int32 BIFF12_ID_SHEETS = 0x008F;
+const sal_Int32 BIFF12_ID_SHEETVIEW = 0x0089;
+const sal_Int32 BIFF12_ID_SHEETVIEWS = 0x0085;
+const sal_Int32 BIFF12_ID_SI = 0x0013;
+const sal_Int32 BIFF12_ID_SST = 0x009F;
+const sal_Int32 BIFF12_ID_STYLESHEET = 0x0116;
+const sal_Int32 BIFF12_ID_TABLE = 0x0157;
+const sal_Int32 BIFF12_ID_TABLEPART = 0x0295;
+const sal_Int32 BIFF12_ID_TABLEPARTS = 0x0294;
+const sal_Int32 BIFF12_ID_TABLESTYLEINFO = 0x0201;
+const sal_Int32 BIFF12_ID_TABLESTYLES = 0x01FC;
+const sal_Int32 BIFF12_ID_TOP10FILTER = 0x00AA;
+const sal_Int32 BIFF12_ID_VOLTYPE = 0x0204;
+const sal_Int32 BIFF12_ID_VOLTYPEMAIN = 0x0206;
+const sal_Int32 BIFF12_ID_VOLTYPES = 0x0202;
+const sal_Int32 BIFF12_ID_VOLTYPESTP = 0x020A;
+const sal_Int32 BIFF12_ID_VOLTYPETR = 0x020B;
+const sal_Int32 BIFF12_ID_WEBPR = 0x0105;
+const sal_Int32 BIFF12_ID_WEBPRTABLES = 0x0107;
+const sal_Int32 BIFF12_ID_WORKBOOK = 0x0083;
+const sal_Int32 BIFF12_ID_WORKBOOKPR = 0x0099;
+const sal_Int32 BIFF12_ID_WORKBOOKVIEW = 0x009E;
+const sal_Int32 BIFF12_ID_WORKSHEET = 0x0081;
+const sal_Int32 BIFF12_ID_XF = 0x002F;
+
+// BIFF2-BIFF8 record identifiers =============================================
/** An enumeration for all binary Excel file format types (BIFF types). */
enum BiffType
@@ -260,6 +272,7 @@ const sal_uInt16 BIFF8_MAXRECSIZE = 8224;
const sal_uInt16 BIFF2_ID_ARRAY = 0x0021;
const sal_uInt16 BIFF3_ID_ARRAY = 0x0221;
+const sal_uInt16 BIFF_ID_AUTOFILTER = 0x009D;
const sal_uInt16 BIFF2_ID_BLANK = 0x0001;
const sal_uInt16 BIFF3_ID_BLANK = 0x0201;
const sal_uInt16 BIFF2_ID_BOF = 0x0009;
@@ -352,6 +365,7 @@ const sal_uInt16 BIFF_ID_COLINFO = 0x007D;
const sal_uInt16 BIFF_ID_COLUMNDEFAULT = 0x0020;
const sal_uInt16 BIFF_ID_COLWIDTH = 0x0024;
const sal_uInt16 BIFF_ID_COMPRESSPICS = 0x089B;
+const sal_uInt16 BIFF_ID_CONNECTION = 0x0876;
const sal_uInt16 BIFF_ID_CONT = 0x003C;
const sal_uInt16 BIFF_ID_COORDLIST = 0x00A9;
const sal_uInt16 BIFF_ID_COUNTRY = 0x008C;
@@ -363,6 +377,7 @@ const sal_uInt16 BIFF_ID_DATAVALIDATION = 0x01BE;
const sal_uInt16 BIFF_ID_DATAVALIDATIONS = 0x01B2;
const sal_uInt16 BIFF_ID_DATEMODE = 0x0022;
const sal_uInt16 BIFF_ID_DBCELL = 0x00D7;
+const sal_uInt16 BIFF_ID_DBQUERY = 0x00DC;
const sal_uInt16 BIFF_ID_DCONBINAME = 0x01B5;
const sal_uInt16 BIFF_ID_DCONNAME = 0x0052;
const sal_uInt16 BIFF_ID_DCONREF = 0x0051;
@@ -385,6 +400,8 @@ const sal_uInt16 BIFF_ID_EXTERNSHEET = 0x0017;
const sal_uInt16 BIFF_ID_EXTSST = 0x00FF;
const sal_uInt16 BIFF_ID_FILEPASS = 0x002F;
const sal_uInt16 BIFF_ID_FILESHARING = 0x005B;
+const sal_uInt16 BIFF_ID_FILTERCOLUMN = 0x009E;
+const sal_uInt16 BIFF_ID_FILTERMODE = 0x009B;
const sal_uInt16 BIFF2_ID_FONT = 0x0031;
const sal_uInt16 BIFF3_ID_FONT = 0x0231;
const sal_uInt16 BIFF5_ID_FONT = 0x0031;
@@ -434,6 +451,7 @@ const sal_uInt16 BIFF_ID_PAGELAYOUTVIEW = 0x088B;
const sal_uInt16 BIFF_ID_PAGESETUP = 0x00A1;
const sal_uInt16 BIFF_ID_PALETTE = 0x0092;
const sal_uInt16 BIFF_ID_PANE = 0x0041;
+const sal_uInt16 BIFF_ID_PARAMQUERY = 0x00DC;
const sal_uInt16 BIFF_ID_PASSWORD = 0x0013;
const sal_uInt16 BIFF_ID_PCDEFINITION = 0x00C6;
const sal_uInt16 BIFF_ID_PCDEFINITION2 = 0x0122;
@@ -469,6 +487,10 @@ const sal_uInt16 BIFF_ID_PTFITEM = 0x00B2;
const sal_uInt16 BIFF_ID_PTPAGEFIELDS = 0x00B6;
const sal_uInt16 BIFF_ID_PTROWCOLFIELDS = 0x00B4;
const sal_uInt16 BIFF_ID_PTROWCOLITEMS = 0x00B5;
+const sal_uInt16 BIFF_ID_QUERYTABLE = 0x01AD;
+const sal_uInt16 BIFF_ID_QUERYTABLEREFRESH = 0x0802;
+const sal_uInt16 BIFF_ID_QUERYTABLESETTINGS = 0x0803;
+const sal_uInt16 BIFF_ID_QUERYTABLESTRING = 0x0804;
const sal_uInt16 BIFF_ID_RECALCID = 0x01C1;
const sal_uInt16 BIFF_ID_REFMODE = 0x000F;
const sal_uInt16 BIFF_ID_RIGHTMARGIN = 0x0027;
@@ -495,7 +517,6 @@ const sal_uInt16 BIFF2_ID_STRING = 0x0007;
const sal_uInt16 BIFF3_ID_STRING = 0x0207;
const sal_uInt16 BIFF_ID_STYLE = 0x0293;
const sal_uInt16 BIFF_ID_STYLEEXT = 0x0892;
-const sal_uInt16 BIFF_ID_SXEXT = 0x00DC;
const sal_uInt16 BIFF_ID_TABLESTYLES = 0x088E;
const sal_uInt16 BIFF_ID_THEME = 0x0896;
const sal_uInt16 BIFF_ID_TOPMARGIN = 0x0028;
@@ -520,6 +541,8 @@ const sal_uInt16 BIFF_ID_XFEXT = 0x087D;
const sal_uInt16 BIFF_ID_UNKNOWN = SAL_MAX_UINT16;
+// OBJ subrecord identifiers --------------------------------------------------
+
const sal_uInt16 BIFF_ID_OBJEND = 0x0000; /// End of OBJ.
const sal_uInt16 BIFF_ID_OBJMACRO = 0x0004; /// Macro link.
const sal_uInt16 BIFF_ID_OBJBUTTON = 0x0005; /// Button data.
@@ -562,7 +585,10 @@ const sal_uInt8 BIFF_DATATYPE_STRING = 2;
const sal_uInt8 BIFF_DATATYPE_BOOL = 4;
const sal_uInt8 BIFF_DATATYPE_ERROR = 16;
-// unicode strings ------------------------------------------------------------
+const sal_uInt8 BIFF_BOOLERR_BOOL = 0;
+const sal_uInt8 BIFF_BOOLERR_ERROR = 1;
+
+// BIFF8 unicode strings ------------------------------------------------------
const sal_uInt8 BIFF_STRF_16BIT = 0x01;
const sal_uInt8 BIFF_STRF_PHONETIC = 0x04;
@@ -591,6 +617,32 @@ public:
/** Returns a Windows code page from a text encoding. */
static sal_uInt16 calcCodePageFromTextEncoding( rtl_TextEncoding eTextEnc );
+ // BIFF12 import ----------------------------------------------------------
+
+ /** Reads a BIFF12 string with leading 16-bit or 32-bit length field. */
+ static ::rtl::OUString readString( SequenceInputStream& rStrm, bool b32BitLen = true );
+
+ // BIFF2-BIFF8 import -----------------------------------------------------
+
+ /** Returns true, if the current record of the stream is a BOF record. */
+ static bool isBofRecord( BiffInputStream& rStrm );
+
+ /** Skips a block of records up to the specified end record.
+
+ Skips all records until next end record. When this function returns,
+ the stream points to the end record, and the next call of the function
+ startNextRecord() at the stream will start the record following the end
+ record.
+
+ The identifier of the record that is active while this function is
+ called is used as start record identifier. This identifier is used to
+ correctly skip embedded record blocks with the same start and end
+ record identifier.
+
+ @return True = stream points to the end record.
+ */
+ static bool skipRecordBlock( BiffInputStream& rStrm, sal_uInt16 nEndRecId );
+
/** Imports a picture from an IMGDATA record. */
static void importImgData( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, BiffType eBiff );
@@ -599,10 +651,18 @@ private:
~BiffHelper(); // not implemented
};
+// ----------------------------------------------------------------------------
+
+/** BIFF12 stream operator for an ::rtl::OUString, reads 32-bit string length and Unicode array. */
+inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, ::rtl::OUString& orString )
+{
+ orString = BiffHelper::readString( rStrm );
+ return rStrm;
+}
+
// ============================================================================
} // namespace xls
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/biffinputstream.hxx b/oox/inc/oox/xls/biffinputstream.hxx
index c804d2c9c6e0..003ab28be34f 100644
--- a/oox/inc/oox/xls/biffinputstream.hxx
+++ b/oox/inc/oox/xls/biffinputstream.hxx
@@ -444,4 +444,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/biffoutputstream.hxx b/oox/inc/oox/xls/biffoutputstream.hxx
index 6e36b08d3592..ada646bd879a 100644
--- a/oox/inc/oox/xls/biffoutputstream.hxx
+++ b/oox/inc/oox/xls/biffoutputstream.hxx
@@ -162,4 +162,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/chartsheetfragment.hxx b/oox/inc/oox/xls/chartsheetfragment.hxx
index dc8e0f85fd13..8dfedc5ba48e 100644
--- a/oox/inc/oox/xls/chartsheetfragment.hxx
+++ b/oox/inc/oox/xls/chartsheetfragment.hxx
@@ -35,24 +35,20 @@ namespace xls {
// ============================================================================
-class OoxChartsheetFragment : public OoxWorksheetFragmentBase
+class ChartsheetFragment : public WorksheetFragmentBase
{
public:
- explicit OoxChartsheetFragment(
+ explicit ChartsheetFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
sal_Int16 nSheet );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
-
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
- // oox.core.FragmentHandler2 interface ------------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
virtual void initializeImport();
@@ -62,7 +58,7 @@ private:
/** Imports the the relation identifier for the DrawingML part. */
void importDrawing( const AttributeList& rAttribs );
/** Imports the DRAWING record containing the relation identifier for the DrawingML part. */
- void importDrawing( RecordInputStream& rStrm );
+ void importDrawing( SequenceInputStream& rStrm );
};
// ============================================================================
@@ -72,7 +68,7 @@ class BiffChartsheetFragment : public BiffWorksheetFragmentBase
public:
explicit BiffChartsheetFragment(
const BiffWorkbookFragmentBase& rParent,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
sal_Int16 nSheet );
/** Imports the entire sheet fragment, returns true, if EOF record has been reached. */
@@ -85,4 +81,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/commentsbuffer.hxx b/oox/inc/oox/xls/commentsbuffer.hxx
index 8a43eb7fe9fe..e87d52ff03a2 100644
--- a/oox/inc/oox/xls/commentsbuffer.hxx
+++ b/oox/inc/oox/xls/commentsbuffer.hxx
@@ -56,7 +56,7 @@ public:
/** Imports a cell comment from the passed attributes of the comment element. */
void importComment( const AttributeList& rAttribs );
/** Imports a cell comment from the passed stream of a COMMENT record. */
- void importComment( RecordInputStream& rStrm );
+ void importComment( SequenceInputStream& rStrm );
/** Creates and returns a new rich-string object for the comment text. */
RichStringRef createText();
@@ -99,4 +99,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/commentsfragment.hxx b/oox/inc/oox/xls/commentsfragment.hxx
index 584c6a2bb340..3751cde764f4 100644
--- a/oox/inc/oox/xls/commentsfragment.hxx
+++ b/oox/inc/oox/xls/commentsfragment.hxx
@@ -36,30 +36,27 @@ namespace xls {
// ============================================================================
-class OoxCommentsFragment : public OoxWorksheetFragmentBase
+class CommentsFragment : public WorksheetFragmentBase
{
public:
- explicit OoxCommentsFragment(
+ explicit CommentsFragment(
const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual void onEndRecord();
- // oox.core.FragmentHandler2 interface ------------------------------------
-
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
private:
/** Imports comment data from the comment element. */
void importComment( const AttributeList& rAttribs );
/** Imports comment data from the COMMENT record. */
- void importComment( RecordInputStream& rStrm );
+ void importComment( SequenceInputStream& rStrm );
private:
CommentRef mxComment;
@@ -71,4 +68,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/condformatbuffer.hxx b/oox/inc/oox/xls/condformatbuffer.hxx
index 25259ce04295..fae6381f6402 100644
--- a/oox/inc/oox/xls/condformatbuffer.hxx
+++ b/oox/inc/oox/xls/condformatbuffer.hxx
@@ -29,7 +29,6 @@
#define OOX_XLS_CONDFORMATBUFFER_HXX
#include <com/sun/star/sheet/ConditionOperator.hpp>
-#include "oox/helper/containerhelper.hxx"
#include "oox/xls/formulaparser.hxx"
#include "oox/xls/worksheethelper.hxx"
@@ -64,11 +63,11 @@ struct CondFormatRuleModel
explicit CondFormatRuleModel();
- /** Sets the passed OOBIN or BIFF operator for condition type cellIs. */
- void setBinOperator( sal_Int32 nOperator );
+ /** Sets the passed BIFF operator for condition type cellIs. */
+ void setBiffOperator( sal_Int32 nOperator );
- /** Sets the passed OOBIN text comparison type and operator. */
- void setOobTextType( sal_Int32 nOperator );
+ /** Sets the passed BIFF12 text comparison type and operator. */
+ void setBiff12TextType( sal_Int32 nOperator );
};
// ============================================================================
@@ -87,7 +86,7 @@ public:
void appendFormula( const ::rtl::OUString& rFormula );
/** Imports rule settings from a CFRULE record. */
- void importCfRule( RecordInputStream& rStrm );
+ void importCfRule( SequenceInputStream& rStrm );
/** Imports rule settings from a CFRULE record. */
void importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority );
@@ -131,9 +130,9 @@ public:
CondFormatRuleRef importCfRule( const AttributeList& rAttribs );
/** Imports settings from the CONDFORMATTING record. */
- void importCondFormatting( RecordInputStream& rStrm );
+ void importCondFormatting( SequenceInputStream& rStrm );
/** Imports a conditional formatting rule from the CFRULE record. */
- void importCfRule( RecordInputStream& rStrm );
+ void importCfRule( SequenceInputStream& rStrm );
/** Imports settings from the CFHEADER record. */
void importCfHeader( BiffInputStream& rStrm );
@@ -167,7 +166,7 @@ public:
/** Imports settings from the conditionalFormatting element. */
CondFormatRef importConditionalFormatting( const AttributeList& rAttribs );
/** Imports settings from the CONDFORMATTING record. */
- CondFormatRef importCondFormatting( RecordInputStream& rStrm );
+ CondFormatRef importCondFormatting( SequenceInputStream& rStrm );
/** Imports settings from the CFHEADER record. */
void importCfHeader( BiffInputStream& rStrm );
@@ -192,4 +191,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/condformatcontext.hxx b/oox/inc/oox/xls/condformatcontext.hxx
index 799e3127b7a3..44c9fe592250 100644
--- a/oox/inc/oox/xls/condformatcontext.hxx
+++ b/oox/inc/oox/xls/condformatcontext.hxx
@@ -36,20 +36,18 @@ namespace xls {
// ============================================================================
-class OoxCondFormatContext : public OoxWorksheetContextBase
+class CondFormatContext : public WorksheetContextBase
{
public:
- explicit OoxCondFormatContext( OoxWorksheetFragmentBase& rFragment );
+ explicit CondFormatContext( WorksheetFragmentBase& rFragment );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
private:
CondFormatRef mxCondFmt;
@@ -62,4 +60,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/connectionsbuffer.hxx b/oox/inc/oox/xls/connectionsbuffer.hxx
new file mode 100755
index 000000000000..98a5bea17bc6
--- /dev/null
+++ b/oox/inc/oox/xls/connectionsbuffer.hxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_XLS_CONNECTIONSBUFFER_HXX
+#define OOX_XLS_CONNECTIONSBUFFER_HXX
+
+#include "oox/helper/refvector.hxx"
+#include "oox/xls/workbookhelper.hxx"
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+const sal_Int32 BIFF12_CONNECTION_UNKNOWN = 0;
+const sal_Int32 BIFF12_CONNECTION_ODBC = 1;
+const sal_Int32 BIFF12_CONNECTION_DAO = 2;
+const sal_Int32 BIFF12_CONNECTION_FILE = 3;
+const sal_Int32 BIFF12_CONNECTION_HTML = 4;
+const sal_Int32 BIFF12_CONNECTION_OLEDB = 5;
+const sal_Int32 BIFF12_CONNECTION_TEXT = 6;
+const sal_Int32 BIFF12_CONNECTION_ADO = 7;
+const sal_Int32 BIFF12_CONNECTION_DSP = 8;
+
+// ============================================================================
+
+/** Special properties for data connections representing web queries. */
+struct WebPrModel
+{
+ typedef ::std::vector< ::com::sun::star::uno::Any > TablesVector;
+
+ TablesVector maTables; /// Names or indexes of the web query tables.
+ ::rtl::OUString maUrl; /// Source URL to refresh the data.
+ ::rtl::OUString maPostMethod; /// POST method to query data.
+ ::rtl::OUString maEditPage; /// Web page showing query data (for XML queries).
+ sal_Int32 mnHtmlFormat; /// Plain text, rich text, or HTML.
+ bool mbXml; /// True = XML query, false = HTML query.
+ bool mbSourceData; /// True = import XML source data referred by HTML table.
+ bool mbParsePre; /// True = parse preformatted sections (<pre> tag).
+ bool mbConsecutive; /// True = join consecutive delimiters.
+ bool mbFirstRow; /// True = use column withs of first row for entire <pre> tag.
+ bool mbXl97Created; /// True = web query created with Excel 97.
+ bool mbTextDates; /// True = read date values as text, false = parse dates.
+ bool mbXl2000Refreshed; /// True = refreshed with Excel 2000 or newer.
+ bool mbHtmlTables; /// True = HTML tables, false = entire document.
+
+ explicit WebPrModel();
+};
+
+// ----------------------------------------------------------------------------
+
+/** Common properties of an external data connection. */
+struct ConnectionModel
+{
+ typedef ::std::auto_ptr< WebPrModel > WebPrModelPtr;
+
+ WebPrModelPtr mxWebPr; /// Special settings for web queries.
+ ::rtl::OUString maName; /// Unique name of this connection.
+ ::rtl::OUString maDescription; /// User description of this connection.
+ ::rtl::OUString maSourceFile; /// URL of a source data file.
+ ::rtl::OUString maSourceConnFile; /// URL of a source connection file.
+ ::rtl::OUString maSsoId; /// Single sign-on identifier.
+ sal_Int32 mnId; /// Unique connection identifier.
+ sal_Int32 mnType; /// Data source type.
+ sal_Int32 mnReconnectMethod; /// Reconnection method.
+ sal_Int32 mnCredentials; /// Credentials method.
+ sal_Int32 mnInterval; /// Refresh interval in minutes.
+ bool mbKeepAlive; /// True = keep connection open after import.
+ bool mbNew; /// True = new connection, never updated.
+ bool mbDeleted; /// True = connection has been deleted.
+ bool mbOnlyUseConnFile; /// True = use maSourceConnFile, ignore mnReconnectMethod.
+ bool mbBackground; /// True = background refresh enabled.
+ bool mbRefreshOnLoad; /// True = refresh connection on import.
+ bool mbSaveData; /// True = save cached data with connection.
+ bool mbSavePassword; /// True = save password in connection string.
+
+ explicit ConnectionModel();
+
+ WebPrModel& createWebPr();
+};
+
+// ----------------------------------------------------------------------------
+
+/** An external data connection (database, web query, etc.). */
+class Connection : public WorkbookHelper
+{
+public:
+ explicit Connection( const WorkbookHelper& rHelper, sal_Int32 nConnId = -1 );
+
+ /** Imports connection settings from the connection element. */
+ void importConnection( const AttributeList& rAttribs );
+ /** Imports web query settings from the webPr element. */
+ void importWebPr( const AttributeList& rAttribs );
+ /** Imports web query table settings from the tables element. */
+ void importTables( const AttributeList& rAttribs );
+ /** Imports a web query table identifier from the m, s, or x element. */
+ void importTable( const AttributeList& rAttribs, sal_Int32 nElement );
+
+ /** Imports connection settings from the CONNECTION record. */
+ void importConnection( SequenceInputStream& rStrm );
+ /** Imports web query settings from the WEBPR record. */
+ void importWebPr( SequenceInputStream& rStrm );
+ /** Imports web query table settings from the WEBPRTABLES record. */
+ void importWebPrTables( SequenceInputStream& rStrm );
+ /** Imports a web query table identifier from the PCITEM_MISSING, PCITEM_STRING, or PCITEM_INDEX record. */
+ void importWebPrTable( SequenceInputStream& rStrm, sal_Int32 nRecId );
+
+ /** Imports connection settings from the DBQUERY record. */
+ void importDbQuery( BiffInputStream& rStrm );
+ /** Imports connection settings from the QUERYTABLESETTINGS record. */
+ void importQueryTableSettings( BiffInputStream& rStrm );
+
+ /** Returns the unique connection identifier. */
+ inline sal_Int32 getConnectionId() const { return maModel.mnId; }
+ /** Returns the source data type of the connection. */
+ inline sal_Int32 getConnectionType() const { return maModel.mnType; }
+ /** Returns read-only access to the connection model data. */
+ const ConnectionModel& getModel() const { return maModel; }
+
+private:
+ ConnectionModel maModel;
+};
+
+typedef ::boost::shared_ptr< Connection > ConnectionRef;
+
+// ============================================================================
+
+class ConnectionsBuffer : public WorkbookHelper
+{
+public:
+ explicit ConnectionsBuffer( const WorkbookHelper& rHelper );
+
+ /** Creates a new empty connection. */
+ Connection& createConnection();
+ /** Creates a new empty connection with a valid but unused identifier. */
+ Connection& createConnectionWithId();
+
+ /** Maps all connections by their identifier. */
+ void finalizeImport();
+
+ /** Returns a data connection by its unique identifier. */
+ ConnectionRef getConnection( sal_Int32 nConnId ) const;
+
+private:
+ /** Inserts the passed connection into the map according to its identifier. */
+ void insertConnectionToMap( const ConnectionRef& rxConnection );
+
+private:
+ typedef RefVector< Connection > ConnectionVector;
+ typedef RefMap< sal_Int32, Connection > ConnectionMap;
+
+ ConnectionVector maConnections;
+ ConnectionMap maConnectionsById;
+ sal_Int32 mnUnusedId;
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/xls/connectionsfragment.hxx b/oox/inc/oox/xls/connectionsfragment.hxx
index 85951a5bbfc7..5a9a9085c6c5 100644
--- a/oox/inc/oox/xls/connectionsfragment.hxx
+++ b/oox/inc/oox/xls/connectionsfragment.hxx
@@ -29,31 +29,45 @@
#define OOX_XLS_CONNECTIONSFRAGMENT_HXX
#include "oox/xls/excelhandlers.hxx"
-#include "oox/xls/workbookhelper.hxx"
namespace oox {
namespace xls {
+class Connection;
+
+// ============================================================================
+
+class ConnectionContext : public WorkbookContextBase
+{
+public:
+ explicit ConnectionContext( WorkbookFragmentBase& rParent, Connection& rConnection );
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
+
+private:
+ Connection& mrConnection;
+};
+
// ============================================================================
-class OoxConnectionsFragment : public OoxWorkbookFragmentBase
+class ConnectionsFragment : public WorkbookFragmentBase
{
public:
- explicit OoxConnectionsFragment(
+ explicit ConnectionsFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
-private:
- void importConnection( const AttributeList& rAttribs );
- void importWebPr( const AttributeList& rAttribs );
- void importTables( const AttributeList& rAttribs );
- void importS( const AttributeList& rAttribs );
- void importX( const AttributeList& rAttribs );
+ virtual const ::oox::core::RecordInfo* getRecordInfos() const;
+ virtual void finalizeImport();
};
// ============================================================================
@@ -62,4 +76,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx
index 45208f0ac344..5374c47f6a07 100644
--- a/oox/inc/oox/xls/defnamesbuffer.hxx
+++ b/oox/inc/oox/xls/defnamesbuffer.hxx
@@ -28,8 +28,6 @@
#ifndef OOX_XLS_DEFINEDNAMESBUFFER_HXX
#define OOX_XLS_DEFINEDNAMESBUFFER_HXX
-#include "oox/helper/containerhelper.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/formulabase.hxx"
namespace com { namespace sun { namespace star {
@@ -45,21 +43,21 @@ class BiffInputStreamPos;
// ============================================================================
// codes for built-in names
-const sal_Unicode OOX_DEFNAME_CONSOLIDATEAREA = '\x00';
-const sal_Unicode OOX_DEFNAME_AUTOOPEN = '\x01';
-const sal_Unicode OOX_DEFNAME_AUTOCLOSE = '\x02';
-const sal_Unicode OOX_DEFNAME_EXTRACT = '\x03';
-const sal_Unicode OOX_DEFNAME_DATABASE = '\x04';
-const sal_Unicode OOX_DEFNAME_CRITERIA = '\x05';
-const sal_Unicode OOX_DEFNAME_PRINTAREA = '\x06';
-const sal_Unicode OOX_DEFNAME_PRINTTITLES = '\x07';
-const sal_Unicode OOX_DEFNAME_RECORDER = '\x08';
-const sal_Unicode OOX_DEFNAME_DATAFORM = '\x09';
-const sal_Unicode OOX_DEFNAME_AUTOACTIVATE = '\x0A';
-const sal_Unicode OOX_DEFNAME_AUTODEACTIVATE = '\x0B';
-const sal_Unicode OOX_DEFNAME_SHEETTITLE = '\x0C';
-const sal_Unicode OOX_DEFNAME_FILTERDATABASE = '\x0D';
-const sal_Unicode OOX_DEFNAME_UNKNOWN = '\x0E';
+const sal_Unicode BIFF_DEFNAME_CONSOLIDATEAREA = '\x00';
+const sal_Unicode BIFF_DEFNAME_AUTOOPEN = '\x01'; // Sheet macro executed when workbook is opened.
+const sal_Unicode BIFF_DEFNAME_AUTOCLOSE = '\x02'; // Sheet macro executed when workbook is closed.
+const sal_Unicode BIFF_DEFNAME_EXTRACT = '\x03'; // Filter output destination for advanced filter.
+const sal_Unicode BIFF_DEFNAME_DATABASE = '\x04';
+const sal_Unicode BIFF_DEFNAME_CRITERIA = '\x05'; // Filter criteria source range for advanced filter.
+const sal_Unicode BIFF_DEFNAME_PRINTAREA = '\x06'; // Print ranges.
+const sal_Unicode BIFF_DEFNAME_PRINTTITLES = '\x07'; // Rows/columns repeated on each page when printing.
+const sal_Unicode BIFF_DEFNAME_RECORDER = '\x08';
+const sal_Unicode BIFF_DEFNAME_DATAFORM = '\x09';
+const sal_Unicode BIFF_DEFNAME_AUTOACTIVATE = '\x0A'; // Sheet macro executed when workbook is activated.
+const sal_Unicode BIFF_DEFNAME_AUTODEACTIVATE = '\x0B'; // Sheet macro executed when workbook is deactivated.
+const sal_Unicode BIFF_DEFNAME_SHEETTITLE = '\x0C';
+const sal_Unicode BIFF_DEFNAME_FILTERDATABASE = '\x0D'; // Sheet range autofilter or advanced filter works on.
+const sal_Unicode BIFF_DEFNAME_UNKNOWN = '\x0E';
// ============================================================================
@@ -69,9 +67,9 @@ struct DefinedNameModel
::rtl::OUString maFormula; /// The formula string.
sal_Int32 mnSheet; /// Sheet index for local names.
sal_Int32 mnFuncGroupId; /// Function group identifier.
- bool mbMacro; /// True = Macro name (VBasic or sheet macro).
+ bool mbMacro; /// True = Macro name (VBA or sheet macro).
bool mbFunction; /// True = function, false = command.
- bool mbVBName; /// True = VBasic macro, false = sheet macro.
+ bool mbVBName; /// True = VBA macro, false = sheet macro.
bool mbHidden; /// True = name hidden in UI.
explicit DefinedNameModel();
@@ -96,10 +94,10 @@ public:
::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddress ) const;
protected:
- /** Imports the OOX formula string, using the passed formula context. */
+ /** Imports the OOXML formula string, using the passed formula context. */
void importOoxFormula( FormulaContext& rContext, sal_Int16 nBaseSheet );
- /** Imports the OOBIN formula, using the passed formula context. */
- void importOobFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, RecordInputStream& rStrm );
+ /** 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 );
@@ -125,7 +123,7 @@ public:
/** Sets the formula string from the body of the definedName element. */
void setFormula( const ::rtl::OUString& rFormula );
/** Imports the defined name from a DEFINEDNAME record in the passed stream. */
- void importDefinedName( RecordInputStream& rStrm );
+ void importDefinedName( SequenceInputStream& rStrm );
/** Imports the defined name from a DEFINEDNAME record in the passed BIFF stream. */
void importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcSheet );
@@ -134,22 +132,26 @@ public:
/** Converts the formula string or BIFF token array for this defined name. */
void convertFormula();
+ /** Returns true, if this defined name is global in the document. */
+ inline bool isGlobalName() const { return mnCalcSheet < 0; }
/** Returns true, if this defined name is a special builtin name. */
- inline bool isBuiltinName() const { return mcBuiltinId != OOX_DEFNAME_UNKNOWN; }
+ inline bool isBuiltinName() const { return mcBuiltinId != BIFF_DEFNAME_UNKNOWN; }
/** Returns true, if this defined name is a macro function call. */
inline bool isMacroFunction() const { return maModel.mbMacro && maModel.mbFunction; }
- /** Returns true, if this defined name is global in the document. */
- inline bool isGlobalName() const { return mnCalcSheet < 0; }
+ /** Returns true, if this defined name is a reference to a VBA macro. */
+ inline bool isVBName() const { return maModel.mbMacro && maModel.mbVBName; }
- /** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */
- inline sal_Int32 getTokenIndex() const { return mnTokenIndex; }
/** Returns the 0-based sheet index for local names, or -1 for global names. */
inline sal_Int16 getLocalCalcSheet() const { return mnCalcSheet; }
+ /** Returns the built-in identifier of the defined name. */
+ inline sal_Unicode getBuiltinId() const { return mcBuiltinId; }
+ /** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */
+ inline sal_Int32 getTokenIndex() const { return mnTokenIndex; }
/** Tries to resolve the defined name to an absolute cell range. */
bool getAbsoluteRange( ::com::sun::star::table::CellRangeAddress& orRange ) const;
private:
- /** Imports the OOX or OOBIN formula, using the passed formula context. */
+ /** 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 );
@@ -163,7 +165,7 @@ private:
sal_Int32 mnTokenIndex; /// Name index used in API token array.
sal_Int16 mnCalcSheet; /// Calc sheet index for sheet-local names.
sal_Unicode mcBuiltinId; /// Identifier for built-in defined names.
- StreamDataSeqPtr mxFormula; /// Formula data for OOBIN import.
+ StreamDataSeqPtr mxFormula; /// Formula data for BIFF12 import.
BiffStreamPosPtr mxBiffStrm; /// Cached BIFF stream for formula import.
sal_uInt16 mnFmlaSize; /// Cached BIFF formula size for formula import.
};
@@ -183,7 +185,7 @@ public:
/** Imports a defined name from the passed attribute set. */
DefinedNameRef importDefinedName( const AttributeList& rAttribs );
/** Imports a defined name from a DEFINEDNAME record in the passed stream. */
- void importDefinedName( RecordInputStream& rStrm );
+ void importDefinedName( SequenceInputStream& rStrm );
/** Imports a defined name from a DEFINEDNAME record in the passed BIFF stream. */
void importDefinedName( BiffInputStream& rStrm );
@@ -199,16 +201,27 @@ public:
If no local name is found, tries to find a matching global name.
@return Reference to the defined name or empty reference. */
DefinedNameRef getByModelName( const ::rtl::OUString& rModelName, sal_Int16 nCalcSheet = -1 ) const;
+ /** Returns a built-in defined name by its built-in identifier.
+ @param nSheet The sheet index of the built-in name.
+ @return Reference to the defined name or empty reference. */
+ DefinedNameRef getByBuiltinId( sal_Unicode cBuiltinId, sal_Int16 nCalcSheet ) const;
private:
DefinedNameRef createDefinedName();
private:
+ typedef ::std::pair< sal_Int16, ::rtl::OUString > SheetNameKey;
+ typedef ::std::pair< sal_Int16, sal_Unicode > BuiltinKey;
+
typedef RefVector< DefinedName > DefNameVector;
- typedef RefMap< sal_Int32, DefinedName > DefNameMap;
+ typedef RefMap< SheetNameKey, DefinedName > DefNameNameMap;
+ typedef RefMap< BuiltinKey, DefinedName > DefNameBuiltinMap;
+ typedef RefMap< sal_Int32, DefinedName > DefNameTokenIdMap;
DefNameVector maDefNames; /// List of all defined names in insertion order.
- DefNameMap maDefNameMap; /// Maps all defined names by API token index.
+ DefNameNameMap maModelNameMap; /// Maps all defined names by sheet index and model name.
+ DefNameBuiltinMap maBuiltinMap; /// Maps all defined names by sheet index and built-in identifier.
+ DefNameTokenIdMap maTokenIdMap; /// Maps all defined names by API token index.
sal_Int16 mnCalcSheet; /// Current sheet index for BIFF2-BIFF4 names (always sheet-local).
};
@@ -218,4 +231,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx
index 66d716220b8a..0d3360323a94 100644
--- a/oox/inc/oox/xls/drawingfragment.hxx
+++ b/oox/inc/oox/xls/drawingfragment.hxx
@@ -31,14 +31,25 @@
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/awt/Size.hpp>
#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapegroupcontext.hxx"
+#include "oox/ole/axcontrol.hxx"
+#include "oox/ole/vbaproject.hxx"
#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmldrawingfragment.hxx"
+#include "oox/vml/vmltextbox.hxx"
#include "oox/xls/excelhandlers.hxx"
+namespace oox { namespace ole {
+ struct AxFontData;
+ class AxMorphDataModelBase;
+} }
+
namespace oox {
namespace xls {
// ============================================================================
+// DrawingML
+// ============================================================================
/** Absolute position in spreadsheet (in EMUs) independent from cells. */
struct AnchorPosModel : public ::oox::drawingml::EmuPoint
@@ -100,6 +111,7 @@ public:
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. */
@@ -131,19 +143,81 @@ typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef;
// ============================================================================
+class ShapeMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
+{
+public:
+ explicit ShapeMacroAttacher( const ::rtl::OUString& rMacroName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape );
+
+private:
+ virtual void attachMacro( const ::rtl::OUString& rMacroUrl );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
+};
+
+// ============================================================================
+
+class Shape : public ::oox::drawingml::Shape, public WorksheetHelper
+{
+public:
+ explicit Shape(
+ const WorksheetHelper& rHelper,
+ const AttributeList& rAttribs,
+ const sal_Char* pcServiceName = 0 );
+
+protected:
+ virtual void finalizeXShape(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+
+private:
+ ::rtl::OUString maMacroName;
+};
+
+// ============================================================================
+
+/** Context handler for creation of shapes embedded in group shapes. */
+class GroupShapeContext : public ::oox::drawingml::ShapeGroupContext, public WorksheetHelper
+{
+public:
+ explicit GroupShapeContext(
+ ::oox::core::ContextHandler& rParent,
+ const WorksheetHelper& rHelper,
+ const ::oox::drawingml::ShapePtr& rxParentShape,
+ const ::oox::drawingml::ShapePtr& rxShape );
+
+ static ::oox::core::ContextHandlerRef
+ createShapeContext(
+ ::oox::core::ContextHandler& rParent,
+ const WorksheetHelper& rHelper,
+ sal_Int32 nElement,
+ const AttributeList& rAttribs,
+ const ::oox::drawingml::ShapePtr& rxParentShape,
+ ::oox::drawingml::ShapePtr* pxShape = 0 );
+
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ============================================================================
+
/** Fragment handler for a complete sheet drawing. */
-class OoxDrawingFragment : public OoxWorksheetFragmentBase
+class DrawingFragment : public WorksheetFragmentBase
{
public:
- explicit OoxDrawingFragment(
+ explicit DrawingFragment(
const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
private:
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
@@ -155,6 +229,27 @@ private:
};
// ============================================================================
+// VML
+// ============================================================================
+
+class VmlControlMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
+{
+public:
+ explicit VmlControlMacroAttacher( const ::rtl::OUString& rMacroName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rxCtrlFormIC,
+ sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle );
+
+private:
+ virtual void attachMacro( const ::rtl::OUString& rMacroUrl );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxCtrlFormIC;
+ sal_Int32 mnCtrlIndex;
+ sal_Int32 mnCtrlType;
+ sal_Int32 mnDropStyle;
+};
+
+// ============================================================================
class VmlDrawing : public ::oox::vml::Drawing, public WorksheetHelper
{
@@ -167,29 +262,55 @@ public:
/** Filters cell note shapes. */
virtual bool isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const;
+ /** Returns additional base names for automatic shape name creation. */
+ virtual ::rtl::OUString getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) const;
+
/** Calculates the shape rectangle from a cell anchor string. */
- virtual bool convertShapeClientAnchor(
+ virtual bool convertClientAnchor(
::com::sun::star::awt::Rectangle& orShapeRect,
const ::rtl::OUString& rShapeAnchor ) const;
- /** Converts additional form control properties from the passed VML shape
- client data. */
- virtual void convertControlClientData(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
- const ::oox::vml::ShapeClientData& rClientData ) const;
+ /** Creates a UNO control shape for legacy drawing controls. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertClientXShape(
+ const ::oox::vml::ShapeBase& rShape,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
/** Updates the bounding box covering all shapes of this drawing. */
- virtual void notifyShapeInserted(
+ virtual void notifyXShapeInserted(
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
- const ::com::sun::star::awt::Rectangle& rShapeRect );
+ const ::com::sun::star::awt::Rectangle& rShapeRect,
+ const ::oox::vml::ShapeBase& rShape, bool bGroupChild );
+
+private:
+ /** Converts the passed VML textbox text color to an OLE color. */
+ sal_uInt32 convertControlTextColor( const ::rtl::OUString& rTextColor ) const;
+ /** Converts the passed VML textbox font to an ActiveX form control font. */
+ void convertControlFontData(
+ ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor,
+ const ::oox::vml::TextFontModel& rFontModel ) const;
+ /** Converts the caption, the font settings, and the horizontal alignment
+ from the passed VML textbox to ActiveX form control settings. */
+ void convertControlText(
+ ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, ::rtl::OUString& rCaption,
+ const ::oox::vml::TextBox* pTextBox, sal_Int32 nTextHAlign ) const;
+ /** Converts the passed VML shape background formatting to ActiveX control formatting. */
+ void convertControlBackground(
+ ::oox::ole::AxMorphDataModelBase& rAxModel,
+ const ::oox::vml::ShapeBase& rShape ) const;
+
+private:
+ ::oox::ole::ControlConverter maControlConv;
+ ::oox::vml::TextFontModel maListBoxFont;
};
// ============================================================================
-class OoxVmlDrawingFragment : public ::oox::vml::DrawingFragment, public WorksheetHelper
+class VmlDrawingFragment : public ::oox::vml::DrawingFragment, public WorksheetHelper
{
public:
- explicit OoxVmlDrawingFragment(
+ explicit VmlDrawingFragment(
const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
@@ -203,4 +324,3 @@ protected:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/excelchartconverter.hxx b/oox/inc/oox/xls/excelchartconverter.hxx
index 08c3398a5718..a46d484f2074 100644
--- a/oox/inc/oox/xls/excelchartconverter.hxx
+++ b/oox/inc/oox/xls/excelchartconverter.hxx
@@ -59,4 +59,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx
index b5d7a97f33b5..789cbc99cb07 100644
--- a/oox/inc/oox/xls/excelfilter.hxx
+++ b/oox/inc/oox/xls/excelfilter.hxx
@@ -28,8 +28,8 @@
#ifndef OOX_XLS_EXCELFILTER_HXX
#define OOX_XLS_EXCELFILTER_HXX
-#include "oox/core/xmlfilterbase.hxx"
#include "oox/core/binaryfilterbase.hxx"
+#include "oox/core/xmlfilterbase.hxx"
namespace oox {
namespace xls {
@@ -59,7 +59,8 @@ class ExcelFilter : public ::oox::core::XmlFilterBase, public ExcelFilterBase
{
public:
explicit ExcelFilter(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~ExcelFilter();
virtual bool importDocument() throw();
@@ -72,6 +73,7 @@ public:
private:
virtual GraphicHelper* implCreateGraphicHelper() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
virtual ::rtl::OUString implGetImplementationName() const;
};
@@ -81,7 +83,8 @@ class ExcelBiffFilter : public ::oox::core::BinaryFilterBase, public ExcelFilter
{
public:
explicit ExcelBiffFilter(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~ExcelBiffFilter();
virtual bool importDocument() throw();
@@ -89,13 +92,28 @@ public:
private:
virtual GraphicHelper* implCreateGraphicHelper() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
virtual ::rtl::OUString implGetImplementationName() const;
};
// ============================================================================
+class ExcelVbaProjectFilter : public ExcelBiffFilter
+{
+public:
+ explicit ExcelVbaProjectFilter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+private:
+ virtual ::rtl::OUString implGetImplementationName() const;
+};
+ // ============================================================================
+
} // namespace xls
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx
index 986f42aadba4..864f5f9a9e44 100644
--- a/oox/inc/oox/xls/excelhandlers.hxx
+++ b/oox/inc/oox/xls/excelhandlers.hxx
@@ -41,17 +41,17 @@ namespace xls {
Used to import contexts in global workbook fragments.
*/
-class OoxWorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper
+class WorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper
{
public:
template< typename ParentType >
- explicit OoxWorkbookContextBase( ParentType& rParent );
+ explicit WorkbookContextBase( ParentType& rParent );
};
// ----------------------------------------------------------------------------
template< typename ParentType >
-OoxWorkbookContextBase::OoxWorkbookContextBase( ParentType& rParent ) :
+WorkbookContextBase::WorkbookContextBase( ParentType& rParent ) :
::oox::core::ContextHandler2( rParent ),
WorkbookHelper( rParent )
{
@@ -63,32 +63,32 @@ OoxWorkbookContextBase::OoxWorkbookContextBase( ParentType& rParent ) :
Used to import contexts in sheet fragments.
*/
-class OoxWorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelperRoot
+class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelperRoot
{
public:
template< typename ParentType >
- explicit OoxWorksheetContextBase(
+ explicit WorksheetContextBase(
ParentType& rParent,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
WorksheetType eSheetType,
sal_Int16 nSheet );
template< typename ParentType >
- explicit OoxWorksheetContextBase( ParentType& rParent );
+ explicit WorksheetContextBase( ParentType& rParent );
};
// ----------------------------------------------------------------------------
template< typename ParentType >
-OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent,
- ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+WorksheetContextBase::WorksheetContextBase( ParentType& rParent,
+ const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
::oox::core::ContextHandler2( rParent ),
- WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
+ WorksheetHelperRoot( rParent, rxProgressBar, eSheetType, nSheet )
{
}
template< typename ParentType >
-OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent ) :
+WorksheetContextBase::WorksheetContextBase( ParentType& rParent ) :
::oox::core::ContextHandler2( rParent ),
WorksheetHelperRoot( rParent )
{
@@ -100,10 +100,10 @@ OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent ) :
Used to import global workbook fragments.
*/
-class OoxWorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper
+class WorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper
{
public:
- explicit OoxWorkbookFragmentBase(
+ explicit WorkbookFragmentBase(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
};
@@ -114,17 +114,17 @@ public:
Used to import sheet fragments.
*/
-class OoxWorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelperRoot
+class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelperRoot
{
public:
- explicit OoxWorksheetFragmentBase(
+ explicit WorksheetFragmentBase(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
WorksheetType eSheetType,
sal_Int16 nSheet );
- explicit OoxWorksheetFragmentBase(
+ explicit WorksheetFragmentBase(
const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
};
@@ -132,72 +132,21 @@ public:
// ============================================================================
// ============================================================================
-/** An enumeration for all types of fragments in a BIFF workbook stream. */
-enum BiffFragmentType
-{
- BIFF_FRAGMENT_GLOBALS, /// Workbook globals fragment.
- BIFF_FRAGMENT_WORKSHEET, /// Worksheet fragment.
- BIFF_FRAGMENT_CHARTSHEET, /// Chart sheet fragment.
- BIFF_FRAGMENT_MACROSHEET, /// Macro sheet fragment.
- BIFF_FRAGMENT_MODULESHEET, /// BIFF5 VB module fragment.
- BIFF_FRAGMENT_EMPTYSHEET, /// Sheet fragment of unsupported type.
- BIFF_FRAGMENT_WORKSPACE, /// BIFF4 workspace/workbook globals.
- BIFF_FRAGMENT_UNKNOWN /// Unknown fragment/error.
-};
-
-// ============================================================================
-
-/** Base class for all BIFF context handlers and fragment handlers.
-
- This base class holds a reference to the BIFF input stream which can be
- accessed in all derived classes.
- */
-class BiffHandlerBase
-{
-protected:
- inline explicit BiffHandlerBase( BiffInputStream& rStrm ) : mrStrm( rStrm ) {}
- virtual ~BiffHandlerBase();
-
- /** Skips a block of records up to the specified end record.
-
- Skips all records until next end record. When this function returns,
- stream points to the end record, and the next call of startNextRecord()
- at the stream will start the record following the end record.
-
- The identifier of the record that is active while this function is
- called is used as start record identifier. This identifier is used to
- correctly skip embedded record blocks with the same start and end
- record identifier.
-
- @return True = stream points to the end record.
- */
- bool skipRecordBlock( sal_uInt16 nEndRecId );
-
- /** @return True = current record identifier is a BOF record. */
- bool isBofRecord() const;
-
-protected:
- BiffInputStream& mrStrm;
-};
-
-// ============================================================================
-
/** Base class for all BIFF context handlers.
Derived handlers have to implement the importRecord() function that has to
- import the record the BIFF input stream currently points to.
+ import the record the passed BIFF input stream currently points to.
*/
-class BiffContextHandler : public BiffHandlerBase
+class BiffContextHandler
{
public:
- /** Derived classes have to implement importing the current record. */
- virtual void importRecord() = 0;
+ virtual ~BiffContextHandler();
-protected:
- explicit BiffContextHandler( const BiffHandlerBase& rParent );
+ /** Derived classes have to implement importing the current record. */
+ virtual void importRecord( BiffInputStream& rStrm ) = 0;
};
-// ============================================================================
+// ----------------------------------------------------------------------------
/** Context handler derived from the WorkbookHelper helper class.
@@ -206,21 +155,11 @@ protected:
class BiffWorkbookContextBase : public BiffContextHandler, public WorkbookHelper
{
protected:
- template< typename ParentType >
- explicit BiffWorkbookContextBase( const ParentType& rParent );
+ explicit BiffWorkbookContextBase( const WorkbookHelper& rHelper );
};
// ----------------------------------------------------------------------------
-template< typename ParentType >
-BiffWorkbookContextBase::BiffWorkbookContextBase( const ParentType& rParent ) :
- BiffContextHandler( rParent ),
- WorkbookHelper( rParent )
-{
-}
-
-// ============================================================================
-
/** Context handler derived from the WorksheetHelper helper class.
Used to import contexts in sheet fragments.
@@ -228,68 +167,48 @@ BiffWorkbookContextBase::BiffWorkbookContextBase( const ParentType& rParent ) :
class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelperRoot
{
protected:
- template< typename ParentType >
explicit BiffWorksheetContextBase(
- const ParentType& rParent,
- ISegmentProgressBarRef xProgressBar,
+ const WorkbookHelper& rHelper,
+ const ISegmentProgressBarRef& rxProgressBar,
WorksheetType eSheetType,
sal_Int16 nSheet );
- template< typename ParentType >
- explicit BiffWorksheetContextBase( const ParentType& rParent );
+ explicit BiffWorksheetContextBase( const WorksheetHelper& rHelper );
};
-// ----------------------------------------------------------------------------
-
-template< typename ParentType >
-BiffWorksheetContextBase::BiffWorksheetContextBase( const ParentType& rParent,
- ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
- BiffContextHandler( rParent ),
- WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
-{
-}
-
-template< typename ParentType >
-BiffWorksheetContextBase::BiffWorksheetContextBase( const ParentType& rParent ) :
- BiffContextHandler( rParent ),
- WorksheetHelperRoot( rParent )
-{
-}
-
// ============================================================================
-namespace prv {
-
-struct BiffFragmentStreamOwner
+/** An enumeration for all types of fragments in a BIFF workbook stream. */
+enum BiffFragmentType
{
- typedef ::boost::shared_ptr< BinaryXInputStream > XInputStreamRef;
- typedef ::boost::shared_ptr< BiffInputStream > BiffInputStreamRef;
-
- XInputStreamRef mxXInStrm;
- BiffInputStreamRef mxBiffStrm;
-
- explicit BiffFragmentStreamOwner( const ::oox::core::FilterBase& rFilter, const ::rtl::OUString& rStrmName );
- virtual ~BiffFragmentStreamOwner();
+ BIFF_FRAGMENT_GLOBALS, /// Workbook globals fragment.
+ BIFF_FRAGMENT_WORKSHEET, /// Worksheet fragment.
+ BIFF_FRAGMENT_CHARTSHEET, /// Chart sheet fragment.
+ BIFF_FRAGMENT_MACROSHEET, /// Macro sheet fragment.
+ BIFF_FRAGMENT_MODULESHEET, /// BIFF5 VB module fragment.
+ BIFF_FRAGMENT_EMPTYSHEET, /// Sheet fragment of unsupported type.
+ BIFF_FRAGMENT_WORKSPACE, /// BIFF4 workspace/workbook globals.
+ BIFF_FRAGMENT_UNKNOWN /// Unknown fragment/error.
};
-} // namespace prv
-
// ----------------------------------------------------------------------------
-class BiffFragmentHandler : private prv::BiffFragmentStreamOwner, public BiffHandlerBase
+class BiffFragmentHandler
{
public:
- /** Imports the fragment, returns true, if EOF record has been reached. */
- virtual bool importFragment() = 0;
-
-protected:
/** Opens the stream with the passed full name. */
explicit BiffFragmentHandler(
const ::oox::core::FilterBase& rFilter,
const ::rtl::OUString& rStrmName );
- /** Reuses the stream of the passed fragment. */
- explicit BiffFragmentHandler( const BiffFragmentHandler& rHandler );
+ virtual ~BiffFragmentHandler();
+
+ /** Imports the fragment, returns true, if EOF record has been reached. */
+ virtual bool importFragment() = 0;
+
+protected:
+ /** Returns the BIFF input stream of this fragment. */
+ inline BiffInputStream& getInputStream() { return *mxBiffStrm; }
/** Starts a new fragment in a workbbok stream and returns the fragment type.
@@ -326,11 +245,14 @@ protected:
bool skipFragment();
private:
- /** Implementation helper for the startFragment() functions. */
- BiffFragmentType implStartFragment( BiffType eBiff );
+ typedef ::boost::shared_ptr< BinaryXInputStream > XInputStreamRef;
+ typedef ::boost::shared_ptr< BiffInputStream > BiffInputStreamRef;
+
+ XInputStreamRef mxXInStrm;
+ BiffInputStreamRef mxBiffStrm;
};
-// ============================================================================
+// ----------------------------------------------------------------------------
/** Fragment handler derived from the WorkbookHelper helper class.
@@ -345,7 +267,7 @@ protected:
bool bCloneDecoder = false );
};
-// ============================================================================
+// ----------------------------------------------------------------------------
/** Fragment handler derived from the WorksheetHelper helper class.
@@ -356,12 +278,12 @@ class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHe
protected:
explicit BiffWorksheetFragmentBase(
const BiffWorkbookFragmentBase& rParent,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
WorksheetType eSheetType,
sal_Int16 nSheet );
};
-// ============================================================================
+// ----------------------------------------------------------------------------
/** Special fragment handler for worksheets that have to be skipped.
*/
@@ -370,7 +292,7 @@ class BiffSkipWorksheetFragment : public BiffWorksheetFragmentBase
public:
explicit BiffSkipWorksheetFragment(
const BiffWorkbookFragmentBase& rParent,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
sal_Int16 nSheet );
virtual bool importFragment();
@@ -383,4 +305,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/excelvbaproject.hxx b/oox/inc/oox/xls/excelvbaproject.hxx
index 121e6a1667cd..96dabd08b5d7 100755
--- a/oox/inc/oox/xls/excelvbaproject.hxx
+++ b/oox/inc/oox/xls/excelvbaproject.hxx
@@ -45,12 +45,9 @@ class OOX_DLLPUBLIC ExcelVbaProject : public ::oox::ole::VbaProject
{
public:
explicit ExcelVbaProject(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument );
- /** Generates VBA modules for sheets that do not specify a codename. */
- void createMissingModules();
-
protected:
/** Adds dummy modules for sheets without imported code name. */
virtual void prepareImport();
diff --git a/oox/inc/oox/xls/externallinkbuffer.hxx b/oox/inc/oox/xls/externallinkbuffer.hxx
index b9980cc21e2f..c616a2b97e97 100644
--- a/oox/inc/oox/xls/externallinkbuffer.hxx
+++ b/oox/inc/oox/xls/externallinkbuffer.hxx
@@ -84,19 +84,19 @@ public:
void importOleItem( const AttributeList& rAttribs );
/** Imports the EXTERNALNAME record containing the name (only). */
- void importExternalName( RecordInputStream& rStrm );
+ void importExternalName( SequenceInputStream& rStrm );
/** Imports the EXTERNALNAMEFLAGS record containing the settings of an external name. */
- void importExternalNameFlags( RecordInputStream& rStrm );
+ void importExternalNameFlags( SequenceInputStream& rStrm );
/** Imports the DDEITEMVALUES record containing the size of the DDE result matrix. */
- void importDdeItemValues( RecordInputStream& rStrm );
+ void importDdeItemValues( SequenceInputStream& rStrm );
/** Imports the DDEITEM_BOOL record containing a boolean value in a link result. */
- void importDdeItemBool( RecordInputStream& rStrm );
+ void importDdeItemBool( SequenceInputStream& rStrm );
/** Imports the DDEITEM_DOUBLE record containing a double value in a link result. */
- void importDdeItemDouble( RecordInputStream& rStrm );
+ void importDdeItemDouble( SequenceInputStream& rStrm );
/** Imports the DDEITEM_ERROR record containing an error code in a link result. */
- void importDdeItemError( RecordInputStream& rStrm );
+ void importDdeItemError( SequenceInputStream& rStrm );
/** Imports the DDEITEM_STRING record containing a string in a link result. */
- void importDdeItemString( RecordInputStream& rStrm );
+ void importDdeItemString( SequenceInputStream& rStrm );
/** Imports the EXTERNALNAME record from the passed stream. */
void importExternalName( BiffInputStream& rStrm );
@@ -227,19 +227,19 @@ public:
ExternalNameRef importOleItem( const AttributeList& rAttribs );
/** Imports the EXTERNALBOOK record describing an externally linked document, DDE link, or OLE link. */
- void importExternalBook( const ::oox::core::Relations& rRelations, RecordInputStream& rStrm );
+ void importExternalBook( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
/** Imports the EXTSHEETNAMES record containing the sheet names in an externally linked document. */
- void importExtSheetNames( RecordInputStream& rStrm );
+ void importExtSheetNames( SequenceInputStream& rStrm );
/** Imports the EXTERNALNAME record describing an external name. */
- ExternalNameRef importExternalName( RecordInputStream& rStrm );
+ ExternalNameRef importExternalName( SequenceInputStream& rStrm );
/** Imports the EXTERNALREF record from the passed stream. */
- void importExternalRef( RecordInputStream& rStrm );
+ void importExternalRef( SequenceInputStream& rStrm );
/** Imports the EXTERNALSELF record from the passed stream. */
- void importExternalSelf( RecordInputStream& rStrm );
+ void importExternalSelf( SequenceInputStream& rStrm );
/** Imports the EXTERNALSAME record from the passed stream. */
- void importExternalSame( RecordInputStream& rStrm );
+ void importExternalSame( SequenceInputStream& rStrm );
/** Imports the EXTERNALADDIN record from the passed stream. */
- void importExternalAddin( RecordInputStream& rStrm );
+ void importExternalAddin( SequenceInputStream& rStrm );
/** Imports the EXTERNSHEET record from the passed stream. */
void importExternSheet( BiffInputStream& rStrm );
@@ -248,6 +248,9 @@ public:
/** Imports the EXTERNALNAME record from the passed stream. */
void importExternalName( BiffInputStream& rStrm );
+ /** Sets the link type to 'self reference'. */
+ inline void setSelfLinkType() { meLinkType = LINKTYPE_SELF; }
+
/** Returns the type of this external link. */
inline ExternalLinkType getLinkType() const { return meLinkType; }
/** Returns true, if the link refers to the current workbook. */
@@ -314,10 +317,10 @@ typedef ::boost::shared_ptr< ExternalLink > ExternalLinkRef;
// ============================================================================
-/** Represents a REF entry in the OOBIN EXTERNALSHEETS or in the BIFF8
+/** Represents a REF entry in the BIFF12 EXTERNALSHEETS or in the BIFF8
EXTERNSHEET record.
- This struct is used to map ref identifiers to external books (OOBIN:
+ This struct is used to map ref identifiers to external books (BIFF12:
EXTERNALREF records, BIFF8: EXTERNALBOOK records), and provides sheet
indexes into the sheet list of the external document.
*/
@@ -329,7 +332,7 @@ struct RefSheetsModel
explicit RefSheetsModel();
- void readOobData( RecordInputStream& rStrm );
+ void readBiff12Data( SequenceInputStream& rStrm );
void readBiff8Data( BiffInputStream& rStrm );
};
@@ -344,15 +347,15 @@ public:
ExternalLinkRef importExternalReference( const AttributeList& rAttribs );
/** Imports the EXTERNALREF record from the passed stream. */
- ExternalLinkRef importExternalRef( RecordInputStream& rStrm );
+ ExternalLinkRef importExternalRef( SequenceInputStream& rStrm );
/** Imports the EXTERNALSELF record from the passed stream. */
- void importExternalSelf( RecordInputStream& rStrm );
+ void importExternalSelf( SequenceInputStream& rStrm );
/** Imports the EXTERNALSAME record from the passed stream. */
- void importExternalSame( RecordInputStream& rStrm );
+ void importExternalSame( SequenceInputStream& rStrm );
/** Imports the EXTERNALADDIN record from the passed stream. */
- void importExternalAddin( RecordInputStream& rStrm );
+ void importExternalAddin( SequenceInputStream& rStrm );
/** Imports the EXTERNALSHEETS record from the passed stream. */
- void importExternalSheets( RecordInputStream& rStrm );
+ void importExternalSheets( SequenceInputStream& rStrm );
/** Imports the EXTERNSHEET record from the passed stream. */
ExternalLinkRef importExternSheet( BiffInputStream& rStrm );
@@ -368,7 +371,7 @@ public:
getLinkInfos() const;
/** Returns the external link for the passed reference identifier. */
- ExternalLinkRef getExternalLink( sal_Int32 nRefId ) const;
+ ExternalLinkRef getExternalLink( sal_Int32 nRefId, bool bUseRefSheets = true ) const;
/** Returns the sheet range for the specified reference (BIFF2-BIFF5 only). */
LinkSheetRange getSheetRange( sal_Int32 nRefId, sal_Int16 nTabId1, sal_Int16 nTabId2 ) const;
@@ -386,10 +389,11 @@ private:
typedef RefVector< ExternalLink > ExternalLinkVec;
typedef ::std::vector< RefSheetsModel > RefSheetsModelVec;
+ ExternalLinkRef mxSelfRef; /// Implicit self reference at index 0.
ExternalLinkVec maLinks; /// List of link structures for all kinds of links.
ExternalLinkVec maExtLinks; /// Real external links needed for formula parser.
RefSheetsModelVec maRefSheets; /// Sheet indexes for reference ids.
- bool mbUseRefSheets; /// True = use maRefSheets list (OOBIN only).
+ bool mbUseRefSheets; /// True = use maRefSheets list (BIFF12 only).
};
// ============================================================================
@@ -398,4 +402,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/externallinkfragment.hxx b/oox/inc/oox/xls/externallinkfragment.hxx
index ec310974818a..0e1f293d2444 100644
--- a/oox/inc/oox/xls/externallinkfragment.hxx
+++ b/oox/inc/oox/xls/externallinkfragment.hxx
@@ -37,41 +37,40 @@ namespace xls {
class ExternalLink;
// ============================================================================
+// ============================================================================
/** This class implements importing the sheetData element in external sheets.
The sheetData element embedded in the externalBook element contains cached
cells from externally linked sheets.
*/
-class OoxExternalSheetDataContext : public OoxWorkbookContextBase
+class ExternalSheetDataContext : public WorkbookContextBase
{
public:
- explicit OoxExternalSheetDataContext(
- OoxWorkbookFragmentBase& rFragment,
+ explicit ExternalSheetDataContext(
+ WorkbookFragmentBase& rFragment,
const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >& rxSheetCache );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
private:
/** Imports cell settings from a c element. */
void importCell( const AttributeList& rAttribs );
/** Imports the EXTCELL_BLANK from the passed stream. */
- void importExtCellBlank( RecordInputStream& rStrm );
+ void importExtCellBlank( SequenceInputStream& rStrm );
/** Imports the EXTCELL_BOOL from the passed stream. */
- void importExtCellBool( RecordInputStream& rStrm );
+ void importExtCellBool( SequenceInputStream& rStrm );
/** Imports the EXTCELL_DOUBLE from the passed stream. */
- void importExtCellDouble( RecordInputStream& rStrm );
+ void importExtCellDouble( SequenceInputStream& rStrm );
/** Imports the EXTCELL_ERROR from the passed stream. */
- void importExtCellError( RecordInputStream& rStrm );
+ void importExtCellError( SequenceInputStream& rStrm );
/** Imports the EXTCELL_STRING from the passed stream. */
- void importExtCellString( RecordInputStream& rStrm );
+ void importExtCellString( SequenceInputStream& rStrm );
/** Sets the passed cell value to the current position in the sheet cache. */
void setCellValue( const ::com::sun::star::uno::Any& rValue );
@@ -85,23 +84,20 @@ private:
// ============================================================================
-class OoxExternalLinkFragment : public OoxWorkbookFragmentBase
+class ExternalLinkFragment : public WorkbookFragmentBase
{
public:
- explicit OoxExternalLinkFragment(
+ explicit ExternalLinkFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath,
ExternalLink& rExtLink );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
-
- // oox.core.FragmentHandler2 interface ------------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
@@ -116,29 +112,24 @@ private:
};
// ============================================================================
+// ============================================================================
-class BiffExternalLinkFragment : public BiffWorkbookFragmentBase
+class BiffExternalSheetDataContext : public BiffWorkbookContextBase
{
public:
- explicit BiffExternalLinkFragment( const BiffWorkbookFragmentBase& rParent, bool bImportDefNames );
- virtual ~BiffExternalLinkFragment();
-
- /** Imports all records related to external links. */
- virtual bool importFragment();
+ explicit BiffExternalSheetDataContext( const WorkbookHelper& rHelper, bool bImportDefNames );
+ virtual ~BiffExternalSheetDataContext();
/** Tries to import a record related to external links and defined names. */
- void importRecord();
-
- /** Finalizes buffers related to external links and defined names. */
- void finalizeImport();
+ virtual void importRecord( BiffInputStream& rStrm );
private:
- void importExternSheet();
- void importExternalBook();
- void importExternalName();
- void importXct();
- void importCrn();
- void importDefinedName();
+ void importExternSheet( BiffInputStream& rStrm );
+ void importExternalBook( BiffInputStream& rStrm );
+ void importExternalName( BiffInputStream& rStrm );
+ void importXct( BiffInputStream& rStrm );
+ void importCrn( BiffInputStream& rStrm );
+ void importDefinedName( BiffInputStream& rStrm );
/** Sets the passed cell value to the passed position in the sheet cache. */
void setCellValue( const BinAddress& rBinAddr, const ::com::sun::star::uno::Any& rValue );
@@ -152,8 +143,19 @@ private:
// ============================================================================
+class BiffExternalLinkFragment : public BiffWorkbookFragmentBase
+{
+public:
+ explicit BiffExternalLinkFragment( const BiffWorkbookFragmentBase& rParent );
+
+ /** Imports all records related to external links. */
+ virtual bool importFragment();
+};
+
+// ============================================================================
+// ============================================================================
+
} // namespace xls
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx
index 510404d2b662..013e63f3bf30 100644
--- a/oox/inc/oox/xls/formulabase.hxx
+++ b/oox/inc/oox/xls/formulabase.hxx
@@ -28,19 +28,19 @@
#ifndef OOX_XLS_FORMULABASE_HXX
#define OOX_XLS_FORMULABASE_HXX
-#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
+#include <com/sun/star/sheet/FormulaToken.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/sheet/FormulaToken.hpp>
-#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
-#include "oox/helper/containerhelper.hxx"
+#include <com/sun/star/uno/Sequence.hxx>
#include "oox/helper/propertyset.hxx"
+#include "oox/helper/refvector.hxx"
#include "oox/xls/addressconverter.hxx"
namespace com { namespace sun { namespace star {
+ namespace sheet { class XFormulaOpCodeMapper; }
namespace sheet { class XFormulaParser; }
namespace sheet { class XFormulaTokens; }
- namespace sheet { class XFormulaOpCodeMapper; }
} } }
namespace oox { template< typename Type > class Matrix; }
@@ -126,24 +126,14 @@ const sal_uInt8 BIFF_TOKID_AREAERR3D = 0x1D; /// Deleted 3D area
// specific token constants ---------------------------------------------------
-const sal_uInt8 OOBIN_TOK_ARRAY_DOUBLE = 0;
-const sal_uInt8 OOBIN_TOK_ARRAY_STRING = 1;
-const sal_uInt8 OOBIN_TOK_ARRAY_BOOL = 2;
-const sal_uInt8 OOBIN_TOK_ARRAY_ERROR = 4;
+const sal_uInt8 BIFF_TOK_ARRAY_DOUBLE = 0; /// Double value in an array.
+const sal_uInt8 BIFF_TOK_ARRAY_STRING = 1; /// String value in an array.
+const sal_uInt8 BIFF_TOK_ARRAY_BOOL = 2; /// Boolean value in an array.
+const sal_uInt8 BIFF_TOK_ARRAY_ERROR = 4; /// Error code in an array.
const sal_uInt8 BIFF_TOK_BOOL_FALSE = 0; /// FALSE value of a tBool token.
const sal_uInt8 BIFF_TOK_BOOL_TRUE = 1; /// TRUE value of a tBool token.
-const sal_uInt8 OOBIN_TOK_ATTR_VOLATILE = 0x01; /// Volatile function.
-const sal_uInt8 OOBIN_TOK_ATTR_IF = 0x02; /// Start of true condition in IF function.
-const sal_uInt8 OOBIN_TOK_ATTR_CHOOSE = 0x04; /// Jump array of CHOOSE function.
-const sal_uInt8 OOBIN_TOK_ATTR_SKIP = 0x08; /// Skip tokens.
-const sal_uInt8 OOBIN_TOK_ATTR_SUM = 0x10; /// SUM function with one parameter.
-const sal_uInt8 OOBIN_TOK_ATTR_ASSIGN = 0x20; /// BASIC style assignment.
-const sal_uInt8 OOBIN_TOK_ATTR_SPACE = 0x40; /// Spaces in formula representation.
-const sal_uInt8 OOBIN_TOK_ATTR_SPACE_VOLATILE = 0x41; /// Leading spaces and volatile formula.
-const sal_uInt8 OOBIN_TOK_ATTR_IFERROR = 0x80; /// Start of condition in IFERROR function.
-
const sal_uInt8 BIFF_TOK_ATTR_VOLATILE = 0x01; /// Volatile function.
const sal_uInt8 BIFF_TOK_ATTR_IF = 0x02; /// Start of true condition in IF function.
const sal_uInt8 BIFF_TOK_ATTR_CHOOSE = 0x04; /// Jump array of CHOOSE function.
@@ -152,6 +142,7 @@ const sal_uInt8 BIFF_TOK_ATTR_SUM = 0x10; /// SUM function wit
const sal_uInt8 BIFF_TOK_ATTR_ASSIGN = 0x20; /// BASIC style assignment.
const sal_uInt8 BIFF_TOK_ATTR_SPACE = 0x40; /// Spaces in formula representation.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_VOLATILE = 0x41; /// Leading spaces and volatile formula.
+const sal_uInt8 BIFF_TOK_ATTR_IFERROR = 0x80; /// Start of condition in IFERROR function (BIFF12 only).
const sal_uInt8 BIFF_TOK_ATTR_SPACE_SP = 0x00; /// Spaces before next token.
const sal_uInt8 BIFF_TOK_ATTR_SPACE_BR = 0x01; /// Line breaks before next token.
@@ -166,27 +157,27 @@ const sal_uInt16 BIFF_TOK_FUNCVAR_FUNCIDMASK = 0x7FFF; /// Mask for functio
const sal_uInt8 BIFF_TOK_FUNCVAR_CMDPROMPT = 0x80; /// User prompt for macro commands.
const sal_uInt8 BIFF_TOK_FUNCVAR_COUNTMASK = 0x7F; /// Mask for parameter count.
-const sal_uInt16 OOBIN_TOK_REF_COLMASK = 0x3FFF; /// Mask to extract column from reference.
-const sal_Int32 OOBIN_TOK_REF_ROWMASK = 0xFFFFF; /// Mask to extract row from reference.
-const sal_uInt16 OOBIN_TOK_REF_COLREL = 0x4000; /// True = column is relative.
-const sal_uInt16 OOBIN_TOK_REF_ROWREL = 0x8000; /// True = row is relative.
+const sal_uInt16 BIFF12_TOK_REF_COLMASK = 0x3FFF; /// Mask to extract column from reference (BIFF12).
+const sal_Int32 BIFF12_TOK_REF_ROWMASK = 0xFFFFF; /// Mask to extract row from reference (BIFF12).
+const sal_uInt16 BIFF12_TOK_REF_COLREL = 0x4000; /// True = column is relative (BIFF12).
+const sal_uInt16 BIFF12_TOK_REF_ROWREL = 0x8000; /// True = row is relative (BIFF12).
const sal_uInt16 BIFF_TOK_REF_COLMASK = 0x00FF; /// Mask to extract BIFF8 column from reference.
const sal_uInt16 BIFF_TOK_REF_ROWMASK = 0x3FFF; /// Mask to extract BIFF2-BIFF5 row from reference.
const sal_uInt16 BIFF_TOK_REF_COLREL = 0x4000; /// True = column is relative.
const sal_uInt16 BIFF_TOK_REF_ROWREL = 0x8000; /// True = row is relative.
-const sal_uInt16 OOBIN_TOK_TABLE_COLUMN = 0x0001; /// Table reference: Single column.
-const sal_uInt16 OOBIN_TOK_TABLE_COLRANGE = 0x0002; /// Table reference: Range of columns.
-const sal_uInt16 OOBIN_TOK_TABLE_ALL = 0x0004; /// Table reference: Special [#All] range.
-const sal_uInt16 OOBIN_TOK_TABLE_HEADERS = 0x0008; /// Table reference: Special [#Headers] range.
-const sal_uInt16 OOBIN_TOK_TABLE_DATA = 0x0010; /// Table reference: Special [#Data] range.
-const sal_uInt16 OOBIN_TOK_TABLE_TOTALS = 0x0020; /// Table reference: Special [#Totals] range.
-const sal_uInt16 OOBIN_TOK_TABLE_THISROW = 0x0040; /// Table reference: Special [#This Row] range.
-const sal_uInt16 OOBIN_TOK_TABLE_SP_BRACKETS = 0x0080; /// Table reference: Spaces in outer brackets.
-const sal_uInt16 OOBIN_TOK_TABLE_SP_SEP = 0x0100; /// Table reference: Spaces after separators.
-const sal_uInt16 OOBIN_TOK_TABLE_ROW = 0x0200; /// Table reference: Single row.
-const sal_uInt16 OOBIN_TOK_TABLE_CELL = 0x0400; /// Table reference: Single cell.
+const sal_uInt16 BIFF12_TOK_TABLE_COLUMN = 0x0001; /// Table reference: Single column.
+const sal_uInt16 BIFF12_TOK_TABLE_COLRANGE = 0x0002; /// Table reference: Range of columns.
+const sal_uInt16 BIFF12_TOK_TABLE_ALL = 0x0004; /// Table reference: Special [#All] range.
+const sal_uInt16 BIFF12_TOK_TABLE_HEADERS = 0x0008; /// Table reference: Special [#Headers] range.
+const sal_uInt16 BIFF12_TOK_TABLE_DATA = 0x0010; /// Table reference: Special [#Data] range.
+const sal_uInt16 BIFF12_TOK_TABLE_TOTALS = 0x0020; /// Table reference: Special [#Totals] range.
+const sal_uInt16 BIFF12_TOK_TABLE_THISROW = 0x0040; /// Table reference: Special [#This Row] range.
+const sal_uInt16 BIFF12_TOK_TABLE_SP_BRACKETS = 0x0080; /// Table reference: Spaces in outer brackets.
+const sal_uInt16 BIFF12_TOK_TABLE_SP_SEP = 0x0100; /// Table reference: Spaces after separators.
+const sal_uInt16 BIFF12_TOK_TABLE_ROW = 0x0200; /// Table reference: Single row.
+const sal_uInt16 BIFF12_TOK_TABLE_CELL = 0x0400; /// Table reference: Single cell.
const sal_uInt8 BIFF_TOK_NLR_ERR = 0x01; /// NLR: Invalid/deleted.
const sal_uInt8 BIFF_TOK_NLR_ROWR = 0x02; /// NLR: Row index.
@@ -209,23 +200,21 @@ const sal_uInt32 BIFF_TOK_NLR_ADDMASK = 0x3FFFFFFF; /// Mask for num
// function constants ---------------------------------------------------------
-const sal_uInt8 OOX_MAX_PARAMCOUNT = 255; /// Maximum parameter count for OOXML/OOBIN files.
-const sal_uInt8 BIFF_MAX_PARAMCOUNT = 30; /// Maximum parameter count for BIFF files.
-
-const sal_uInt16 OOBIN_FUNC_IF = 1; /// OOBIN function id of the IF function.
-const sal_uInt16 OOBIN_FUNC_SUM = 4; /// OOBIN function id of the SUM function.
-const sal_uInt16 OOBIN_FUNC_TRUE = 34; /// OOBIN function id of the TRUE function.
-const sal_uInt16 OOBIN_FUNC_FALSE = 35; /// OOBIN function id of the FALSE function.
-const sal_uInt16 OOBIN_FUNC_ROWS = 76; /// OOBIN function id of the ROWS function.
-const sal_uInt16 OOBIN_FUNC_COLUMNS = 77; /// OOBIN function id of the COLUMNS function.
-const sal_uInt16 OOBIN_FUNC_OFFSET = 78; /// OOBIN function id of the OFFSET function.
-const sal_uInt16 OOBIN_FUNC_FLOOR = 285; /// OOBIN function id of the FLOOR function.
-const sal_uInt16 OOBIN_FUNC_CEILING = 288; /// OOBIN function id of the CEILING function.
-const sal_uInt16 OOBIN_FUNC_HYPERLINK = 359; /// OOBIN function id of the HYPERLINK function.
-const sal_uInt16 OOBIN_FUNC_WEEKNUM = 465; /// OOBIN function id of the WEEKNUM function.
-
-const sal_uInt16 BIFF_FUNC_SUM = 4; /// BIFF function id of the SUM function.
+const sal_uInt8 OOX_MAX_PARAMCOUNT = 255; /// Maximum parameter count for OOXML/BIFF12 files.
+const sal_uInt8 BIFF_MAX_PARAMCOUNT = 30; /// Maximum parameter count for BIFF2-BIFF8 files.
+
+const sal_uInt16 BIFF_FUNC_IF = 1; /// Function identifier of the IF function.
+const sal_uInt16 BIFF_FUNC_SUM = 4; /// Function identifier of the SUM function.
+const sal_uInt16 BIFF_FUNC_TRUE = 34; /// Function identifier of the TRUE function.
+const sal_uInt16 BIFF_FUNC_FALSE = 35; /// Function identifier of the FALSE function.
+const sal_uInt16 BIFF_FUNC_ROWS = 76; /// Function identifier of the ROWS function.
+const sal_uInt16 BIFF_FUNC_COLUMNS = 77; /// Function identifier of the COLUMNS function.
+const sal_uInt16 BIFF_FUNC_OFFSET = 78; /// Function identifier of the OFFSET function.
const sal_uInt16 BIFF_FUNC_EXTERNCALL = 255; /// BIFF function id of the EXTERN.CALL function.
+const sal_uInt16 BIFF_FUNC_FLOOR = 285; /// Function identifier of the FLOOR function.
+const sal_uInt16 BIFF_FUNC_CEILING = 288; /// Function identifier of the CEILING function.
+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 ==========================================================
@@ -239,11 +228,11 @@ struct BinSingleRef2d
explicit BinSingleRef2d();
- void setOobData( sal_uInt16 nCol, sal_Int32 nRow, bool bRelativeAsOffset );
+ void setBiff12Data( sal_uInt16 nCol, sal_Int32 nRow, bool bRelativeAsOffset );
void setBiff2Data( sal_uInt8 nCol, sal_uInt16 nRow, bool bRelativeAsOffset );
void setBiff8Data( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelativeAsOffset );
- void readOobData( RecordInputStream& rStrm, bool bRelativeAsOffset );
+ void readBiff12Data( SequenceInputStream& rStrm, bool bRelativeAsOffset );
void readBiff2Data( BiffInputStream& rStrm, bool bRelativeAsOffset );
void readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset );
};
@@ -256,7 +245,7 @@ struct BinComplexRef2d
BinSingleRef2d maRef1; /// Start (top-left) cell address.
BinSingleRef2d maRef2; /// End (bottom-right) cell address.
- void readOobData( RecordInputStream& rStrm, bool bRelativeAsOffset );
+ void readBiff12Data( SequenceInputStream& rStrm, bool bRelativeAsOffset );
void readBiff2Data( BiffInputStream& rStrm, bool bRelativeAsOffset );
void readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset );
};
@@ -495,8 +484,8 @@ struct FunctionInfo
::rtl::OUString maExtProgName; /// Programmatic function name for external functions.
FunctionLibraryType meFuncLibType; /// The external library this function is part of.
sal_Int32 mnApiOpCode; /// API function opcode.
- sal_uInt16 mnOobFuncId; /// OOBIN function identifier.
- sal_uInt16 mnBiffFuncId; /// BIFF function identifier.
+ sal_uInt16 mnBiff12FuncId; /// BIFF12 function identifier.
+ sal_uInt16 mnBiffFuncId; /// BIFF2-BIFF8 function identifier.
sal_uInt8 mnMinParamCount; /// Minimum number of parameters.
sal_uInt8 mnMaxParamCount; /// Maximum number of parameters.
sal_uInt8 mnRetClass; /// BIFF token class of the return value.
@@ -551,13 +540,13 @@ public:
/** Returns the function info for an ODF function name, or 0 on error. */
const FunctionInfo* getFuncInfoFromOdfFuncName( const ::rtl::OUString& rFuncName ) const;
- /** Returns the function info for an OOX function name, or 0 on error. */
+ /** Returns the function info for an OOXML function name, or 0 on error. */
const FunctionInfo* getFuncInfoFromOoxFuncName( const ::rtl::OUString& rFuncName ) const;
- /** Returns the function info for an OOBIN function index, or 0 on error. */
- const FunctionInfo* getFuncInfoFromOobFuncId( sal_uInt16 nFuncId ) const;
+ /** Returns the function info for a BIFF12 function index, or 0 on error. */
+ const FunctionInfo* getFuncInfoFromBiff12FuncId( sal_uInt16 nFuncId ) const;
- /** Returns the function info for a BIFF function index, or 0 on error. */
+ /** Returns the function info for a BIFF2-BIFF8 function index, or 0 on error. */
const FunctionInfo* getFuncInfoFromBiffFuncId( sal_uInt16 nFuncId ) const;
/** Returns the function info for a macro function referred by the
@@ -599,7 +588,7 @@ public:
/** Returns the function info for an API token, or 0 on error. */
const FunctionInfo* getFuncInfoFromApiToken( const ApiToken& rToken ) const;
- /** Returns the op-code map that is used by the OOX formula parser. */
+ /** Returns the op-code map that is used by the OOXML formula parser. */
::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >
getOoxParserMap() const;
@@ -933,4 +922,3 @@ public:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/formulaparser.hxx b/oox/inc/oox/xls/formulaparser.hxx
index 0227e8efee6d..c595993264d9 100644
--- a/oox/inc/oox/xls/formulaparser.hxx
+++ b/oox/inc/oox/xls/formulaparser.hxx
@@ -100,9 +100,9 @@ private:
class FormulaParserImpl;
-/** Import formula parser for OOX and BIFF filters.
+/** Import formula parser for OOXML and BIFF filters.
- This class implements formula import for the OOX and BIFF filter. One
+ This class implements formula import for the OOXML and BIFF filter. One
instance is contained in the global filter data to prevent construction and
destruction of internal buffers for every imported formula.
*/
@@ -112,17 +112,17 @@ public:
explicit FormulaParser( const WorkbookHelper& rHelper );
virtual ~FormulaParser();
- /** Converts an XML formula string. */
+ /** Converts an OOXML formula string. */
void importFormula(
FormulaContext& rContext,
const ::rtl::OUString& rFormulaString ) const;
- /** Imports and converts a OOBIN token array from the passed stream. */
+ /** Imports and converts a BIFF12 token array from the passed stream. */
void importFormula(
FormulaContext& rContext,
- RecordInputStream& rStrm ) const;
+ SequenceInputStream& rStrm ) const;
- /** Imports and converts a BIFF token array from the passed stream.
+ /** 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(
@@ -150,13 +150,16 @@ public:
::rtl::OUString importOleTargetLink( const ::rtl::OUString& rFormulaString );
/** Imports and converts an OLE link target from the passed stream. */
- ::rtl::OUString importOleTargetLink( RecordInputStream& rStrm );
+ ::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;
+ /** Converts the passed formula to a macro name for a drawing shape. */
+ ::rtl::OUString importMacroName( const ::rtl::OUString& rFormulaString );
+
private:
::std::auto_ptr< FormulaParserImpl > mxImpl;
};
@@ -167,4 +170,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/numberformatsbuffer.hxx b/oox/inc/oox/xls/numberformatsbuffer.hxx
index 59a2c4e9324e..768572a5839c 100644
--- a/oox/inc/oox/xls/numberformatsbuffer.hxx
+++ b/oox/inc/oox/xls/numberformatsbuffer.hxx
@@ -29,7 +29,6 @@
#define OOX_XLS_NUMBERFORMATSBUFFER_HXX
#include <com/sun/star/lang/Locale.hpp>
-#include "oox/helper/containerhelper.hxx"
#include "oox/xls/workbookhelper.hxx"
namespace com { namespace sun { namespace star {
@@ -109,7 +108,7 @@ public:
/** Inserts a new number format code. */
NumberFormatRef importNumFmt( const AttributeList& rAttribs );
/** Inserts a new number format code from a NUMFMT record. */
- void importNumFmt( RecordInputStream& rStrm );
+ void importNumFmt( SequenceInputStream& rStrm );
/** Inserts a new number format code from a FORMAT record. */
void importFormat( BiffInputStream& rStrm );
@@ -137,4 +136,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/ooxformulaparser.hxx b/oox/inc/oox/xls/ooxformulaparser.hxx
index 1c20febf5f43..7bc1bbdd4909 100644
--- a/oox/inc/oox/xls/ooxformulaparser.hxx
+++ b/oox/inc/oox/xls/ooxformulaparser.hxx
@@ -109,4 +109,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/pagesettings.hxx b/oox/inc/oox/xls/pagesettings.hxx
index eb163daf94c8..6ff896b1bb51 100644
--- a/oox/inc/oox/xls/pagesettings.hxx
+++ b/oox/inc/oox/xls/pagesettings.hxx
@@ -83,8 +83,8 @@ struct PageSettingsModel
explicit PageSettingsModel();
- /** Sets the OOBIN or BIFF print errors mode. */
- void setBinPrintErrors( sal_uInt8 nPrintErrors );
+ /** Sets the BIFF print errors mode. */
+ void setBiffPrintErrors( sal_uInt8 nPrintErrors );
};
// ============================================================================
@@ -110,17 +110,17 @@ public:
void importPicture( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs );
/** Imports the PRINTOPTIONS record from the passed stream. */
- void importPrintOptions( RecordInputStream& rStrm );
+ void importPrintOptions( SequenceInputStream& rStrm );
/** Imports the PAGEMARGINS record from the passed stream. */
- void importPageMargins( RecordInputStream& rStrm );
+ void importPageMargins( SequenceInputStream& rStrm );
/** Imports the PAGESETUP record from the passed stream. */
- void importPageSetup( const ::oox::core::Relations& rRelations, RecordInputStream& rStrm );
+ void importPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
/** Imports the CHARTPAGESETUP record from the passed stream. */
- void importChartPageSetup( const ::oox::core::Relations& rRelations, RecordInputStream& rStrm );
+ void importChartPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
/** Imports the HEADERFOOTER record from the passed stream. */
- void importHeaderFooter( RecordInputStream& rStrm );
+ void importHeaderFooter( SequenceInputStream& rStrm );
/** Imports the PICTURE record from the passed stream. */
- void importPicture( const ::oox::core::Relations& rRelations, RecordInputStream& rStrm );
+ void importPicture( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
/** Imports the LEFTMARGIN record from the passed BIFF stream. */
void importLeftMargin( BiffInputStream& rStrm );
@@ -217,4 +217,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/pivotcachebuffer.hxx b/oox/inc/oox/xls/pivotcachebuffer.hxx
index 8f79ab0685b3..2e32d0faa7e5 100644
--- a/oox/inc/oox/xls/pivotcachebuffer.hxx
+++ b/oox/inc/oox/xls/pivotcachebuffer.hxx
@@ -28,10 +28,10 @@
#ifndef OOX_XLS_PIVOTCACHEBUFFER_HXX
#define OOX_XLS_PIVOTCACHEBUFFER_HXX
-#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
-#include "oox/helper/containerhelper.hxx"
+#include <com/sun/star/util/DateTime.hpp>
+#include "oox/helper/refvector.hxx"
#include "oox/xls/workbookhelper.hxx"
namespace com { namespace sun { namespace star {
@@ -66,17 +66,17 @@ public:
void readIndex( const AttributeList& rAttribs );
/** Reads the string value from a pivot cache item. */
- void readString( RecordInputStream& rStrm );
+ void readString( SequenceInputStream& rStrm );
/** Reads the double value from a pivot cache item. */
- void readDouble( RecordInputStream& rStrm );
+ void readDouble( SequenceInputStream& rStrm );
/** Reads the date/time value from a pivot cache item. */
- void readDate( RecordInputStream& rStrm );
+ void readDate( SequenceInputStream& rStrm );
/** Reads the boolean value from a pivot cache item. */
- void readBool( RecordInputStream& rStrm );
+ void readBool( SequenceInputStream& rStrm );
/** Reads the error code value from a pivot cache item. */
- void readError( RecordInputStream& rStrm );
+ void readError( SequenceInputStream& rStrm );
/** Reads the index of a shared item. */
- void readIndex( RecordInputStream& rStrm );
+ void readIndex( SequenceInputStream& rStrm );
/** Reads the string value from a pivot cache item. */
void readString( BiffInputStream& rStrm, const WorkbookHelper& rHelper );
@@ -100,7 +100,7 @@ public:
private:
::com::sun::star::uno::Any maValue; /// Value of the item.
- sal_Int32 mnType; /// Value type (OOX token identifier).
+ sal_Int32 mnType; /// Value type (OOXML token identifier).
};
// ----------------------------------------------------------------------------
@@ -113,7 +113,7 @@ public:
/** Imports the item from the passed attribute list. */
void importItem( sal_Int32 nElement, const AttributeList& rAttribs );
/** Imports the item from the passed stream and record. */
- void importItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+ void importItem( sal_Int32 nRecId, SequenceInputStream& rStrm );
/** Imports a complete item list from the passed stream. */
void importItemList( BiffInputStream& rStrm, sal_uInt16 nCount );
@@ -131,7 +131,7 @@ private:
/** Creates and returns a new item at the end of the items list. */
PivotCacheItem& createItem();
/** Imports an array of items from the PCITEM_ARRAY record */
- void importArray( RecordInputStream& rStrm );
+ void importArray( SequenceInputStream& rStrm );
private:
typedef ::std::vector< PivotCacheItem > CacheItemVector;
@@ -196,8 +196,8 @@ struct PCFieldGroupModel
explicit PCFieldGroupModel();
- /** Sets the group-by value for BIFF/OOBIN import. */
- void setBinGroupBy( sal_uInt8 nGroupBy );
+ /** Sets the group-by value for BIFF import. */
+ void setBiffGroupBy( sal_uInt8 nGroupBy );
};
// ----------------------------------------------------------------------------
@@ -237,19 +237,19 @@ public:
void importGroupItem( sal_Int32 nElement, const AttributeList& rAttribs );
/** Imports pivot cache field settings from the PCDFIELD record. */
- void importPCDField( RecordInputStream& rStrm );
+ void importPCDField( SequenceInputStream& rStrm );
/** Imports shared items settings from the PCDFSHAREDITEMS record. */
- void importPCDFSharedItems( RecordInputStream& rStrm );
+ void importPCDFSharedItems( SequenceInputStream& rStrm );
/** Imports one or more shared items from the passed record. */
- void importPCDFSharedItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+ void importPCDFSharedItem( sal_Int32 nRecId, SequenceInputStream& rStrm );
/** Imports grouping settings from the PCDFIELDGROUP record. */
- void importPCDFieldGroup( RecordInputStream& rStrm );
+ void importPCDFieldGroup( SequenceInputStream& rStrm );
/** Imports numeric grouping settings from the PCDFRANGEPR record. */
- void importPCDFRangePr( RecordInputStream& rStrm );
+ void importPCDFRangePr( SequenceInputStream& rStrm );
/** Imports an item of the mapping between group items and base items from the passed record. */
- void importPCDFDiscretePrItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+ void importPCDFDiscretePrItem( sal_Int32 nRecId, SequenceInputStream& rStrm );
/** Imports one or more group items from the passed record. */
- void importPCDFGroupItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+ void importPCDFGroupItem( sal_Int32 nRecId, SequenceInputStream& rStrm );
/** Imports pivot cache field settings from the PCDFIELD record. */
void importPCDField( BiffInputStream& rStrm );
@@ -304,7 +304,7 @@ public:
const PivotCacheItem& rItem ) const;
/** Reads an item from the PCRECORD record and writes it to the passed sheet. */
- void importPCRecordItem( RecordInputStream& rStrm,
+ void importPCRecordItem( SequenceInputStream& rStrm,
WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const;
/** Reads an item index from the PCITEM_INDEXLIST record and writes the item to the passed sheet. */
void importPCItemIndex( BiffInputStream& rStrm,
@@ -392,11 +392,11 @@ public:
void importWorksheetSource( const AttributeList& rAttribs, const ::oox::core::Relations& rRelations );
/** Reads pivot cache global settings from the PCDEFINITION record. */
- void importPCDefinition( RecordInputStream& rStrm );
+ void importPCDefinition( SequenceInputStream& rStrm );
/** Reads cache source settings from the PCDSOURCE record. */
- void importPCDSource( RecordInputStream& rStrm );
+ void importPCDSource( SequenceInputStream& rStrm );
/** Reads sheet source settings from the PCDSHEETSOURCE record. */
- void importPCDSheetSource( RecordInputStream& rStrm, const ::oox::core::Relations& rRelations );
+ void importPCDSheetSource( SequenceInputStream& rStrm, const ::oox::core::Relations& rRelations );
/** Reads cache source settings from the PCDSOURCE record. */
void importPCDSource( BiffInputStream& rStrm );
@@ -434,7 +434,7 @@ public:
const PivotCacheItem& rItem ) const;
/** Reads a PCRECORD record and writes all item values to the passed sheet. */
- void importPCRecord( RecordInputStream& rStrm,
+ void importPCRecord( SequenceInputStream& rStrm,
WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const;
/** Reads a PCITEM_INDEXLIST record and writes all item values to the passed sheet. */
void importPCItemIndexList( BiffInputStream& rStrm,
@@ -479,9 +479,9 @@ class PivotCacheBuffer : public WorkbookHelper
public:
explicit PivotCacheBuffer( const WorkbookHelper& rHelper );
- /** Registers a pivot cache definition fragment. The fragment will be loaded on demand (OOX/OOBIN only). */
+ /** Registers a pivot cache definition fragment. The fragment will be loaded on demand (OOXML/BIFF12 only). */
void registerPivotCacheFragment( sal_Int32 nCacheId, const ::rtl::OUString& rFragmentPath );
- /** Reads the reference to a pivot cache stream. The stream will be loaded on demand (BIFF only). */
+ /** Reads the reference to a pivot cache stream. The stream will be loaded on demand (BIFF2-BIFF8 only). */
void importPivotCacheRef( BiffInputStream& rStrm );
/** Imports and stores a pivot cache definition fragment on first call,
@@ -508,4 +508,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/pivotcachefragment.hxx b/oox/inc/oox/xls/pivotcachefragment.hxx
index 745208f485e6..34a833e26525 100644
--- a/oox/inc/oox/xls/pivotcachefragment.hxx
+++ b/oox/inc/oox/xls/pivotcachefragment.hxx
@@ -38,18 +38,18 @@ class PivotCacheField;
// ============================================================================
-class OoxPivotCacheFieldContext : public OoxWorkbookContextBase
+class PivotCacheFieldContext : public WorkbookContextBase
{
public:
- explicit OoxPivotCacheFieldContext(
- OoxWorkbookFragmentBase& rFragment,
+ explicit PivotCacheFieldContext(
+ WorkbookFragmentBase& rFragment,
PivotCacheField& rCacheField );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
private:
PivotCacheField& mrCacheField;
@@ -57,17 +57,17 @@ private:
// ============================================================================
-class OoxPivotCacheDefinitionFragment : public OoxWorkbookFragmentBase
+class PivotCacheDefinitionFragment : public WorkbookFragmentBase
{
public:
- explicit OoxPivotCacheDefinitionFragment(
+ explicit PivotCacheDefinitionFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath,
PivotCache& rPivotCache );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
virtual void finalizeImport();
@@ -77,23 +77,23 @@ private:
// ============================================================================
-class OoxPivotCacheRecordsFragment : public OoxWorksheetFragmentBase
+class PivotCacheRecordsFragment : public WorksheetFragmentBase
{
public:
- explicit OoxPivotCacheRecordsFragment(
+ explicit PivotCacheRecordsFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath,
const PivotCache& rPivotCache );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
private:
void startCacheRecord();
- void importPCRecord( RecordInputStream& rStrm );
- void importPCRecordItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+ void importPCRecord( SequenceInputStream& rStrm );
+ void importPCRecordItem( sal_Int32 nRecId, SequenceInputStream& rStrm );
private:
const PivotCache& mrPivotCache;
@@ -126,12 +126,12 @@ class BiffPivotCacheRecordsContext : public BiffWorksheetContextBase
{
public:
explicit BiffPivotCacheRecordsContext(
- const BiffWorkbookFragmentBase& rFragment,
+ const WorkbookHelper& rHelper,
const PivotCache& rPivotCache );
/** Reads the current record from stream and tries to insert a cell into
the source data sheet. */
- virtual void importRecord();
+ virtual void importRecord( BiffInputStream& rStrm );
private:
void startNextRow();
@@ -153,4 +153,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/pivottablebuffer.hxx b/oox/inc/oox/xls/pivottablebuffer.hxx
index 6fde212f0018..7732037bd579 100644
--- a/oox/inc/oox/xls/pivottablebuffer.hxx
+++ b/oox/inc/oox/xls/pivottablebuffer.hxx
@@ -29,9 +29,8 @@
#define OOX_XLS_PIVOTTABLEBUFFER_HXX
#include <com/sun/star/table/CellRangeAddress.hpp>
-#include "oox/helper/containerhelper.hxx"
#include "oox/xls/pivotcachebuffer.hxx"
-#include "oox/xls/workbookhelper.hxx"
+#include "oox/xls/stylesbuffer.hxx"
namespace com { namespace sun { namespace star {
namespace sheet { class XDataPilotDescriptor; }
@@ -54,8 +53,8 @@ struct PTFieldItemModel
explicit PTFieldItemModel();
- /** Sets item type for BIFF/OOBIN import. */
- void setBinType( sal_uInt16 nType );
+ /** Sets item type for BIFF import. */
+ void setBiffType( sal_uInt16 nType );
};
// ----------------------------------------------------------------------------
@@ -93,8 +92,8 @@ struct PTFieldModel
explicit PTFieldModel();
- /** Sets axis type for BIFF/OOBIN import. */
- void setBinAxis( sal_uInt8 nAxisFlags );
+ /** Sets axis type for BIFF import. */
+ void setBiffAxis( sal_uInt8 nAxisFlags );
};
// ----------------------------------------------------------------------------
@@ -122,10 +121,10 @@ struct PTDataFieldModel
explicit PTDataFieldModel();
- /** Sets the subtotal aggregation function for BIFF/OOBIN import. */
- void setBinSubtotal( sal_Int32 nSubtotal );
- /** Sets the 'show data as' type for BIFF/OOBIN import. */
- void setBinShowDataAs( sal_Int32 nShowDataAs );
+ /** Sets the subtotal aggregation function for BIFF import. */
+ void setBiffSubtotal( sal_Int32 nSubtotal );
+ /** Sets the 'show data as' type for BIFF import. */
+ void setBiffShowDataAs( sal_Int32 nShowDataAs );
};
// ----------------------------------------------------------------------------
@@ -145,13 +144,13 @@ public:
void importReferenceItem( const AttributeList& rAttribs );
/** Imports pivot field settings from the PTFIELD record. */
- void importPTField( RecordInputStream& rStrm );
+ void importPTField( SequenceInputStream& rStrm );
/** Imports settings of an item in this pivot field from the PTFITEM record. */
- void importPTFItem( RecordInputStream& rStrm );
+ void importPTFItem( SequenceInputStream& rStrm );
/** Imports pivot field reference settings from the PTREFERENCE record. */
- void importPTReference( RecordInputStream& rStrm );
+ void importPTReference( SequenceInputStream& rStrm );
/** Imports pivot field item reference settings from the PTREFERENCEITEM record. */
- void importPTReferenceItem( RecordInputStream& rStrm );
+ void importPTReferenceItem( SequenceInputStream& rStrm );
/** Imports pivot field settings from the PTFIELD and following records. */
void importPTField( BiffInputStream& rStrm );
@@ -235,9 +234,9 @@ public:
void importTop10( const AttributeList& rAttribs );
/** Reads the settings of a field filter from the PTFILTER record. */
- void importPTFilter( RecordInputStream& rStrm );
+ void importPTFilter( SequenceInputStream& rStrm );
/** Reads additional settings of a field filter from the TOP10FILTER record. */
- void importTop10Filter( RecordInputStream& rStrm );
+ void importTop10Filter( SequenceInputStream& rStrm );
/** Applies the filter to the associated pivot table field if possible. */
void finalizeImport();
@@ -249,7 +248,7 @@ private:
// ============================================================================
-struct PTDefinitionModel
+struct PTDefinitionModel : public AutoFormatModel
{
::rtl::OUString maName;
::rtl::OUString maDataCaption;
@@ -281,6 +280,7 @@ struct PTDefinitionModel
bool mbPrintDrill;
bool mbEnableDrill;
bool mbPreserveFormatting;
+ bool mbUseAutoFormat;
bool mbPageOverThenDown;
bool mbSubtotalHiddenItems;
bool mbRowGrandTotals;
@@ -333,17 +333,17 @@ public:
void importDataField( const AttributeList& rAttribs );
/** Reads global pivot table settings from the PTDEFINITION record. */
- void importPTDefinition( RecordInputStream& rStrm );
+ void importPTDefinition( SequenceInputStream& rStrm );
/** Reads the location of the pivot table from the PTLOCATION record. */
- void importPTLocation( RecordInputStream& rStrm, sal_Int16 nSheet );
+ void importPTLocation( SequenceInputStream& rStrm, sal_Int16 nSheet );
/** Reads the indexes of all fields located in the row dimension from a PTROWFIELDS record. */
- void importPTRowFields( RecordInputStream& rStrm );
+ void importPTRowFields( SequenceInputStream& rStrm );
/** Reads the indexes of all fields located in the column dimension from a PTCOLFIELDS record. */
- void importPTColFields( RecordInputStream& rStrm );
+ void importPTColFields( SequenceInputStream& rStrm );
/** Reads the settings of a field located in the page dimension from the PTPAGEFIELD record. */
- void importPTPageField( RecordInputStream& rStrm );
+ void importPTPageField( SequenceInputStream& rStrm );
/** Reads the settings of a field located in the data dimension from the PTDATAFIELD record. */
- void importPTDataField( RecordInputStream& rStrm );
+ void importPTDataField( SequenceInputStream& rStrm );
/** Reads global pivot table settings from the PTDEFINITION record. */
void importPTDefinition( BiffInputStream& rStrm, sal_Int16 nSheet );
@@ -403,7 +403,7 @@ private:
/** Reads a field index for the row or column dimension. */
static void importField( IndexVector& orFields, const AttributeList& rAttribs );
/** Reads an array of field indexes for the row or column dimension. */
- static void importFields( IndexVector& orFields, RecordInputStream& rStrm );
+ static void importFields( IndexVector& orFields, SequenceInputStream& rStrm );
/** Reads an array of field indexes for the row or column dimension. */
static void importFields( IndexVector& orFields, BiffInputStream& rStrm, sal_Int32 nCount );
@@ -446,4 +446,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/pivottablefragment.hxx b/oox/inc/oox/xls/pivottablefragment.hxx
index 59c86b4ba3cb..aafae063990c 100644
--- a/oox/inc/oox/xls/pivottablefragment.hxx
+++ b/oox/inc/oox/xls/pivottablefragment.hxx
@@ -40,18 +40,18 @@ class PivotTableFilter;
// ============================================================================
-class OoxPivotTableFieldContext : public OoxWorksheetContextBase
+class PivotTableFieldContext : public WorksheetContextBase
{
public:
- explicit OoxPivotTableFieldContext(
- OoxWorksheetFragmentBase& rFragment,
+ explicit PivotTableFieldContext(
+ WorksheetFragmentBase& rFragment,
PivotTableField& rTableField );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
private:
PivotTableField& mrTableField;
@@ -59,18 +59,18 @@ private:
// ============================================================================
-class OoxPivotTableFilterContext : public OoxWorksheetContextBase
+class PivotTableFilterContext : public WorksheetContextBase
{
public:
- explicit OoxPivotTableFilterContext(
- OoxWorksheetFragmentBase& rFragment,
+ explicit PivotTableFilterContext(
+ WorksheetFragmentBase& rFragment,
PivotTableFilter& rTableFilter );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
private:
PivotTableFilter& mrTableFilter;
@@ -78,16 +78,16 @@ private:
// ============================================================================
-class OoxPivotTableFragment : public OoxWorksheetFragmentBase
+class PivotTableFragment : public WorksheetFragmentBase
{
public:
- explicit OoxPivotTableFragment(
+ explicit PivotTableFragment(
const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
private:
@@ -100,10 +100,10 @@ private:
class BiffPivotTableContext : public BiffWorksheetContextBase
{
public:
- explicit BiffPivotTableContext( const BiffWorksheetFragmentBase& rFragment, PivotTable& rPivotTable );
+ explicit BiffPivotTableContext( const WorksheetHelper& rHelper );
/** Imports all records related to the current pivot table. */
- virtual void importRecord();
+ virtual void importRecord( BiffInputStream& rStrm );
private:
PivotTable& mrPivotTable;
@@ -115,4 +115,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/querytablebuffer.hxx b/oox/inc/oox/xls/querytablebuffer.hxx
new file mode 100644
index 000000000000..fa67ca8874c0
--- /dev/null
+++ b/oox/inc/oox/xls/querytablebuffer.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_XLS_QUERYTABLEBUFFER_HXX
+#define OOX_XLS_QUERYTABLEBUFFER_HXX
+
+#include "oox/xls/stylesbuffer.hxx"
+#include "oox/xls/worksheethelper.hxx"
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+struct QueryTableModel : public AutoFormatModel
+{
+ ::rtl::OUString maDefName; /// Defined name containing the target cell range.
+ sal_Int32 mnConnId; /// Identifier of the external connection used to query the data.
+ sal_Int32 mnGrowShrinkType; /// Behaviour when source data size changes.
+ bool mbHeaders; /// True = source data contains a header row.
+ bool mbRowNumbers; /// True = first column contains row numbers.
+ bool mbDisableRefresh; /// True = refreshing data disabled.
+ bool mbBackground; /// True = refresh asynchronously.
+ bool mbFirstBackground; /// True = first background refresh not yet finished.
+ bool mbRefreshOnLoad; /// True = refresh table after import.
+ bool mbFillFormulas; /// True = expand formulas next to range when source data grows.
+ bool mbRemoveDataOnSave; /// True = remove querried data before saving.
+ bool mbDisableEdit; /// True = connection locked for editing.
+ bool mbPreserveFormat; /// True = use existing formatting for new rows.
+ bool mbAdjustColWidth; /// True = adjust column widths after refresh.
+ bool mbIntermediate; /// True = query table defined but not built yet.
+
+ explicit QueryTableModel();
+};
+
+// ----------------------------------------------------------------------------
+
+class QueryTable : public WorksheetHelper
+{
+public:
+ explicit QueryTable( const WorksheetHelper& rHelper );
+
+ /** Imports query table settings from the queryTable element. */
+ void importQueryTable( const AttributeList& rAttribs );
+ /** Imports query table settings from the QUERYTABLE record. */
+ void importQueryTable( SequenceInputStream& rStrm );
+
+ /** Imports query table settings from the QUERYTABLE record. */
+ void importQueryTable( BiffInputStream& rStrm );
+ /** Imports query table settings from the QUERYTABLEREFRESH record. */
+ void importQueryTableRefresh( BiffInputStream& rStrm );
+ /** Imports query table settings from the QUERYTABLESETTINGS record. */
+ void importQueryTableSettings( BiffInputStream& rStrm );
+
+ /** Inserts a web query into the sheet. */
+ void finalizeImport();
+
+private:
+ QueryTableModel maModel;
+};
+
+// ============================================================================
+
+class QueryTableBuffer : public WorksheetHelper
+{
+public:
+ explicit QueryTableBuffer( const WorksheetHelper& rHelper );
+
+ /** Creates a new query table and stores it into the internal vector. */
+ QueryTable& createQueryTable();
+
+ /** Inserts all web queries into the sheet. */
+ void finalizeImport();
+
+private:
+ typedef RefVector< QueryTable > QueryTableVector;
+ QueryTableVector maQueryTables;
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/xls/querytablefragment.hxx b/oox/inc/oox/xls/querytablefragment.hxx
index 3702069b4859..6eb561aa5a5e 100644
--- a/oox/inc/oox/xls/querytablefragment.hxx
+++ b/oox/inc/oox/xls/querytablefragment.hxx
@@ -33,19 +33,39 @@
namespace oox {
namespace xls {
+class QueryTable;
+
// ============================================================================
-class OoxQueryTableFragment : public OoxWorkbookFragmentBase
+class QueryTableFragment : public WorksheetFragmentBase
{
public:
- explicit OoxQueryTableFragment(
- const WorkbookHelper& rHelper,
+ explicit QueryTableFragment(
+ const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ virtual const ::oox::core::RecordInfo* getRecordInfos() const;
+
+private:
+ QueryTable& mrQueryTable;
+};
+
+// ============================================================================
+
+class BiffQueryTableContext : public BiffWorksheetContextBase
+{
+public:
+ explicit BiffQueryTableContext( const WorksheetHelper& rHelper );
+
+ /** Imports all records related to the current query table. */
+ virtual void importRecord( BiffInputStream& rStrm );
+
+private:
+ QueryTable& mrQueryTable;
};
// ============================================================================
@@ -54,4 +74,3 @@ protected:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx
index 6293aac4d340..f21e2a021111 100644
--- a/oox/inc/oox/xls/richstring.hxx
+++ b/oox/inc/oox/xls/richstring.hxx
@@ -28,7 +28,7 @@
#ifndef OOX_XLS_RICHSTRING_HXX
#define OOX_XLS_RICHSTRING_HXX
-#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/refvector.hxx"
#include "oox/xls/stylesbuffer.hxx"
namespace com { namespace sun { namespace star {
@@ -110,7 +110,7 @@ struct FontPortionModel
explicit inline FontPortionModel( sal_Int32 nPos, sal_Int32 nFontId ) :
mnPos( nPos ), mnFontId( nFontId ) {}
- void read( RecordInputStream& rStrm );
+ void read( SequenceInputStream& rStrm );
void read( BiffInputStream& rStrm, BiffFontPortionMode eMode );
};
@@ -125,7 +125,7 @@ public:
/** Appends a rich-string font identifier. */
void appendPortion( const FontPortionModel& rPortion );
/** Reads count and font identifiers from the passed stream. */
- void importPortions( RecordInputStream& rStrm );
+ void importPortions( SequenceInputStream& rStrm );
/** Reads nCount font identifiers from the passed stream. */
void importPortions( BiffInputStream& rStrm, sal_uInt16 nCount, BiffFontPortionMode eMode );
/** Reads count and font identifiers from the passed stream. */
@@ -143,7 +143,7 @@ struct PhoneticDataModel
explicit PhoneticDataModel();
/** Sets the passed data from binary import. */
- void setBinData( sal_Int32 nType, sal_Int32 nAlignment );
+ void setBiffData( sal_Int32 nType, sal_Int32 nAlignment );
};
// ----------------------------------------------------------------------------
@@ -156,12 +156,12 @@ public:
/** Imports phonetic settings from the phoneticPr element. */
void importPhoneticPr( const AttributeList& rAttribs );
/** Imports phonetic settings from the PHONETICPR record. */
- void importPhoneticPr( RecordInputStream& rStrm );
+ void importPhoneticPr( SequenceInputStream& rStrm );
/** Imports phonetic settings from the PHONETICPR record. */
void importPhoneticPr( BiffInputStream& rStrm );
/** Imports phonetic settings from a rich string. */
- void importStringData( RecordInputStream& rStrm );
+ void importStringData( SequenceInputStream& rStrm );
/** Imports phonetic settings from a rich string. */
void importStringData( BiffInputStream& rStrm );
@@ -206,7 +206,7 @@ struct PhoneticPortionModel
explicit inline PhoneticPortionModel( sal_Int32 nPos, sal_Int32 nBasePos, sal_Int32 nBaseLen ) :
mnPos( nPos ), mnBasePos( nBasePos ), mnBaseLen( nBaseLen ) {}
- void read( RecordInputStream& rStrm );
+ void read( SequenceInputStream& rStrm );
void read( BiffInputStream& rStrm );
};
@@ -221,7 +221,7 @@ public:
/** Appends a rich-string phonetic portion. */
void appendPortion( const PhoneticPortionModel& rPortion );
/** Reads all phonetic portions from the passed stream. */
- void importPortions( RecordInputStream& rStrm );
+ void importPortions( SequenceInputStream& rStrm );
/** Reads phonetic portion data from the passed stream. */
::rtl::OUString importPortions( BiffInputStream& rStrm, sal_Int32 nPhoneticSize );
};
@@ -244,7 +244,7 @@ public:
void importPhoneticPr( const AttributeList& rAttribs );
/** Imports a Unicode rich-string from the passed record stream. */
- void importString( RecordInputStream& rStrm, bool bRich );
+ 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 );
@@ -292,4 +292,3 @@ typedef ::boost::shared_ptr< RichString > RichStringRef;
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/richstringcontext.hxx b/oox/inc/oox/xls/richstringcontext.hxx
index 53882641df7e..df3f412d87ec 100644
--- a/oox/inc/oox/xls/richstringcontext.hxx
+++ b/oox/inc/oox/xls/richstringcontext.hxx
@@ -36,17 +36,15 @@ namespace xls {
// ============================================================================
-class OoxRichStringContext : public OoxWorkbookContextBase
+class RichStringContext : public WorkbookContextBase
{
public:
template< typename ParentType >
- explicit OoxRichStringContext( ParentType& rParent, RichStringRef xString );
+ explicit RichStringContext( ParentType& rParent, RichStringRef xString );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
private:
RichStringRef mxString; /// Processed string.
@@ -58,11 +56,11 @@ private:
// ----------------------------------------------------------------------------
template< typename ParentType >
-OoxRichStringContext::OoxRichStringContext( ParentType& rParent, RichStringRef xString ) :
- OoxWorkbookContextBase( rParent ),
+RichStringContext::RichStringContext( ParentType& rParent, RichStringRef xString ) :
+ WorkbookContextBase( rParent ),
mxString( xString )
{
- OSL_ENSURE( mxString.get(), "OoxRichStringContext::OoxRichStringContext - missing string object" );
+ OSL_ENSURE( mxString.get(), "RichStringContext::RichStringContext - missing string object" );
}
// ============================================================================
@@ -71,4 +69,3 @@ OoxRichStringContext::OoxRichStringContext( ParentType& rParent, RichStringRef x
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/scenariobuffer.hxx b/oox/inc/oox/xls/scenariobuffer.hxx
index 8c2e0b0f1065..ed8d4e919bd2 100644
--- a/oox/inc/oox/xls/scenariobuffer.hxx
+++ b/oox/inc/oox/xls/scenariobuffer.hxx
@@ -29,7 +29,8 @@
#define OOX_XLS_SCENARIOBUFFER_HXX
#include <com/sun/star/table/CellAddress.hpp>
-#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
#include "oox/xls/workbookhelper.hxx"
namespace oox {
@@ -73,9 +74,9 @@ public:
void importInputCells( const AttributeList& rAttribs );
/** Imports a scenario definition from a SCENARIO record. */
- void importScenario( RecordInputStream& rStrm );
+ void importScenario( SequenceInputStream& rStrm );
/** Imports a new cell for this scenario from a INPUTCELLS record. */
- void importInputCells( RecordInputStream& rStrm );
+ void importInputCells( SequenceInputStream& rStrm );
/** Imports a scenario definition from a SCENARIO record. */
void importScenario( BiffInputStream& rStrm );
@@ -111,7 +112,7 @@ public:
/** Imports sheet scenario settings from a scenarios element. */
void importScenarios( const AttributeList& rAttribs );
/** Imports sheet scenario settings from a SCENARIOS record. */
- void importScenarios( RecordInputStream& rStrm );
+ void importScenarios( SequenceInputStream& rStrm );
/** Imports sheet scenario settings from a SCENARIOS record. */
void importScenarios( BiffInputStream& rStrm );
@@ -152,4 +153,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/scenariocontext.hxx b/oox/inc/oox/xls/scenariocontext.hxx
index f3286f144656..3e6ccc5c22d6 100644
--- a/oox/inc/oox/xls/scenariocontext.hxx
+++ b/oox/inc/oox/xls/scenariocontext.hxx
@@ -38,17 +38,17 @@ class SheetScenarios;
// ============================================================================
-class OoxScenarioContext : public OoxWorksheetContextBase
+class ScenarioContext : public WorksheetContextBase
{
public:
- explicit OoxScenarioContext( OoxWorksheetContextBase& rParent, SheetScenarios& rSheetScenarios );
+ explicit ScenarioContext( WorksheetContextBase& rParent, SheetScenarios& rSheetScenarios );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
private:
Scenario& mrScenario;
@@ -56,17 +56,17 @@ private:
// ============================================================================
-class OoxScenariosContext : public OoxWorksheetContextBase
+class ScenariosContext : public WorksheetContextBase
{
public:
- explicit OoxScenariosContext( OoxWorksheetFragmentBase& rFragment );
+ explicit ScenariosContext( WorksheetFragmentBase& rFragment );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
private:
SheetScenarios& mrSheetScenarios;
@@ -78,4 +78,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/sharedformulabuffer.hxx b/oox/inc/oox/xls/sharedformulabuffer.hxx
index 0f9fb0bb093e..94b7572dcfd9 100644
--- a/oox/inc/oox/xls/sharedformulabuffer.hxx
+++ b/oox/inc/oox/xls/sharedformulabuffer.hxx
@@ -61,12 +61,12 @@ class SharedFormulaBuffer : public WorksheetHelper
public:
explicit SharedFormulaBuffer( const WorksheetHelper& rHelper );
- /** Imports a shared formula from a OOX formula string. */
+ /** 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( RecordInputStream& rStrm,
+ 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,
@@ -109,4 +109,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/sharedstringsbuffer.hxx b/oox/inc/oox/xls/sharedstringsbuffer.hxx
index 27827ec215ed..eff8ab4e7738 100644
--- a/oox/inc/oox/xls/sharedstringsbuffer.hxx
+++ b/oox/inc/oox/xls/sharedstringsbuffer.hxx
@@ -28,7 +28,6 @@
#ifndef OOX_XLS_SHAREDSTRINGSBUFFER_HXX
#define OOX_XLS_SHAREDSTRINGSBUFFER_HXX
-#include "oox/helper/containerhelper.hxx"
#include "oox/xls/richstring.hxx"
namespace oox {
@@ -67,4 +66,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/sharedstringsfragment.hxx b/oox/inc/oox/xls/sharedstringsfragment.hxx
index 7294643b7df5..bc3a23122d19 100644
--- a/oox/inc/oox/xls/sharedstringsfragment.hxx
+++ b/oox/inc/oox/xls/sharedstringsfragment.hxx
@@ -35,21 +35,16 @@ namespace xls {
// ============================================================================
-class OoxSharedStringsFragment : public OoxWorkbookFragmentBase
+class SharedStringsFragment : public WorkbookFragmentBase
{
public:
- explicit OoxSharedStringsFragment(
+ explicit SharedStringsFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
-
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
-
- // oox.core.FragmentHandler2 interface ------------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
virtual void finalizeImport();
@@ -61,4 +56,3 @@ protected:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx
index a77f4b285fa4..fdbc0ba21231 100644
--- a/oox/inc/oox/xls/sheetdatacontext.hxx
+++ b/oox/inc/oox/xls/sheetdatacontext.hxx
@@ -45,18 +45,17 @@ namespace xls {
The sheetData element contains all row settings and all cells in a single
sheet of a spreadsheet document.
*/
-class OoxSheetDataContext : public OoxWorksheetContextBase
+class SheetDataContext : public WorksheetContextBase
{
public:
- explicit OoxSheetDataContext( OoxWorksheetFragmentBase& rFragment );
+ explicit SheetDataContext( WorksheetFragmentBase& rFragment );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
private:
/** Different types of cell records. */
@@ -70,35 +69,35 @@ private:
void importFormula( const AttributeList& rAttribs );
/** Imports a cell address and the following XF identifier. */
- void importCellHeader( RecordInputStream& rStrm, CellType eCellType );
+ void importCellHeader( SequenceInputStream& rStrm, CellType eCellType );
/** Imports an empty cell from a CELL_BLANK or MULTCELL_BLANK record. */
- void importCellBlank( RecordInputStream& rStrm, CellType eCellType );
+ void importCellBlank( SequenceInputStream& rStrm, CellType eCellType );
/** Imports a boolean cell from a CELL_BOOL, MULTCELL_BOOL, or FORMULA_BOOL record. */
- void importCellBool( RecordInputStream& rStrm, CellType eCellType );
+ void importCellBool( SequenceInputStream& rStrm, CellType eCellType );
/** Imports a numeric cell from a CELL_DOUBLE, MULTCELL_DOUBLE, or FORMULA_DOUBLE record. */
- void importCellDouble( RecordInputStream& rStrm, CellType eCellType );
+ void importCellDouble( SequenceInputStream& rStrm, CellType eCellType );
/** Imports an error code cell from a CELL_ERROR, MULTCELL_ERROR, or FORMULA_ERROR record. */
- void importCellError( RecordInputStream& rStrm, CellType eCellType );
+ void importCellError( SequenceInputStream& rStrm, CellType eCellType );
/** Imports an encoded numeric cell from a CELL_RK or MULTCELL_RK record. */
- void importCellRk( RecordInputStream& rStrm, CellType eCellType );
+ void importCellRk( SequenceInputStream& rStrm, CellType eCellType );
/** Imports a rich-string cell from a CELL_RSTRING or MULTCELL_RSTRING record. */
- void importCellRString( RecordInputStream& rStrm, CellType eCellType );
+ void importCellRString( SequenceInputStream& rStrm, CellType eCellType );
/** Imports a string cell from a CELL_SI or MULTCELL_SI record. */
- void importCellSi( RecordInputStream& rStrm, CellType eCellType );
+ void importCellSi( SequenceInputStream& rStrm, CellType eCellType );
/** Imports a string cell from a CELL_STRING, MULTCELL_STRING, or FORMULA_STRING record. */
- void importCellString( RecordInputStream& rStrm, CellType eCellType );
+ void importCellString( SequenceInputStream& rStrm, CellType eCellType );
/** Imports a cell formula for the current cell. */
- void importCellFormula( RecordInputStream& rStrm );
+ void importCellFormula( SequenceInputStream& rStrm );
/** Imports row settings from a ROW record. */
- void importRow( RecordInputStream& rStrm );
+ void importRow( SequenceInputStream& rStrm );
/** Imports an array formula from an ARRAY record. */
- void importArray( RecordInputStream& rStrm );
+ void importArray( SequenceInputStream& rStrm );
/** Imports a shared formula from a SHAREDFORMULA record. */
- void importSharedFmla( RecordInputStream& rStrm );
+ void importSharedFmla( SequenceInputStream& rStrm );
/** Imports table operation from a DATATABLE record. */
- void importDataTable( RecordInputStream& rStrm );
+ void importDataTable( SequenceInputStream& rStrm );
private:
CellModel maCurrCell; /// Position and formatting of current imported cell.
@@ -114,49 +113,49 @@ private:
class BiffSheetDataContext : public BiffWorksheetContextBase
{
public:
- explicit BiffSheetDataContext( const BiffWorksheetFragmentBase& rParent );
+ explicit BiffSheetDataContext( const WorksheetHelper& rHelper );
/** Tries to import a sheet data record. */
- virtual void importRecord();
+ virtual void importRecord( BiffInputStream& rStrm );
private:
/** Sets current cell according to the passed address. */
void setCurrCell( const BinAddress& rAddr );
/** Imports an XF identifier and sets the mnXfId member. */
- void importXfId( bool bBiff2 );
+ void importXfId( BiffInputStream& rStrm, bool bBiff2 );
/** Imports a BIFF cell address and the following XF identifier. */
- void importCellHeader( bool bBiff2 );
+ void importCellHeader( BiffInputStream& rStrm, bool bBiff2 );
/** Imports a BLANK record describing a blank but formatted cell. */
- void importBlank();
+ void importBlank( BiffInputStream& rStrm );
/** Imports a BOOLERR record describing a boolean or error code cell. */
- void importBoolErr();
+ void importBoolErr( BiffInputStream& rStrm );
/** Imports a FORMULA record describing a formula cell. */
- void importFormula();
+ void importFormula( BiffInputStream& rStrm );
/** Imports an INTEGER record describing a BIFF2 integer cell. */
- void importInteger();
+ void importInteger( BiffInputStream& rStrm );
/** Imports a LABEL record describing an unformatted string cell. */
- void importLabel();
+ void importLabel( BiffInputStream& rStrm );
/** Imports a LABELSST record describing a string cell using the shared string list. */
- void importLabelSst();
+ void importLabelSst( BiffInputStream& rStrm );
/** Imports a MULTBLANK record describing a range of blank but formatted cells. */
- void importMultBlank();
+ void importMultBlank( BiffInputStream& rStrm );
/** Imports a MULTRK record describing a range of numeric cells. */
- void importMultRk();
+ void importMultRk( BiffInputStream& rStrm );
/** Imports a NUMBER record describing a floating-point cell. */
- void importNumber();
+ void importNumber( BiffInputStream& rStrm );
/** Imports an RK record describing a numeric cell. */
- void importRk();
+ void importRk( BiffInputStream& rStrm );
/** Imports row settings from a ROW record. */
- void importRow();
+ void importRow( BiffInputStream& rStrm );
/** Imports an ARRAY record describing an array formula of a cell range. */
- void importArray();
+ void importArray( BiffInputStream& rStrm );
/** Imports a SHAREDFMLA record describing a shared formula in a cell range. */
- void importSharedFmla();
+ void importSharedFmla( BiffInputStream& rStrm );
/** Imports table operation from a DATATABLE or DATATABLE2 record. */
- void importDataTable();
+ void importDataTable( BiffInputStream& rStrm );
private:
CellModel maCurrCell; /// Position and formatting of current imported cell.
@@ -171,4 +170,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx
index 4fa9c964108e..64a56968aa37 100644
--- a/oox/inc/oox/xls/stylesbuffer.hxx
+++ b/oox/inc/oox/xls/stylesbuffer.hxx
@@ -29,14 +29,15 @@
#define OOX_XLS_STYLESBUFFER_HXX
#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/util/CellProtection.hpp>
#include <com/sun/star/table/CellHoriJustify.hpp>
#include <com/sun/star/table/CellOrientation.hpp>
#include <com/sun/star/table/CellVertJustify.hpp>
#include <com/sun/star/table/TableBorder.hpp>
-#include "oox/helper/containerhelper.hxx"
-#include "oox/helper/graphichelper.hxx"
+#include <com/sun/star/util/CellProtection.hpp>
#include "oox/drawingml/color.hxx"
+#include "oox/helper/graphichelper.hxx"
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
#include "oox/xls/numberformatsbuffer.hxx"
namespace com { namespace sun { namespace star {
@@ -111,11 +112,11 @@ public:
void importColor( const AttributeList& rAttribs );
/** Imports a 64-bit color from the passed binary stream. */
- void importColor( RecordInputStream& rStrm );
- /** Imports a 32-bit palette color identifier from the passed OOBIN stream. */
- void importColorId( RecordInputStream& rStrm );
- /** Imports a 32-bit RGBA color value from the passed OOBIN stream. */
- void importColorRgb( RecordInputStream& rStrm );
+ void importColor( SequenceInputStream& rStrm );
+ /** Imports a 32-bit palette color identifier from the passed BIFF12 stream. */
+ void importColorId( SequenceInputStream& rStrm );
+ /** Imports a 32-bit RGBA color value from the passed BIFF12 stream. */
+ void importColorRgb( SequenceInputStream& rStrm );
/** Imports an 8-bit or 16-bit palette color identifier from the passed BIFF stream. */
void importColorId( BiffInputStream& rStrm, bool b16Bit = true );
@@ -128,7 +129,7 @@ public:
// ----------------------------------------------------------------------------
-RecordInputStream& operator>>( RecordInputStream& rStrm, Color& orColor );
+SequenceInputStream& operator>>( SequenceInputStream& rStrm, Color& orColor );
// ============================================================================
@@ -142,9 +143,11 @@ public:
/** Appends a new color from the passed attributes. */
void importPaletteColor( const AttributeList& rAttribs );
/** Appends a new color from the passed RGBCOLOR record. */
- void importPaletteColor( RecordInputStream& rStrm );
+ void importPaletteColor( SequenceInputStream& rStrm );
/** Imports the PALETTE record from the passed stream. */
void importPalette( BiffInputStream& rStrm );
+ /** Imports a color palette from a UNO sequence in the passed any. */
+ void importPalette( const ::com::sun::star::uno::Any& rPalette );
/** Rturns the RGB value of the color with the passed index. */
sal_Int32 getColor( sal_Int32 nPaletteIdx ) const;
@@ -179,7 +182,7 @@ struct FontModel
explicit FontModel();
- void setBinScheme( sal_uInt8 nScheme );
+ void setBiff12Scheme( sal_uInt8 nScheme );
void setBiffHeight( sal_uInt16 nHeight );
void setBiffWeight( sal_uInt16 nWeight );
void setBiffUnderline( sal_uInt16 nUnderline );
@@ -259,23 +262,23 @@ public:
void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
/** Imports the FONT record from the passed stream. */
- void importFont( RecordInputStream& rStrm );
+ void importFont( SequenceInputStream& rStrm );
/** Imports the font name from a DXF record. */
- void importDxfName( RecordInputStream& rStrm );
+ void importDxfName( SequenceInputStream& rStrm );
/** Imports the font color from a DXF record. */
- void importDxfColor( RecordInputStream& rStrm );
+ void importDxfColor( SequenceInputStream& rStrm );
/** Imports the font scheme from a DXF record. */
- void importDxfScheme( RecordInputStream& rStrm );
+ void importDxfScheme( SequenceInputStream& rStrm );
/** Imports the font height from a DXF record. */
- void importDxfHeight( RecordInputStream& rStrm );
+ void importDxfHeight( SequenceInputStream& rStrm );
/** Imports the font weight from a DXF record. */
- void importDxfWeight( RecordInputStream& rStrm );
+ void importDxfWeight( SequenceInputStream& rStrm );
/** Imports the font underline style from a DXF record. */
- void importDxfUnderline( RecordInputStream& rStrm );
+ void importDxfUnderline( SequenceInputStream& rStrm );
/** Imports the font escapement style from a DXF record. */
- void importDxfEscapement( RecordInputStream& rStrm );
+ void importDxfEscapement( SequenceInputStream& rStrm );
/** Imports a font style flag from a DXF record. */
- void importDxfFlag( sal_Int32 nElement, RecordInputStream& rStrm );
+ void importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm );
/** Imports the FONT record from the passed stream. */
void importFont( BiffInputStream& rStrm );
@@ -346,12 +349,12 @@ struct AlignmentModel
explicit AlignmentModel();
- /** Sets horizontal alignment from the passed OOBIN or BIFF data. */
- void setBinHorAlign( sal_uInt8 nHorAlign );
- /** Sets vertical alignment from the passed OOBIN or BIFF data. */
- void setBinVerAlign( sal_uInt8 nVerAlign );
- /** Sets rotation from the passed OOBIN or BIFF text orientation. */
- void setBinTextOrient( sal_uInt8 nTextOrient );
+ /** Sets horizontal alignment from the passed BIFF data. */
+ void setBiffHorAlign( sal_uInt8 nHorAlign );
+ /** Sets vertical alignment from the passed BIFF data. */
+ void setBiffVerAlign( sal_uInt8 nVerAlign );
+ /** Sets rotation from the passed BIFF text orientation. */
+ void setBiffTextOrient( sal_uInt8 nTextOrient );
};
// ----------------------------------------------------------------------------
@@ -387,8 +390,8 @@ public:
/** Sets all attributes from the alignment element. */
void importAlignment( const AttributeList& rAttribs );
- /** Sets the alignment attributes from the passed OOBIN XF record data. */
- void setBinData( sal_uInt32 nFlags );
+ /** Sets the alignment attributes from the passed BIFF12 XF record data. */
+ void setBiff12Data( sal_uInt32 nFlags );
/** Sets the alignment attributes from the passed BIFF2 XF record data. */
void setBiff2Data( sal_uInt8 nFlags );
/** Sets the alignment attributes from the passed BIFF3 XF record data. */
@@ -453,8 +456,8 @@ public:
/** Sets all attributes from the protection element. */
void importProtection( const AttributeList& rAttribs );
- /** Sets the protection attributes from the passed OOBIN XF record data. */
- void setBinData( sal_uInt32 nFlags );
+ /** Sets the protection attributes from the passed BIFF12 XF record data. */
+ void setBiff12Data( sal_uInt32 nFlags );
/** Sets the protection attributes from the passed BIFF2 XF record data. */
void setBiff2Data( sal_uInt8 nNumFmt );
/** Sets the protection attributes from the passed BIFF3-BIFF8 XF record data. */
@@ -489,7 +492,7 @@ struct BorderLineModel
explicit BorderLineModel( bool bDxf );
- /** Sets the passed OOBIN or BIFF line style. */
+ /** Sets the passed BIFF line style. */
void setBiffStyle( sal_Int32 nLineStyle );
/** Sets line style and line color from the passed BIFF data. */
void setBiffData( sal_uInt8 nLineStyle, sal_uInt16 nLineColor );
@@ -548,9 +551,9 @@ public:
void importColor( sal_Int32 nElement, const AttributeList& rAttribs );
/** Imports the BORDER record from the passed stream. */
- void importBorder( RecordInputStream& rStrm );
+ void importBorder( SequenceInputStream& rStrm );
/** Imports a border from a DXF record from the passed stream. */
- void importDxfBorder( sal_Int32 nElement, RecordInputStream& rStrm );
+ void importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm );
/** Sets the border attributes from the passed BIFF2 XF record data. */
void setBiff2Data( sal_uInt8 nFlags );
@@ -605,8 +608,8 @@ struct PatternFillModel
explicit PatternFillModel( bool bDxf );
- /** Sets the passed OOBIN or BIFF pattern identifier. */
- void setBinPattern( sal_Int32 nPattern );
+ /** Sets the passed BIFF pattern identifier. */
+ void setBiffPattern( sal_Int32 nPattern );
/** Sets the pattern and pattern colors from the passed BIFF data. */
void setBiffData( sal_uInt16 nPatternColor, sal_uInt16 nFillColor, sal_uInt8 nPattern );
};
@@ -628,10 +631,10 @@ struct GradientFillModel
explicit GradientFillModel();
- /** Reads OOBIN gradient settings from a FILL or DXF record. */
- void readGradient( RecordInputStream& rStrm );
- /** Reads OOBIN gradient stop settings from a FILL or DXF record. */
- void readGradientStop( RecordInputStream& rStrm, bool bDxf );
+ /** Reads BIFF12 gradient settings from a FILL or DXF record. */
+ void readGradient( SequenceInputStream& rStrm );
+ /** Reads BIFF12 gradient stop settings from a FILL or DXF record. */
+ void readGradientStop( SequenceInputStream& rStrm, bool bDxf );
};
// ----------------------------------------------------------------------------
@@ -668,17 +671,17 @@ public:
void importColor( const AttributeList& rAttribs, double fPosition );
/** Imports the FILL record from the passed stream. */
- void importFill( RecordInputStream& rStrm );
+ void importFill( SequenceInputStream& rStrm );
/** Imports the fill pattern from a DXF record. */
- void importDxfPattern( RecordInputStream& rStrm );
+ void importDxfPattern( SequenceInputStream& rStrm );
/** Imports the pattern color from a DXF record. */
- void importDxfFgColor( RecordInputStream& rStrm );
+ void importDxfFgColor( SequenceInputStream& rStrm );
/** Imports the background color from a DXF record. */
- void importDxfBgColor( RecordInputStream& rStrm );
+ void importDxfBgColor( SequenceInputStream& rStrm );
/** Imports gradient settings from a DXF record. */
- void importDxfGradient( RecordInputStream& rStrm );
+ void importDxfGradient( SequenceInputStream& rStrm );
/** Imports gradient stop settings from a DXF record. */
- void importDxfStop( RecordInputStream& rStrm );
+ void importDxfStop( SequenceInputStream& rStrm );
/** Sets the fill attributes from the passed BIFF2 XF record data. */
void setBiff2Data( sal_uInt8 nFlags );
@@ -762,7 +765,7 @@ public:
void importProtection( const AttributeList& rAttribs );
/** Imports the XF record from the passed stream. */
- void importXf( RecordInputStream& rStrm, bool bCellXf );
+ void importXf( SequenceInputStream& rStrm, bool bCellXf );
/** Imports the XF record from the passed stream. */
void importXf( BiffInputStream& rStrm );
@@ -823,7 +826,7 @@ public:
void importProtection( const AttributeList& rAttribs );
/** Imports the DXF record from the passed stream. */
- void importDxf( RecordInputStream& rStrm );
+ void importDxf( SequenceInputStream& rStrm );
/** Imports font, border, and fill settings from the CFRULE record. */
void importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags );
@@ -878,7 +881,7 @@ public:
/** Imports passed attributes from the cellStyle element. */
void importCellStyle( const AttributeList& rAttribs );
/** Imports style settings from a CELLSTYLE record. */
- void importCellStyle( RecordInputStream& rStrm );
+ void importCellStyle( SequenceInputStream& rStrm );
/** Imports style settings from a STYLE record. */
void importStyle( BiffInputStream& rStrm );
@@ -911,7 +914,7 @@ public:
/** Appends and returns a new named cell style object. */
CellStyleRef importCellStyle( const AttributeList& rAttribs );
/** Imports the CELLSTYLE record from the passed stream. */
- CellStyleRef importCellStyle( RecordInputStream& rStrm );
+ CellStyleRef importCellStyle( SequenceInputStream& rStrm );
/** Imports the STYLE record from the passed stream. */
CellStyleRef importStyle( BiffInputStream& rStrm );
@@ -943,6 +946,21 @@ private:
// ============================================================================
+struct AutoFormatModel
+{
+ sal_Int32 mnAutoFormatId; /// Index of predefined autoformatting.
+ bool mbApplyNumFmt; /// True = apply number format from autoformatting.
+ bool mbApplyFont; /// True = apply font from autoformatting.
+ bool mbApplyAlignment; /// True = apply alignment from autoformatting.
+ bool mbApplyBorder; /// True = apply border from autoformatting.
+ bool mbApplyFill; /// True = apply fill from autoformatting.
+ bool mbApplyProtection; /// True = apply protection from autoformatting.
+
+ explicit AutoFormatModel();
+};
+
+// ============================================================================
+
class StylesBuffer : public WorkbookHelper
{
public:
@@ -977,11 +995,11 @@ public:
CellStyleRef importCellStyle( const AttributeList& rAttribs );
/** Appends a new color to the color palette. */
- void importPaletteColor( RecordInputStream& rStrm );
+ void importPaletteColor( SequenceInputStream& rStrm );
/** Imports the NUMFMT record from the passed stream. */
- void importNumFmt( RecordInputStream& rStrm );
+ void importNumFmt( SequenceInputStream& rStrm );
/** Imports the CELLSTYLE record from the passed stream. */
- void importCellStyle( RecordInputStream& rStrm );
+ void importCellStyle( SequenceInputStream& rStrm );
/** Imports the PALETTE record from the passed stream. */
void importPalette( BiffInputStream& rStrm );
@@ -996,6 +1014,9 @@ public:
/** Imports the STYLE record from the passed stream. */
void importStyle( BiffInputStream& rStrm );
+ /** Imports a color palette from a UNO sequence in the passed any. */
+ void importPalette( const ::com::sun::star::uno::Any& rPalette );
+
/** Final processing after import of all style settings. */
void finalizeImport();
@@ -1075,4 +1096,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/stylesfragment.hxx b/oox/inc/oox/xls/stylesfragment.hxx
index b3dc63fe6e31..eb1af53d9cdb 100644
--- a/oox/inc/oox/xls/stylesfragment.hxx
+++ b/oox/inc/oox/xls/stylesfragment.hxx
@@ -36,24 +36,24 @@ namespace xls {
// ============================================================================
-class OoxIndexedColorsContext : public OoxWorkbookContextBase
+class IndexedColorsContext : public WorkbookContextBase
{
public:
- explicit OoxIndexedColorsContext( OoxWorkbookFragmentBase& rFragment );
+ explicit IndexedColorsContext( WorkbookFragmentBase& rFragment );
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
};
// ============================================================================
-class OoxFontContext : public OoxWorkbookContextBase
+class FontContext : public WorkbookContextBase
{
public:
template< typename ParentType >
- inline explicit OoxFontContext( ParentType& rParent, const FontRef& rxFont ) :
- OoxWorkbookContextBase( rParent ), mxFont( rxFont ) {}
+ inline explicit FontContext( ParentType& rParent, const FontRef& rxFont ) :
+ WorkbookContextBase( rParent ), mxFont( rxFont ) {}
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -64,12 +64,12 @@ private:
// ============================================================================
-class OoxBorderContext : public OoxWorkbookContextBase
+class BorderContext : public WorkbookContextBase
{
public:
template< typename ParentType >
- inline explicit OoxBorderContext( ParentType& rParent, const BorderRef& rxBorder ) :
- OoxWorkbookContextBase( rParent ), mxBorder( rxBorder ) {}
+ inline explicit BorderContext( ParentType& rParent, const BorderRef& rxBorder ) :
+ WorkbookContextBase( rParent ), mxBorder( rxBorder ) {}
protected:
virtual void onStartElement( const AttributeList& rAttribs );
@@ -81,12 +81,12 @@ private:
// ============================================================================
-class OoxFillContext : public OoxWorkbookContextBase
+class FillContext : public WorkbookContextBase
{
public:
template< typename ParentType >
- inline explicit OoxFillContext( ParentType& rParent, const FillRef& rxFill ) :
- OoxWorkbookContextBase( rParent ), mxFill( rxFill ), mfGradPos( -1.0 ) {}
+ inline explicit FillContext( ParentType& rParent, const FillRef& rxFill ) :
+ WorkbookContextBase( rParent ), mxFill( rxFill ), mfGradPos( -1.0 ) {}
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -98,12 +98,12 @@ private:
// ============================================================================
-class OoxXfContext : public OoxWorkbookContextBase
+class XfContext : public WorkbookContextBase
{
public:
template< typename ParentType >
- inline explicit OoxXfContext( ParentType& rParent, const XfRef& rxXf, bool bCellXf ) :
- OoxWorkbookContextBase( rParent ), mxXf( rxXf ), mbCellXf( bCellXf ) {}
+ inline explicit XfContext( ParentType& rParent, const XfRef& rxXf, bool bCellXf ) :
+ WorkbookContextBase( rParent ), mxXf( rxXf ), mbCellXf( bCellXf ) {}
protected:
virtual void onStartElement( const AttributeList& rAttribs );
@@ -116,12 +116,12 @@ private:
// ============================================================================
-class OoxDxfContext : public OoxWorkbookContextBase
+class DxfContext : public WorkbookContextBase
{
public:
template< typename ParentType >
- inline explicit OoxDxfContext( ParentType& rParent, const DxfRef& rxDxf ) :
- OoxWorkbookContextBase( rParent ), mxDxf( rxDxf ) {}
+ inline explicit DxfContext( ParentType& rParent, const DxfRef& rxDxf ) :
+ WorkbookContextBase( rParent ), mxDxf( rxDxf ) {}
protected:
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -132,20 +132,16 @@ private:
// ============================================================================
-class OoxStylesFragment : public OoxWorkbookFragmentBase
+class StylesFragment : public WorkbookFragmentBase
{
public:
- explicit OoxStylesFragment(
+ explicit StylesFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
-
- // oox.core.FragmentHandler2 interface ------------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
virtual void finalizeImport();
@@ -157,4 +153,3 @@ protected:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/tablebuffer.hxx b/oox/inc/oox/xls/tablebuffer.hxx
index 993b4305d03a..d643fbc40728 100644
--- a/oox/inc/oox/xls/tablebuffer.hxx
+++ b/oox/inc/oox/xls/tablebuffer.hxx
@@ -29,7 +29,7 @@
#define OOX_XLS_TABLEBUFFER_HXX
#include <com/sun/star/table/CellRangeAddress.hpp>
-#include "oox/helper/containerhelper.hxx"
+#include "oox/xls/autofilterbuffer.hxx"
#include "oox/xls/workbookhelper.hxx"
namespace oox {
@@ -61,16 +61,18 @@ public:
/** Imports a table definition from the passed attributes. */
void importTable( const AttributeList& rAttribs, sal_Int16 nSheet );
/** Imports a table definition from a TABLE record. */
- void importTable( RecordInputStream& rStrm, sal_Int16 nSheet );
+ void importTable( SequenceInputStream& rStrm, sal_Int16 nSheet );
+ /** Creates a new auto filter and stores it internally. */
+ inline AutoFilter& createAutoFilter() { return maAutoFilters.createAutoFilter(); }
/** Creates a database range from this tables. */
void finalizeImport();
- /** Returns the table identifier. */
+ /** Returns the unique table identifier. */
inline sal_Int32 getTableId() const { return maModel.mnId; }
/** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */
inline sal_Int32 getTokenIndex() const { return mnTokenIndex; }
- /** Returns the display name of the table. */
+ /** Returns the original display name of the table. */
inline const ::rtl::OUString& getDisplayName() const { return maModel.maDisplayName; }
/** Returns the original (unchecked) total range of the table. */
@@ -88,6 +90,8 @@ public:
private:
TableModel maModel;
+ AutoFilterBuffer maAutoFilters; /// Filter settings for this table.
+ ::rtl::OUString maDBRangeName; /// Name of the databae range in the Calc document.
::com::sun::star::table::CellRangeAddress
maDestRange; /// Validated range of the table in the worksheet.
sal_Int32 mnTokenIndex; /// Token index used in API token array.
@@ -102,10 +106,8 @@ class TableBuffer : public WorkbookHelper
public:
explicit TableBuffer( const WorkbookHelper& rHelper );
- /** Imports a table definition from the passed attributes. */
- TableRef importTable( const AttributeList& rAttribs, sal_Int16 nSheet );
- /** Imports a table definition from a TABLE record. */
- TableRef importTable( RecordInputStream& rStrm, sal_Int16 nSheet );
+ /** Creates a new empty table. */
+ Table& createTable();
/** Creates database ranges from all imported tables. */
void finalizeImport();
@@ -116,12 +118,15 @@ public:
TableRef getTable( const ::rtl::OUString& rDispName ) const;
private:
- void insertTable( TableRef xTable );
+ /** Inserts the passed table into the maps according to its identifier and name. */
+ void insertTableToMaps( const TableRef& rxTable );
private:
+ typedef RefVector< Table > TableVector;
typedef RefMap< sal_Int32, Table > TableIdMap;
typedef RefMap< ::rtl::OUString, Table > TableNameMap;
+ TableVector maTables;
TableIdMap maIdTables;
TableNameMap maNameTables;
};
@@ -132,4 +137,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/tablefragment.hxx b/oox/inc/oox/xls/tablefragment.hxx
index e30eb1e2f9e8..9c2678405ee5 100644
--- a/oox/inc/oox/xls/tablefragment.hxx
+++ b/oox/inc/oox/xls/tablefragment.hxx
@@ -29,32 +29,29 @@
#define OOX_XLS_TABLEFRAGMENT_HXX
#include "oox/xls/excelhandlers.hxx"
-#include "oox/xls/tablebuffer.hxx"
namespace oox {
namespace xls {
+class Table;
+
// ============================================================================
-class OoxTableFragment : public OoxWorksheetFragmentBase
+class TableFragment : public WorksheetFragmentBase
{
public:
- explicit OoxTableFragment(
+ explicit TableFragment(
const WorksheetHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
-
- // oox.core.FragmentHandler2 interface ------------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
private:
- TableRef mxTable; /// Current table.
+ Table& mrTable;
};
// ============================================================================
@@ -63,4 +60,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/themebuffer.hxx b/oox/inc/oox/xls/themebuffer.hxx
index 338837e40427..95d092198b95 100644
--- a/oox/inc/oox/xls/themebuffer.hxx
+++ b/oox/inc/oox/xls/themebuffer.hxx
@@ -61,4 +61,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/unitconverter.hxx b/oox/inc/oox/xls/unitconverter.hxx
index 36a70a7f4067..1ea4180bc6fd 100644
--- a/oox/inc/oox/xls/unitconverter.hxx
+++ b/oox/inc/oox/xls/unitconverter.hxx
@@ -28,8 +28,8 @@
#ifndef OOX_XLS_UNITCONVERTER_HXX
#define OOX_XLS_UNITCONVERTER_HXX
-#include <vector>
#include <map>
+#include <vector>
#include "oox/xls/workbookhelper.hxx"
namespace com { namespace sun { namespace star {
@@ -121,4 +121,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/viewsettings.hxx b/oox/inc/oox/xls/viewsettings.hxx
index 1f82aedeef91..c5880bf077fe 100644
--- a/oox/inc/oox/xls/viewsettings.hxx
+++ b/oox/inc/oox/xls/viewsettings.hxx
@@ -30,7 +30,6 @@
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
-#include "oox/helper/containerhelper.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/stylesbuffer.hxx"
#include "oox/xls/worksheethelper.hxx"
@@ -119,13 +118,13 @@ public:
void importChartSheetView( const AttributeList& rAttribs );
/** Imports the SHEETVIEW record containing sheet view settings. */
- void importSheetView( RecordInputStream& rStrm );
+ void importSheetView( SequenceInputStream& rStrm );
/** Imports the PANE record containing sheet pane settings. */
- void importPane( RecordInputStream& rStrm );
+ void importPane( SequenceInputStream& rStrm );
/** Imports the SELECTION record containing selection settings for a pane. */
- void importSelection( RecordInputStream& rStrm );
+ void importSelection( SequenceInputStream& rStrm );
/** Imports the CHARTSHEETVIEW record containing view settings of a chart sheet. */
- void importChartSheetView( RecordInputStream& rStrm );
+ void importChartSheetView( SequenceInputStream& rStrm );
/** Imports the WINDOW2 record containing sheet view settings. */
void importWindow2( BiffInputStream& rStrm );
@@ -139,6 +138,9 @@ public:
/** Converts all imported sheet view settings. */
void finalizeImport();
+ /** Returns true, if the sheet layout is set to right-to-left. */
+ bool isSheetRightToLeft() const;
+
private:
SheetViewModelRef createSheetView();
@@ -182,9 +184,9 @@ public:
/** Imports the oleSize element containing the visible size of the workbook. */
void importOleSize( const AttributeList& rAttribs );
/** Imports the WORKBOOKVIEW record containing workbook view settings. */
- void importWorkbookView( RecordInputStream& rStrm );
+ void importWorkbookView( SequenceInputStream& rStrm );
/** Imports the OLESIZE record containing the visible size of the workbook. */
- void importOleSize( RecordInputStream& rStrm );
+ void importOleSize( SequenceInputStream& rStrm );
/** Imports the WINDOW1 record containing workbook view settings. */
void importWindow1( BiffInputStream& rStrm );
/** Imports the OLESIZE record containing the visible size of the workbook. */
@@ -228,4 +230,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/webquerybuffer.hxx b/oox/inc/oox/xls/webquerybuffer.hxx
deleted file mode 100644
index 22c91bc15d1f..000000000000
--- a/oox/inc/oox/xls/webquerybuffer.hxx
+++ /dev/null
@@ -1,127 +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_WEBQUERYBUFFER_HXX
-#define OOX_XLS_WEBQUERYBUFFER_HXX
-
-#include <vector>
-#include <hash_map>
-#include <boost/shared_ptr.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include "oox/xls/workbookhelper.hxx"
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-struct QueryTable
-{
- sal_Int32 mnConnectionId;
-};
-
-// struct WebQuery
-// {
-// enum WebQueryMode
-// {
-// xlWQUnknown, /// Not specified.
-// xlWQDocument, /// Entire document.
-// xlWQAllTables, /// All tables.
-// xlWQSpecTables /// Specific tables.
-// };
-//
-// ::rtl::OUString maURL; /// Source document URL.
-// ::rtl::OUString maTables; /// List of source range names.
-// ::com::sun::star::table::CellRangeAddress maDestRange; /// Destination range.
-// WebQueryMode meMode; /// Current mode of web query.
-// sal_uInt16 mnRefresh; /// Refresh time in minutes.
-// };
-
-struct BaseProperties
-{
-};
-
-/** Stores web query properties from webPr element. */
-struct WebProperties : public BaseProperties
-{
- ::rtl::OUString maURL;
-};
-
-/** Stores text data source properties from textPr element. */
-struct TextProperties : public BaseProperties
-{
- ::rtl::OUString maSourceFile;
-};
-
-struct Connection
-{
- static const sal_Int32 CONNECTION_ODBC_SOURCE;
- static const sal_Int32 CONNECTION_DAO_SOURCE;
- static const sal_Int32 CONNECTION_FILE_SOURCE;
- static const sal_Int32 CONNECTION_WEBQUERY;
- static const sal_Int32 CONNECTION_OLEDB_SOURCE;
- static const sal_Int32 CONNECTION_TEXT_SOURCE;
- static const sal_Int32 CONNECTION_ADO_RECORD_SET;
- static const sal_Int32 CONNECTION_DSP;
-
- ::rtl::OUString maName; /// Connection name (must be unique).
- sal_Int32 mnType;
- ::boost::shared_ptr< BaseProperties > mpProperties;
-};
-
-// ============================================================================
-
-typedef ::std::hash_map< ::rtl::OUString, QueryTable, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > QueryTableHashMap;
-
-class WebQueryBuffer : public WorkbookHelper
-{
-public:
- explicit WebQueryBuffer( const WorkbookHelper& rHelper );
-
- void importQueryTable( const AttributeList& rAttribs );
-
- void importConnection( const AttributeList& rAttribs );
-
- void importWebPr( const AttributeList& rAttribs );
-
- /** Dumps content for debug purposes. */
- void dump() const;
-
-private:
- QueryTableHashMap maQueryTableMap;
- ::std::vector< Connection > maConnections;
-
- sal_Int32 mnCurConnId; /// Current connection ID.
-};
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
-#endif
-
diff --git a/oox/inc/oox/xls/workbookfragment.hxx b/oox/inc/oox/xls/workbookfragment.hxx
index f9f0bb25c78f..d0b0cadd416b 100644
--- a/oox/inc/oox/xls/workbookfragment.hxx
+++ b/oox/inc/oox/xls/workbookfragment.hxx
@@ -38,22 +38,18 @@ class ExternalLink;
// ============================================================================
-class OoxWorkbookFragment : public OoxWorkbookFragmentBase
+class WorkbookFragment : public WorkbookFragmentBase
{
public:
- explicit OoxWorkbookFragment(
+ explicit WorkbookFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
-
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
- // oox.core.FragmentHandler2 interface ------------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
virtual void finalizeImport();
@@ -63,8 +59,8 @@ private:
void importDefinedName( const AttributeList& rAttribs );
void importPivotCache( const AttributeList& rAttribs );
- void importExternalRef( RecordInputStream& rStrm );
- void importPivotCache( RecordInputStream& rStrm );
+ void importExternalRef( SequenceInputStream& rStrm );
+ void importPivotCache( SequenceInputStream& rStrm );
void importExternalLinkFragment( ExternalLink& rExtLink );
void importPivotCacheDefFragment( const ::rtl::OUString& rRelId, sal_Int32 nCacheId );
@@ -100,4 +96,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx
index 0ff8c0f9d3e5..ecf824076ef5 100644
--- a/oox/inc/oox/xls/workbookhelper.hxx
+++ b/oox/inc/oox/xls/workbookhelper.hxx
@@ -37,24 +37,21 @@ namespace com { namespace sun { namespace star {
namespace container { class XNameAccess; }
namespace container { class XNameContainer; }
namespace lang { class XMultiServiceFactory; }
- namespace awt { class XDevice; }
+ namespace sheet { class XDatabaseRange; }
+ namespace sheet { class XNamedRange; }
+ namespace sheet { class XSpreadsheet; }
+ namespace sheet { class XSpreadsheetDocument; }
+ namespace style { class XStyle; }
namespace table { struct CellAddress; }
namespace table { struct CellRangeAddress; }
namespace table { class XCell; }
namespace table { class XCellRange; }
- namespace sheet { class XSpreadsheetDocument; }
- namespace sheet { class XSpreadsheet; }
- namespace sheet { class XNamedRanges; }
- namespace sheet { class XNamedRange; }
- namespace sheet { class XDatabaseRanges; }
- namespace sheet { class XExternalDocLinks; }
- namespace style { class XStyle; }
} } }
namespace oox {
class AttributeList;
class SegmentProgressBar;
- class RecordInputStream;
+ class SequenceInputStream;
}
namespace oox { namespace core {
@@ -79,8 +76,8 @@ class ExcelBiffFilter;
/** An enumeration for all supported spreadsheet filter types. */
enum FilterType
{
- FILTER_OOX, /// MS Excel OOXML (Office Open XML) or OOBIN.
- FILTER_BIFF, /// MS Excel BIFF (Binary Interchange File Format).
+ FILTER_OOXML, /// MS Excel OOXML (Office Open XML) or BIFF12.
+ FILTER_BIFF, /// MS Excel BIFF2-BIFF8 (Binary Interchange File Format).
FILTER_UNKNOWN /// Unknown filter type.
};
@@ -89,31 +86,31 @@ enum FilterType
/** Functor for case-insensitive string comparison, usable in maps etc. */
struct IgnoreCaseCompare
{
- bool operator()( const ::rtl::OUString& rName1, const ::rtl::OUString& rName2 ) const;
+ bool operator()( const ::rtl::OUString& rName1, const ::rtl::OUString& rName2 ) const;
};
// ============================================================================
-class WorkbookData;
-class WorkbookSettings;
-class ViewSettings;
-class WorksheetBuffer;
-class ThemeBuffer;
-class StylesBuffer;
-class SharedStringsBuffer;
-class ExternalLinkBuffer;
+class AddressConverter;
+class BiffCodecHelper;
+class ConnectionsBuffer;
class DefinedNamesBuffer;
-class TableBuffer;
-class ScenarioBuffer;
-class WebQueryBuffer;
+class ExcelChartConverter;
+class ExternalLinkBuffer;
+class FormulaParser;
+class PageSettingsConverter;
class PivotCacheBuffer;
class PivotTableBuffer;
-class FormulaParser;
+class ScenarioBuffer;
+class SharedStringsBuffer;
+class StylesBuffer;
+class TableBuffer;
+class ThemeBuffer;
class UnitConverter;
-class AddressConverter;
-class ExcelChartConverter;
-class PageSettingsConverter;
-class BiffCodecHelper;
+class ViewSettings;
+class WorkbookData;
+class WorkbookSettings;
+class WorksheetBuffer;
/** Helper class to provice access to global workbook data.
@@ -163,21 +160,6 @@ public:
/** 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 the reference device of the document. */
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >
- getReferenceDevice() const;
- /** Returns the container for defined names from the Calc document. */
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRanges >
- getNamedRanges() const;
- /** Returns the container for database ranges from the Calc document. */
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRanges >
- getDatabaseRanges() const;
- /** Returns the container for external documents from the Calc document. */
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLinks >
- getExternalDocLinks() const;
- /** Returns the container for DDE links from the Calc document. */
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
- getDdeLinks() const;
/** Returns a reference to the specified spreadsheet in the document model. */
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >
@@ -203,12 +185,21 @@ public:
getStyleObject( const ::rtl::OUString& rStyleName, bool bPageStyle ) const;
/** Creates and returns a defined name on-the-fly in the Calc document.
- The name will not be buffered in this defined names buffer.
+ The name will not be buffered in the global defined names buffer.
@param orName (in/out-parameter) Returns the resulting used name. */
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >
createNamedRangeObject(
::rtl::OUString& orName,
sal_Int32 nNameFlags = 0 ) const;
+
+ /** Creates and returns a database range on-the-fly in the Calc document.
+ The range will not be buffered in the global table buffer.
+ @param orName (in/out-parameter) Returns the resulting used name. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRange >
+ createDatabaseRangeObject(
+ ::rtl::OUString& orName,
+ const ::com::sun::star::table::CellRangeAddress& rRangeAddr ) const;
+
/** Creates and returns a com.sun.star.style.Style object for cells or pages. */
::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
createStyleObject(
@@ -237,8 +228,8 @@ public:
TableBuffer& getTables() const;
/** Returns the scenarios collection. */
ScenarioBuffer& getScenarios() const;
- /** Returns the web queries. */
- WebQueryBuffer& getWebQueries() const;
+ /** Returns the collection of external data connections. */
+ ConnectionsBuffer& getConnections() const;
/** Returns the collection of pivot caches. */
PivotCacheBuffer& getPivotCaches() const;
/** Returns the collection of pivot tables. */
@@ -257,17 +248,17 @@ public:
/** Returns the page and print settings converter. */
PageSettingsConverter& getPageSettingsConverter() const;
- // OOX specific (MUST NOT be called in BIFF filter) -----------------------
+ // OOXML/BIFF12 specific (MUST NOT be called in BIFF filter) --------------
- /** Returns the base OOX filter object.
- Must not be called, if current filter is not the OOX filter. */
+ /** Returns the base OOXML/BIFF12 filter object.
+ Must not be called, if current filter is not the OOXML/BIFF12 filter. */
::oox::core::XmlFilterBase& getOoxFilter() const;
/** Imports a fragment using the passed fragment handler, which contains
the full path to the fragment stream. */
bool importOoxFragment( const ::rtl::Reference< ::oox::core::FragmentHandler >& rxHandler );
- // BIFF specific (MUST NOT be called in OOX filter) -----------------------
+ // BIFF2-BIFF8 specific (MUST NOT be called in OOXML/BIFF12 filter) -------
/** Returns the base BIFF filter object. */
::oox::core::BinaryFilterBase& getBiffFilter() const;
diff --git a/oox/inc/oox/xls/workbooksettings.hxx b/oox/inc/oox/xls/workbooksettings.hxx
index 8ba322103955..858e886df778 100644
--- a/oox/inc/oox/xls/workbooksettings.hxx
+++ b/oox/inc/oox/xls/workbooksettings.hxx
@@ -61,8 +61,8 @@ struct WorkbookSettingsModel
explicit WorkbookSettingsModel();
- /** Sets OOBIN or BIFF object visibility mode. */
- void setBinObjectMode( sal_uInt16 nObjMode );
+ /** Sets BIFF object visibility mode. */
+ void setBiffObjectMode( sal_uInt16 nObjMode );
};
// ============================================================================
@@ -101,11 +101,11 @@ public:
void importCalcPr( const AttributeList& rAttribs );
/** Imports the FILESHARING record containing write protection settings. */
- void importFileSharing( RecordInputStream& rStrm );
+ void importFileSharing( SequenceInputStream& rStrm );
/** Imports the WORKBOOKPR record containing global workbook settings. */
- void importWorkbookPr( RecordInputStream& rStrm );
+ void importWorkbookPr( SequenceInputStream& rStrm );
/** Imports the CALCPR record containing workbook calculation settings. */
- void importCalcPr( RecordInputStream& rStrm );
+ void importCalcPr( SequenceInputStream& rStrm );
/** Sets the save external linked values flag, e.g. from the WSBOOL record. */
void setSaveExtLinkValues( bool bSaveExtLinks );
@@ -162,4 +162,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/worksheetbuffer.hxx b/oox/inc/oox/xls/worksheetbuffer.hxx
index 2f9359b38370..7c59cce988dd 100644
--- a/oox/inc/oox/xls/worksheetbuffer.hxx
+++ b/oox/inc/oox/xls/worksheetbuffer.hxx
@@ -29,7 +29,8 @@
#define OOX_XLS_WORKSHEETBUFFER_HXX
#include <utility>
-#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
#include "oox/xls/workbookhelper.hxx"
namespace com { namespace sun { namespace star {
@@ -58,8 +59,8 @@ struct SheetInfoModel
/** Stores information about all sheets in a spreadsheet document.
Information about sheets includes the sheet name, the visibility state, and
- for the OOX filter, the relation identifier of the sheet used to obtain the
- related worksheet fragment.
+ for the OOXML filter, the relation identifier of the sheet used to obtain
+ the related worksheet fragment.
*/
class WorksheetBuffer : public WorkbookHelper
{
@@ -74,8 +75,8 @@ public:
/** Imports the attributes of a sheet element. */
void importSheet( const AttributeList& rAttribs );
- /** Imports the SHEET record from the passed OOBIN stream. */
- void importSheet( RecordInputStream& rStrm );
+ /** Imports the SHEET record from the passed BIFF12 stream. */
+ void importSheet( SequenceInputStream& rStrm );
/** Imports the SHEET record from the passed BIFF stream. */
void importSheet( BiffInputStream& rStrm );
/** Inserts a new empty sheet into the document. Looks for an unused name.
@@ -84,7 +85,7 @@ public:
/** Returns the number of original sheets contained in the workbook. */
sal_Int32 getWorksheetCount() const;
- /** Returns the OOX relation identifier of the specified worksheet. */
+ /** Returns the OOXML relation identifier of the specified worksheet. */
::rtl::OUString getWorksheetRelId( sal_Int32 nWorksheet ) const;
/** Returns the BIFF record handle of the associated sheet substream. */
sal_Int64 getBiffRecordHandle( sal_Int32 nWorksheet ) const;
@@ -130,4 +131,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/worksheetfragment.hxx b/oox/inc/oox/xls/worksheetfragment.hxx
index 7234153d7dd3..4fe3bf4240dd 100644
--- a/oox/inc/oox/xls/worksheetfragment.hxx
+++ b/oox/inc/oox/xls/worksheetfragment.hxx
@@ -35,24 +35,23 @@ namespace xls {
// ============================================================================
-class OoxDataValidationsContext : public OoxWorksheetContextBase
+class DataValidationsContext : public WorksheetContextBase
{
public:
- explicit OoxDataValidationsContext( OoxWorksheetFragmentBase& rFragment );
+ explicit DataValidationsContext( WorksheetFragmentBase& rFragment );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
+ virtual void onEndElement();
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
private:
/** Imports the dataValidation element containing data validation settings. */
void importDataValidation( const AttributeList& rAttribs );
/** Imports the DATAVALIDATION record containing data validation settings. */
- void importDataValidation( RecordInputStream& rStrm );
+ void importDataValidation( SequenceInputStream& rStrm );
private:
::std::auto_ptr< ValidationModel > mxValModel;
@@ -60,25 +59,21 @@ private:
// ============================================================================
-class OoxWorksheetFragment : public OoxWorksheetFragmentBase
+class WorksheetFragment : public WorksheetFragmentBase
{
public:
- explicit OoxWorksheetFragment(
+ explicit WorksheetFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
WorksheetType eSheetType,
sal_Int16 nSheet );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
-
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
-
- virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual void onCharacters( const ::rtl::OUString& rChars );
- // oox.core.FragmentHandler2 interface ------------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
virtual void initializeImport();
@@ -109,25 +104,25 @@ private:
void importControl( const AttributeList& rAttribs );
/** Imports the DIMENSION record containing the used area of the sheet. */
- void importDimension( RecordInputStream& rStrm );
+ void importDimension( SequenceInputStream& rStrm );
/** Imports sheet format properties from a SHEETFORMATPR record. */
- void importSheetFormatPr( RecordInputStream& rStrm );
+ void importSheetFormatPr( SequenceInputStream& rStrm );
/** Imports column settings from a COL record. */
- void importCol( RecordInputStream& rStrm );
+ void importCol( SequenceInputStream& rStrm );
/** Imports a merged cell range from a MERGECELL record. */
- void importMergeCell( RecordInputStream& rStrm );
+ void importMergeCell( SequenceInputStream& rStrm );
/** Imports a hyperlink for a cell range from a HYPERLINK record. */
- void importHyperlink( RecordInputStream& rStrm );
+ void importHyperlink( SequenceInputStream& rStrm );
/** Imports the BRK record for an individual row or column page break. */
- void importBrk( RecordInputStream& rStrm, bool bRowBreak );
+ void importBrk( SequenceInputStream& rStrm, bool bRowBreak );
/** Imports the DRAWING record containing the relation identifier for the DrawingML part. */
- void importDrawing( RecordInputStream& rStrm );
+ void importDrawing( SequenceInputStream& rStrm );
/** Imports the LEGACYDRAWING record containing the relation identifier for the VML drawing part. */
- void importLegacyDrawing( RecordInputStream& rStrm );
+ void importLegacyDrawing( SequenceInputStream& rStrm );
/** Imports additional data for an OLE object. */
- void importOleObject( RecordInputStream& rStrm );
+ void importOleObject( SequenceInputStream& rStrm );
/** Imports additional data for an OCX form control. */
- void importControl( RecordInputStream& rStrm );
+ void importControl( SequenceInputStream& rStrm );
/** Imports the binary data of an embedded OLE object from the fragment with the passed ID. */
void importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const ::rtl::OUString& rRelId );
@@ -135,14 +130,12 @@ private:
// ============================================================================
-class BiffPivotTableContext;
-
class BiffWorksheetFragment : public BiffWorksheetFragmentBase
{
public:
explicit BiffWorksheetFragment(
const BiffWorkbookFragmentBase& rParent,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
WorksheetType eSheetType,
sal_Int16 nSheet );
virtual ~BiffWorksheetFragment();
@@ -151,41 +144,45 @@ public:
virtual bool importFragment();
private:
+ /** Imports the AUTOFILTER and following records with auto filter settings. */
+ void importAutoFilter( BiffInputStream& rStrm );
/** Imports the COLINFO record and sets column properties and formatting. */
- void importColInfo();
+ void importColInfo( BiffInputStream& rStrm );
/** Imports the BIFF2 COLUMNDEFAULT record and sets column default formatting. */
- void importColumnDefault();
+ void importColumnDefault( BiffInputStream& rStrm );
/** Imports the BIFF2 COLWIDTH record and sets column width. */
- void importColWidth();
+ void importColWidth( BiffInputStream& rStrm );
/** Imports the DATAVALIDATION record containing cell ranges with data validation settings. */
- void importDataValidation();
+ void importDataValidation( BiffInputStream& rStrm );
/** Imports the DATAVALIDATIONS record containing global data validation settings. */
- void importDataValidations();
+ void importDataValidations( BiffInputStream& rStrm );
/** Imports the DEFCOLWIDTH record and sets default column width. */
- void importDefColWidth();
+ void importDefColWidth( BiffInputStream& rStrm );
/** Imports the DEFROWHEIGHT record and sets default row height and properties. */
- void importDefRowHeight();
+ void importDefRowHeight( BiffInputStream& rStrm );
/** Imports the DIMENSION record containing the used area of the sheet. */
- void importDimension();
+ void importDimension( BiffInputStream& rStrm );
/** Imports the HYPERLINK record and sets a cell hyperlink. */
- void importHyperlink();
+ void importHyperlink( BiffInputStream& rStrm );
/** Imports the LABELRANGES record and sets the imported label ranges. */
- void importLabelRanges();
+ void importLabelRanges( BiffInputStream& rStrm );
/** Imports the MEREDCELLS record and merges all cells in the document. */
- void importMergedCells();
+ void importMergedCells( BiffInputStream& rStrm );
/** Imports the HORPAGEBREAKS or VERPAGEBREAKS record and inserts page breaks. */
- void importPageBreaks( bool bRowBreak );
+ void importPageBreaks( BiffInputStream& rStrm, bool bRowBreak );
/** Imports a pivot table. */
- void importPTDefinition();
+ void importPTDefinition( BiffInputStream& rStrm );
+ /** Imports the QUERYTABLE and following records and inserts a web query. */
+ void importQueryTable( BiffInputStream& rStrm );
/** Imports the SCENARIOS record and the following scenarios. */
- void importScenarios();
+ void importScenarios( BiffInputStream& rStrm );
/** Imports the SHAREDFEATHEAD record. */
- void importSharedFeatHead();
+ void importSharedFeatHead( BiffInputStream& rStrm );
/** Imports the STANDARDWIDTH record and sets standard column width. */
- void importStandardWidth();
+ void importStandardWidth( BiffInputStream& rStrm );
private:
- ::boost::shared_ptr< BiffPivotTableContext > mxPTContext;
+ ::boost::shared_ptr< BiffWorksheetContextBase > mxContext;
};
// ============================================================================
@@ -194,4 +191,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx
index 632d7027403f..55bf1c044e30 100644
--- a/oox/inc/oox/xls/worksheethelper.hxx
+++ b/oox/inc/oox/xls/worksheethelper.hxx
@@ -37,29 +37,31 @@ namespace com { namespace sun { namespace star {
namespace awt { struct Point; }
namespace awt { struct Rectangle; }
namespace awt { struct Size; }
- namespace util { struct DateTime; }
namespace drawing { class XDrawPage; }
- namespace table { class XTableColumns; }
- namespace table { class XTableRows; }
+ namespace sheet { class XSheetCellRanges; }
+ namespace sheet { class XSpreadsheet; }
namespace table { class XCell; }
namespace table { class XCellRange; }
- namespace sheet { class XSpreadsheet; }
- namespace sheet { class XSheetCellRanges; }
+ namespace table { class XTableColumns; }
+ namespace table { class XTableRows; }
+ namespace util { struct DateTime; }
} } }
namespace oox {
namespace xls {
+class AutoFilterBuffer;
struct BinAddress;
struct BinRange;
class BinRangeList;
-class WorksheetSettings;
-class SharedFormulaBuffer;
-class CondFormatBuffer;
class CommentsBuffer;
+class CondFormatBuffer;
class PageSettings;
+class QueryTableBuffer;
+class SharedFormulaBuffer;
class SheetViewSettings;
class VmlDrawing;
+class WorksheetSettings;
// ============================================================================
// ============================================================================
@@ -202,12 +204,12 @@ struct ValidationModel
explicit ValidationModel();
- /** Sets the passed OOBIN or BIFF validation type. */
- void setBinType( sal_uInt8 nType );
- /** Sets the passed OOBIN or BIFF operator. */
- void setBinOperator( sal_uInt8 nOperator );
- /** Sets the passed OOBIN or BIFF error style. */
- void setBinErrorStyle( sal_uInt8 nErrorStyle );
+ /** Sets the passed BIFF validation type. */
+ void setBiffType( sal_uInt8 nType );
+ /** Sets the passed BIFF operator. */
+ void setBiffOperator( sal_uInt8 nOperator );
+ /** Sets the passed BIFF error style. */
+ void setBiffErrorStyle( sal_uInt8 nErrorStyle );
};
// ============================================================================
@@ -314,6 +316,10 @@ public:
CondFormatBuffer& getCondFormats() const;
/** Returns the buffer for all cell comments in this sheet. */
CommentsBuffer& getComments() const;
+ /** Returns the auto filters for the sheet. */
+ AutoFilterBuffer& getAutoFilters() const;
+ /** Returns the buffer for all web query tables in this sheet. */
+ QueryTableBuffer& getQueryTables() const;
/** Returns the page/print settings for this sheet. */
PageSettings& getPageSettings() const;
/** Returns the view settings for this sheet. */
@@ -383,9 +389,8 @@ public:
void extendUsedArea( const ::com::sun::star::table::CellAddress& rAddress );
/** Extends the used area of this sheet by the passed cell range. */
void extendUsedArea( const ::com::sun::star::table::CellRangeAddress& rRange );
- /** Extends the shape bounding box by the position and size of the passed rectangle. */
- void extendShapeBoundingBox(
- const ::com::sun::star::awt::Rectangle& rShapeRect );
+ /** Extends the shape bounding box by the position and size of the passed rectangle (in 1/100 mm). */
+ void extendShapeBoundingBox( const ::com::sun::star::awt::Rectangle& rShapeRect );
/** Sets base width for all columns (without padding pixels). This value
is only used, if width has not been set with setDefaultColumnWidth(). */
@@ -445,7 +450,7 @@ protected:
/** Constructs from the passed data, creates and owns a new data object. */
explicit WorksheetHelperRoot(
const WorkbookHelper& rHelper,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
WorksheetType eSheetType,
sal_Int16 nSheet );
@@ -468,4 +473,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/inc/oox/xls/worksheetsettings.hxx b/oox/inc/oox/xls/worksheetsettings.hxx
index 17e22dc5342c..6d6c8a4912d2 100644
--- a/oox/inc/oox/xls/worksheetsettings.hxx
+++ b/oox/inc/oox/xls/worksheetsettings.hxx
@@ -28,8 +28,8 @@
#ifndef OOX_XLS_WORKSHEETSETTINGS_HXX
#define OOX_XLS_WORKSHEETSETTINGS_HXX
-#include "oox/xls/worksheethelper.hxx"
#include "oox/xls/richstring.hxx"
+#include "oox/xls/worksheethelper.hxx"
namespace oox {
namespace xls {
@@ -98,16 +98,18 @@ public:
void importPhoneticPr( const AttributeList& rAttribs );
/** Imports sheet properties from the SHEETPR record. */
- void importSheetPr( RecordInputStream& rStrm );
+ void importSheetPr( SequenceInputStream& rStrm );
/** Imports sheet properties from the CHARTSHEETPR record. */
- void importChartSheetPr( RecordInputStream& rStrm );
+ void importChartSheetPr( SequenceInputStream& rStrm );
/** Imports sheet protection settings from the SHEETPROTECTION record. */
- void importSheetProtection( RecordInputStream& rStrm );
+ void importSheetProtection( SequenceInputStream& rStrm );
/** Imports chart sheet protection settings from the CHARTPROTECTION record. */
- void importChartProtection( RecordInputStream& rStrm );
+ void importChartProtection( SequenceInputStream& rStrm );
/** Imports phonetic settings from the PHONETICPR record. */
- void importPhoneticPr( RecordInputStream& rStrm );
+ void importPhoneticPr( SequenceInputStream& rStrm );
+ /** Imports sheet properties from a SHEETEXT record. */
+ void importSheetExt( BiffInputStream& rStrm );
/** Imports sheet properties from a SHEETPR record. */
void importSheetPr( BiffInputStream& rStrm );
/** Imports protection status from the PROTECT record. */
@@ -140,4 +142,3 @@ private:
} // namespace oox
#endif
-
diff --git a/oox/prj/d.lst b/oox/prj/d.lst
index f656056b119e..69ff66b95bc5 100644
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@ -1,10 +1,11 @@
mkdir: %_DEST%\inc%_EXT%\oox
-mkdir: %_DEST%\inc%_EXT%\oox\helper
mkdir: %_DEST%\inc%_EXT%\oox\core
mkdir: %_DEST%\inc%_EXT%\oox\drawingml
mkdir: %_DEST%\inc%_EXT%\oox\drawingml\chart
mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table
+mkdir: %_DEST%\inc%_EXT%\oox\helper
mkdir: %_DEST%\inc%_EXT%\oox\ole
+mkdir: %_DEST%\inc%_EXT%\oox\token
mkdir: %_DEST%\inc%_EXT%\oox\vml
mkdir: %_DEST%\inc%_EXT%\oox\xls
@@ -17,14 +18,15 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls
..\%__SRC%\lib\i*.lib %_DEST%\lib%_EXT%\i*.lib
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
-..\%__SRC%\inc\tokens.hxx %_DEST%\inc%_EXT%\oox\core\tokens.hxx
+..\%__SRC%\inc\oox\token\tokens.hxx %_DEST%\inc%_EXT%\oox\token\tokens.hxx
+..\%__SRC%\misc\namespaces.txt %_DEST%\inc%_EXT%\oox\namespaces.txt
..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt
-..\source\token\namespaces.txt %_DEST%\inc%_EXT%\oox\namespaces.txt
..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx
..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
-..\inc\oox\helper\containerhelper.hxx %_DEST%\inc%_EXT%\oox\helper\containerhelper.hxx
+..\inc\oox\helper\refmap.hxx %_DEST%\inc%_EXT%\oox\helper\refmap.hxx
+..\inc\oox\helper\refvector.hxx %_DEST%\inc%_EXT%\oox\helper\refvector.hxx
..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx
..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx
..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
diff --git a/oox/source/core/binarycodec.cxx b/oox/source/core/binarycodec.cxx
index 954f623f1f91..3f406ba1af08 100644
--- a/oox/source/core/binarycodec.cxx
+++ b/oox/source/core/binarycodec.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/core/binarycodec.hxx"
+
#include <algorithm>
#include <string.h>
#include "oox/helper/attributelist.hxx"
@@ -424,4 +425,3 @@ bool BinaryCodec_RCF::skip( sal_Int32 nBytes )
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/binaryfilterbase.cxx b/oox/source/core/binaryfilterbase.cxx
index f308f02ac9dc..9bebedb9c96b 100644
--- a/oox/source/core/binaryfilterbase.cxx
+++ b/oox/source/core/binaryfilterbase.cxx
@@ -26,21 +26,24 @@
************************************************************************/
#include "oox/core/binaryfilterbase.hxx"
-#include "oox/ole/olestorage.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XStream;
+#include "oox/ole/olestorage.hxx"
namespace oox {
namespace core {
// ============================================================================
-BinaryFilterBase::BinaryFilterBase( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
- FilterBase( rxGlobalFactory )
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+BinaryFilterBase::BinaryFilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ FilterBase( rxContext )
{
}
@@ -52,16 +55,15 @@ BinaryFilterBase::~BinaryFilterBase()
StorageRef BinaryFilterBase::implCreateStorage( const Reference< XInputStream >& rxInStream ) const
{
- return StorageRef( new ::oox::ole::OleStorage( getGlobalFactory(), rxInStream, true ) );
+ return StorageRef( new ::oox::ole::OleStorage( getServiceFactory(), rxInStream, true ) );
}
StorageRef BinaryFilterBase::implCreateStorage( const Reference< XStream >& rxOutStream ) const
{
- return StorageRef( new ::oox::ole::OleStorage( getGlobalFactory(), rxOutStream, true ) );
+ return StorageRef( new ::oox::ole::OleStorage( getServiceFactory(), rxOutStream, true ) );
}
// ============================================================================
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/contexthandler.cxx b/oox/source/core/contexthandler.cxx
index b9c7cb48377e..8bf2c4eadfeb 100644
--- a/oox/source/core/contexthandler.cxx
+++ b/oox/source/core/contexthandler.cxx
@@ -26,21 +26,21 @@
************************************************************************/
#include "oox/core/contexthandler.hxx"
-#include "oox/core/fragmenthandler.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::xml::sax::SAXException;
-using ::com::sun::star::xml::sax::XFastAttributeList;
-using ::com::sun::star::xml::sax::XFastContextHandler;
-using ::com::sun::star::xml::sax::XLocator;
+#include "oox/core/fragmenthandler.hxx"
namespace oox {
namespace core {
// ============================================================================
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
ContextHandler::ContextHandler( ContextHandler& rParent ) :
ContextHandlerImplBase(),
mxBaseData( rParent.mxBaseData )
@@ -133,12 +133,12 @@ void ContextHandler::processingInstruction( const OUString&, const OUString& ) t
// record context interface ---------------------------------------------------
-ContextHandlerRef ContextHandler::createRecordContext( sal_Int32, RecordInputStream& )
+ContextHandlerRef ContextHandler::createRecordContext( sal_Int32, SequenceInputStream& )
{
return 0;
}
-void ContextHandler::startRecord( sal_Int32, RecordInputStream& )
+void ContextHandler::startRecord( sal_Int32, SequenceInputStream& )
{
}
@@ -150,4 +150,3 @@ void ContextHandler::endRecord( sal_Int32 )
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/contexthandler2.cxx b/oox/source/core/contexthandler2.cxx
index 0f39ba313e6b..48f5718f9149 100644
--- a/oox/source/core/contexthandler2.cxx
+++ b/oox/source/core/contexthandler2.cxx
@@ -28,36 +28,29 @@
#include "oox/core/contexthandler2.hxx"
#include <rtl/ustrbuf.hxx>
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::xml::sax::SAXException;
-using ::com::sun::star::xml::sax::XFastAttributeList;
-using ::com::sun::star::xml::sax::XFastContextHandler;
-
namespace oox {
namespace core {
// ============================================================================
-/** Information about a processed context element. */
-struct ContextInfo
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
+/** Information about a processed element. */
+struct ElementInfo
{
- OUStringBuffer maCurrChars; /// Collected characters from context.
- OUStringBuffer maFinalChars; /// Finalized (stipped) characters.
+ OUStringBuffer maChars; /// Collected element characters.
sal_Int32 mnElement; /// The element identifier.
bool mbTrimSpaces; /// True = trims leading/trailing spaces from text data.
- explicit ContextInfo();
+ inline explicit ElementInfo() : mnElement( XML_TOKEN_INVALID ), mbTrimSpaces( false ) {}
};
-ContextInfo::ContextInfo() :
- mnElement( XML_TOKEN_INVALID ),
- mbTrimSpaces( false )
-{
-}
-
// ============================================================================
ContextHandler2Helper::ContextHandler2Helper( bool bEnableTrimSpace ) :
@@ -65,7 +58,7 @@ ContextHandler2Helper::ContextHandler2Helper( bool bEnableTrimSpace ) :
mnRootStackSize( 0 ),
mbEnableTrimSpace( bEnableTrimSpace )
{
- pushContextInfo( XML_ROOT_CONTEXT );
+ pushElementInfo( XML_ROOT_CONTEXT );
}
ContextHandler2Helper::ContextHandler2Helper( const ContextHandler2Helper& rParent ) :
@@ -84,7 +77,7 @@ sal_Int32 ContextHandler2Helper::getCurrentElement() const
return mxContextStack->empty() ? XML_ROOT_CONTEXT : mxContextStack->back().mnElement;
}
-sal_Int32 ContextHandler2Helper::getPreviousElement( sal_Int32 nCountBack ) const
+sal_Int32 ContextHandler2Helper::getParentElement( sal_Int32 nCountBack ) const
{
if( (nCountBack < 0) || (mxContextStack->size() < static_cast< size_t >( nCountBack )) )
return XML_TOKEN_INVALID;
@@ -97,49 +90,50 @@ bool ContextHandler2Helper::isRootElement() const
return mxContextStack->size() == mnRootStackSize + 1;
}
-Reference< XFastContextHandler > ContextHandler2Helper::implCreateChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
+Reference< XFastContextHandler > ContextHandler2Helper::implCreateChildContext(
+ sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
{
- appendCollectedChars();
+ // #i76091# process collected characters (calls onCharacters() if needed)
+ processCollectedChars();
ContextHandlerRef xContext = onCreateContext( nElement, AttributeList( rxAttribs ) );
return Reference< XFastContextHandler >( xContext.get() );
}
-void ContextHandler2Helper::implStartCurrentContext( sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
+void ContextHandler2Helper::implStartElement( sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
{
AttributeList aAttribs( rxAttribs );
- pushContextInfo( nElement ).mbTrimSpaces = aAttribs.getToken( NMSP_XML | XML_space, XML_TOKEN_INVALID ) != XML_preserve;
+ pushElementInfo( nElement ).mbTrimSpaces = aAttribs.getToken( XML_TOKEN( space ), XML_TOKEN_INVALID ) != XML_preserve;
onStartElement( aAttribs );
}
void ContextHandler2Helper::implCharacters( const OUString& rChars )
{
- // #i76091# collect characters until context ends
+ // #i76091# collect characters until new element starts or this element ends
if( !mxContextStack->empty() )
- mxContextStack->back().maCurrChars.append( rChars );
+ mxContextStack->back().maChars.append( rChars );
}
-void ContextHandler2Helper::implEndCurrentContext( sal_Int32 nElement )
+void ContextHandler2Helper::implEndElement( sal_Int32 nElement )
{
(void)nElement; // prevent "unused parameter" warning in product build
- OSL_ENSURE( getCurrentElement() == nElement, "ContextHandler2Helper::implEndCurrentContext - context stack broken" );
+ OSL_ENSURE( getCurrentElement() == nElement, "ContextHandler2Helper::implEndElement - context stack broken" );
if( !mxContextStack->empty() )
{
- // #i76091# process collected characters
- appendCollectedChars();
- // finalize the current context and pop context info from stack
- onEndElement( mxContextStack->back().maFinalChars.makeStringAndClear() );
- popContextInfo();
+ // #i76091# process collected characters (calls onCharacters() if needed)
+ processCollectedChars();
+ onEndElement();
+ popElementInfo();
}
}
-ContextHandlerRef ContextHandler2Helper::implCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef ContextHandler2Helper::implCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
return onCreateRecordContext( nRecId, rStrm );
}
-void ContextHandler2Helper::implStartRecord( sal_Int32 nRecId, RecordInputStream& rStrm )
+void ContextHandler2Helper::implStartRecord( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
- pushContextInfo( nRecId );
+ pushElementInfo( nRecId );
onStartRecord( rStrm );
}
@@ -149,42 +143,44 @@ void ContextHandler2Helper::implEndRecord( sal_Int32 nRecId )
OSL_ENSURE( getCurrentElement() == nRecId, "ContextHandler2Helper::implEndRecord - context stack broken" );
if( !mxContextStack->empty() )
{
- // finalize the current context and pop context info from stack
onEndRecord();
- popContextInfo();
+ popElementInfo();
}
}
-ContextInfo& ContextHandler2Helper::pushContextInfo( sal_Int32 nElement )
+ElementInfo& ContextHandler2Helper::pushElementInfo( sal_Int32 nElement )
{
mxContextStack->resize( mxContextStack->size() + 1 );
- ContextInfo& rInfo = mxContextStack->back();
+ ElementInfo& rInfo = mxContextStack->back();
rInfo.mnElement = nElement;
return rInfo;
}
-void ContextHandler2Helper::popContextInfo()
+void ContextHandler2Helper::popElementInfo()
{
- OSL_ENSURE( !mxContextStack->empty(), "ContextHandler2Helper::popContextInfo - context stack broken" );
+ OSL_ENSURE( !mxContextStack->empty(), "ContextHandler2Helper::popElementInfo - context stack broken" );
if( !mxContextStack->empty() )
mxContextStack->pop_back();
}
-void ContextHandler2Helper::appendCollectedChars()
+void ContextHandler2Helper::processCollectedChars()
{
- OSL_ENSURE( !mxContextStack->empty(), "ContextHandler2Helper::appendCollectedChars - no context info" );
- ContextInfo& rInfo = mxContextStack->back();
- if( rInfo.maCurrChars.getLength() > 0 )
+ OSL_ENSURE( !mxContextStack->empty(), "ContextHandler2Helper::processCollectedChars - no context info" );
+ ElementInfo& rInfo = mxContextStack->back();
+ if( rInfo.maChars.getLength() > 0 )
{
- OUString aChars = rInfo.maCurrChars.makeStringAndClear();
- rInfo.maFinalChars.append( (mbEnableTrimSpace && rInfo.mbTrimSpaces) ? aChars.trim() : aChars );
+ OUString aChars = rInfo.maChars.makeStringAndClear();
+ if( mbEnableTrimSpace && rInfo.mbTrimSpaces )
+ aChars = aChars.trim();
+ if( aChars.getLength() > 0 )
+ onCharacters( aChars );
}
}
// ============================================================================
ContextHandler2::ContextHandler2( ContextHandler2Helper& rParent ) :
- ContextHandler( rParent.queryContextHandler() ),
+ ContextHandler( dynamic_cast< ContextHandler& >( rParent ) ),
ContextHandler2Helper( rParent )
{
}
@@ -193,11 +189,6 @@ ContextHandler2::~ContextHandler2()
{
}
-ContextHandler& ContextHandler2::queryContextHandler()
-{
- return *this;
-}
-
// com.sun.star.xml.sax.XFastContextHandler interface -------------------------
Reference< XFastContextHandler > SAL_CALL ContextHandler2::createFastChildContext(
@@ -209,7 +200,7 @@ Reference< XFastContextHandler > SAL_CALL ContextHandler2::createFastChildContex
void SAL_CALL ContextHandler2::startFastElement(
sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) throw( SAXException, RuntimeException )
{
- implStartCurrentContext( nElement, rxAttribs );
+ implStartElement( nElement, rxAttribs );
}
void SAL_CALL ContextHandler2::characters( const OUString& rChars ) throw( SAXException, RuntimeException )
@@ -219,17 +210,17 @@ void SAL_CALL ContextHandler2::characters( const OUString& rChars ) throw( SAXEx
void SAL_CALL ContextHandler2::endFastElement( sal_Int32 nElement ) throw( SAXException, RuntimeException )
{
- implEndCurrentContext( nElement );
+ implEndElement( nElement );
}
// oox.core.RecordContext interface -------------------------------------------
-ContextHandlerRef ContextHandler2::createRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef ContextHandler2::createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
return implCreateRecordContext( nRecId, rStrm );
}
-void ContextHandler2::startRecord( sal_Int32 nRecId, RecordInputStream& rStrm )
+void ContextHandler2::startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
implStartRecord( nRecId, rStrm );
}
@@ -250,16 +241,20 @@ void ContextHandler2::onStartElement( const AttributeList& )
{
}
-void ContextHandler2::onEndElement( const OUString& )
+void ContextHandler2::onCharacters( const OUString& )
{
}
-ContextHandlerRef ContextHandler2::onCreateRecordContext( sal_Int32, RecordInputStream& )
+void ContextHandler2::onEndElement()
+{
+}
+
+ContextHandlerRef ContextHandler2::onCreateRecordContext( sal_Int32, SequenceInputStream& )
{
return 0;
}
-void ContextHandler2::onStartRecord( RecordInputStream& )
+void ContextHandler2::onStartRecord( SequenceInputStream& )
{
}
@@ -271,4 +266,3 @@ void ContextHandler2::onEndRecord()
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/facreg.cxx b/oox/source/core/facreg.cxx
deleted file mode 100644
index ed54ae81e7e5..000000000000
--- a/oox/source/core/facreg.cxx
+++ /dev/null
@@ -1,137 +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.
- *
- ************************************************************************/
-
-#include "oox/dllapi.h"
-
-#include <string.h>
-
-#include <sal/config.h>
-
-#include <com/sun/star/container/XSet.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-
-#include <cppuhelper/factory.hxx>
-#include <uno/lbnames.h>
-
-using namespace rtl;
-using namespace com::sun::star;
-
-#define SERVICE( className ) \
-extern OUString SAL_CALL className##_getImplementationName() throw(); \
-extern uno::Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw();\
-extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance( \
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) \
- throw( uno::Exception )
-
-#define SERVICE2( className ) \
-extern OUString SAL_CALL className##_getImplementationName() throw(); \
-extern uno::Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw();\
-extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance( \
- const uno::Reference< uno::XComponentContext > & xContext ) \
- throw( uno::Exception )
-
-namespace oox {
- namespace core { SERVICE( FilterDetect ); }
- namespace ppt { SERVICE( PowerPointImport ); }
- namespace xls { SERVICE( BiffDetector ); }
- namespace xls { SERVICE( ExcelFilter ); }
- namespace xls { SERVICE( ExcelBiffFilter ); }
- namespace shape { SERVICE( ShapeContextHandler ); }
- namespace shape { SERVICE( FastTokenHandlerService ); }
- namespace docprop { SERVICE2( OOXMLDocPropImportImpl ); }
- namespace xls { SERVICE2( OOXMLFormulaParser ); }
-}
-
-//
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-OOX_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-#define SINGLEFACTORY(classname)\
- if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
- {\
- xFactory = ::cppu::createSingleFactory( xMSF,\
- classname##_getImplementationName(),\
- classname##_createInstance,\
- classname##_getSupportedServiceNames() );\
- }
-
-#define SINGLEFACTORY2(classname)\
- if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
- {\
- xCompFactory = ::cppu::createSingleComponentFactory(\
- classname##_createInstance,\
- classname##_getImplementationName(),\
- classname##_getSupportedServiceNames() );\
- }
-
-OOX_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * )
-{
- void * pRet = 0;
- if( pServiceManager )
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
-
- uno::Reference< lang::XSingleServiceFactory > xFactory;
- uno::Reference< lang::XSingleComponentFactory > xCompFactory;
-
- const sal_Int32 nImplNameLen = strlen( pImplName );
-
- SINGLEFACTORY( ::oox::core::FilterDetect )
- else SINGLEFACTORY( oox::ppt::PowerPointImport )
- else SINGLEFACTORY( ::oox::xls::BiffDetector )
- else SINGLEFACTORY( ::oox::xls::ExcelFilter )
- else SINGLEFACTORY( ::oox::xls::ExcelBiffFilter )
- else SINGLEFACTORY( ::oox::shape::ShapeContextHandler)
- else SINGLEFACTORY( ::oox::shape::FastTokenHandlerService)
- else SINGLEFACTORY2( ::oox::docprop::OOXMLDocPropImportImpl )
- else SINGLEFACTORY2( ::oox::xls::OOXMLFormulaParser )
-
- if( xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- else if ( xCompFactory.is() )
- {
- xCompFactory->acquire();
- pRet = xCompFactory.get();
- }
- }
- return pRet;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx
new file mode 100755
index 000000000000..eaf8c428b92c
--- /dev/null
+++ b/oox/source/core/fastparser.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/core/fastparser.hxx"
+
+#include "oox/core/fasttokenhandler.hxx"
+#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/token/namespacemap.hxx"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+namespace {
+
+class InputStreamCloseGuard
+{
+public:
+ explicit InputStreamCloseGuard( const Reference< XInputStream >& rxInStream, bool bCloseStream );
+ ~InputStreamCloseGuard();
+private:
+ Reference< XInputStream > mxInStream;
+ bool mbCloseStream;
+};
+
+InputStreamCloseGuard::InputStreamCloseGuard( const Reference< XInputStream >& rxInStream, bool bCloseStream ) :
+ mxInStream( rxInStream ),
+ mbCloseStream( bCloseStream )
+{
+}
+
+InputStreamCloseGuard::~InputStreamCloseGuard()
+{
+ if( mxInStream.is() && mbCloseStream ) try { mxInStream->closeInput(); } catch( Exception& ) {}
+}
+
+} // namespace
+
+// ============================================================================
+
+FastParser::FastParser( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ mrNamespaceMap( StaticNamespaceMap::get() )
+{
+ // create a fast parser instance
+ Reference< XMultiComponentFactory > xFactory( rxContext->getServiceManager(), UNO_SET_THROW );
+ mxParser.set( xFactory->createInstanceWithContext( CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ), rxContext ), UNO_QUERY_THROW );
+
+ // create the fast token handler based on the OOXML token list
+ mxParser->setTokenHandler( new FastTokenHandler );
+}
+
+FastParser::~FastParser()
+{
+}
+
+void FastParser::registerNamespace( sal_Int32 nNamespaceId ) throw( IllegalArgumentException, RuntimeException )
+{
+ if( !mxParser.is() )
+ throw RuntimeException();
+
+ const OUString* pNamespaceUrl = ContainerHelper::getMapElement( mrNamespaceMap, nNamespaceId );
+ if( !pNamespaceUrl )
+ throw IllegalArgumentException();
+
+ mxParser->registerNamespace( *pNamespaceUrl, nNamespaceId );
+}
+
+void FastParser::setDocumentHandler( const Reference< XFastDocumentHandler >& rxDocHandler ) throw( RuntimeException )
+{
+ if( !mxParser.is() )
+ throw RuntimeException();
+ mxParser->setFastDocumentHandler( rxDocHandler );
+}
+
+void FastParser::parseStream( const InputSource& rInputSource, bool bCloseStream ) throw( SAXException, IOException, RuntimeException )
+{
+ // guard closing the input stream also when exceptions are thrown
+ InputStreamCloseGuard aGuard( rInputSource.aInputStream, bCloseStream );
+ if( !mxParser.is() )
+ throw RuntimeException();
+ mxParser->parseStream( rInputSource );
+}
+
+void FastParser::parseStream( const Reference< XInputStream >& rxInStream, const OUString& rStreamName, bool bCloseStream ) throw( SAXException, IOException, RuntimeException )
+{
+ InputSource aInputSource;
+ aInputSource.sSystemId = rStreamName;
+ aInputSource.aInputStream = rxInStream;
+ parseStream( aInputSource, bCloseStream );
+}
+
+void FastParser::parseStream( StorageBase& rStorage, const OUString& rStreamName, bool bCloseStream ) throw( SAXException, IOException, RuntimeException )
+{
+ parseStream( rStorage.openInputStream( rStreamName ), rStreamName, bCloseStream );
+}
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
diff --git a/oox/source/core/fasttokenhandler.cxx b/oox/source/core/fasttokenhandler.cxx
index c662828bc583..e09687cc5470 100644
--- a/oox/source/core/fasttokenhandler.cxx
+++ b/oox/source/core/fasttokenhandler.cxx
@@ -26,29 +26,38 @@
************************************************************************/
#include "oox/core/fasttokenhandler.hxx"
-#include <osl/mutex.hxx>
-#include "oox/token/tokenmap.hxx"
-using ::rtl::OUString;
-using ::osl::Mutex;
-using ::osl::MutexGuard;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::RuntimeException;
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/token/tokenmap.hxx"
namespace oox {
namespace core {
// ============================================================================
-namespace {
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+OUString SAL_CALL FastTokenHandler_getImplementationName()
+{
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.core.FastTokenHandler" );
+}
-Mutex& lclGetTokenMutex()
+Sequence< OUString > SAL_CALL FastTokenHandler_getSupportedServiceNames()
{
- static Mutex aMutex;
- return aMutex;
+ Sequence< OUString > aServiceNames( 1 );
+ aServiceNames[ 0 ] = CREATE_OUSTRING( "com.sun.star.xml.sax.FastTokenHandler" );
+ return aServiceNames;
}
-} // namespace
+Reference< XInterface > SAL_CALL FastTokenHandler_createInstance( const Reference< XComponentContext >& /*rxContext*/ ) throw (Exception)
+{
+ return static_cast< ::cppu::OWeakObject* >( new FastTokenHandler );
+}
// ============================================================================
@@ -61,27 +70,46 @@ FastTokenHandler::~FastTokenHandler()
{
}
+// XServiceInfo
+
+OUString SAL_CALL FastTokenHandler::getImplementationName() throw (RuntimeException)
+{
+ return FastTokenHandler_getImplementationName();
+}
+
+sal_Bool SAL_CALL FastTokenHandler::supportsService( const OUString& rServiceName ) throw (RuntimeException)
+{
+ Sequence< OUString > aServiceNames = FastTokenHandler_getSupportedServiceNames();
+ for( sal_Int32 nIndex = 0, nLength = aServiceNames.getLength(); nIndex < nLength; ++nIndex )
+ if( aServiceNames[ nIndex ] == rServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL FastTokenHandler::getSupportedServiceNames() throw (RuntimeException)
+{
+ return FastTokenHandler_getSupportedServiceNames();
+}
+
+// XFastTokenHandler
+
sal_Int32 FastTokenHandler::getToken( const OUString& rIdentifier ) throw( RuntimeException )
{
- MutexGuard aGuard( lclGetTokenMutex() );
return mrTokenMap.getTokenFromUnicode( rIdentifier );
}
OUString FastTokenHandler::getIdentifier( sal_Int32 nToken ) throw( RuntimeException )
{
- MutexGuard aGuard( lclGetTokenMutex() );
return mrTokenMap.getUnicodeTokenName( nToken );
}
Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken ) throw( RuntimeException )
{
- MutexGuard aGuard( lclGetTokenMutex() );
return mrTokenMap.getUtf8TokenName( nToken );
}
sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier ) throw( RuntimeException )
{
- MutexGuard aGuard( lclGetTokenMutex() );
return mrTokenMap.getTokenFromUtf8( rIdentifier );
}
@@ -89,4 +117,3 @@ sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdent
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 6d2b98454444..b215150acb88 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -26,51 +26,41 @@
************************************************************************/
#include "oox/core/filterbase.hxx"
+
#include <set>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <comphelper/docpasswordhelper.hxx>
+#include <comphelper/mediadescriptor.hxx>
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
#include <rtl/uri.hxx>
-#include <comphelper/docpasswordhelper.hxx>
-#include <comphelper/mediadescriptor.hxx>
-#include "tokens.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/binaryoutputstream.hxx"
#include "oox/helper/graphichelper.hxx"
#include "oox/helper/modelobjecthelper.hxx"
#include "oox/ole/oleobjecthelper.hxx"
+#include "oox/ole/vbaproject.hxx"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::graphic;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::uno;
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-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::lang::IllegalArgumentException;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::lang::XComponent;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::frame::XFrame;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XStream;
-using ::com::sun::star::task::XStatusIndicator;
-using ::com::sun::star::task::XInteractionHandler;
-using ::com::sun::star::graphic::XGraphic;
using ::comphelper::MediaDescriptor;
using ::comphelper::SequenceAsHashMap;
using ::oox::ole::OleObjectHelper;
-
-using namespace ::com::sun::star;
-
-namespace oox {
-namespace core {
+using ::oox::ole::VbaProject;
+using ::rtl::OUString;
// ============================================================================
@@ -142,6 +132,7 @@ struct FilterBaseImpl
typedef ::boost::shared_ptr< GraphicHelper > GraphicHelperRef;
typedef ::boost::shared_ptr< ModelObjectHelper > ModelObjHelperRef;
typedef ::boost::shared_ptr< OleObjectHelper > OleObjHelperRef;
+ typedef ::boost::shared_ptr< VbaProject > VbaProjectRef;
FilterDirection meDirection;
SequenceAsHashMap maArguments;
@@ -152,8 +143,11 @@ struct FilterBaseImpl
GraphicHelperRef mxGraphicHelper; /// Graphic and graphic object handling.
ModelObjHelperRef mxModelObjHelper; /// Tables to create new named drawing objects.
OleObjHelperRef mxOleObjHelper; /// OLE object handling.
+ VbaProjectRef mxVbaProject; /// VBA project manager.
- Reference< XMultiServiceFactory > mxGlobalFactory;
+ Reference< XComponentContext > mxComponentContext;
+ Reference< XMultiComponentFactory > mxComponentFactory;
+ Reference< XMultiServiceFactory > mxServiceFactory;
Reference< XModel > mxModel;
Reference< XMultiServiceFactory > mxModelFactory;
Reference< XFrame > mxTargetFrame;
@@ -162,10 +156,9 @@ struct FilterBaseImpl
Reference< XStatusIndicator > mxStatusIndicator;
Reference< XInteractionHandler > mxInteractionHandler;
- explicit FilterBaseImpl( const Reference< XMultiServiceFactory >& rxGlobalFactory );
+ explicit FilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException );
- void setDocumentModel( const Reference< XComponent >& rxComponent );
- bool hasDocumentModel() const;
+ void setDocumentModel( const Reference< XComponent >& rxComponent ) throw( IllegalArgumentException );
void initializeFilter();
void finalizeFilter();
@@ -173,22 +166,25 @@ struct FilterBaseImpl
// ----------------------------------------------------------------------------
-FilterBaseImpl::FilterBaseImpl( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
+FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
meDirection( FILTERDIRECTION_UNKNOWN ),
- mxGlobalFactory( rxGlobalFactory )
-{
- OSL_ENSURE( mxGlobalFactory.is(), "FilterBaseImpl::FilterBaseImpl - missing service factory" );
-}
-
-void FilterBaseImpl::setDocumentModel( const Reference< XComponent >& rxComponent )
+ mxComponentContext( rxContext, UNO_SET_THROW ),
+ mxComponentFactory( rxContext->getServiceManager(), UNO_SET_THROW ),
+ mxServiceFactory( rxContext->getServiceManager(), UNO_QUERY_THROW )
{
- mxModel.set( rxComponent, UNO_QUERY );
- mxModelFactory.set( rxComponent, UNO_QUERY );
}
-bool FilterBaseImpl::hasDocumentModel() const
+void FilterBaseImpl::setDocumentModel( const Reference< XComponent >& rxComponent ) throw( IllegalArgumentException )
{
- return mxGlobalFactory.is() && mxModel.is() && mxModelFactory.is();
+ try
+ {
+ mxModel.set( rxComponent, UNO_QUERY_THROW );
+ mxModelFactory.set( rxComponent, UNO_QUERY_THROW );
+ }
+ catch( Exception& )
+ {
+ throw IllegalArgumentException();
+ }
}
void FilterBaseImpl::initializeFilter()
@@ -219,8 +215,8 @@ void FilterBaseImpl::finalizeFilter()
// ============================================================================
-FilterBase::FilterBase( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
- mxImpl( new FilterBaseImpl( rxGlobalFactory ) )
+FilterBase::FilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ mxImpl( new FilterBaseImpl( rxContext ) )
{
}
@@ -246,9 +242,19 @@ Any FilterBase::getArgument( const OUString& rArgName ) const
return (aIt == mxImpl->maArguments.end()) ? Any() : aIt->second;
}
-const Reference< XMultiServiceFactory >& FilterBase::getGlobalFactory() const
+const Reference< XComponentContext >& FilterBase::getComponentContext() const
+{
+ return mxImpl->mxComponentContext;
+}
+
+const Reference< XMultiComponentFactory >& FilterBase::getComponentFactory() const
{
- return mxImpl->mxGlobalFactory;
+ return mxImpl->mxComponentFactory;
+}
+
+const Reference< XMultiServiceFactory >& FilterBase::getServiceFactory() const
+{
+ return mxImpl->mxServiceFactory;
}
const Reference< XModel >& FilterBase::getModel() const
@@ -401,7 +407,14 @@ OleObjectHelper& FilterBase::getOleObjectHelper() const
return *mxImpl->mxOleObjHelper;
}
-uno::Sequence< beans::NamedValue > FilterBase::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const
+VbaProject& FilterBase::getVbaProject() const
+{
+ if( !mxImpl->mxVbaProject )
+ mxImpl->mxVbaProject.reset( implCreateVbaProject() );
+ return *mxImpl->mxVbaProject;
+}
+
+Sequence< NamedValue > FilterBase::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const
{
::std::vector< OUString > aDefaultPasswords;
aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) );
@@ -466,8 +479,6 @@ void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs ) throw( Exce
void SAL_CALL FilterBase::setTargetDocument( const Reference< XComponent >& rxDocument ) throw( IllegalArgumentException, RuntimeException )
{
mxImpl->setDocumentModel( rxDocument );
- if( !mxImpl->hasDocumentModel() )
- throw IllegalArgumentException();
mxImpl->meDirection = FILTERDIRECTION_IMPORT;
}
@@ -476,8 +487,6 @@ void SAL_CALL FilterBase::setTargetDocument( const Reference< XComponent >& rxDo
void SAL_CALL FilterBase::setSourceDocument( const Reference< XComponent >& rxDocument ) throw( IllegalArgumentException, RuntimeException )
{
mxImpl->setDocumentModel( rxDocument );
- if( !mxImpl->hasDocumentModel() )
- throw IllegalArgumentException();
mxImpl->meDirection = FILTERDIRECTION_EXPORT;
}
@@ -485,35 +494,35 @@ void SAL_CALL FilterBase::setSourceDocument( const Reference< XComponent >& rxDo
sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDescSeq ) throw( RuntimeException )
{
+ if( !mxImpl->mxModel.is() || !mxImpl->mxModelFactory.is() || (mxImpl->meDirection == FILTERDIRECTION_UNKNOWN) )
+ throw RuntimeException();
+
sal_Bool bRet = sal_False;
- if( mxImpl->hasDocumentModel() && (mxImpl->meDirection != FILTERDIRECTION_UNKNOWN) )
+ setMediaDescriptor( rMediaDescSeq );
+ DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl );
+ if( aOpenedGuard.isValid() || !mxImpl->maFileUrl.getLength() )
{
- setMediaDescriptor( rMediaDescSeq );
- DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl );
- if( aOpenedGuard.isValid() || !mxImpl->maFileUrl.getLength() )
+ mxImpl->initializeFilter();
+ switch( mxImpl->meDirection )
{
- mxImpl->initializeFilter();
- switch( mxImpl->meDirection )
- {
- case FILTERDIRECTION_UNKNOWN:
- break;
- case FILTERDIRECTION_IMPORT:
- if( mxImpl->mxInStream.is() )
- {
- mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream );
- bRet = mxImpl->mxStorage.get() && importDocument();
- }
- break;
- case FILTERDIRECTION_EXPORT:
- if( mxImpl->mxOutStream.is() )
- {
- mxImpl->mxStorage = implCreateStorage( mxImpl->mxOutStream );
- bRet = mxImpl->mxStorage.get() && exportDocument();
- }
- break;
- }
- mxImpl->finalizeFilter();
+ case FILTERDIRECTION_UNKNOWN:
+ break;
+ case FILTERDIRECTION_IMPORT:
+ if( mxImpl->mxInStream.is() )
+ {
+ mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream );
+ bRet = mxImpl->mxStorage.get() && importDocument();
+ }
+ break;
+ case FILTERDIRECTION_EXPORT:
+ if( mxImpl->mxOutStream.is() )
+ {
+ mxImpl->mxStorage = implCreateStorage( mxImpl->mxOutStream );
+ bRet = mxImpl->mxStorage.get() && exportDocument();
+ }
+ break;
}
+ mxImpl->finalizeFilter();
}
return bRet;
}
@@ -565,7 +574,7 @@ void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDesc
GraphicHelper* FilterBase::implCreateGraphicHelper() const
{
// default: return base implementation without any special behaviour
- return new GraphicHelper( mxImpl->mxGlobalFactory, mxImpl->mxTargetFrame, mxImpl->mxStorage );
+ return new GraphicHelper( mxImpl->mxComponentContext, mxImpl->mxTargetFrame, mxImpl->mxStorage );
}
// ============================================================================
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index 53d8809330d9..cdab111e9898 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -26,52 +26,36 @@
************************************************************************/
#include "oox/core/filterdetect.hxx"
+
#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
-#include <rtl/digest.h>
-#include <openssl/evp.h>
#include <comphelper/docpasswordhelper.hxx>
#include <comphelper/mediadescriptor.hxx>
+#include <openssl/evp.h>
+#include <rtl/digest.h>
+#include "oox/core/fastparser.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/binaryoutputstream.hxx"
#include "oox/helper/zipstorage.hxx"
-#include "oox/core/fasttokenhandler.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/ole/olestorage.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::beans::NamedValue;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XStream;
-using ::com::sun::star::xml::sax::InputSource;
-using ::com::sun::star::xml::sax::SAXException;
-using ::com::sun::star::xml::sax::XFastAttributeList;
-using ::com::sun::star::xml::sax::XFastContextHandler;
-using ::com::sun::star::xml::sax::XFastParser;
-using ::com::sun::star::xml::sax::XLocator;
-using ::comphelper::MediaDescriptor;
-using ::comphelper::SequenceAsHashMap;
-
-using namespace ::com::sun::star;
-
namespace oox {
namespace core {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::comphelper::MediaDescriptor;
+using ::comphelper::SequenceAsHashMap;
+using ::rtl::OUString;
+
+// ============================================================================
+
FilterDetectDocHandler::FilterDetectDocHandler( OUString& rFilterName ) :
mrFilterName( rFilterName )
{
@@ -105,22 +89,22 @@ void SAL_CALL FilterDetectDocHandler::startFastElement(
switch ( nElement )
{
// cases for _rels/.rels
- case NMSP_PACKAGE_RELATIONSHIPS|XML_Relationships:
+ case PR_TOKEN( Relationships ):
break;
- case NMSP_PACKAGE_RELATIONSHIPS|XML_Relationship:
- if( !maContextStack.empty() && (maContextStack.back() == (NMSP_PACKAGE_RELATIONSHIPS|XML_Relationships)) )
+ case PR_TOKEN( Relationship ):
+ if( !maContextStack.empty() && (maContextStack.back() == PR_TOKEN( Relationships )) )
parseRelationship( aAttribs );
break;
// cases for [Content_Types].xml
- case NMSP_CONTENT_TYPES|XML_Types:
+ case PC_TOKEN( Types ):
break;
- case NMSP_CONTENT_TYPES|XML_Default:
- if( !maContextStack.empty() && (maContextStack.back() == (NMSP_CONTENT_TYPES|XML_Types)) )
+ case PC_TOKEN( Default ):
+ if( !maContextStack.empty() && (maContextStack.back() == PC_TOKEN( Types )) )
parseContentTypesDefault( aAttribs );
break;
- case NMSP_CONTENT_TYPES|XML_Override:
- if( !maContextStack.empty() && (maContextStack.back() == (NMSP_CONTENT_TYPES|XML_Types)) )
+ case PC_TOKEN( Override ):
+ if( !maContextStack.empty() && (maContextStack.back() == PC_TOKEN( Types )) )
parseContentTypesOverride( aAttribs );
break;
}
@@ -249,17 +233,16 @@ OUString FilterDetect_getImplementationName()
}
/* Helper for registry */
-Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( Exception )
+Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XComponentContext >& rxContext ) throw( Exception )
{
- return Reference< XInterface >( *new FilterDetect( xServiceManager ) );
+ return static_cast< ::cppu::OWeakObject* >( new FilterDetect( rxContext ) );
}
// ----------------------------------------------------------------------------
-FilterDetect::FilterDetect( const Reference< XMultiServiceFactory >& rxFactory ) :
- mxFactory( rxFactory )
+FilterDetect::FilterDetect( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ mxContext( rxContext, UNO_SET_THROW )
{
- OSL_ENSURE( mxFactory.is(), "FilterDetect::FilterDetect - no service factory" );
}
FilterDetect::~FilterDetect()
@@ -410,7 +393,7 @@ bool lclCheckEncryptionData( const sal_uInt8* pnKey, sal_uInt32 nKeySize, const
// ----------------------------------------------------------------------------
-uno::Sequence< beans::NamedValue > lclGenerateEncryptionKey( const PackageEncryptionInfo& rEncrInfo, const OUString& rPassword, sal_uInt8* pnKey, sal_uInt32 nRequiredKeyLen )
+Sequence< NamedValue > lclGenerateEncryptionKey( const PackageEncryptionInfo& rEncrInfo, const OUString& rPassword, sal_uInt8* pnKey, sal_uInt32 nRequiredKeyLen )
{
size_t nBufferSize = rEncrInfo.mnSaltSize + 2 * rPassword.getLength();
sal_uInt8* pnBuffer = new sal_uInt8[ nBufferSize ];
@@ -449,15 +432,14 @@ uno::Sequence< beans::NamedValue > lclGenerateEncryptionKey( const PackageEncryp
lclDeriveKey( pnHash, RTL_DIGEST_LENGTH_SHA1, pnKey, nRequiredKeyLen );
delete[] pnHash;
- uno::Sequence< beans::NamedValue > aResult;
- if ( lclCheckEncryptionData( pnKey, nRequiredKeyLen, rEncrInfo.mpnEncrVerifier, sizeof( rEncrInfo.mpnEncrVerifier ), rEncrInfo.mpnEncrVerifierHash, sizeof( rEncrInfo.mpnEncrVerifierHash ) ) )
+ Sequence< NamedValue > aResult;
+ if( lclCheckEncryptionData( pnKey, nRequiredKeyLen, rEncrInfo.mpnEncrVerifier, sizeof( rEncrInfo.mpnEncrVerifier ), rEncrInfo.mpnEncrVerifierHash, sizeof( rEncrInfo.mpnEncrVerifierHash ) ) )
{
- ::comphelper::SequenceAsHashMap aEncryptionData;
- aEncryptionData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionKey" ) ) ] <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( pnKey ), nRequiredKeyLen );
- aEncryptionData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionSalt" ) ) ] <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnSalt ), rEncrInfo.mnSaltSize );
- aEncryptionData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionVerifier" ) ) ] <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnEncrVerifier ), sizeof( rEncrInfo.mpnEncrVerifier ) );
- aEncryptionData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionVerifierHash" ) ) ] <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnEncrVerifierHash ), sizeof( rEncrInfo.mpnEncrVerifierHash ) );
-
+ SequenceAsHashMap aEncryptionData;
+ aEncryptionData[ CREATE_OUSTRING( "AES128EncryptionKey" ) ] <<= Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( pnKey ), nRequiredKeyLen );
+ aEncryptionData[ CREATE_OUSTRING( "AES128EncryptionSalt" ) ] <<= Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnSalt ), rEncrInfo.mnSaltSize );
+ aEncryptionData[ CREATE_OUSTRING( "AES128EncryptionVerifier" ) ] <<= Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnEncrVerifier ), sizeof( rEncrInfo.mpnEncrVerifier ) );
+ aEncryptionData[ CREATE_OUSTRING( "AES128EncryptionVerifierHash" ) ] <<= Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnEncrVerifierHash ), sizeof( rEncrInfo.mpnEncrVerifierHash ) );
aResult = aEncryptionData.getAsConstNamedValueList();
}
@@ -471,8 +453,10 @@ class PasswordVerifier : public ::comphelper::IDocPasswordVerifier
public:
explicit PasswordVerifier( const PackageEncryptionInfo& rEncryptInfo );
- virtual ::comphelper::DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData );
- virtual ::comphelper::DocPasswordVerifierResult verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData );
+ virtual ::comphelper::DocPasswordVerifierResult
+ verifyPassword( const OUString& rPassword, Sequence< NamedValue >& o_rEncryptionData );
+ virtual ::comphelper::DocPasswordVerifierResult
+ verifyEncryptionData( const Sequence< NamedValue >& rEncryptionData );
inline const sal_uInt8* getKey() const { return &maKey.front(); }
@@ -487,29 +471,26 @@ PasswordVerifier::PasswordVerifier( const PackageEncryptionInfo& rEncryptInfo )
{
}
-::comphelper::DocPasswordVerifierResult PasswordVerifier::verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData )
+::comphelper::DocPasswordVerifierResult PasswordVerifier::verifyPassword( const OUString& rPassword, Sequence< NamedValue >& o_rEncryptionData )
{
// verifies the password and writes the related decryption key into maKey
o_rEncryptionData = lclGenerateEncryptionKey( mrEncryptInfo, rPassword, &maKey.front(), maKey.size() );
- return ( o_rEncryptionData.getLength() > 0 ) ?
- ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
+ return o_rEncryptionData.hasElements() ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
}
-::comphelper::DocPasswordVerifierResult PasswordVerifier::verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData )
+::comphelper::DocPasswordVerifierResult PasswordVerifier::verifyEncryptionData( const Sequence< NamedValue >& rEncryptionData )
{
- ::comphelper::SequenceAsHashMap aHashData( rEncryptionData );
- uno::Sequence< sal_Int8 > aKey = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionKey" ) ), uno::Sequence< sal_Int8 >() );
- uno::Sequence< sal_Int8 > aVerifier = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionVerifier" ) ), uno::Sequence< sal_Int8 >() );
- uno::Sequence< sal_Int8 > aVerifierHash = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionVerifierHash" ) ), uno::Sequence< sal_Int8 >() );
+ SequenceAsHashMap aHashData( rEncryptionData );
+ Sequence< sal_Int8 > aKey = aHashData.getUnpackedValueOrDefault( CREATE_OUSTRING( "AES128EncryptionKey" ), Sequence< sal_Int8 >() );
+ Sequence< sal_Int8 > aVerifier = aHashData.getUnpackedValueOrDefault( CREATE_OUSTRING( "AES128EncryptionVerifier" ), Sequence< sal_Int8 >() );
+ Sequence< sal_Int8 > aVerifierHash = aHashData.getUnpackedValueOrDefault( CREATE_OUSTRING( "AES128EncryptionVerifierHash" ), Sequence< sal_Int8 >() );
- return lclCheckEncryptionData(
- reinterpret_cast< const sal_uInt8* >( aKey.getConstArray() ),
- aKey.getLength(),
- reinterpret_cast< const sal_uInt8* >( aVerifier.getConstArray() ),
- aVerifier.getLength(),
- reinterpret_cast< const sal_uInt8* >( aVerifierHash.getConstArray() ),
- aVerifierHash.getLength() )
- ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
+ bool bResult = lclCheckEncryptionData(
+ reinterpret_cast< const sal_uInt8* >( aKey.getConstArray() ), aKey.getLength(),
+ reinterpret_cast< const sal_uInt8* >( aVerifier.getConstArray() ), aVerifier.getLength(),
+ reinterpret_cast< const sal_uInt8* >( aVerifierHash.getConstArray() ), aVerifierHash.getLength() );
+
+ return bResult ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
}
} // namespace
@@ -518,11 +499,12 @@ PasswordVerifier::PasswordVerifier( const PackageEncryptionInfo& rEncryptInfo )
Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescriptor& rMediaDesc ) const
{
- if( mxFactory.is() )
+ Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY );
+ if( xFactory.is() )
{
// try the plain input stream
Reference< XInputStream > xInStrm( rMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ], UNO_QUERY );
- if( !xInStrm.is() || lclIsZipPackage( mxFactory, xInStrm ) )
+ if( !xInStrm.is() || lclIsZipPackage( xFactory, xInStrm ) )
return xInStrm;
// check if a temporary file is passed in the 'ComponentData' property
@@ -530,12 +512,12 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
if( xDecrypted.is() )
{
Reference< XInputStream > xDecrInStrm = xDecrypted->getInputStream();
- if( lclIsZipPackage( mxFactory, xDecrInStrm ) )
+ if( lclIsZipPackage( xFactory, xDecrInStrm ) )
return xDecrInStrm;
}
// try to decrypt an encrypted OLE package
- ::oox::ole::OleStorage aOleStorage( mxFactory, xInStrm, false );
+ ::oox::ole::OleStorage aOleStorage( xFactory, xInStrm, false );
if( aOleStorage.isStorage() ) try
{
// open the required input streams in the encrypted package
@@ -571,7 +553,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
(according to the verifier), or with an empty string if
user has cancelled the password input dialog. */
PasswordVerifier aVerifier( aEncryptInfo );
- uno::Sequence< beans::NamedValue > aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
+ Sequence< NamedValue > aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
aVerifier, rMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords );
if( aEncryptionData.getLength() == 0 )
@@ -581,7 +563,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
else
{
// create temporary file for unencrypted package
- Reference< XStream > xTempFile( mxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW );
Reference< XOutputStream > xDecryptedPackage( xTempFile->getOutputStream(), UNO_SET_THROW );
BinaryXOutputStream aDecryptedPackage( xDecryptedPackage, true );
BinaryXInputStream aEncryptedPackage( xEncryptedPackage, true );
@@ -612,7 +594,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript
rMediaDesc.setComponentDataEntry( CREATE_OUSTRING( "DecryptedPackage" ), Any( xTempFile ) );
Reference< XInputStream > xDecrInStrm = xTempFile->getInputStream();
- if( lclIsZipPackage( mxFactory, xDecrInStrm ) )
+ if( lclIsZipPackage( xFactory, xDecrInStrm ) )
return xDecrInStrm;
}
}
@@ -651,12 +633,13 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq
{
OUString aFilterName;
MediaDescriptor aMediaDesc( rMediaDescSeq );
+ Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW );
/* Check that the user has not choosen to abort detection, e.g. by hitting
'Cancel' in the password input dialog. This may happen because this
filter detection is used by different filters. */
bool bAborted = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_ABORTED(), false );
- if( !bAborted && mxFactory.is() ) try
+ if( !bAborted ) try
{
aMediaDesc.addInputStream();
@@ -666,30 +649,21 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq
descriptor. */
Reference< XInputStream > xInStrm( extractUnencryptedPackage( aMediaDesc ), UNO_SET_THROW );
- // try to detect the file type, must be a ZIP package
- ZipStorage aZipStorage( mxFactory, xInStrm );
+ // stream must be a ZIP package
+ ZipStorage aZipStorage( xFactory, xInStrm );
if( aZipStorage.isStorage() )
{
- Reference< XFastParser > xParser( mxFactory->createInstance(
- CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW );
-
- xParser->setFastDocumentHandler( new FilterDetectDocHandler( aFilterName ) );
- xParser->setTokenHandler( new FastTokenHandler );
-
- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS );
- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS );
- xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/content-types" ), NMSP_CONTENT_TYPES );
-
- // Parse _rels/.rels to get the target path.
- InputSource aParserInput;
- aParserInput.sSystemId = CREATE_OUSTRING( "_rels/.rels" );
- aParserInput.aInputStream = aZipStorage.openInputStream( aParserInput.sSystemId );
- xParser->parseStream( aParserInput );
-
- // Parse [Content_Types].xml to determine the content type of the part at the target path.
- aParserInput.sSystemId = CREATE_OUSTRING( "[Content_Types].xml" );
- aParserInput.aInputStream = aZipStorage.openInputStream( aParserInput.sSystemId );
- xParser->parseStream( aParserInput );
+ // create the fast parser, register the XML namespaces, set document handler
+ FastParser aParser( mxContext );
+ aParser.registerNamespace( NMSP_packageRel );
+ aParser.registerNamespace( NMSP_officeRel );
+ aParser.registerNamespace( NMSP_packageContentTypes );
+ aParser.setDocumentHandler( new FilterDetectDocHandler( aFilterName ) );
+
+ /* Parse '_rels/.rels' to get the target path and '[Content_Types].xml'
+ to determine the content type of the part at the target path. */
+ aParser.parseStream( aZipStorage, CREATE_OUSTRING( "_rels/.rels" ) );
+ aParser.parseStream( aZipStorage, CREATE_OUSTRING( "[Content_Types].xml" ) );
}
}
catch( Exception& )
@@ -705,4 +679,3 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/fragmenthandler.cxx b/oox/source/core/fragmenthandler.cxx
index 66c7bf5e136b..a1c42e56c155 100644
--- a/oox/source/core/fragmenthandler.cxx
+++ b/oox/source/core/fragmenthandler.cxx
@@ -26,22 +26,22 @@
************************************************************************/
#include "oox/core/fragmenthandler.hxx"
-#include "oox/core/xmlfilterbase.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::xml::sax::SAXException;
-using ::com::sun::star::xml::sax::XFastAttributeList;
-using ::com::sun::star::xml::sax::XFastContextHandler;
-using ::com::sun::star::xml::sax::XLocator;
+#include "oox/core/xmlfilterbase.hxx"
namespace oox {
namespace core {
// ============================================================================
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
FragmentBaseData::FragmentBaseData( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations ) :
mrFilter( rFilter ),
maFragmentPath( rFragmentPath ),
@@ -139,4 +139,3 @@ const RecordInfo* FragmentHandler::getRecordInfos() const
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx
index 531f43d76d28..7771b89747b9 100644
--- a/oox/source/core/fragmenthandler2.cxx
+++ b/oox/source/core/fragmenthandler2.cxx
@@ -27,18 +27,18 @@
#include "oox/core/fragmenthandler2.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::xml::sax::SAXException;
-using ::com::sun::star::xml::sax::XFastAttributeList;
-using ::com::sun::star::xml::sax::XFastContextHandler;
-
namespace oox {
namespace core {
// ============================================================================
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
FragmentHandler2::FragmentHandler2( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEnableTrimSpace ) :
FragmentHandler( rFilter, rFragmentPath ),
ContextHandler2Helper( bEnableTrimSpace )
@@ -49,11 +49,6 @@ FragmentHandler2::~FragmentHandler2()
{
}
-ContextHandler& FragmentHandler2::queryContextHandler()
-{
- return *this;
-}
-
// com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
void SAL_CALL FragmentHandler2::startDocument() throw( SAXException, RuntimeException )
@@ -77,7 +72,7 @@ Reference< XFastContextHandler > SAL_CALL FragmentHandler2::createFastChildConte
void SAL_CALL FragmentHandler2::startFastElement(
sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) throw( SAXException, RuntimeException )
{
- implStartCurrentContext( nElement, rxAttribs );
+ implStartElement( nElement, rxAttribs );
}
void SAL_CALL FragmentHandler2::characters( const OUString& rChars ) throw( SAXException, RuntimeException )
@@ -87,17 +82,17 @@ void SAL_CALL FragmentHandler2::characters( const OUString& rChars ) throw( SAXE
void SAL_CALL FragmentHandler2::endFastElement( sal_Int32 nElement ) throw( SAXException, RuntimeException )
{
- implEndCurrentContext( nElement );
+ implEndElement( nElement );
}
// oox.core.ContextHandler interface ------------------------------------------
-ContextHandlerRef FragmentHandler2::createRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef FragmentHandler2::createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
return implCreateRecordContext( nRecId, rStrm );
}
-void FragmentHandler2::startRecord( sal_Int32 nRecId, RecordInputStream& rStrm )
+void FragmentHandler2::startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
implStartRecord( nRecId, rStrm );
}
@@ -118,16 +113,20 @@ void FragmentHandler2::onStartElement( const AttributeList& )
{
}
-void FragmentHandler2::onEndElement( const OUString& )
+void FragmentHandler2::onCharacters( const OUString& )
{
}
-ContextHandlerRef FragmentHandler2::onCreateRecordContext( sal_Int32, RecordInputStream& )
+void FragmentHandler2::onEndElement()
+{
+}
+
+ContextHandlerRef FragmentHandler2::onCreateRecordContext( sal_Int32, SequenceInputStream& )
{
return 0;
}
-void FragmentHandler2::onStartRecord( RecordInputStream& )
+void FragmentHandler2::onStartRecord( SequenceInputStream& )
{
}
@@ -149,4 +148,3 @@ void FragmentHandler2::finalizeImport()
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/makefile.mk b/oox/source/core/makefile.mk
index 2e29cf01543a..2b58b95777df 100644
--- a/oox/source/core/makefile.mk
+++ b/oox/source/core/makefile.mk
@@ -49,7 +49,7 @@ SLOFILES = \
$(SLO)$/binaryfilterbase.obj \
$(SLO)$/contexthandler.obj \
$(SLO)$/contexthandler2.obj \
- $(SLO)$/facreg.obj \
+ $(SLO)$/fastparser.obj \
$(SLO)$/fasttokenhandler.obj \
$(SLO)$/filterbase.obj \
$(SLO)$/filterdetect.obj \
@@ -58,6 +58,7 @@ SLOFILES = \
$(SLO)$/recordparser.obj \
$(SLO)$/relations.obj \
$(SLO)$/relationshandler.obj \
+ $(SLO)$/services.obj \
$(SLO)$/xmlfilterbase.obj
# --- Targets -------------------------------------------------------
diff --git a/oox/source/core/recordparser.cxx b/oox/source/core/recordparser.cxx
index 8f0de9c2894a..aef73ceed86c 100644
--- a/oox/source/core/recordparser.cxx
+++ b/oox/source/core/recordparser.cxx
@@ -26,27 +26,27 @@
************************************************************************/
#include "oox/core/recordparser.hxx"
+
#include <vector>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/xml/sax/XLocator.hpp>
#include <cppuhelper/implbase1.hxx>
-#include "oox/helper/recordinputstream.hxx"
#include "oox/core/fragmenthandler.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::lang::DisposedException;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::IOException;
-using ::com::sun::star::xml::sax::SAXException;
-using ::com::sun::star::xml::sax::XLocator;
-
namespace oox {
namespace core {
// ============================================================================
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace prv {
class Locator : public ::cppu::WeakImplHelper1< XLocator >
@@ -273,7 +273,7 @@ void RecordParser::parseStream( const RecordInputSource& rInputSource ) throw( S
while( lclReadNextRecord( nRecId, aRecData, *maSource.mxInStream ) )
{
// create record stream object from imported record data
- RecordInputStream aRecStrm( aRecData );
+ SequenceInputStream aRecStrm( aRecData );
// try to leave a context, there may be other incomplete contexts on the stack
if( const RecordInfo* pEndRecInfo = getEndRecordInfo( nRecId ) )
{
@@ -348,4 +348,3 @@ const RecordInfo* RecordParser::getEndRecordInfo( sal_Int32 nRecId ) const
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx
index c8d17cce3b9b..f6cade391a0f 100644
--- a/oox/source/core/relations.cxx
+++ b/oox/source/core/relations.cxx
@@ -26,17 +26,20 @@
************************************************************************/
#include "oox/core/relations.hxx"
+
#include <rtl/ustrbuf.hxx>
#include "oox/helper/helper.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-
namespace oox {
namespace core {
// ============================================================================
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
OUString lclRemoveFileName( const OUString& rPath )
@@ -68,7 +71,7 @@ const Relation* Relations::getRelationFromRelId( const OUString& rId ) const
const Relation* Relations::getRelationFromFirstType( const OUString& rType ) const
{
for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
- if( aIt->second.maType == rType )
+ if( aIt->second.maType.equalsIgnoreAsciiCase( rType ) )
return &aIt->second;
return 0;
}
@@ -77,7 +80,7 @@ RelationsRef Relations::getRelationsFromType( const OUString& rType ) const
{
RelationsRef xRelations( new Relations( maFragmentPath ) );
for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
- if( aIt->second.maType == rType )
+ if( aIt->second.maType.equalsIgnoreAsciiCase( rType ) )
(*xRelations)[ aIt->first ] = aIt->second;
return xRelations;
}
@@ -143,4 +146,3 @@ OUString Relations::getFragmentPathFromFirstType( const OUString& rType ) const
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/relationshandler.cxx b/oox/source/core/relationshandler.cxx
index e0d7acda81e0..6812a4acada6 100644
--- a/oox/source/core/relationshandler.cxx
+++ b/oox/source/core/relationshandler.cxx
@@ -26,18 +26,20 @@
************************************************************************/
#include "oox/core/relationshandler.hxx"
+
#include <rtl/ustrbuf.hxx>
-#include "tokens.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
+namespace oox {
+namespace core {
+
+// ============================================================================
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
-namespace oox {
-namespace core {
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
// ============================================================================
@@ -76,7 +78,7 @@ Reference< XFastContextHandler > RelationsFragment::createFastChildContext(
AttributeList aAttribs( rxAttribs );
switch( nElement )
{
- case NMSP_PACKAGE_RELATIONSHIPS|XML_Relationship:
+ case PR_TOKEN( Relationship ):
{
Relation aRelation;
aRelation.maId = aAttribs.getString( XML_Id, OUString() );
@@ -95,7 +97,7 @@ Reference< XFastContextHandler > RelationsFragment::createFastChildContext(
}
}
break;
- case NMSP_PACKAGE_RELATIONSHIPS|XML_Relationships:
+ case PR_TOKEN( Relationships ):
xRet = getFastContextHandler();
break;
}
@@ -106,4 +108,3 @@ Reference< XFastContextHandler > RelationsFragment::createFastChildContext(
} // namespace core
} // namespace oox
-
diff --git a/oox/source/core/services.cxx b/oox/source/core/services.cxx
new file mode 100644
index 000000000000..f05524f4d046
--- /dev/null
+++ b/oox/source/core/services.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <cppuhelper/implementationentry.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+
+// Declare static functions providing service information =====================
+
+#define DECLARE_FUNCTIONS( className ) \
+extern OUString SAL_CALL className##_getImplementationName() throw(); \
+extern Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw(); \
+extern Reference< XInterface > SAL_CALL className##_createInstance( \
+ const Reference< XComponentContext >& rxContext ) throw (Exception)
+
+namespace oox {
+ namespace core { DECLARE_FUNCTIONS( FastTokenHandler ); }
+ namespace core { DECLARE_FUNCTIONS( FilterDetect ); }
+ namespace docprop { DECLARE_FUNCTIONS( DocumentPropertiesImport ); }
+ namespace ole { DECLARE_FUNCTIONS( WordVbaProjectFilter ); }
+ namespace ppt { DECLARE_FUNCTIONS( PowerPointImport ); }
+ namespace shape { DECLARE_FUNCTIONS( ShapeContextHandler ); }
+ namespace xls { DECLARE_FUNCTIONS( BiffDetector ); }
+ namespace xls { DECLARE_FUNCTIONS( ExcelFilter ); }
+ namespace xls { DECLARE_FUNCTIONS( ExcelBiffFilter ); }
+ namespace xls { DECLARE_FUNCTIONS( ExcelVbaProjectFilter ); }
+ namespace xls { DECLARE_FUNCTIONS( OOXMLFormulaParser ); }
+}
+
+#undef DECLARE_FUNCTIONS
+
+// ============================================================================
+
+namespace {
+
+#define IMPLEMENTATION_ENTRY( className ) \
+ { &className##_createInstance, &className##_getImplementationName, &className##_getSupportedServiceNames, ::cppu::createSingleComponentFactory, 0, 0 }
+
+static ::cppu::ImplementationEntry const spServices[] =
+{
+ IMPLEMENTATION_ENTRY( ::oox::core::FastTokenHandler ),
+ IMPLEMENTATION_ENTRY( ::oox::core::FilterDetect ),
+ IMPLEMENTATION_ENTRY( ::oox::docprop::DocumentPropertiesImport ),
+ IMPLEMENTATION_ENTRY( ::oox::ole::WordVbaProjectFilter ),
+ IMPLEMENTATION_ENTRY( ::oox::ppt::PowerPointImport ),
+ IMPLEMENTATION_ENTRY( ::oox::shape::ShapeContextHandler ),
+ IMPLEMENTATION_ENTRY( ::oox::xls::BiffDetector ),
+ IMPLEMENTATION_ENTRY( ::oox::xls::ExcelFilter ),
+ IMPLEMENTATION_ENTRY( ::oox::xls::ExcelBiffFilter ),
+ IMPLEMENTATION_ENTRY( ::oox::xls::ExcelVbaProjectFilter ),
+ IMPLEMENTATION_ENTRY( ::oox::xls::OOXMLFormulaParser ),
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+#undef IMPLEMENTATION_ENTRY
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char** ppEnvironmentTypeName, uno_Environment** /*ppEnvironment*/ )
+{
+ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const char* pImplName, void* pServiceManager, void* pRegistryKey )
+{
+ return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, spServices );
+}
+
+// ============================================================================
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 87faadd7a9ce..fe13d9322346 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -28,9 +28,6 @@
#include "oox/core/xmlfilterbase.hxx"
#include <cstdio>
-
-#include <rtl/strbuf.hxx>
-#include <rtl/ustrbuf.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/embed/XRelationshipAccess.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
@@ -38,50 +35,38 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <comphelper/mediadescriptor.hxx>
#include <sax/fshelper.hxx>
-#include "properties.hxx"
-#include "tokens.hxx"
-#include "oox/helper/containerhelper.hxx"
-#include "oox/helper/propertyset.hxx"
-#include "oox/helper/zipstorage.hxx"
-#include "oox/core/fasttokenhandler.hxx"
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "oox/core/fastparser.hxx"
#include "oox/core/filterdetect.hxx"
#include "oox/core/fragmenthandler.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/recordparser.hxx"
#include "oox/core/relationshandler.hxx"
+#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/helper/zipstorage.hxx"
+
+namespace oox {
+namespace core {
+// ============================================================================
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::xml::sax;
+
+using ::comphelper::MediaDescriptor;
using ::rtl::OStringBuffer;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::beans::StringPair;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-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::lang::Locale;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::embed::XRelationshipAccess;
-using ::com::sun::star::embed::XStorage;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XStream;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::xml::sax::XFastParser;
-using ::com::sun::star::xml::sax::XFastTokenHandler;
-using ::com::sun::star::xml::sax::XFastDocumentHandler;
-using ::com::sun::star::xml::sax::InputSource;
-using ::com::sun::star::xml::sax::SAXException;
-using ::com::sun::star::document::XDocumentProperties;
-using ::com::sun::star::util::DateTime;
-using ::comphelper::MediaDescriptor;
-using ::sax_fastparser::FastSerializerHelper;
using ::sax_fastparser::FSHelperPtr;
-
-namespace oox {
-namespace core {
+using ::sax_fastparser::FastSerializerHelper;
// ============================================================================
@@ -101,62 +86,54 @@ struct XmlFilterBaseImpl
{
typedef RefMap< OUString, Relations > RelationsMap;
- Reference< XFastParser > mxFastParser;
- OUString maBinSuffix;
- OUString maVmlSuffix;
+ FastParser maFastParser;
+ const OUString maBinSuffix;
+ const OUString maVmlSuffix;
RelationsMap maRelationsMap;
TextFieldStack maTextFieldStack;
- explicit XmlFilterBaseImpl();
+
+ explicit XmlFilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException );
};
// ----------------------------------------------------------------------------
-XmlFilterBaseImpl::XmlFilterBaseImpl() :
+XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ maFastParser( rxContext ),
maBinSuffix( CREATE_OUSTRING( ".bin" ) ),
maVmlSuffix( CREATE_OUSTRING( ".vml" ) )
{
+ // register XML namespaces
+ maFastParser.registerNamespace( NMSP_xml );
+ maFastParser.registerNamespace( NMSP_packageRel );
+ maFastParser.registerNamespace( NMSP_officeRel );
+
+ maFastParser.registerNamespace( NMSP_dml );
+ maFastParser.registerNamespace( NMSP_dmlDiagram );
+ maFastParser.registerNamespace( NMSP_dmlChart );
+ maFastParser.registerNamespace( NMSP_dmlChartDr );
+ maFastParser.registerNamespace( NMSP_dmlSpreadDr );
+
+ maFastParser.registerNamespace( NMSP_vml );
+ maFastParser.registerNamespace( NMSP_vmlOffice );
+ maFastParser.registerNamespace( NMSP_vmlWord );
+ maFastParser.registerNamespace( NMSP_vmlExcel );
+ maFastParser.registerNamespace( NMSP_vmlPowerpoint );
+
+ maFastParser.registerNamespace( NMSP_xls );
+ maFastParser.registerNamespace( NMSP_ppt );
+
+ maFastParser.registerNamespace( NMSP_ax );
+ maFastParser.registerNamespace( NMSP_xm );
}
// ============================================================================
-XmlFilterBase::XmlFilterBase( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
- FilterBase( rxGlobalFactory ),
- mxImpl( new XmlFilterBaseImpl ),
+XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ FilterBase( rxContext ),
+ mxImpl( new XmlFilterBaseImpl( rxContext ) ),
mnRelId( 1 ),
mnMaxDocId( 0 )
{
- try
- {
- // create the fast parser
- mxImpl->mxFastParser.set( rxGlobalFactory->createInstance( CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW );
- mxImpl->mxFastParser->setTokenHandler( new FastTokenHandler );
-
- // register XML namespaces
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://www.w3.org/XML/1998/namespace" ), NMSP_XML );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS );
-
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/main" ), NMSP_DRAWINGML );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ), NMSP_DIAGRAM );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chart" ), NMSP_CHART );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing" ), NMSP_CDR );
-
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:word" ), NMSP_VML_DOC );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:excel" ), NMSP_VML_XLS );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:powerpoint" ), NMSP_VML_PPT );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/activeX" ), NMSP_AX );
-
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/spreadsheetml/2006/main"), NMSP_XLS );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" ), NMSP_XDR );
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/excel/2006/main" ), NMSP_XM );
-
- mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/presentationml/2006/main"), NMSP_PPT );
- }
- catch( Exception& )
- {
- }
}
XmlFilterBase::~XmlFilterBase()
@@ -213,25 +190,20 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r
if( !xDocHandler.is() )
return false;
- // check that the fast parser exists
- if( !mxImpl->mxFastParser.is() )
- return false;
-
// try to import XML stream
try
{
- // try to open the fragment stream (this may fail - do not assert)
- Reference< XInputStream > xInStrm( rxHandler->openFragmentStream(), UNO_SET_THROW );
+ /* Try to open the fragment stream (may fail, do not throw/assert).
+ Using the virtual function openFragmentStream() allows a document
+ handler to create specialized input streams, e.g. VML streams that
+ have to preprocess the raw input data. */
+ Reference< XInputStream > xInStrm = rxHandler->openFragmentStream();
- // create the input source and parse the stream
- InputSource aSource;
- aSource.aInputStream = xInStrm;
- aSource.sSystemId = aFragmentPath;
// own try/catch block for showing parser failure assertion with fragment path
- try
+ if( xInStrm.is() ) try
{
- mxImpl->mxFastParser->setFastDocumentHandler( xDocHandler );
- mxImpl->mxFastParser->parseStream( aSource );
+ mxImpl->maFastParser.setDocumentHandler( xDocHandler );
+ mxImpl->maFastParser.parseStream( xInStrm, aFragmentPath );
return true;
}
catch( Exception& )
@@ -516,7 +488,7 @@ Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rM
/* Get the input stream directly from the media descriptor, or decrypt the
package again. The latter is needed e.g. when the document is reloaded.
All this is implemented in the detector service. */
- FilterDetect aDetector( getGlobalFactory() );
+ FilterDetect aDetector( getComponentContext() );
return aDetector.extractUnencryptedPackage( rMediaDesc );
}
@@ -524,16 +496,15 @@ Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rM
StorageRef XmlFilterBase::implCreateStorage( const Reference< XInputStream >& rxInStream ) const
{
- return StorageRef( new ZipStorage( getGlobalFactory(), rxInStream ) );
+ return StorageRef( new ZipStorage( getServiceFactory(), rxInStream ) );
}
StorageRef XmlFilterBase::implCreateStorage( const Reference< XStream >& rxOutStream ) const
{
- return StorageRef( new ZipStorage( getGlobalFactory(), rxOutStream ) );
+ return StorageRef( new ZipStorage( getServiceFactory(), rxOutStream ) );
}
// ============================================================================
} // namespace core
} // namespace oox
-
diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 1830a8c5d5f9..560fcf141c19 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -33,9 +33,7 @@
#include <osl/time.h>
-#include "tokens.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
using namespace ::com::sun::star;
@@ -226,19 +224,19 @@ void OOXMLDocPropHandler::UpdateDocStatistic( const ::rtl::OUString& aChars )
switch( m_nBlock )
{
- case XML_Characters|NMSP_EXTPR:
+ case EXTPR_TOKEN( Characters ):
aName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterCount" ) );
break;
- case XML_Pages|NMSP_EXTPR:
+ case EXTPR_TOKEN( Pages ):
aName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageCount" ) );
break;
- case XML_Words|NMSP_EXTPR:
+ case EXTPR_TOKEN( Words ):
aName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WordCount" ) );
break;
- case XML_Paragraphs|NMSP_EXTPR:
+ case EXTPR_TOKEN( Paragraphs ):
aName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphCount" ) );
break;
@@ -299,9 +297,9 @@ void SAL_CALL OOXMLDocPropHandler::startFastElement( ::sal_Int32 nElement, const
{
if ( !m_nInBlock && !m_nState )
{
- if ( nElement == ( XML_coreProperties|NMSP_COREPR )
- || nElement == ( XML_Properties|NMSP_EXTPR )
- || nElement == ( XML_Properties|NMSP_CUSTPR ) )
+ if ( nElement == COREPR_TOKEN( coreProperties )
+ || nElement == EXTPR_TOKEN( Properties )
+ || nElement == CUSTPR_TOKEN( Properties ) )
{
m_nState = nElement;
}
@@ -320,7 +318,7 @@ void SAL_CALL OOXMLDocPropHandler::startFastElement( ::sal_Int32 nElement, const
if ( xAttribs.is() && xAttribs->hasAttribute( XML_name ) )
m_aCustomPropertyName = xAttribs->getValue( XML_name );
}
- else if ( m_nState && m_nInBlock && m_nInBlock == 2 && ( nElement >> 16 ) == ( NMSP_VT >> 16 ) )
+ else if ( m_nState && m_nInBlock && m_nInBlock == 2 && getNamespace( nElement ) == NMSP_officeDocPropsVT )
{
m_nType = nElement;
}
@@ -402,72 +400,72 @@ void SAL_CALL OOXMLDocPropHandler::characters( const ::rtl::OUString& aChars )
{
if ( (m_nInBlock == 2) || ((m_nInBlock == 3) && m_nType) )
{
- if ( m_nState == ( XML_coreProperties|NMSP_COREPR ) )
+ if ( m_nState == COREPR_TOKEN( coreProperties ) )
{
switch( m_nBlock )
{
- case XML_category|NMSP_COREPR:
+ case COREPR_TOKEN( category ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "category" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_contentStatus|NMSP_COREPR:
+ case COREPR_TOKEN( contentStatus ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "contentStatus" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_contentType|NMSP_COREPR:
+ case COREPR_TOKEN( contentType ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "contentType" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_identifier|NMSP_COREPR:
+ case COREPR_TOKEN( identifier ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "identifier" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_version|NMSP_COREPR:
+ case COREPR_TOKEN( version ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "version" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_created|NMSP_DCTERMS:
+ case DCT_TOKEN( created ):
if ( aChars.getLength() >= 4 )
m_xDocProp->setCreationDate( GetDateTimeFromW3CDTF( aChars ) );
break;
- case XML_creator|NMSP_DC:
+ case DC_TOKEN( creator ):
m_xDocProp->setAuthor( aChars );
break;
- case XML_description|NMSP_DC:
+ case DC_TOKEN( description ):
m_xDocProp->setDescription( aChars );
break;
- case XML_keywords|NMSP_COREPR:
+ case COREPR_TOKEN( keywords ):
m_xDocProp->setKeywords( GetKeywordsSet( aChars ) );
break;
- case XML_language|NMSP_DC:
+ case DC_TOKEN( language ):
if ( aChars.getLength() >= 2 )
m_xDocProp->setLanguage( GetLanguage( aChars ) );
break;
- case XML_lastModifiedBy|NMSP_COREPR:
+ case COREPR_TOKEN( lastModifiedBy ):
m_xDocProp->setModifiedBy( aChars );
break;
- case XML_lastPrinted|NMSP_COREPR:
+ case COREPR_TOKEN( lastPrinted ):
if ( aChars.getLength() >= 4 )
m_xDocProp->setPrintDate( GetDateTimeFromW3CDTF( aChars ) );
break;
- case XML_modified|NMSP_DCTERMS:
+ case DCT_TOKEN( modified ):
if ( aChars.getLength() >= 4 )
m_xDocProp->setModificationDate( GetDateTimeFromW3CDTF( aChars ) );
break;
- case XML_revision|NMSP_COREPR:
+ case COREPR_TOKEN( revision ):
try
{
m_xDocProp->setEditingCycles(
@@ -479,11 +477,11 @@ void SAL_CALL OOXMLDocPropHandler::characters( const ::rtl::OUString& aChars )
}
break;
- case XML_subject|NMSP_DC:
+ case DC_TOKEN( subject ):
m_xDocProp->setSubject( aChars );
break;
- case XML_title|NMSP_DC:
+ case DC_TOKEN( title ):
m_xDocProp->setTitle( aChars );
break;
@@ -491,19 +489,19 @@ void SAL_CALL OOXMLDocPropHandler::characters( const ::rtl::OUString& aChars )
OSL_ASSERT( "Unexpected core property!" );
}
}
- else if ( m_nState == ( XML_Properties|NMSP_EXTPR ) )
+ else if ( m_nState == EXTPR_TOKEN( Properties ) )
{
switch( m_nBlock )
{
- case XML_Application|NMSP_EXTPR:
+ case EXTPR_TOKEN( Application ):
m_xDocProp->setGenerator( aChars );
break;
- case XML_Template|NMSP_EXTPR:
+ case EXTPR_TOKEN( Template ):
m_xDocProp->setTemplateName( aChars );
break;
- case XML_TotalTime|NMSP_EXTPR:
+ case EXTPR_TOKEN( TotalTime ):
try
{
m_xDocProp->setEditingDuration( aChars.toInt32() );
@@ -514,89 +512,89 @@ void SAL_CALL OOXMLDocPropHandler::characters( const ::rtl::OUString& aChars )
}
break;
- case XML_Characters|NMSP_EXTPR:
- case XML_Pages|NMSP_EXTPR:
- case XML_Words|NMSP_EXTPR:
- case XML_Paragraphs|NMSP_EXTPR:
+ case EXTPR_TOKEN( Characters ):
+ case EXTPR_TOKEN( Pages ):
+ case EXTPR_TOKEN( Words ):
+ case EXTPR_TOKEN( Paragraphs ):
UpdateDocStatistic( aChars );
break;
- case XML_HyperlinksChanged|NMSP_EXTPR:
+ case EXTPR_TOKEN( HyperlinksChanged ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HyperlinksChanged" ) );
AddCustomProperty( uno::makeAny( aChars.toBoolean() ) ); // the property has boolean type
break;
- case XML_LinksUpToDate|NMSP_EXTPR:
+ case EXTPR_TOKEN( LinksUpToDate ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LinksUpToDate" ) );
AddCustomProperty( uno::makeAny( aChars.toBoolean() ) ); // the property has boolean type
break;
- case XML_ScaleCrop|NMSP_EXTPR:
+ case EXTPR_TOKEN( ScaleCrop ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScaleCrop" ) );
AddCustomProperty( uno::makeAny( aChars.toBoolean() ) ); // the property has boolean type
break;
- case XML_SharedDoc|NMSP_EXTPR:
+ case EXTPR_TOKEN( SharedDoc ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShareDoc" ) );
AddCustomProperty( uno::makeAny( aChars.toBoolean() ) ); // the property has boolean type
break;
- case XML_DocSecurity|NMSP_EXTPR:
+ case EXTPR_TOKEN( DocSecurity ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocSecurity" ) );
AddCustomProperty( uno::makeAny( aChars.toInt32() ) ); // the property has sal_Int32 type
break;
- case XML_HiddenSlides|NMSP_EXTPR:
+ case EXTPR_TOKEN( HiddenSlides ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HiddenSlides" ) );
AddCustomProperty( uno::makeAny( aChars.toInt32() ) ); // the property has sal_Int32 type
break;
- case XML_MMClips|NMSP_EXTPR:
+ case EXTPR_TOKEN( MMClips ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MMClips" ) );
AddCustomProperty( uno::makeAny( aChars.toInt32() ) ); // the property has sal_Int32 type
break;
- case XML_Notes|NMSP_EXTPR:
+ case EXTPR_TOKEN( Notes ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Notes" ) );
AddCustomProperty( uno::makeAny( aChars.toInt32() ) ); // the property has sal_Int32 type
break;
- case XML_Slides|NMSP_EXTPR:
+ case EXTPR_TOKEN( Slides ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Slides" ) );
AddCustomProperty( uno::makeAny( aChars.toInt32() ) ); // the property has sal_Int32 type
break;
- case XML_AppVersion|NMSP_EXTPR:
+ case EXTPR_TOKEN( AppVersion ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AppVersion" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_Company|NMSP_EXTPR:
+ case EXTPR_TOKEN( Company ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Company" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_HyperlinkBase|NMSP_EXTPR:
+ case EXTPR_TOKEN( HyperlinkBase ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HyperlinkBase" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_Manager|NMSP_EXTPR:
+ case EXTPR_TOKEN( Manager ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Manager" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_PresentationFormat|NMSP_EXTPR:
+ case EXTPR_TOKEN( PresentationFormat ):
m_aCustomPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PresentationFormat" ) );
AddCustomProperty( uno::makeAny( aChars ) ); // the property has string type
break;
- case XML_CharactersWithSpaces|NMSP_EXTPR:
- case XML_Lines|NMSP_EXTPR:
- case XML_DigSig|NMSP_EXTPR:
- case XML_HeadingPairs|NMSP_EXTPR:
- case XML_HLinks|NMSP_EXTPR:
- case XML_TitlesOfParts|NMSP_EXTPR:
+ case EXTPR_TOKEN( CharactersWithSpaces ):
+ case EXTPR_TOKEN( Lines ):
+ case EXTPR_TOKEN( DigSig ):
+ case EXTPR_TOKEN( HeadingPairs ):
+ case EXTPR_TOKEN( HLinks ):
+ case EXTPR_TOKEN( TitlesOfParts ):
// ignored during the import currently
break;
@@ -604,46 +602,46 @@ void SAL_CALL OOXMLDocPropHandler::characters( const ::rtl::OUString& aChars )
OSL_ASSERT( "Unexpected extended property!" );
}
}
- else if ( m_nState == ( XML_Properties|NMSP_CUSTPR ) )
+ else if ( m_nState == CUSTPR_TOKEN( Properties ) )
{
- if ( m_nBlock == ( XML_property|NMSP_CUSTPR ) )
+ if ( m_nBlock == CUSTPR_TOKEN( property ) )
{
// this is a custom property
switch( m_nType )
{
- case XML_bool|NMSP_VT:
+ case VT_TOKEN( bool ):
AddCustomProperty( uno::makeAny( aChars.toBoolean() ) );
break;
- case XML_bstr|NMSP_VT:
- case XML_lpstr|NMSP_VT:
- case XML_lpwstr|NMSP_VT:
+ case VT_TOKEN( bstr ):
+ case VT_TOKEN( lpstr ):
+ case VT_TOKEN( lpwstr ):
AddCustomProperty( uno::makeAny( AttributeConversion::decodeXString( aChars ) ) ); // the property has string type
break;
- case XML_date|NMSP_VT:
- case XML_filetime|NMSP_VT:
+ case VT_TOKEN( date ):
+ case VT_TOKEN( filetime ):
AddCustomProperty( uno::makeAny( GetDateTimeFromW3CDTF( aChars ) ) );
- case XML_i1|NMSP_VT:
- case XML_i2|NMSP_VT:
+ case VT_TOKEN( i1 ):
+ case VT_TOKEN( i2 ):
AddCustomProperty( uno::makeAny( (sal_Int16)aChars.toInt32() ) );
break;
- case XML_i4|NMSP_VT:
- case XML_int|NMSP_VT:
+ case VT_TOKEN( i4 ):
+ case VT_TOKEN( int ):
AddCustomProperty( uno::makeAny( aChars.toInt32() ) );
break;
- case XML_i8|NMSP_VT:
+ case VT_TOKEN( i8 ):
AddCustomProperty( uno::makeAny( aChars.toInt64() ) );
break;
- case XML_r4|NMSP_VT:
+ case VT_TOKEN( r4 ):
AddCustomProperty( uno::makeAny( aChars.toFloat() ) );
break;
- case XML_r8|NMSP_VT:
+ case VT_TOKEN( r8 ):
AddCustomProperty( uno::makeAny( aChars.toDouble() ) );
break;
diff --git a/oox/source/docprop/docprophandler.hxx b/oox/source/docprop/docprophandler.hxx
index bb2cff323159..13e6e47b025e 100644
--- a/oox/source/docprop/docprophandler.hxx
+++ b/oox/source/docprop/docprophandler.hxx
@@ -34,9 +34,19 @@
#include <cppuhelper/implbase1.hxx>
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
+
namespace oox {
namespace docprop {
+#define COREPR_TOKEN( token ) (::oox::NMSP_packageMetaCorePr | XML_##token)
+#define CUSTPR_TOKEN( token ) (::oox::NMSP_officeCustomPr | XML_##token)
+#define EXTPR_TOKEN( token ) (::oox::NMSP_officeExtPr | XML_##token)
+#define VT_TOKEN( token ) (::oox::NMSP_officeDocPropsVT | XML_##token)
+#define DC_TOKEN( token ) (::oox::NMSP_dc | XML_##token)
+#define DCT_TOKEN( token ) (::oox::NMSP_dcTerms | XML_##token)
+
class OOXMLDocPropHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastDocumentHandler >
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
diff --git a/oox/source/docprop/ooxmldocpropimport.cxx b/oox/source/docprop/ooxmldocpropimport.cxx
index de34f592e98a..7f3a08859302 100644
--- a/oox/source/docprop/ooxmldocpropimport.cxx
+++ b/oox/source/docprop/ooxmldocpropimport.cxx
@@ -25,203 +25,165 @@
*
************************************************************************/
-#include <com/sun/star/embed/XStorage.hpp>
+#include "ooxmldocpropimport.hxx"
+
+#include <vector>
+#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
#include <com/sun/star/embed/XRelationshipAccess.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
-#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
-#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
-
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implementationentry.hxx>
-
-#include <oox/core/namespaces.hxx>
+#include <com/sun/star/embed/XStorage.hpp>
+#include "oox/core/fastparser.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/helper.hxx"
#include "docprophandler.hxx"
-#include "ooxmldocpropimport.hxx"
-
-using namespace ::com::sun::star;
namespace oox {
namespace docprop {
-// -----------------------------------------------------------
-::rtl::OUString SAL_CALL OOXMLDocPropImportImpl_getImplementationName()
+// ============================================================================
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+OUString SAL_CALL DocumentPropertiesImport_getImplementationName()
{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.oox.docprop.OOXMLDocumentPropertiesImporter"));
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.docprop.DocumentPropertiesImporter" );
}
-// -----------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OOXMLDocPropImportImpl_getSupportedServiceNames()
+Sequence< OUString > SAL_CALL DocumentPropertiesImport_getSupportedServiceNames()
{
- uno::Sequence< ::rtl::OUString > s(1);
- s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.document.OOXMLDocumentPropertiesImporter"));
- return s;
+ Sequence< OUString > aServices( 1 );
+ aServices[ 0 ] = CREATE_OUSTRING( "com.sun.star.document.OOXMLDocumentPropertiesImporter" );
+ return aServices;
}
-// -----------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOXMLDocPropImportImpl_createInstance(
- const uno::Reference< uno::XComponentContext > & context)
- SAL_THROW((uno::Exception))
+Reference< XInterface > SAL_CALL DocumentPropertiesImport_createInstance( const Reference< XComponentContext >& rxContext ) SAL_THROW((Exception))
{
- return static_cast< ::cppu::OWeakObject * >(new OOXMLDocPropImportImpl(context));
+ return static_cast< ::cppu::OWeakObject* >( new DocumentPropertiesImport( rxContext ) );
}
+// ============================================================================
-// -----------------------------------------------------------
-OOXMLDocPropImportImpl::OOXMLDocPropImportImpl(uno::Reference< uno::XComponentContext > const & xContext) :
- m_xContext( xContext )
-{}
+namespace {
-// -----------------------------------------------------------
-uno::Sequence< xml::sax::InputSource > OOXMLDocPropImportImpl::GetRelatedStreams( const uno::Reference< embed::XStorage > xStorage, const ::rtl::OUString& aStreamType )
+Sequence< InputSource > lclGetRelatedStreams( const Reference< XStorage >& rxStorage, const OUString& rStreamType ) throw (RuntimeException)
{
- if ( !xStorage.is() )
- throw uno::RuntimeException();
+ Reference< XRelationshipAccess > xRelation( rxStorage, UNO_QUERY_THROW );
+ Reference< XHierarchicalStorageAccess > xHierarchy( rxStorage, UNO_QUERY_THROW );
- uno::Reference< embed::XRelationshipAccess > xRelation( xStorage, uno::UNO_QUERY_THROW );
- uno::Reference< embed::XHierarchicalStorageAccess > xHierarchy( xStorage, uno::UNO_QUERY_THROW );
+ Sequence< Sequence< StringPair > > aPropsInfo = xRelation->getRelationshipsByType( rStreamType );
- uno::Sequence< uno::Sequence< beans::StringPair > > aPropsInfo = xRelation->getRelationshipsByType( aStreamType );
+ ::std::vector< InputSource > aResult;
- sal_Int32 nLength = 0;
- uno::Sequence< xml::sax::InputSource > aResult( aPropsInfo.getLength() );
- if ( aPropsInfo.getLength() )
+ for( sal_Int32 nIndex = 0, nLength = aPropsInfo.getLength(); nIndex < nLength; ++nIndex )
{
- for ( sal_Int32 nInd = 0; nInd < aPropsInfo.getLength(); nInd++ )
- for ( sal_Int32 nEntryInd = 0; nEntryInd < aPropsInfo[nInd].getLength(); nEntryInd++ )
- if ( aPropsInfo[nInd][nEntryInd].First.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Target" ) ) ) )
+ const Sequence< StringPair >& rEntries = aPropsInfo[ nIndex ];
+ for( sal_Int32 nEntryIndex = 0, nEntryLength = rEntries.getLength(); nEntryIndex < nEntryLength; ++nEntryIndex )
+ {
+ const StringPair& rEntry = rEntries[ nEntryIndex ];
+ if( rEntry.First.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Target" ) ) )
+ {
+ Reference< XExtendedStorageStream > xExtStream(
+ xHierarchy->openStreamElementByHierarchicalName( rEntry.Second, ElementModes::READ ), UNO_QUERY_THROW );
+ Reference< XInputStream > xInStream = xExtStream->getInputStream();
+ if( xInStream.is() )
{
- uno::Reference< embed::XExtendedStorageStream > xExtStream = xHierarchy->openStreamElementByHierarchicalName( aPropsInfo[nInd][nEntryInd].Second, embed::ElementModes::READ );
- if ( !xExtStream.is() )
- throw uno::RuntimeException();
-
- aResult[nLength].sSystemId = aPropsInfo[nInd][nEntryInd].Second;
- aResult[nLength++].aInputStream = xExtStream->getInputStream();
- break;
+ aResult.resize( aResult.size() + 1 );
+ aResult.back().sSystemId = rEntry.Second;
+ aResult.back().aInputStream = xExtStream->getInputStream();
}
-
- aResult.realloc( nLength );
+ break;
+ }
+ }
}
- return aResult;
+ return ContainerHelper::vectorToSequence( aResult );
}
-// com.sun.star.uno.XServiceInfo:
-// -----------------------------------------------------------
-::rtl::OUString SAL_CALL OOXMLDocPropImportImpl::getImplementationName() throw (uno::RuntimeException)
+} // namespace
+
+// ============================================================================
+
+DocumentPropertiesImport::DocumentPropertiesImport( const Reference< XComponentContext >& rxContext ) :
+ mxContext( rxContext )
{
- return OOXMLDocPropImportImpl_getImplementationName();
}
-// -----------------------------------------------------------
-::sal_Bool SAL_CALL OOXMLDocPropImportImpl::supportsService(::rtl::OUString const & serviceName) throw (uno::RuntimeException)
-{
- uno::Sequence< ::rtl::OUString > serviceNames = OOXMLDocPropImportImpl_getSupportedServiceNames();
- for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i)
- {
- if (serviceNames[i] == serviceName)
- return sal_True;
- }
+// XServiceInfo
- return sal_False;
+OUString SAL_CALL DocumentPropertiesImport::getImplementationName() throw (RuntimeException)
+{
+ return DocumentPropertiesImport_getImplementationName();
}
-// -----------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OOXMLDocPropImportImpl::getSupportedServiceNames() throw (uno::RuntimeException)
+sal_Bool SAL_CALL DocumentPropertiesImport::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{
- return OOXMLDocPropImportImpl_getSupportedServiceNames();
+ Sequence< OUString > aServiceNames = DocumentPropertiesImport_getSupportedServiceNames();
+ for( sal_Int32 nIndex = 0, nLength = aServiceNames.getLength(); nIndex < nLength; ++nIndex )
+ if( aServiceNames[ nIndex ] == rServiceName )
+ return sal_True;
+ return sal_False;
}
-// -----------------------------------------------------------
-// ::com::sun::star::document::XOOXMLDocumentPropertiesImporter:
-void SAL_CALL OOXMLDocPropImportImpl::importProperties(const uno::Reference< embed::XStorage > & xSource, const uno::Reference< document::XDocumentProperties > & xDocumentProperties) throw (uno::RuntimeException, lang::IllegalArgumentException, xml::sax::SAXException, uno::Exception)
+Sequence< OUString > SAL_CALL DocumentPropertiesImport::getSupportedServiceNames() throw (RuntimeException)
{
- // TODO: Insert your implementation for "importProperties" here.
- if ( !m_xContext.is() )
- throw uno::RuntimeException();
+ return DocumentPropertiesImport_getSupportedServiceNames();
+}
- if ( !xSource.is() || !xDocumentProperties.is() )
- throw lang::IllegalArgumentException();
+// XOOXMLDocumentPropertiesImporter
- // the MS Office seems to have a bug, so we have to do similar handling
- ::rtl::OUString aCoreType( RTL_CONSTASCII_USTRINGPARAM( "http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties" ) );
- ::rtl::OUString aCoreWorkaroundType( RTL_CONSTASCII_USTRINGPARAM( "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" ) );
+void SAL_CALL DocumentPropertiesImport::importProperties(
+ const Reference< XStorage >& rxSource, const Reference< XDocumentProperties >& rxDocumentProperties )
+ throw (RuntimeException, IllegalArgumentException, SAXException, Exception)
+{
+ if( !mxContext.is() )
+ throw RuntimeException();
- ::rtl::OUString aExtType( RTL_CONSTASCII_USTRINGPARAM( "http://schemas.openxmlformats.org/officedocument/2006/relationships/extended-properties" ) );
- ::rtl::OUString aCustomType( RTL_CONSTASCII_USTRINGPARAM( "http://schemas.openxmlformats.org/officedocument/2006/relationships/custom-properties" ) );
+ if( !rxSource.is() || !rxDocumentProperties.is() )
+ throw IllegalArgumentException();
- uno::Sequence< xml::sax::InputSource > aCoreStreams = GetRelatedStreams( xSource, aCoreType );
- if ( !aCoreStreams.getLength() )
- aCoreStreams = GetRelatedStreams( xSource, aCoreWorkaroundType );
+ Sequence< InputSource > aCoreStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE( "metadata/core-properties" ) );
+ // MS Office seems to have a bug, so we have to do similar handling
+ if( !aCoreStreams.hasElements() )
+ aCoreStreams = lclGetRelatedStreams( rxSource, CREATE_PACKAGE_RELATION_TYPE( "metadata/core-properties" ) );
- uno::Sequence< xml::sax::InputSource > aExtStreams = GetRelatedStreams( xSource, aExtType );
- uno::Sequence< xml::sax::InputSource > aCustomStreams = GetRelatedStreams( xSource, aCustomType );
+ Sequence< InputSource > aExtStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE( "extended-properties" ) );
+ Sequence< InputSource > aCustomStreams = lclGetRelatedStreams( rxSource, CREATE_OFFICEDOC_RELATION_TYPE( "custom-properties" ) );
- if ( aCoreStreams.getLength() || aExtStreams.getLength() || aCustomStreams.getLength() )
+ if( aCoreStreams.hasElements() || aExtStreams.hasElements() || aCustomStreams.hasElements() )
{
- if ( aCoreStreams.getLength() > 1 )
- throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected core properties stream!" ) ), uno::Reference< uno::XInterface >() );
-
- uno::Reference< lang::XMultiComponentFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-
- uno::Reference< xml::sax::XFastParser > xParser(
- xFactory->createInstanceWithContext(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.FastParser" ) ),
- m_xContext ),
- uno::UNO_QUERY_THROW );
-
- uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler(
- xFactory->createInstanceWithContext(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.oox.FastTokenHandlerService" ) ),
- m_xContext ),
- uno::UNO_QUERY_THROW );
-
- uno::Reference< xml::sax::XFastDocumentHandler > xDocHandler( static_cast< xml::sax::XFastDocumentHandler* >( new OOXMLDocPropHandler( m_xContext, xDocumentProperties ) ) );
-
- xParser->setFastDocumentHandler( xDocHandler );
- xParser->setTokenHandler( xTokenHandler );
-
- xParser->registerNamespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "http://schemas.openxmlformats.org/package/2006/metadata/core-properties" ) ), NMSP_COREPR );
- xParser->registerNamespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "http://purl.org/dc/elements/1.1/" ) ), NMSP_DC );
- xParser->registerNamespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "http://purl.org/dc/terms/" ) ), NMSP_DCTERMS );
- xParser->registerNamespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" ) ), NMSP_EXTPR );
- xParser->registerNamespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" ) ), NMSP_CUSTPR );
- xParser->registerNamespace( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" ) ), NMSP_VT );
-
- // #158414# XFastParser::parseStream() throws on invalid XML
- if ( aCoreStreams.getLength() ) try
- {
- if ( aCoreStreams[0].aInputStream.is() )
- {
- xParser->parseStream( aCoreStreams[0] );
- aCoreStreams[0].aInputStream->closeInput();
- }
- }
- catch( uno::Exception& )
- {
- }
-
- sal_Int32 nInd = 0;
- for ( nInd = 0; nInd < aExtStreams.getLength(); nInd++ )
- {
- xParser->parseStream( aExtStreams[nInd] );
- if ( aExtStreams[nInd].aInputStream.is() )
- aExtStreams[nInd].aInputStream->closeInput();
- }
-
- for ( nInd = 0; nInd < aCustomStreams.getLength(); nInd++ )
- {
- xParser->parseStream( aCustomStreams[nInd] );
- if ( aCustomStreams[nInd].aInputStream.is() )
- aCustomStreams[nInd].aInputStream->closeInput();
- }
+ if( aCoreStreams.getLength() > 1 )
+ throw IOException( CREATE_OUSTRING( "Unexpected core properties stream!" ), Reference< XInterface >() );
+
+ ::oox::core::FastParser aParser( mxContext );
+ aParser.registerNamespace( NMSP_packageMetaCorePr );
+ aParser.registerNamespace( NMSP_dc );
+ aParser.registerNamespace( NMSP_dcTerms );
+ aParser.registerNamespace( NMSP_officeExtPr );
+ aParser.registerNamespace( NMSP_officeCustomPr );
+ aParser.registerNamespace( NMSP_officeDocPropsVT );
+ aParser.setDocumentHandler( new OOXMLDocPropHandler( mxContext, rxDocumentProperties ) );
+
+ if( aCoreStreams.hasElements() )
+ aParser.parseStream( aCoreStreams[ 0 ], true );
+ for( sal_Int32 nIndex = 0; nIndex < aExtStreams.getLength(); ++nIndex )
+ aParser.parseStream( aExtStreams[ nIndex ], true );
+ for( sal_Int32 nIndex = 0; nIndex < aCustomStreams.getLength(); ++nIndex )
+ aParser.parseStream( aCustomStreams[ nIndex ], true );
}
}
+// ============================================================================
+
} // namespace docprop
} // namespace oox
-
-
diff --git a/oox/source/docprop/ooxmldocpropimport.hxx b/oox/source/docprop/ooxmldocpropimport.hxx
index a10eafbe1eb4..79f4d1f7e60b 100644
--- a/oox/source/docprop/ooxmldocpropimport.hxx
+++ b/oox/source/docprop/ooxmldocpropimport.hxx
@@ -28,44 +28,44 @@
#ifndef OOX_DOCPROP_OOXMLDOCPROPIMPORT_HXX
#define OOX_DOCPROP_OOXMLDOCPROPIMPORT_HXX
-#include <sal/config.h>
-#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
+#include <cppuhelper/implbase2.hxx>
namespace oox {
namespace docprop {
-class OOXMLDocPropImportImpl:
+// ============================================================================
+
+class DocumentPropertiesImport :
public ::cppu::WeakImplHelper2<
::com::sun::star::lang::XServiceInfo,
- ::com::sun::star::document::XOOXMLDocumentPropertiesImporter>
+ ::com::sun::star::document::XOOXMLDocumentPropertiesImporter >
{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
-
- OOXMLDocPropImportImpl(const OOXMLDocPropImportImpl &); // not defined
- OOXMLDocPropImportImpl& operator=(const OOXMLDocPropImportImpl &); // not defined
-
public:
- explicit OOXMLDocPropImportImpl(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context);
- virtual ~OOXMLDocPropImportImpl() {}
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::xml::sax::InputSource > GetRelatedStreams( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > xStorage, const ::rtl::OUString& aStreamType );
+ explicit DocumentPropertiesImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
- // ::com::sun::star::lang::XServiceInfo:
+ // XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::document::XOOXMLDocumentPropertiesImporter:
- virtual void SAL_CALL importProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > & xSource, const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > & xDocumentProperties) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::Exception);
+ // XOOXMLDocumentPropertiesImporter
+ virtual void SAL_CALL importProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rxSource,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >& rxDocumentProperties )
+ throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::Exception);
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
};
+// ============================================================================
+
} // namespace docprop
} // namespace oox
#endif
-
diff --git a/oox/source/drawingml/chart/axiscontext.cxx b/oox/source/drawingml/chart/axiscontext.cxx
index 1066f91c0e19..cfcdd3ff0754 100644
--- a/oox/source/drawingml/chart/axiscontext.cxx
+++ b/oox/source/drawingml/chart/axiscontext.cxx
@@ -26,21 +26,24 @@
************************************************************************/
#include "oox/drawingml/chart/axiscontext.hxx"
+
#include "oox/drawingml/shapepropertiescontext.hxx"
#include "oox/drawingml/textbodycontext.hxx"
#include "oox/drawingml/chart/axismodel.hxx"
#include "oox/drawingml/chart/titlecontext.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::ContextHandler2Helper;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+using ::oox::core::ContextHandlerRef;
+using ::oox::core::ContextHandler2Helper;
+using ::rtl::OUString;
+
+// ============================================================================
+
AxisDispUnitsContext::AxisDispUnitsContext( ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel ) :
ContextBase< AxisDispUnitsModel >( rParent, rModel )
{
@@ -315,4 +318,3 @@ ContextHandlerRef ValAxisContext::onCreateContext( sal_Int32 nElement, const Att
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index da4fc3e5b83f..028fc3d19eb1 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -26,36 +26,20 @@
************************************************************************/
#include "oox/drawingml/chart/axisconverter.hxx"
+
#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
#include <com/sun/star/chart/ChartAxisPosition.hpp>
-#include <com/sun/star/chart2/TickmarkStyle.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/TickmarkStyle.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
-#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/chart/axismodel.hxx"
#include "oox/drawingml/chart/titleconverter.hxx"
#include "oox/drawingml/chart/typegroupconverter.hxx"
-#include "properties.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::chart2::IncrementData;
-using ::com::sun::star::chart2::ScaleData;
-using ::com::sun::star::chart2::SubIncrement;
-using ::com::sun::star::chart2::XAxis;
-using ::com::sun::star::chart2::XCoordinateSystem;
-using ::com::sun::star::chart2::XScaling;
-using ::com::sun::star::chart2::XTitled;
+#include "oox/drawingml/lineproperties.hxx"
namespace oox {
namespace drawingml {
@@ -63,6 +47,14 @@ namespace chart {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
template< typename Type >
@@ -330,4 +322,3 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/axismodel.cxx b/oox/source/drawingml/chart/axismodel.cxx
index 9f1d52adc0d2..8736e8f6dcd5 100644
--- a/oox/source/drawingml/chart/axismodel.cxx
+++ b/oox/source/drawingml/chart/axismodel.cxx
@@ -78,4 +78,3 @@ AxisModel::~AxisModel()
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/chartcontextbase.cxx b/oox/source/drawingml/chart/chartcontextbase.cxx
index d3746f07ba6c..69c1f2622b46 100644
--- a/oox/source/drawingml/chart/chartcontextbase.cxx
+++ b/oox/source/drawingml/chart/chartcontextbase.cxx
@@ -26,11 +26,9 @@
************************************************************************/
#include "oox/drawingml/chart/chartcontextbase.hxx"
-#include "oox/drawingml/shapepropertiescontext.hxx"
-#include "oox/drawingml/chart/modelbase.hxx"
-using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextHandlerRef;
+#include "oox/drawingml/chart/modelbase.hxx"
+#include "oox/drawingml/shapepropertiescontext.hxx"
namespace oox {
namespace drawingml {
@@ -38,6 +36,11 @@ namespace chart {
// ============================================================================
+using ::oox::core::ContextHandler2Helper;
+using ::oox::core::ContextHandlerRef;
+
+// ============================================================================
+
ShapePrWrapperContext::ShapePrWrapperContext( ContextHandler2Helper& rParent, Shape& rModel ) :
ContextBase< Shape >( rParent, rModel )
{
@@ -117,4 +120,3 @@ ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const Attr
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx
index efd8e6d021e1..02672088c763 100644
--- a/oox/source/drawingml/chart/chartconverter.cxx
+++ b/oox/source/drawingml/chart/chartconverter.cxx
@@ -26,27 +26,28 @@
************************************************************************/
#include "oox/drawingml/chart/chartconverter.hxx"
+
#include <com/sun/star/chart2/XChartDocument.hpp>
#include "oox/drawingml/chart/chartspaceconverter.hxx"
#include "oox/drawingml/chart/chartspacemodel.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::drawing::XShapes;
-using ::com::sun::star::chart2::XChartDocument;
-using ::com::sun::star::chart2::data::XDataProvider;
-using ::com::sun::star::chart2::data::XDataSequence;
-using ::oox::core::XmlFilterBase;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::chart2::data;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::XmlFilterBase;
+using ::rtl::OUString;
+
+// ============================================================================
+
ChartConverter::ChartConverter()
{
}
@@ -90,4 +91,3 @@ Reference< XDataSequence > ChartConverter::createDataSequence( const Reference<
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/chartdrawingfragment.cxx b/oox/source/drawingml/chart/chartdrawingfragment.cxx
index fcc350b583c3..03c634453e8b 100644
--- a/oox/source/drawingml/chart/chartdrawingfragment.cxx
+++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx
@@ -26,28 +26,28 @@
************************************************************************/
#include "oox/drawingml/chart/chartdrawingfragment.hxx"
+
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/connectorshapecontext.hxx"
#include "oox/drawingml/graphicshapecontext.hxx"
#include "oox/drawingml/shapecontext.hxx"
#include "oox/drawingml/shapegroupcontext.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::drawing::XShapes;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::FragmentHandler2;
-using ::oox::core::XmlFilterBase;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::uno;
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
ShapeAnchor::ShapeAnchor( bool bRelSize ) :
mbRelSize( bRelSize )
{
@@ -175,7 +175,7 @@ ContextHandlerRef ChartDrawingFragment::onCreateContext( sal_Int32 nElement, con
case CDR_TOKEN( graphicFrame ):
if( !mbOleSupport )
return 0;
- mxShape.reset( new Shape( "com.sun.star.drawing.OLE2Shape" ) );
+ mxShape.reset( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) );
return new GraphicalObjectFrameContext( *this, ShapePtr(), mxShape, true );
case CDR_TOKEN( grpSp ):
mxShape.reset( new Shape( "com.sun.star.drawing.GroupShape" ) );
@@ -204,26 +204,24 @@ ContextHandlerRef ChartDrawingFragment::onCreateContext( sal_Int32 nElement, con
return 0;
}
-void ChartDrawingFragment::onEndElement( const OUString& rChars )
+void ChartDrawingFragment::onCharacters( const OUString& rChars )
{
- switch( getCurrentElement() )
- {
- case CDR_TOKEN( x ):
- case CDR_TOKEN( y ):
- if( mxAnchor.get() ) mxAnchor->setPos( getCurrentElement(), getPreviousElement(), rChars );
- break;
+ if( isCurrentElement( CDR_TOKEN( x ), CDR_TOKEN( y ) ) && mxAnchor.get() )
+ mxAnchor->setPos( getCurrentElement(), getParentElement(), rChars );
+}
- case CDR_TOKEN( absSizeAnchor ):
- case CDR_TOKEN( relSizeAnchor ):
- if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() )
- {
- Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuChartRect );
- if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) )
- mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), mxDrawPage, &aLoc );
- }
- mxShape.reset();
- mxAnchor.reset();
- break;
+void ChartDrawingFragment::onEndElement()
+{
+ if( isCurrentElement( CDR_TOKEN( absSizeAnchor ), CDR_TOKEN( relSizeAnchor ) ) )
+ {
+ if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() )
+ {
+ Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuChartRect );
+ if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) )
+ mxShape->addShape( getFilter(), getFilter().getCurrentTheme(), mxDrawPage, &aLoc );
+ }
+ mxShape.reset();
+ mxAnchor.reset();
}
}
@@ -232,4 +230,3 @@ void ChartDrawingFragment::onEndElement( const OUString& rChars )
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 54212f1bdbda..b16ac91e09c9 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/drawingml/chart/chartspaceconverter.hxx"
+
#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -38,20 +39,6 @@
#include "oox/drawingml/chart/chartspacemodel.hxx"
#include "oox/drawingml/chart/plotareaconverter.hxx"
#include "oox/drawingml/chart/titleconverter.hxx"
-#include "properties.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::util::XNumberFormatsSupplier;
-using ::com::sun::star::drawing::XDrawPageSupplier;
-using ::com::sun::star::drawing::XShapes;
-using ::com::sun::star::chart2::XDiagram;
-using ::com::sun::star::chart2::XTitled;
-using ::com::sun::star::chart2::data::XDataReceiver;
namespace oox {
namespace drawingml {
@@ -59,6 +46,17 @@ namespace chart {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::chart2::data;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
ChartSpaceConverter::ChartSpaceConverter( const ConverterRoot& rParent, ChartSpaceModel& rModel ) :
ConverterBase< ChartSpaceModel >( rParent, rModel )
{
@@ -206,4 +204,3 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/chartspacefragment.cxx b/oox/source/drawingml/chart/chartspacefragment.cxx
index 75df94e95de7..d4b4a66f361f 100644
--- a/oox/source/drawingml/chart/chartspacefragment.cxx
+++ b/oox/source/drawingml/chart/chartspacefragment.cxx
@@ -26,22 +26,25 @@
************************************************************************/
#include "oox/drawingml/chart/chartspacefragment.hxx"
+
#include "oox/drawingml/shapepropertiescontext.hxx"
#include "oox/drawingml/textbodycontext.hxx"
#include "oox/drawingml/chart/chartspacemodel.hxx"
#include "oox/drawingml/chart/plotareacontext.hxx"
#include "oox/drawingml/chart/titlecontext.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::XmlFilterBase;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
ChartSpaceFragment::ChartSpaceFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, ChartSpaceModel& rModel ) :
FragmentBase< ChartSpaceModel >( rFilter, rFragmentPath, rModel )
{
@@ -124,4 +127,3 @@ ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/chartspacemodel.cxx b/oox/source/drawingml/chart/chartspacemodel.cxx
index e386334160a8..3e2253a2ffc1 100644
--- a/oox/source/drawingml/chart/chartspacemodel.cxx
+++ b/oox/source/drawingml/chart/chartspacemodel.cxx
@@ -51,4 +51,3 @@ ChartSpaceModel::~ChartSpaceModel()
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx
index b5a0511bf1b8..df4d40e952ac 100644
--- a/oox/source/drawingml/chart/converterbase.cxx
+++ b/oox/source/drawingml/chart/converterbase.cxx
@@ -26,48 +26,41 @@
************************************************************************/
#include "oox/drawingml/chart/converterbase.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/drawing/LineStyle.hpp>
+
#include <com/sun/star/chart/XAxisXSupplier.hpp>
#include <com/sun/star/chart/XAxisYSupplier.hpp>
#include <com/sun/star/chart/XAxisZSupplier.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <tools/solar.h> // for F_PI180
-#include "properties.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/theme.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-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::lang::XMultiServiceFactory;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::chart2::RelativePosition;
-using ::com::sun::star::chart2::XChartDocument;
-using ::com::sun::star::chart2::XTitle;
-using ::com::sun::star::drawing::XShape;
-using ::oox::core::XmlFilterBase;
-
-namespace cssc = ::com::sun::star::chart;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+namespace cssc = ::com::sun::star::chart;
+
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::XmlFilterBase;
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
struct TitleKey : public ::std::pair< ObjectType, ::std::pair< sal_Int32, sal_Int32 > >
@@ -247,7 +240,7 @@ Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceN
Reference< XInterface > xInt;
try
{
- xInt = mxData->mrFilter.getGlobalFactory()->createInstance( rServiceName );
+ xInt = mxData->mrFilter.getServiceFactory()->createInstance( rServiceName );
}
catch( Exception& )
{
@@ -419,4 +412,3 @@ bool LayoutConverter::convertFromModel( const Reference< XShape >& rxShape, doub
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/datasourcecontext.cxx b/oox/source/drawingml/chart/datasourcecontext.cxx
index d55b955d6e0d..a044dd67018d 100644
--- a/oox/source/drawingml/chart/datasourcecontext.cxx
+++ b/oox/source/drawingml/chart/datasourcecontext.cxx
@@ -26,11 +26,8 @@
************************************************************************/
#include "oox/drawingml/chart/datasourcecontext.hxx"
-#include "oox/drawingml/chart/datasourcemodel.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextHandlerRef;
+#include "oox/drawingml/chart/datasourcemodel.hxx"
namespace oox {
namespace drawingml {
@@ -38,6 +35,12 @@ namespace chart {
// ============================================================================
+using ::oox::core::ContextHandler2Helper;
+using ::oox::core::ContextHandlerRef;
+using ::rtl::OUString;
+
+// ============================================================================
+
DoubleSequenceContext::DoubleSequenceContext( ContextHandler2Helper& rParent, DataSequenceModel& rModel ) :
DataSequenceContextBase( rParent, rModel ),
mnPtIndex( -1 )
@@ -87,7 +90,7 @@ ContextHandlerRef DoubleSequenceContext::onCreateContext( sal_Int32 nElement, co
return 0;
}
-void DoubleSequenceContext::onEndElement( const OUString& rChars )
+void DoubleSequenceContext::onCharacters( const OUString& rChars )
{
switch( getCurrentElement() )
{
@@ -160,7 +163,7 @@ ContextHandlerRef StringSequenceContext::onCreateContext( sal_Int32 nElement, co
return 0;
}
-void StringSequenceContext::onEndElement( const OUString& rChars )
+void StringSequenceContext::onCharacters( const OUString& rChars )
{
switch( getCurrentElement() )
{
@@ -228,4 +231,3 @@ ContextHandlerRef DataSourceContext::onCreateContext( sal_Int32 nElement, const
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx b/oox/source/drawingml/chart/datasourceconverter.cxx
index 2409f8e89962..c68a6cbe4adf 100644
--- a/oox/source/drawingml/chart/datasourceconverter.cxx
+++ b/oox/source/drawingml/chart/datasourceconverter.cxx
@@ -26,14 +26,10 @@
************************************************************************/
#include "oox/drawingml/chart/datasourceconverter.hxx"
+
#include <com/sun/star/chart2/XChartDocument.hpp>
#include "oox/drawingml/chart/chartconverter.hxx"
#include "oox/drawingml/chart/datasourcemodel.hxx"
-#include "properties.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::chart2::data::XDataSequence;
namespace oox {
namespace drawingml {
@@ -41,6 +37,13 @@ namespace chart {
// ============================================================================
+using namespace ::com::sun::star::chart2::data;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
DataSequenceConverter::DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel ) :
ConverterBase< DataSequenceModel >( rParent, rModel )
{
@@ -89,4 +92,3 @@ Reference< XDataSequence > DataSourceConverter::createDataSequence( const OUStri
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/datasourcemodel.cxx b/oox/source/drawingml/chart/datasourcemodel.cxx
index 1f5b15f3e809..aad5a1bff959 100644
--- a/oox/source/drawingml/chart/datasourcemodel.cxx
+++ b/oox/source/drawingml/chart/datasourcemodel.cxx
@@ -57,4 +57,3 @@ DataSourceModel::~DataSourceModel()
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/modelbase.cxx b/oox/source/drawingml/chart/modelbase.cxx
index c182d8e3e410..f32a118c5589 100644
--- a/oox/source/drawingml/chart/modelbase.cxx
+++ b/oox/source/drawingml/chart/modelbase.cxx
@@ -26,9 +26,8 @@
************************************************************************/
#include "oox/drawingml/chart/modelbase.hxx"
-#include "oox/helper/attributelist.hxx"
-using ::rtl::OUString;
+#include "oox/helper/attributelist.hxx"
namespace oox {
namespace drawingml {
@@ -36,6 +35,10 @@ namespace chart {
// ============================================================================
+using ::rtl::OUString;
+
+// ============================================================================
+
NumberFormat::NumberFormat() :
mbSourceLinked( true )
{
@@ -73,4 +76,3 @@ LayoutModel::~LayoutModel()
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index d96e2d43dd6f..f6d441ded650 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -26,13 +26,11 @@
************************************************************************/
#include "oox/drawingml/chart/objectformatter.hxx"
-#include <rtl/strbuf.hxx>
-#include <osl/thread.h>
+
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
-#include "properties.hxx"
-#include "tokens.hxx"
-#include "oox/helper/modelobjecthelper.hxx"
+#include <osl/thread.h>
+#include <rtl/strbuf.hxx>
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/fillproperties.hxx"
#include "oox/drawingml/lineproperties.hxx"
@@ -40,24 +38,7 @@
#include "oox/drawingml/textparagraph.hxx"
#include "oox/drawingml/theme.hxx"
#include "oox/drawingml/chart/chartspacemodel.hxx"
-
-using ::rtl::OStringBuffer;
-using ::rtl::OUString;
-using ::rtl::OUStringToOString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::lang::Locale;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::chart2::XChartDocument;
-using ::com::sun::star::graphic::XGraphic;
-using ::com::sun::star::util::XNumberFormats;
-using ::com::sun::star::util::XNumberFormatsSupplier;
-using ::com::sun::star::util::XNumberFormatTypes;
-using ::oox::core::XmlFilterBase;
+#include "oox/helper/modelobjecthelper.hxx"
namespace oox {
namespace drawingml {
@@ -65,6 +46,20 @@ namespace chart {
// ============================================================================
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::graphic;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::oox::core::XmlFilterBase;
+using ::rtl::OStringBuffer;
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
+
+// ============================================================================
+
namespace {
struct AutoFormatPatternEntry
@@ -1211,4 +1206,3 @@ void ObjectFormatter::convertAutomaticFill( PropertySet& rPropSet, ObjectType eO
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/plotareacontext.cxx b/oox/source/drawingml/chart/plotareacontext.cxx
index 4f8268f06d66..17c6487b59b4 100644
--- a/oox/source/drawingml/chart/plotareacontext.cxx
+++ b/oox/source/drawingml/chart/plotareacontext.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/drawingml/chart/plotareacontext.hxx"
+
#include "oox/drawingml/shapepropertiescontext.hxx"
#include "oox/drawingml/chart/axiscontext.hxx"
#include "oox/drawingml/chart/plotareamodel.hxx"
@@ -33,15 +34,17 @@
#include "oox/drawingml/chart/titlecontext.hxx"
#include "oox/drawingml/chart/typegroupcontext.hxx"
-using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextHandlerRef;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+using ::oox::core::ContextHandler2Helper;
+using ::oox::core::ContextHandlerRef;
+
+// ============================================================================
+
View3DContext::View3DContext( ContextHandler2Helper& rParent, View3DModel& rModel ) :
ContextBase< View3DModel >( rParent, rModel )
{
@@ -182,4 +185,3 @@ ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const At
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx
index c3f74899ed97..78379ae855bd 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -26,28 +26,18 @@
************************************************************************/
#include "oox/drawingml/chart/plotareaconverter.hxx"
-#include <com/sun/star/drawing/Direction3D.hpp>
-#include <com/sun/star/drawing/ProjectionMode.hpp>
-#include <com/sun/star/drawing/ShadeMode.hpp>
+
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
#include "oox/drawingml/chart/axisconverter.hxx"
#include "oox/drawingml/chart/plotareamodel.hxx"
#include "oox/drawingml/chart/typegroupconverter.hxx"
-#include "properties.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::chart2::XCoordinateSystem;
-using ::com::sun::star::chart2::XCoordinateSystemContainer;
-using ::com::sun::star::chart2::XDiagram;
namespace oox {
namespace drawingml {
@@ -55,6 +45,14 @@ namespace chart {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
/** Axes set model. This is a helper for the plot area converter collecting all
@@ -452,4 +450,3 @@ void PlotAreaConverter::convertPositionFromModel()
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/seriescontext.cxx b/oox/source/drawingml/chart/seriescontext.cxx
index d06ca9716944..014ca51e869d 100644
--- a/oox/source/drawingml/chart/seriescontext.cxx
+++ b/oox/source/drawingml/chart/seriescontext.cxx
@@ -26,27 +26,30 @@
************************************************************************/
#include "oox/drawingml/chart/seriescontext.hxx"
+
#include "oox/drawingml/shapepropertiescontext.hxx"
#include "oox/drawingml/textbodycontext.hxx"
#include "oox/drawingml/chart/datasourcecontext.hxx"
#include "oox/drawingml/chart/seriesmodel.hxx"
#include "oox/drawingml/chart/titlecontext.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandler2;
-using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextHandlerRef;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+using ::oox::core::ContextHandler2;
+using ::oox::core::ContextHandler2Helper;
+using ::oox::core::ContextHandlerRef;
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
-ContextHandlerRef lclDataLabelSharedCreateContext(
- ContextHandler2& rContext, sal_Int32 nElement, const AttributeList& rAttribs, DataLabelModelBase& orModel )
+ContextHandlerRef lclDataLabelSharedCreateContext( ContextHandler2& rContext,
+ sal_Int32 nElement, const AttributeList& rAttribs, DataLabelModelBase& orModel )
{
if( rContext.isRootElement() ) switch( nElement )
{
@@ -79,7 +82,7 @@ ContextHandlerRef lclDataLabelSharedCreateContext(
orModel.mobShowVal = rAttribs.getBool( XML_val );
return 0;
case C_TOKEN( separator ):
- // collect separator text in onEndElement()
+ // collect separator text in onCharacters()
return &rContext;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( rContext, orModel.mxShapeProp.create() );
@@ -89,14 +92,10 @@ ContextHandlerRef lclDataLabelSharedCreateContext(
return 0;
}
-void lclDataLabelSharedEndElement( ContextHandler2& rContext, const OUString& rChars, DataLabelModelBase& orModel )
+void lclDataLabelSharedCharacters( ContextHandler2& rContext, const OUString& rChars, DataLabelModelBase& orModel )
{
- switch( rContext.getCurrentElement() )
- {
- case C_TOKEN( separator ):
- orModel.moaSeparator = rChars;
- break;
- }
+ if( rContext.isCurrentElement( C_TOKEN( separator ) ) )
+ orModel.moaSeparator = rChars;
}
} // namespace
@@ -127,9 +126,9 @@ ContextHandlerRef DataLabelContext::onCreateContext( sal_Int32 nElement, const A
return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
}
-void DataLabelContext::onEndElement( const OUString& rChars )
+void DataLabelContext::onCharacters( const OUString& rChars )
{
- lclDataLabelSharedEndElement( *this, rChars, mrModel );
+ lclDataLabelSharedCharacters( *this, rChars, mrModel );
}
// ============================================================================
@@ -159,9 +158,9 @@ ContextHandlerRef DataLabelsContext::onCreateContext( sal_Int32 nElement, const
return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
}
-void DataLabelsContext::onEndElement( const OUString& rChars )
+void DataLabelsContext::onCharacters( const OUString& rChars )
{
- lclDataLabelSharedEndElement( *this, rChars, mrModel );
+ lclDataLabelSharedCharacters( *this, rChars, mrModel );
}
// ============================================================================
@@ -305,7 +304,7 @@ ContextHandlerRef TrendlineContext::onCreateContext( sal_Int32 nElement, const A
mrModel.mfIntercept = rAttribs.getDouble( XML_val, 0.0 );
return 0;
case C_TOKEN( name ):
- return this; // collect name in onEndElement()
+ return this; // collect name in onCharacters()
case C_TOKEN( order ):
mrModel.mnOrder = rAttribs.getInteger( XML_val, 2 );
return 0;
@@ -323,14 +322,10 @@ ContextHandlerRef TrendlineContext::onCreateContext( sal_Int32 nElement, const A
return 0;
}
-void TrendlineContext::onEndElement( const ::rtl::OUString& rChars )
+void TrendlineContext::onCharacters( const OUString& rChars )
{
- switch( getCurrentElement() )
- {
- case C_TOKEN( name ):
- mrModel.maName = rChars;
- break;
- }
+ if( isCurrentElement( C_TOKEN( name ) ) )
+ mrModel.maName = rChars;
}
// ============================================================================
@@ -757,4 +752,3 @@ ContextHandlerRef SurfaceSeriesContext::onCreateContext( sal_Int32 nElement, con
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 717a3972550e..b9eaee5c01be 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/drawingml/chart/seriesconverter.hxx"
+
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart2/DataPointLabel.hpp>
@@ -38,21 +39,7 @@
#include "oox/drawingml/chart/titleconverter.hxx"
#include "oox/drawingml/chart/typegroupconverter.hxx"
#include "oox/drawingml/chart/typegroupmodel.hxx"
-#include "properties.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::chart2::DataPointLabel;
-using ::com::sun::star::chart2::XDataSeries;
-using ::com::sun::star::chart2::XRegressionCurve;
-using ::com::sun::star::chart2::XRegressionCurveContainer;
-using ::com::sun::star::chart2::data::XDataSequence;
-using ::com::sun::star::chart2::data::XDataSink;
-using ::com::sun::star::chart2::data::XLabeledDataSequence;
+#include "oox/helper/containerhelper.hxx"
namespace oox {
namespace drawingml {
@@ -60,6 +47,15 @@ namespace chart {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::chart2::data;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
Reference< XLabeledDataSequence > lclCreateLabeledDataSequence(
@@ -621,4 +617,3 @@ Reference< XLabeledDataSequence > SeriesConverter::createLabeledDataSequence(
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/seriesmodel.cxx b/oox/source/drawingml/chart/seriesmodel.cxx
index 01fff8e8d385..417d250caf77 100644
--- a/oox/source/drawingml/chart/seriesmodel.cxx
+++ b/oox/source/drawingml/chart/seriesmodel.cxx
@@ -154,4 +154,3 @@ SeriesModel::~SeriesModel()
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/titlecontext.cxx b/oox/source/drawingml/chart/titlecontext.cxx
index 5ff71109b710..cc2b7ace0e72 100644
--- a/oox/source/drawingml/chart/titlecontext.cxx
+++ b/oox/source/drawingml/chart/titlecontext.cxx
@@ -26,21 +26,24 @@
************************************************************************/
#include "oox/drawingml/chart/titlecontext.hxx"
+
#include "oox/drawingml/shapepropertiescontext.hxx"
#include "oox/drawingml/textbodycontext.hxx"
#include "oox/drawingml/chart/datasourcecontext.hxx"
#include "oox/drawingml/chart/titlemodel.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextHandlerRef;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+using ::oox::core::ContextHandler2Helper;
+using ::oox::core::ContextHandlerRef;
+using ::rtl::OUString;
+
+// ============================================================================
+
TextContext::TextContext( ContextHandler2Helper& rParent, TextModel& rModel ) :
ContextBase< TextModel >( rParent, rModel )
{
@@ -52,34 +55,28 @@ TextContext::~TextContext()
ContextHandlerRef TextContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
- switch( getCurrentElement() )
+ // this context handler is used for <c:tx> and embedded <c:v> elements
+ if( isCurrentElement( C_TOKEN( tx ) ) ) switch( nElement )
{
- case C_TOKEN( tx ):
- switch( nElement )
- {
- case C_TOKEN( rich ):
- return new TextBodyContext( *this, mrModel.mxTextBody.create() );
- case C_TOKEN( strRef ):
- OSL_ENSURE( !mrModel.mxDataSeq, "TextContext::onCreateContext - multiple data sequences" );
- return new StringSequenceContext( *this, mrModel.mxDataSeq.create() );
- case C_TOKEN( v ):
- OSL_ENSURE( !mrModel.mxDataSeq, "TextContext::onCreateContext - multiple data sequences" );
- return this; // collect value in onEndElement()
- }
- break;
+ case C_TOKEN( rich ):
+ return new TextBodyContext( *this, mrModel.mxTextBody.create() );
+
+ case C_TOKEN( strRef ):
+ OSL_ENSURE( !mrModel.mxDataSeq, "TextContext::onCreateContext - multiple data sequences" );
+ return new StringSequenceContext( *this, mrModel.mxDataSeq.create() );
+
+ case C_TOKEN( v ):
+ OSL_ENSURE( !mrModel.mxDataSeq, "TextContext::onCreateContext - multiple data sequences" );
+ return this; // collect value in onCharacters()
}
return 0;
}
-void TextContext::onEndElement( const OUString& rChars )
+void TextContext::onCharacters( const OUString& rChars )
{
- switch( getCurrentElement() )
- {
- case C_TOKEN( v ):
- // store as single string sequence element
- mrModel.mxDataSeq.create().maData[ 0 ] <<= rChars;
- break;
- }
+ // store as single string sequence element
+ if( isCurrentElement( C_TOKEN( v ) ) )
+ mrModel.mxDataSeq.create().maData[ 0 ] <<= rChars;
}
// ============================================================================
@@ -95,25 +92,25 @@ TitleContext::~TitleContext()
ContextHandlerRef TitleContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- switch( getCurrentElement() )
+ // this context handler is used for <c:title> only
+ switch( nElement )
{
- case C_TOKEN( title ):
- switch( nElement )
- {
- case C_TOKEN( layout ):
- return new LayoutContext( *this, mrModel.mxLayout.create() );
- case C_TOKEN( overlay ):
- // default is 'false', not 'true' as specified
- mrModel.mbOverlay = rAttribs.getBool( XML_val, false );
- return 0;
- case C_TOKEN( spPr ):
- return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
- case C_TOKEN( tx ):
- return new TextContext( *this, mrModel.mxText.create() );
- case C_TOKEN( txPr ):
- return new TextBodyContext( *this, mrModel.mxTextProp.create() );
- }
- break;
+ case C_TOKEN( layout ):
+ return new LayoutContext( *this, mrModel.mxLayout.create() );
+
+ case C_TOKEN( overlay ):
+ // default is 'false', not 'true' as specified
+ mrModel.mbOverlay = rAttribs.getBool( XML_val, false );
+ return 0;
+
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+
+ case C_TOKEN( tx ):
+ return new TextContext( *this, mrModel.mxText.create() );
+
+ case C_TOKEN( txPr ):
+ return new TextBodyContext( *this, mrModel.mxTextProp.create() );
}
return 0;
}
@@ -131,26 +128,26 @@ LegendContext::~LegendContext()
ContextHandlerRef LegendContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- switch( getCurrentElement() )
+ // this context handler is used for <c:legend> only
+ switch( nElement )
{
- case C_TOKEN( legend ):
- switch( nElement )
- {
- case C_TOKEN( layout ):
- return new LayoutContext( *this, mrModel.mxLayout.create() );
- case C_TOKEN( legendPos ):
- mrModel.mnPosition = rAttribs.getToken( XML_val, XML_r );
- return 0;
- case C_TOKEN( overlay ):
- // default is 'false', not 'true' as specified
- mrModel.mbOverlay = rAttribs.getBool( XML_val, false );
- return 0;
- case C_TOKEN( spPr ):
- return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
- case C_TOKEN( txPr ):
- return new TextBodyContext( *this, mrModel.mxTextProp.create() );
- }
- break;
+ case C_TOKEN( layout ):
+ return new LayoutContext( *this, mrModel.mxLayout.create() );
+
+ case C_TOKEN( legendPos ):
+ mrModel.mnPosition = rAttribs.getToken( XML_val, XML_r );
+ return 0;
+
+ case C_TOKEN( overlay ):
+ // default is 'false', not 'true' as specified
+ mrModel.mbOverlay = rAttribs.getBool( XML_val, false );
+ return 0;
+
+ case C_TOKEN( spPr ):
+ return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
+
+ case C_TOKEN( txPr ):
+ return new TextBodyContext( *this, mrModel.mxTextProp.create() );
}
return 0;
}
@@ -160,4 +157,3 @@ ContextHandlerRef LegendContext::onCreateContext( sal_Int32 nElement, const Attr
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx
index bca53f1a2c01..fdc4969f7c5e 100644
--- a/oox/source/drawingml/chart/titleconverter.cxx
+++ b/oox/source/drawingml/chart/titleconverter.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/drawingml/chart/titleconverter.hxx"
+
#include <com/sun/star/chart2/LegendExpansion.hpp>
#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
@@ -33,25 +34,11 @@
#include <com/sun/star/chart2/XLegend.hpp>
#include <com/sun/star/chart2/XTitle.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
-#include "properties.hxx"
#include "oox/drawingml/textbody.hxx"
#include "oox/drawingml/textparagraph.hxx"
#include "oox/drawingml/chart/datasourceconverter.hxx"
#include "oox/drawingml/chart/titlemodel.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::chart2::XDiagram;
-using ::com::sun::star::chart2::XFormattedString;
-using ::com::sun::star::chart2::XLegend;
-using ::com::sun::star::chart2::XTitle;
-using ::com::sun::star::chart2::XTitled;
-using ::com::sun::star::chart2::data::XDataSequence;
-using ::oox::core::XmlFilterBase;
+#include "oox/helper/containerhelper.hxx"
namespace oox {
namespace drawingml {
@@ -59,6 +46,16 @@ namespace chart {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::chart2::data;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::XmlFilterBase;
+using ::rtl::OUString;
+
+// ============================================================================
+
TextConverter::TextConverter( const ConverterRoot& rParent, TextModel& rModel ) :
ConverterBase< TextModel >( rParent, rModel )
{
@@ -270,4 +267,3 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram )
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/titlemodel.cxx b/oox/source/drawingml/chart/titlemodel.cxx
index bb5501e05f32..d1dc2c664e8f 100644
--- a/oox/source/drawingml/chart/titlemodel.cxx
+++ b/oox/source/drawingml/chart/titlemodel.cxx
@@ -69,4 +69,3 @@ LegendModel::~LegendModel()
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/typegroupcontext.cxx b/oox/source/drawingml/chart/typegroupcontext.cxx
index 972295304593..781b2665d6f1 100644
--- a/oox/source/drawingml/chart/typegroupcontext.cxx
+++ b/oox/source/drawingml/chart/typegroupcontext.cxx
@@ -26,18 +26,21 @@
************************************************************************/
#include "oox/drawingml/chart/typegroupcontext.hxx"
+
#include "oox/drawingml/chart/seriescontext.hxx"
#include "oox/drawingml/chart/typegroupmodel.hxx"
-using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextHandlerRef;
-
namespace oox {
namespace drawingml {
namespace chart {
// ============================================================================
+using ::oox::core::ContextHandler2Helper;
+using ::oox::core::ContextHandlerRef;
+
+// ============================================================================
+
UpDownBarsContext::UpDownBarsContext( ContextHandler2Helper& rParent, UpDownBarsModel& rModel ) :
ContextBase< UpDownBarsModel >( rParent, rModel )
{
@@ -399,4 +402,3 @@ ContextHandlerRef SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement,
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index 3746048074e9..6c0d3660a670 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/drawingml/chart/typegroupconverter.hxx"
+
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
@@ -39,23 +40,7 @@
#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/chart/seriesconverter.hxx"
#include "oox/drawingml/chart/typegroupmodel.hxx"
-#include "properties.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::chart2::XChartType;
-using ::com::sun::star::chart2::XChartTypeContainer;
-using ::com::sun::star::chart2::XCoordinateSystem;
-using ::com::sun::star::chart2::XDataSeries;
-using ::com::sun::star::chart2::XDataSeriesContainer;
-using ::com::sun::star::chart2::XDiagram;
-using ::com::sun::star::chart2::data::XDataSink;
-using ::com::sun::star::chart2::data::XLabeledDataSequence;
+#include "oox/helper/containerhelper.hxx"
namespace oox {
namespace drawingml {
@@ -63,6 +48,15 @@ namespace chart {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::chart2::data;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
// chart type service names
@@ -570,4 +564,3 @@ void TypeGroupConverter::insertDataSeries( const Reference< XChartType >& rxChar
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/chart/typegroupmodel.cxx b/oox/source/drawingml/chart/typegroupmodel.cxx
index 24f5420644e4..ee5eefc4d163 100644
--- a/oox/source/drawingml/chart/typegroupmodel.cxx
+++ b/oox/source/drawingml/chart/typegroupmodel.cxx
@@ -80,4 +80,3 @@ TypeGroupModel::~TypeGroupModel()
} // namespace chart
} // namespace drawingml
} // namespace oox
-
diff --git a/oox/source/drawingml/clrscheme.cxx b/oox/source/drawingml/clrscheme.cxx
index fdeb28a27ef0..b011cd27b147 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -26,7 +26,7 @@
************************************************************************/
#include "oox/drawingml/clrscheme.hxx"
-#include "tokens.hxx"
+#include "oox/token/tokens.hxx"
namespace oox { namespace drawingml {
diff --git a/oox/source/drawingml/clrschemecontext.cxx b/oox/source/drawingml/clrschemecontext.cxx
index 996ddef2ab0f..fad92dd35c3c 100644
--- a/oox/source/drawingml/clrschemecontext.cxx
+++ b/oox/source/drawingml/clrschemecontext.cxx
@@ -26,9 +26,7 @@
************************************************************************/
#include "oox/drawingml/clrschemecontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
-#include "tokens.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
@@ -99,7 +97,7 @@ Reference< XFastContextHandler > clrSchemeContext::createFastChildContext(
case A_TOKEN( accent6 ):
case A_TOKEN( hlink ):
case A_TOKEN( folHlink ):
- return new clrSchemeColorContext( *this, mrClrScheme, getToken( nElement ) );
+ return new clrSchemeColorContext( *this, mrClrScheme, getBaseToken( nElement ) );
}
return 0;
}
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 8653d787517d..4ff19a4bf987 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -28,11 +28,11 @@
#include "oox/drawingml/color.hxx"
#include <algorithm>
#include <math.h>
-#include "tokens.hxx"
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/graphichelper.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
using ::rtl::OUString;
@@ -314,7 +314,7 @@ void Color::addTransformation( sal_Int32 nElement, sal_Int32 nValue )
/* Execute alpha transformations directly, store other transformations in
a vector, they may depend on a scheme base color which will be resolved
in Color::getColor(). */
- sal_Int32 nToken = getToken( nElement );
+ sal_Int32 nToken = getBaseToken( nElement );
switch( nToken )
{
case XML_alpha: lclSetValue( mnAlpha, nValue ); break;
@@ -336,7 +336,7 @@ void Color::addChartTintTransformation( double fTint )
void Color::addExcelTintTransformation( double fTint )
{
sal_Int32 nValue = getLimitedValue< sal_Int32, double >( fTint * MAX_PERCENT + 0.5, -MAX_PERCENT, MAX_PERCENT );
- maTransforms.push_back( Transformation( NMSP_XLS | XML_tint, nValue ) );
+ maTransforms.push_back( Transformation( XLS_TOKEN( tint ), nValue ) );
}
void Color::clearTransformations()
diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx
index 2bc01e049a8e..a909f2f68d0c 100644
--- a/oox/source/drawingml/colorchoicecontext.cxx
+++ b/oox/source/drawingml/colorchoicecontext.cxx
@@ -27,7 +27,6 @@
#include "oox/drawingml/colorchoicecontext.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/color.hxx"
using ::com::sun::star::uno::Reference;
diff --git a/oox/source/drawingml/connectorshapecontext.cxx b/oox/source/drawingml/connectorshapecontext.cxx
index 3327d627af6d..f2840a8d82fa 100644
--- a/oox/source/drawingml/connectorshapecontext.cxx
+++ b/oox/source/drawingml/connectorshapecontext.cxx
@@ -35,8 +35,6 @@
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/customshapegeometry.hxx"
#include "oox/drawingml/textbodycontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace oox::core;
@@ -63,7 +61,7 @@ Reference< XFastContextHandler > ConnectorShapeContext::createFastChildContext(
{
Reference< XFastContextHandler > xRet;
- switch( getToken( aElementToken ) )
+ switch( getBaseToken( aElementToken ) )
{
case XML_nvCxnSpPr :
break;
diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx
index a0fcc3142f51..d0c5c6a2dde2 100644
--- a/oox/source/drawingml/customshapegeometry.cxx
+++ b/oox/source/drawingml/customshapegeometry.cxx
@@ -32,10 +32,7 @@
#include <hash_map>
#include "oox/helper/helper.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/token/tokenmap.hxx"
#include "oox/helper/propertymap.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -243,7 +240,7 @@ static EnhancedCustomShapeParameter GetAdjCoordinate( CustomShapeProperties& rCu
sal_Char nVal = 0;
// first check if its a constant value
- switch( StaticTokenMap::get().getTokenFromUnicode( rValue ) )
+ switch( AttributeConversion::decodeToken( rValue ) )
{
case XML_3cd4 : nConstant = 270 * 60000; break;
case XML_3cd8 : nConstant = 135 * 60000; break;
@@ -631,7 +628,7 @@ static rtl::OUString convertToOOEquation( CustomShapeProperties& rCustomShapePro
Reference< XFastContextHandler > GeomGuideListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
- if ( aElementToken == ( NMSP_DRAWINGML | XML_gd ) ) // CT_GeomGuide
+ if ( aElementToken == A_TOKEN( gd ) ) // CT_GeomGuide
{
CustomShapeGuide aGuide;
aGuide.maName = xAttribs->getOptionalValue( XML_name );
@@ -712,7 +709,7 @@ XYAdjustHandleContext::XYAdjustHandleContext( ContextHandler& rParent, const Ref
Reference< XFastContextHandler > XYAdjustHandleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_pos ) )
+ if ( aElementToken == A_TOKEN( pos ) )
xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandle.pos ); // CT_AdjPoint2D
return xContext;
}
@@ -766,7 +763,7 @@ PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler& rParent, con
Reference< XFastContextHandler > PolarAdjustHandleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_pos ) )
+ if ( aElementToken == A_TOKEN( pos ) )
xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandle.pos ); // CT_AdjPoint2D
return xContext;
}
@@ -794,13 +791,13 @@ AdjustHandleListContext::AdjustHandleListContext( ContextHandler& rParent, Custo
Reference< XFastContextHandler > AdjustHandleListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_ahXY ) ) // CT_XYAdjustHandle
+ if ( aElementToken == A_TOKEN( ahXY ) ) // CT_XYAdjustHandle
{
AdjustHandle aAdjustHandle( sal_False );
mrAdjustHandleList.push_back( aAdjustHandle );
xContext = new XYAdjustHandleContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() );
}
- else if ( aElementToken == ( NMSP_DRAWINGML | XML_ahPolar ) ) // CT_PolarAdjustHandle
+ else if ( aElementToken == A_TOKEN( ahPolar ) ) // CT_PolarAdjustHandle
{
AdjustHandle aAdjustHandle( sal_True );
mrAdjustHandleList.push_back( aAdjustHandle );
@@ -833,7 +830,7 @@ ConnectionSiteContext::ConnectionSiteContext( ContextHandler& rParent, const Ref
Reference< XFastContextHandler > ConnectionSiteContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_pos ) )
+ if ( aElementToken == A_TOKEN( pos ) )
xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrConnectionSite.pos ); // CT_AdjPoint2D
return xContext;
}
@@ -861,7 +858,7 @@ Path2DMoveToContext::Path2DMoveToContext( ContextHandler& rParent, CustomShapePr
Reference< XFastContextHandler > Path2DMoveToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_pt ) )
+ if ( aElementToken == A_TOKEN( pt ) )
xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjPoint2D ); // CT_AdjPoint2D
return xContext;
}
@@ -889,7 +886,7 @@ Path2DLineToContext::Path2DLineToContext( ContextHandler& rParent, CustomShapePr
Reference< XFastContextHandler > Path2DLineToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_pt ) )
+ if ( aElementToken == A_TOKEN( pt ) )
xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjPoint2D ); // CT_AdjPoint2D
return xContext;
}
@@ -924,7 +921,7 @@ Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler& rParent,
Reference< XFastContextHandler > Path2DQuadBezierToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_pt ) )
+ if ( aElementToken == A_TOKEN( pt ) )
xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, nCount++ ? mrPt2 : mrPt1 ); // CT_AdjPoint2D
return xContext;
}
@@ -962,7 +959,7 @@ Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler& rParent,
Reference< XFastContextHandler > Path2DCubicBezierToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_pt ) )
+ if ( aElementToken == A_TOKEN( pt ) )
xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties,
nCount++ ? nCount == 2 ? mrControlPt2 : mrEndPt : mrControlPt1 ); // CT_AdjPoint2D
return xContext;
@@ -1021,7 +1018,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3
Reference< XFastContextHandler > xContext;
switch( aElementToken )
{
- case NMSP_DRAWINGML | XML_close :
+ case A_TOKEN( close ) :
{
EnhancedCustomShapeSegment aNewSegment;
aNewSegment.Command = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
@@ -1029,7 +1026,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3
mrSegments.push_back( aNewSegment );
}
break;
- case NMSP_DRAWINGML | XML_moveTo :
+ case A_TOKEN( moveTo ) :
{
EnhancedCustomShapeSegment aNewSegment;
aNewSegment.Command = EnhancedCustomShapeSegmentCommand::MOVETO;
@@ -1041,7 +1038,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3
xContext = new Path2DMoveToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() );
}
break;
- case NMSP_DRAWINGML | XML_lnTo :
+ case A_TOKEN( lnTo ) :
{
if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::LINETO ) )
@@ -1058,7 +1055,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3
xContext = new Path2DLineToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() );
}
break;
- case NMSP_DRAWINGML | XML_arcTo : // CT_Path2DArcTo
+ case A_TOKEN( arcTo ) : // CT_Path2DArcTo
{
if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::ARCTO ) )
mrSegments.back().Count++;
@@ -1084,7 +1081,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3
mrPath2D.parameter.push_back( aPt );
}
break;
- case NMSP_DRAWINGML | XML_quadBezTo :
+ case A_TOKEN( quadBezTo ) :
{
if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO ) )
mrSegments.back().Count++;
@@ -1104,7 +1101,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3
mrPath2D.parameter.back() );
}
break;
- case NMSP_DRAWINGML | XML_cubicBezTo :
+ case A_TOKEN( cubicBezTo ) :
{
if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::CURVETO ) )
mrSegments.back().Count++;
@@ -1160,7 +1157,7 @@ Path2DListContext::Path2DListContext( ContextHandler& rParent, CustomShapeProper
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL Path2DListContext::createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
{
Reference< XFastContextHandler > xContext;
- if ( aElementToken == ( NMSP_DRAWINGML | XML_path ) )
+ if ( aElementToken == A_TOKEN( path ) )
{
Path2D aPath2D;
mrPath2DList.push_back( aPath2D );
@@ -1983,19 +1980,19 @@ Reference< XFastContextHandler > CustomShapeGeometryContext::createFastChildCont
Reference< XFastContextHandler > xContext;
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_avLst: // CT_GeomGuideList adjust value list
+ case A_TOKEN( avLst ): // CT_GeomGuideList adjust value list
xContext = new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
break;
- case NMSP_DRAWINGML|XML_gdLst: // CT_GeomGuideList guide list
+ case A_TOKEN( gdLst ): // CT_GeomGuideList guide list
xContext = new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getGuideList() );
break;
- case NMSP_DRAWINGML|XML_ahLst: // CT_AdjustHandleList adjust handle list
+ case A_TOKEN( ahLst ): // CT_AdjustHandleList adjust handle list
xContext = new AdjustHandleListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustHandleList() );
break;
- case NMSP_DRAWINGML|XML_cxnLst: // CT_ConnectionSiteList connection site list
+ case A_TOKEN( cxnLst ): // CT_ConnectionSiteList connection site list
xContext = this;
break;
- case NMSP_DRAWINGML|XML_rect: // CT_GeomRectList geometry rect list
+ case A_TOKEN( rect ): // CT_GeomRectList geometry rect list
{
GeomRect aGeomRect;
aGeomRect.l = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_l ), sal_True );
@@ -2005,12 +2002,12 @@ Reference< XFastContextHandler > CustomShapeGeometryContext::createFastChildCont
mrCustomShapeProperties.getTextRect() = aGeomRect;
}
break;
- case NMSP_DRAWINGML|XML_pathLst: // CT_Path2DList 2d path list
+ case A_TOKEN( pathLst ): // CT_Path2DList 2d path list
xContext = new Path2DListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getSegments(), mrCustomShapeProperties.getPath2DList() );
break;
// from cxnLst:
- case NMSP_DRAWINGML|XML_cxn: // CT_ConnectionSite
+ case A_TOKEN( cxn ): // CT_ConnectionSite
{
ConnectionSite aConnectionSite;
mrCustomShapeProperties.getConnectionSiteList().push_back( aConnectionSite );
@@ -2037,7 +2034,7 @@ PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler& rParent,
Reference< XFastContextHandler > PresetShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException)
{
- if ( aElementToken == ( NMSP_DRAWINGML | XML_avLst ) )
+ if ( aElementToken == A_TOKEN( avLst ) )
return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
else
return this;
@@ -2059,7 +2056,7 @@ PresetTextShapeContext::PresetTextShapeContext( ContextHandler& rParent, const R
Reference< XFastContextHandler > PresetTextShapeContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException)
{
- if ( aElementToken == ( NMSP_DRAWINGML | XML_avLst ) )
+ if ( aElementToken == A_TOKEN( avLst ) )
return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
else
return this;
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index d296a4041fb9..052fdc5e1dfc 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -29,9 +29,6 @@
#include "oox/helper/helper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/namespaces.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
diff --git a/oox/source/drawingml/diagram/datamodelcontext.cxx b/oox/source/drawingml/diagram/datamodelcontext.cxx
index 901b9267df36..8d81c800b2df 100644
--- a/oox/source/drawingml/diagram/datamodelcontext.cxx
+++ b/oox/source/drawingml/diagram/datamodelcontext.cxx
@@ -27,7 +27,6 @@
#include "oox/drawingml/diagram/datamodelcontext.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/shapepropertiescontext.hxx"
#include "oox/drawingml/textbodycontext.hxx"
@@ -39,8 +38,6 @@ using ::rtl::OUString;
namespace oox { namespace drawingml {
-
-
// CL_Cxn
class CxnContext
: public ContextHandler
@@ -73,7 +70,7 @@ public:
switch( aElementToken )
{
- case NMSP_DIAGRAM|XML_extLst:
+ case DGM_TOKEN( extLst ):
return xRet;
default:
break;
@@ -106,7 +103,7 @@ public:
switch( aElementToken )
{
- case NMSP_DIAGRAM|XML_cxn:
+ case DGM_TOKEN( cxn ):
{
dgm::ConnectionPtr pConnection( new dgm::Connection() );
maConnections.push_back( pConnection );
@@ -161,17 +158,17 @@ public:
switch( aElementToken )
{
- case NMSP_DIAGRAM|XML_extLst:
+ case DGM_TOKEN( extLst ):
return xRet;
- case NMSP_DIAGRAM|XML_prSet:
+ case DGM_TOKEN( prSet ):
// TODO
// CT_ElemPropSet
break;
- case NMSP_DIAGRAM|XML_spPr:
+ case DGM_TOKEN( spPr ):
OSL_TRACE( "shape props for point");
xRet = new ShapePropertiesContext( *this, *mpPoint->getShape() );
break;
- case NMSP_DIAGRAM|XML_t:
+ case DGM_TOKEN( t ):
{
OSL_TRACE( "shape text body for point");
TextBodyPtr xTextBody( new TextBody );
@@ -212,7 +209,7 @@ public:
switch( aElementToken )
{
- case NMSP_DIAGRAM|XML_pt:
+ case DGM_TOKEN( pt ):
{
// CT_Pt
dgm::PointPtr pPoint( new dgm::Point() );
@@ -253,18 +250,18 @@ public:
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_blipFill:
- case NMSP_DRAWINGML|XML_gradFill:
- case NMSP_DRAWINGML|XML_grpFill:
- case NMSP_DRAWINGML|XML_noFill:
- case NMSP_DRAWINGML|XML_pattFill:
- case NMSP_DRAWINGML|XML_solidFill:
+ case A_TOKEN( blipFill ):
+ case A_TOKEN( gradFill ):
+ case A_TOKEN( grpFill ):
+ case A_TOKEN( noFill ):
+ case A_TOKEN( pattFill ):
+ case A_TOKEN( solidFill ):
// EG_FillProperties
xRet.set( FillPropertiesContext::createFillContext(
*this, aElementToken, xAttribs, *mpDataModel->getFillProperties() ) );
break;
- case NMSP_DRAWINGML|XML_effectDag:
- case NMSP_DRAWINGML|XML_effectLst:
+ case A_TOKEN( effectDag ):
+ case A_TOKEN( effectLst ):
// TODO
// EG_EffectProperties
break;
@@ -306,23 +303,23 @@ DataModelContext::createFastChildContext( ::sal_Int32 aElement,
switch( aElement )
{
- case NMSP_DIAGRAM|XML_cxnLst:
+ case DGM_TOKEN( cxnLst ):
// CT_CxnList
xRet.set( new CxnListContext( *this, mpDataModel->getConnections() ) );
break;
- case NMSP_DIAGRAM|XML_ptLst:
+ case DGM_TOKEN( ptLst ):
// CT_PtList
xRet.set( new PtListContext( *this, mpDataModel->getPoints() ) );
break;
- case NMSP_DIAGRAM|XML_bg:
+ case DGM_TOKEN( bg ):
// CT_BackgroundFormatting
xRet.set( new BackgroundFormattingContext( *this, mpDataModel ) );
break;
- case NMSP_DIAGRAM|XML_whole:
+ case DGM_TOKEN( whole ):
// CT_WholeE2oFormatting
// TODO
return xRet;
- case NMSP_DIAGRAM|XML_extLst:
+ case DGM_TOKEN( extLst ):
return xRet;
default:
break;
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 516d6bfb231c..cebb730af103 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -33,8 +33,6 @@
#include <com/sun/star/awt/Size.hpp>
#include "oox/drawingml/diagram/diagram.hxx"
#include "oox/drawingml/fillproperties.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::com::sun::star;
diff --git a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
index 53477211848e..ac98bfb18c38 100644
--- a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
+++ b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
@@ -26,11 +26,9 @@
************************************************************************/
#include "diagramdefinitioncontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/helper.hxx"
#include "layoutnodecontext.hxx"
#include "oox/drawingml/diagram/datamodelcontext.hxx"
-#include "tokens.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
@@ -80,29 +78,29 @@ DiagramDefinitionContext::createFastChildContext( ::sal_Int32 aElement,
switch( aElement )
{
- case NMSP_DIAGRAM|XML_title:
+ case DGM_TOKEN( title ):
mpLayout->setTitle( xAttribs->getOptionalValue( XML_val ) );
break;
- case NMSP_DIAGRAM|XML_desc:
+ case DGM_TOKEN( desc ):
mpLayout->setDesc( xAttribs->getOptionalValue( XML_val ) );
break;
- case NMSP_DIAGRAM|XML_layoutNode:
+ case DGM_TOKEN( layoutNode ):
mpLayout->getNode().reset( new LayoutNode() );
xRet.set( new LayoutNodeContext( *this, xAttribs, mpLayout->getNode() ) );
break;
- case NMSP_DIAGRAM|XML_clrData:
+ case DGM_TOKEN( clrData ):
// TODO, does not matter for the UI. skip.
return xRet;
- case NMSP_DIAGRAM|XML_sampData:
+ case DGM_TOKEN( sampData ):
mpLayout->getSampData().reset( new DiagramData );
xRet.set( new DataModelContext( *this, mpLayout->getSampData() ) );
break;
- case NMSP_DIAGRAM|XML_styleData:
+ case DGM_TOKEN( styleData ):
mpLayout->getStyleData().reset( new DiagramData );
xRet.set( new DataModelContext( *this, mpLayout->getStyleData() ) );
break;
- case NMSP_DIAGRAM|XML_cat:
- case NMSP_DIAGRAM|XML_catLst:
+ case DGM_TOKEN( cat ):
+ case DGM_TOKEN( catLst ):
// TODO, does not matter for the UI
default:
break;
diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
index ac2e755bee40..644e84771b3e 100644
--- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
+++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
@@ -29,9 +29,7 @@
#include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
#include "oox/drawingml/diagram/datamodelcontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "diagramdefinitioncontext.hxx"
-#include "tokens.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star::xml::sax;
@@ -70,7 +68,7 @@ DiagramDataFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
switch( aElement )
{
- case NMSP_DIAGRAM|XML_dataModel:
+ case DGM_TOKEN( dataModel ):
xRet.set( new DataModelContext( *this, mpDataPtr ) );
break;
default:
@@ -115,7 +113,7 @@ DiagramLayoutFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
switch( aElement )
{
- case NMSP_DIAGRAM|XML_layoutDef:
+ case DGM_TOKEN( layoutDef ):
xRet.set( new DiagramDefinitionContext( *this, xAttribs, mpDataPtr ) );
break;
default:
@@ -160,7 +158,7 @@ DiagramQStylesFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
switch( aElement )
{
- case NMSP_DIAGRAM|XML_styleDef:
+ case DGM_TOKEN( styleDef ):
// TODO
break;
default:
@@ -205,7 +203,7 @@ DiagramColorsFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
switch( aElement )
{
- case NMSP_DIAGRAM|XML_colorsDef:
+ case DGM_TOKEN( colorsDef ):
// TODO
break;
default:
diff --git a/oox/source/drawingml/diagram/layoutnodecontext.cxx b/oox/source/drawingml/diagram/layoutnodecontext.cxx
index 4d430bb6ba36..0815843dd424 100644
--- a/oox/source/drawingml/diagram/layoutnodecontext.cxx
+++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx
@@ -28,7 +28,6 @@
#include "layoutnodecontext.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/diagram/diagram.hxx"
#include "oox/drawingml/shapecontext.hxx"
#include "diagramdefinitioncontext.hxx"
@@ -178,7 +177,7 @@ public:
{
Reference< XFastContextHandler > xRet;
- sal_Int32 nIdx = LayoutNodeContext::tagToVarIdx( getToken( aElement ) );
+ sal_Int32 nIdx = LayoutNodeContext::tagToVarIdx( getBaseToken( aElement ) );
if( nIdx != -1 )
{
mVariables[ nIdx ] = makeAny( xAttribs->getOptionalValue( XML_val ) );
@@ -229,31 +228,31 @@ sal_Int32 LayoutNodeContext::tagToVarIdx( sal_Int32 aTag )
sal_Int32 nIdx = -1;
switch( aTag )
{
- case NMSP_DIAGRAM|XML_animLvl:
+ case DGM_TOKEN( animLvl ):
nIdx = LayoutNode::VAR_animLvl;
break;
- case NMSP_DIAGRAM|XML_animOne:
+ case DGM_TOKEN( animOne ):
nIdx = LayoutNode::VAR_animOne;
break;
- case NMSP_DIAGRAM|XML_bulletEnabled:
+ case DGM_TOKEN( bulletEnabled ):
nIdx = LayoutNode::VAR_bulletEnabled;
break;
- case NMSP_DIAGRAM|XML_chMax:
+ case DGM_TOKEN( chMax ):
nIdx = LayoutNode::VAR_chMax;
break;
- case NMSP_DIAGRAM|XML_chPref:
+ case DGM_TOKEN( chPref ):
nIdx = LayoutNode::VAR_chPref;
break;
- case NMSP_DIAGRAM|XML_dir:
+ case DGM_TOKEN( dir ):
nIdx = LayoutNode::VAR_dir;
break;
- case NMSP_DIAGRAM|XML_hierBranch:
+ case DGM_TOKEN( hierBranch ):
nIdx = LayoutNode::VAR_hierBranch;
break;
- case NMSP_DIAGRAM|XML_orgChart:
+ case DGM_TOKEN( orgChart ):
nIdx = LayoutNode::VAR_orgChart;
break;
- case NMSP_DIAGRAM|XML_resizeHandles:
+ case DGM_TOKEN( resizeHandles ):
nIdx = LayoutNode::VAR_resizeHandles;
break;
default:
@@ -272,22 +271,22 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
switch( aElement )
{
- case NMSP_DIAGRAM|XML_layoutNode:
+ case DGM_TOKEN( layoutNode ):
{
LayoutNodePtr pNode( new LayoutNode() );
mpNode->addChild( pNode );
xRet.set( new LayoutNodeContext( *this, xAttribs, pNode ) );
break;
}
- case NMSP_DIAGRAM|XML_shape:
+ case DGM_TOKEN( shape ):
{
ShapePtr pShape( new Shape() );
xRet.set( new ShapeContext( *this, ShapePtr(), pShape ) );
break;
}
- case NMSP_DIAGRAM|XML_extLst:
+ case DGM_TOKEN( extLst ):
return xRet;
- case NMSP_DIAGRAM|XML_alg:
+ case DGM_TOKEN( alg ):
{
// CT_Algorithm
LayoutAtomPtr pAtom( new AlgAtom );
@@ -295,7 +294,7 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
xRet.set( new AlgorithmContext( *this, xAttribs, pAtom ) );
break;
}
- case NMSP_DIAGRAM|XML_choose:
+ case DGM_TOKEN( choose ):
{
// CT_Choose
LayoutAtomPtr pAtom( new ChooseAtom );
@@ -303,7 +302,7 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
xRet.set( new ChooseContext( *this, xAttribs, pAtom ) );
break;
}
- case NMSP_DIAGRAM|XML_forEach:
+ case DGM_TOKEN( forEach ):
{
// CT_ForEach
LayoutAtomPtr pAtom( new ForEachAtom );
@@ -311,11 +310,11 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
xRet.set( new ForEachContext( *this, xAttribs, pAtom ) );
break;
}
- case NMSP_DIAGRAM|XML_constrLst:
+ case DGM_TOKEN( constrLst ):
// CT_Constraints
// TODO
break;
- case NMSP_DIAGRAM|XML_presOf:
+ case DGM_TOKEN( presOf ):
{
// CT_PresentationOf
// TODO
@@ -327,11 +326,11 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
xAttribs->getOptionalValue( XML_step );
break;
}
- case NMSP_DIAGRAM|XML_ruleLst:
+ case DGM_TOKEN( ruleLst ):
// CT_Rules
// TODO
break;
- case NMSP_DIAGRAM|XML_varLst:
+ case DGM_TOKEN( varLst ):
{
LayoutNodePtr pNode( boost::dynamic_pointer_cast< LayoutNode >( mpNode ) );
if( pNode )
diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx
index e5aef824bf54..f99fdc21ab55 100644
--- a/oox/source/drawingml/drawingmltypes.cxx
+++ b/oox/source/drawingml/drawingmltypes.cxx
@@ -31,7 +31,7 @@
#include <com/sun/star/style/CaseMap.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <sax/tools/converter.hxx>
-#include "tokens.hxx"
+#include "oox/token/tokens.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
diff --git a/oox/source/drawingml/embeddedwavaudiofile.cxx b/oox/source/drawingml/embeddedwavaudiofile.cxx
index 02cad5ce9f05..5c9484894109 100644
--- a/oox/source/drawingml/embeddedwavaudiofile.cxx
+++ b/oox/source/drawingml/embeddedwavaudiofile.cxx
@@ -27,9 +27,6 @@
#include "oox/drawingml/embeddedwavaudiofile.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
-
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -46,7 +43,7 @@ namespace oox { namespace drawingml {
{
AttributeList attribs(xAttribs);
- OUString sId = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_embed );
+ OUString sId = xAttribs->getOptionalValue( R_TOKEN( embed ) );
aAudio.msEmbed = rRelations.getFragmentPathFromRelId( sId );
aAudio.mbBuiltIn = attribs.getBool( XML_builtIn, false );
aAudio.msName = xAttribs->getOptionalValue( XML_name );
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 08d001f09a62..19700cd8199c 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -36,13 +36,12 @@
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/RectanglePoint.hpp>
#include <com/sun/star/graphic/XGraphicTransformer.hpp>
-#include "properties.hxx"
-#include "tokens.hxx"
#include "oox/helper/graphichelper.hxx"
#include "oox/helper/modelobjecthelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/token/tokens.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::drawing;
diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
index cb2037294786..15b1ef0f2404 100644
--- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx
+++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
@@ -28,7 +28,6 @@
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/graphichelper.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/fillproperties.hxx"
@@ -190,7 +189,7 @@ Reference< XFastContextHandler > BlipContext::createFastChildContext(
{
case A_TOKEN( biLevel ):
case A_TOKEN( grayscl ):
- mrBlipProps.moColorEffect = getToken( nElement );
+ mrBlipProps.moColorEffect = getBaseToken( nElement );
break;
case A_TOKEN( clrChange ):
@@ -237,7 +236,7 @@ Reference< XFastContextHandler > BlipFillContext::createFastChildContext(
break;
case A_TOKEN( tile ):
- mrBlipProps.moBitmapMode = getToken( nElement );
+ mrBlipProps.moBitmapMode = getBaseToken( nElement );
mrBlipProps.moTileOffsetX = aAttribs.getInteger( XML_tx );
mrBlipProps.moTileOffsetY = aAttribs.getInteger( XML_ty );
mrBlipProps.moTileScaleX = aAttribs.getInteger( XML_sx );
@@ -247,7 +246,7 @@ Reference< XFastContextHandler > BlipFillContext::createFastChildContext(
break;
case A_TOKEN( stretch ):
- mrBlipProps.moBitmapMode = getToken( nElement );
+ mrBlipProps.moBitmapMode = getBaseToken( nElement );
return this; // for fillRect element
case A_TOKEN( fillRect ):
@@ -279,12 +278,12 @@ Reference< XFastContextHandler > FillPropertiesContext::createFastChildContext(
{
switch( nElement )
{
- case A_TOKEN( noFill ): { rFillProps.moFillType = getToken( nElement ); return 0; };
- case A_TOKEN( solidFill ): { rFillProps.moFillType = getToken( nElement ); return new SolidFillContext( rParent, rxAttribs, rFillProps ); };
- case A_TOKEN( gradFill ): { rFillProps.moFillType = getToken( nElement ); return new GradientFillContext( rParent, rxAttribs, rFillProps.maGradientProps ); };
- case A_TOKEN( pattFill ): { rFillProps.moFillType = getToken( nElement ); return new PatternFillContext( rParent, rxAttribs, rFillProps.maPatternProps ); };
- case A_TOKEN( blipFill ): { rFillProps.moFillType = getToken( nElement ); return new BlipFillContext( rParent, rxAttribs, rFillProps.maBlipProps ); };
- case A_TOKEN( grpFill ): { rFillProps.moFillType = getToken( nElement ); return 0; }; // TODO
+ case A_TOKEN( noFill ): { rFillProps.moFillType = getBaseToken( nElement ); return 0; };
+ case A_TOKEN( solidFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new SolidFillContext( rParent, rxAttribs, rFillProps ); };
+ case A_TOKEN( gradFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new GradientFillContext( rParent, rxAttribs, rFillProps.maGradientProps ); };
+ case A_TOKEN( pattFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new PatternFillContext( rParent, rxAttribs, rFillProps.maPatternProps ); };
+ case A_TOKEN( blipFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new BlipFillContext( rParent, rxAttribs, rFillProps.maBlipProps ); };
+ case A_TOKEN( grpFill ): { rFillProps.moFillType = getBaseToken( nElement ); return 0; }; // TODO
}
return 0;
}
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index 48461bb2858e..646017aa22ea 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -27,13 +27,11 @@
#include "oox/drawingml/graphicshapecontext.hxx"
#include <osl/diagnose.h>
-#include <com/sun/star/chart2/XChartDocument.hpp>
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/customshapeproperties.hxx"
#include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
#include "oox/drawingml/table/tablecontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/graphichelper.hxx"
@@ -41,14 +39,8 @@
#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
-#include "oox/ole/oleobjecthelper.hxx"
#include "oox/drawingml/fillproperties.hxx"
#include "oox/drawingml/transform2dcontext.hxx"
-#include "oox/drawingml/chart/chartconverter.hxx"
-#include "oox/drawingml/chart/chartspacefragment.hxx"
-#include "oox/drawingml/chart/chartspacemodel.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -58,7 +50,6 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::xml::sax;
using namespace ::oox::core;
-using ::oox::vml::OleObjectInfo;
namespace oox {
namespace drawingml {
@@ -75,7 +66,7 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa
{
Reference< XFastContextHandler > xRet;
- switch( getToken( aElementToken ) )
+ switch( getBaseToken( aElementToken ) )
{
// CT_ShapeProperties
case XML_xfrm:
@@ -86,13 +77,13 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa
break;
}
- if (getNamespace( aElementToken ) == NMSP_VML && mpShapePtr)
+ if ((getNamespace( aElementToken ) == NMSP_vml) && mpShapePtr)
{
mpShapePtr->setServiceName("com.sun.star.drawing.CustomShape");
CustomShapePropertiesPtr pCstmShpProps
(mpShapePtr->getCustomShapeProperties());
- sal_uInt32 nType = aElementToken & (~ NMSP_MASK);
+ sal_uInt32 nType = getBaseToken( aElementToken );
OUString sType(GetShapeType(nType));
if (sType.getLength() > 0)
@@ -118,7 +109,7 @@ Reference< XFastContextHandler > GraphicalObjectFrameContext::createFastChildCon
{
Reference< XFastContextHandler > xRet;
- switch( aElementToken &(~NMSP_MASK) )
+ switch( getBaseToken( aElementToken ) )
{
// CT_ShapeProperties
case XML_nvGraphicFramePr: // CT_GraphicalObjectFrameNonVisual
@@ -157,65 +148,19 @@ Reference< XFastContextHandler > GraphicalObjectFrameContext::createFastChildCon
// ============================================================================
-class CreateOleObjectCallback : public CreateShapeCallback
-{
-public:
- explicit CreateOleObjectCallback( XmlFilterBase& rFilter, const ::boost::shared_ptr< OleObjectInfo >& rxOleObjectInfo );
- virtual OUString onCreateXShape( const OUString& rServiceName, const awt::Rectangle& rShapeRect );
-
-private:
- ::boost::shared_ptr< OleObjectInfo > mxOleObjectInfo;
-};
-
-// ----------------------------------------------------------------------------
-
-CreateOleObjectCallback::CreateOleObjectCallback( XmlFilterBase& rFilter, const ::boost::shared_ptr< OleObjectInfo >& rxOleObjectInfo ) :
- CreateShapeCallback( rFilter ),
- mxOleObjectInfo( rxOleObjectInfo )
-{
-}
-
-OUString CreateOleObjectCallback::onCreateXShape( const OUString&, const awt::Rectangle& rShapeRect )
-{
- awt::Size aOleSize( rShapeRect.Width, rShapeRect.Height );
- bool bSuccess = mrFilter.getOleObjectHelper().importOleObject( maShapeProps, *mxOleObjectInfo, aOleSize );
- OUString aServiceName = bSuccess ? CREATE_OUSTRING( "com.sun.star.drawing.OLE2Shape" ) : CREATE_OUSTRING( "com.sun.star.drawing.GraphicObjectShape" );
-
- // get the path to the representation graphic
- OUString aGraphicPath;
- if( mxOleObjectInfo->maShapeId.getLength() > 0 )
- if( ::oox::vml::Drawing* pVmlDrawing = mrFilter.getVmlDrawing() )
- if( const ::oox::vml::ShapeBase* pVmlShape = pVmlDrawing->getShapes().getShapeById( mxOleObjectInfo->maShapeId, true ) )
- aGraphicPath = pVmlShape->getGraphicPath();
-
- // import and store the graphic
- if( aGraphicPath.getLength() > 0 )
- {
- Reference< graphic::XGraphic > xGraphic = mrFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath );
- if( xGraphic.is() )
- maShapeProps[ PROP_Graphic ] <<= xGraphic;
- }
-
- return aServiceName;
-}
-
-// ============================================================================
-
OleObjectGraphicDataContext::OleObjectGraphicDataContext( ContextHandler& rParent, ShapePtr xShape ) :
ShapeContext( rParent, ShapePtr(), xShape ),
- mxOleObjectInfo( new OleObjectInfo( true ) )
+ mrOleObjectInfo( xShape->setOleObjectType() )
{
- CreateShapeCallbackRef xCallback( new CreateOleObjectCallback( getFilter(), mxOleObjectInfo ) );
- xShape->setCreateShapeCallback( xCallback );
}
OleObjectGraphicDataContext::~OleObjectGraphicDataContext()
{
/* Register the OLE shape at the VML drawing, this prevents that the
related VML shape converts the OLE object by itself. */
- if( mxOleObjectInfo->maShapeId.getLength() > 0 )
+ if( mrOleObjectInfo.maShapeId.getLength() > 0 )
if( ::oox::vml::Drawing* pVmlDrawing = getFilter().getVmlDrawing() )
- pVmlDrawing->registerOleObject( *mxOleObjectInfo );
+ pVmlDrawing->registerOleObject( mrOleObjectInfo );
}
Reference< XFastContextHandler > OleObjectGraphicDataContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
@@ -227,37 +172,37 @@ Reference< XFastContextHandler > OleObjectGraphicDataContext::createFastChildCon
{
case PPT_TOKEN( oleObj ):
{
- mxOleObjectInfo->maShapeId = aAttribs.getXString( XML_spid, OUString() );
+ mrOleObjectInfo.maShapeId = aAttribs.getXString( XML_spid, OUString() );
const Relation* pRelation = getRelations().getRelationFromRelId( aAttribs.getString( R_TOKEN( id ), OUString() ) );
OSL_ENSURE( pRelation, "OleObjectGraphicDataContext::createFastChildContext - missing relation for OLE object" );
if( pRelation )
{
- mxOleObjectInfo->mbLinked = pRelation->mbExternal;
+ mrOleObjectInfo.mbLinked = pRelation->mbExternal;
if( pRelation->mbExternal )
{
- mxOleObjectInfo->maTargetLink = getFilter().getAbsoluteUrl( pRelation->maTarget );
+ mrOleObjectInfo.maTargetLink = getFilter().getAbsoluteUrl( pRelation->maTarget );
}
else
{
OUString aFragmentPath = getFragmentPathFromRelation( *pRelation );
if( aFragmentPath.getLength() > 0 )
- getFilter().importBinaryData( mxOleObjectInfo->maEmbeddedData, aFragmentPath );
+ getFilter().importBinaryData( mrOleObjectInfo.maEmbeddedData, aFragmentPath );
}
}
- mxOleObjectInfo->maName = aAttribs.getXString( XML_name, OUString() );
- mxOleObjectInfo->maProgId = aAttribs.getXString( XML_progId, OUString() );
- mxOleObjectInfo->mbShowAsIcon = aAttribs.getBool( XML_showAsIcon, false );
+ mrOleObjectInfo.maName = aAttribs.getXString( XML_name, OUString() );
+ mrOleObjectInfo.maProgId = aAttribs.getXString( XML_progId, OUString() );
+ mrOleObjectInfo.mbShowAsIcon = aAttribs.getBool( XML_showAsIcon, false );
xRet.set( this );
}
break;
case PPT_TOKEN( embed ):
- OSL_ENSURE( !mxOleObjectInfo->mbLinked, "OleObjectGraphicDataContext::createFastChildContext - unexpected child element" );
+ OSL_ENSURE( !mrOleObjectInfo.mbLinked, "OleObjectGraphicDataContext::createFastChildContext - unexpected child element" );
break;
case PPT_TOKEN( link ):
- OSL_ENSURE( mxOleObjectInfo->mbLinked, "OleObjectGraphicDataContext::createFastChildContext - unexpected child element" );
- mxOleObjectInfo->mbAutoUpdate = aAttribs.getBool( XML_updateAutomatic, false );
+ OSL_ENSURE( mrOleObjectInfo.mbLinked, "OleObjectGraphicDataContext::createFastChildContext - unexpected child element" );
+ mrOleObjectInfo.mbAutoUpdate = aAttribs.getBool( XML_updateAutomatic, false );
break;
}
return xRet;
@@ -268,8 +213,7 @@ Reference< XFastContextHandler > OleObjectGraphicDataContext::createFastChildCon
DiagramGraphicDataContext::DiagramGraphicDataContext( ContextHandler& rParent, ShapePtr pShapePtr )
: ShapeContext( rParent, ShapePtr(), pShapePtr )
{
- pShapePtr->setServiceName( "com.sun.star.drawing.GroupShape" );
- pShapePtr->setSubType( 0 );
+ pShapePtr->setDiagramType();
}
DiagramGraphicDataContext::~DiagramGraphicDataContext()
@@ -325,12 +269,12 @@ Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildConte
switch( aElementToken )
{
- case NMSP_DIAGRAM|XML_relIds:
+ case DGM_TOKEN( relIds ):
{
- msDm = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_dm );
- msLo = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_lo );
- msQs = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_qs );
- msCs = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_cs );
+ msDm = xAttribs->getOptionalValue( R_TOKEN( dm ) );
+ msLo = xAttribs->getOptionalValue( R_TOKEN( lo ) );
+ msQs = xAttribs->getOptionalValue( R_TOKEN( qs ) );
+ msCs = xAttribs->getOptionalValue( R_TOKEN( cs ) );
DiagramPtr pDiagram = loadDiagram();
pDiagram->addTo( mpShapePtr );
OSL_TRACE("diagram added shape %s of type %s", OUSTRING_TO_CSTR( mpShapePtr->getName() ),
@@ -349,62 +293,10 @@ Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildConte
// ============================================================================
-class CreateChartCallback : public CreateShapeCallback
-{
-public:
- explicit CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEmbedShapes );
- virtual void onXShapeCreated( const Reference< drawing::XShape >& rxShape, const Reference< drawing::XShapes >& rxShapes ) const;
-
-private:
- OUString maFragmentPath;
- bool mbEmbedShapes;
-};
-
-// ----------------------------------------------------------------------------
-
-CreateChartCallback::CreateChartCallback( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEmbedShapes ) :
- CreateShapeCallback( rFilter ),
- maFragmentPath( rFragmentPath ),
- mbEmbedShapes( bEmbedShapes )
-{
-}
-
-void CreateChartCallback::onXShapeCreated( const Reference< drawing::XShape >& rxShape, const Reference< drawing::XShapes >& rxShapes ) const
-{
- OSL_ENSURE( maFragmentPath.getLength() > 0, "CreateChartCallback::onXShapeCreated - missing chart fragment" );
- if( maFragmentPath.getLength() > 0 ) try
- {
- // set the chart2 OLE class ID at the OLE shape
- PropertySet aShapeProp( rxShape );
- aShapeProp.setProperty( PROP_CLSID, CREATE_OUSTRING( "12dcae26-281f-416f-a234-c3086127382e" ) );
-
- // get the XModel interface of the embedded object from the OLE shape
- Reference< frame::XModel > xDocModel;
- aShapeProp.getProperty( xDocModel, PROP_Model );
- Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW );
-
- // load the chart data from the XML fragment
- chart::ChartSpaceModel aModel;
- mrFilter.importFragment( new chart::ChartSpaceFragment( mrFilter, maFragmentPath, aModel ) );
-
- // convert imported chart model to chart document
- Reference< drawing::XShapes > xExternalPage;
- if( !mbEmbedShapes )
- xExternalPage = rxShapes;
- mrFilter.getChartConverter().convertFromModel( mrFilter, aModel, xChartDoc, xExternalPage, rxShape->getPosition(), rxShape->getSize() );
- }
- catch( Exception& )
- {
- }
-}
-
-// ============================================================================
-
ChartGraphicDataContext::ChartGraphicDataContext( ContextHandler& rParent, const ShapePtr& rxShape, bool bEmbedShapes ) :
ShapeContext( rParent, ShapePtr(), rxShape ),
- mbEmbedShapes( bEmbedShapes )
+ mrChartShapeInfo( rxShape->setChartType( bEmbedShapes ) )
{
- rxShape->setServiceName( "com.sun.star.drawing.OLE2Shape" );
}
Reference< XFastContextHandler > ChartGraphicDataContext::createFastChildContext( ::sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
@@ -413,9 +305,7 @@ Reference< XFastContextHandler > ChartGraphicDataContext::createFastChildContext
if( nElement == C_TOKEN( chart ) )
{
AttributeList aAttribs( rxAttribs );
- OUString aFragmentPath = getFragmentPathFromRelId( aAttribs.getString( R_TOKEN( id ), OUString() ) );
- CreateShapeCallbackRef xCallback( new CreateChartCallback( getFilter(), aFragmentPath, mbEmbedShapes ) );
- mpShapePtr->setCreateShapeCallback( xCallback );
+ mrChartShapeInfo.maFragmentPath = getFragmentPathFromRelId( aAttribs.getString( R_TOKEN( id ), OUString() ) );
}
return 0;
}
diff --git a/oox/source/drawingml/guidcontext.cxx b/oox/source/drawingml/guidcontext.cxx
index b53e33fcb746..d5fbc10783ac 100644
--- a/oox/source/drawingml/guidcontext.cxx
+++ b/oox/source/drawingml/guidcontext.cxx
@@ -25,10 +25,7 @@
*
************************************************************************/
-#include <rtl/ustring.hxx>
#include "oox/drawingml/guidcontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx
index 280077eb0b5b..2b2b1ee1cef6 100644
--- a/oox/source/drawingml/hyperlinkcontext.cxx
+++ b/oox/source/drawingml/hyperlinkcontext.cxx
@@ -27,17 +27,12 @@
#include "hyperlinkcontext.hxx"
-#include <rtl/ustring.hxx>
-
#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
#include "oox/helper/propertymap.hxx"
#include "oox/core/relations.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/embeddedwavaudiofile.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -53,7 +48,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler& rParent,
, maProperties(aProperties)
{
OUString sURL, sHref;
- OUString aRelId = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_id );
+ OUString aRelId = xAttributes->getOptionalValue( R_TOKEN( id ) );
if ( aRelId.getLength() )
{
OSL_TRACE("OOX: URI rId %s", ::rtl::OUStringToOString (aRelId, RTL_TEXTENCODING_UTF8).pData->buffer);
@@ -64,10 +59,10 @@ HyperLinkContext::HyperLinkContext( ContextHandler& rParent,
sURL = getFilter().getAbsoluteUrl( sHref );
}
}
- OUString sTooltip = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_tooltip );
+ OUString sTooltip = xAttributes->getOptionalValue( R_TOKEN( tooltip ) );
if ( sTooltip.getLength() )
maProperties[ PROP_Representation ] <<= sTooltip;
- OUString sFrame = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_tgtFrame );
+ OUString sFrame = xAttributes->getOptionalValue( R_TOKEN( tgtFrame ) );
if( sFrame.getLength() )
maProperties[ PROP_TargetFrame ] <<= sFrame;
OUString aAction = xAttributes->getOptionalValue( XML_action );
@@ -164,9 +159,9 @@ Reference< XFastContextHandler > HyperLinkContext::createFastChildContext(
Reference< XFastContextHandler > xRet;
switch( aElement )
{
- case NMSP_DRAWINGML|XML_extLst:
+ case A_TOKEN( extLst ):
return xRet;
- case NMSP_DRAWINGML|XML_snd:
+ case A_TOKEN( snd ):
EmbeddedWAVAudioFile aAudio;
getEmbeddedWAVAudioFile( getRelations(), xAttribs, aAudio );
break;
diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx
index 9f23cf466d30..2eb1ef8b4cdf 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -35,14 +35,13 @@
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/PointSequence.hpp>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
-#include "properties.hxx"
-#include "tokens.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/graphichelper.hxx"
#include "oox/helper/modelobjecthelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/token/tokens.hxx"
using namespace ::com::sun::star::drawing;
diff --git a/oox/source/drawingml/linepropertiescontext.cxx b/oox/source/drawingml/linepropertiescontext.cxx
index a2cf4111a524..a200b60f9e4b 100644
--- a/oox/source/drawingml/linepropertiescontext.cxx
+++ b/oox/source/drawingml/linepropertiescontext.cxx
@@ -30,8 +30,6 @@
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/lineproperties.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -88,7 +86,7 @@ Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext(
case A_TOKEN( round ):
case A_TOKEN( bevel ):
case A_TOKEN( miter ):
- mrLineProperties.moLineJoint = getToken( nElement );
+ mrLineProperties.moLineJoint = getBaseToken( nElement );
break;
case A_TOKEN( headEnd ): // CT_LineEndProperties
diff --git a/oox/source/drawingml/objectdefaultcontext.cxx b/oox/source/drawingml/objectdefaultcontext.cxx
index 69b9423a4abc..d233379f9b02 100644
--- a/oox/source/drawingml/objectdefaultcontext.cxx
+++ b/oox/source/drawingml/objectdefaultcontext.cxx
@@ -28,8 +28,6 @@
#include "oox/drawingml/objectdefaultcontext.hxx"
#include "oox/drawingml/spdefcontext.hxx"
#include "oox/drawingml/theme.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::oox::core;
@@ -48,11 +46,11 @@ Reference< XFastContextHandler > objectDefaultContext::createFastChildContext( s
{
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_spDef:
+ case A_TOKEN( spDef ):
return new spDefContext( *this, mrTheme.getSpDef() );
- case NMSP_DRAWINGML|XML_lnDef:
+ case A_TOKEN( lnDef ):
return new spDefContext( *this, mrTheme.getLnDef() );
- case NMSP_DRAWINGML|XML_txDef:
+ case A_TOKEN( txDef ):
return new spDefContext( *this, mrTheme.getTxDef() );
}
return 0;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f0ae2ec2a7a3..61956c068deb 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -32,11 +32,15 @@
#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/textbody.hxx"
#include "oox/drawingml/table/tableproperties.hxx"
-#include "oox/core/namespaces.hxx"
+#include "oox/drawingml/chart/chartconverter.hxx"
+#include "oox/drawingml/chart/chartspacefragment.hxx"
+#include "oox/drawingml/chart/chartspacemodel.hxx"
+#include "oox/vml/vmldrawing.hxx"
+#include "oox/vml/vmlshape.hxx"
+#include "oox/vml/vmlshapecontainer.hxx"
#include "oox/core/xmlfilterbase.hxx"
+#include "oox/helper/graphichelper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
#include <tools/solar.h> // for the F_PI180 define
#include <com/sun/star/graphic/XGraphic.hpp>
@@ -45,6 +49,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
@@ -64,26 +69,6 @@ namespace oox { namespace drawingml {
// ============================================================================
-CreateShapeCallback::CreateShapeCallback( XmlFilterBase& rFilter ) :
- mrFilter( rFilter )
-{
-}
-
-CreateShapeCallback::~CreateShapeCallback()
-{
-}
-
-OUString CreateShapeCallback::onCreateXShape( const OUString& rServiceName, const Rectangle& )
-{
- return rServiceName;
-}
-
-void CreateShapeCallback::onXShapeCreated( const Reference< XShape >&, const Reference< XShapes >& ) const
-{
-}
-
-// ============================================================================
-
Shape::Shape( const sal_Char* pServiceName )
: mpLinePropertiesPtr( new LineProperties )
, mpFillPropertiesPtr( new FillProperties )
@@ -92,6 +77,7 @@ Shape::Shape( const sal_Char* pServiceName )
, mpMasterTextListStyle( new TextListStyle )
, mnSubType( 0 )
, mnSubTypeIndex( -1 )
+, meFrameType( FRAMETYPE_GENERIC )
, mnRotation( 0 )
, mbFlipH( false )
, mbFlipV( false )
@@ -101,6 +87,7 @@ Shape::Shape( const sal_Char* pServiceName )
msServiceName = OUString::createFromAscii( pServiceName );
setDefaults();
}
+
Shape::~Shape()
{
}
@@ -123,6 +110,39 @@ void Shape::setDefaults()
maShapeProperties[ PROP_CharHeight ] <<= static_cast< float >( 18.0 );
}
+::oox::vml::OleObjectInfo& Shape::setOleObjectType()
+{
+ OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setOleObjectType - multiple frame types" );
+ meFrameType = FRAMETYPE_OLEOBJECT;
+ mxOleObjectInfo.reset( new ::oox::vml::OleObjectInfo( true ) );
+ return *mxOleObjectInfo;
+}
+
+ChartShapeInfo& Shape::setChartType( bool bEmbedShapes )
+{
+ OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setChartType - multiple frame types" );
+ meFrameType = FRAMETYPE_CHART;
+ msServiceName = CREATE_OUSTRING( "com.sun.star.drawing.OLE2Shape" );
+ mxChartShapeInfo.reset( new ChartShapeInfo( bEmbedShapes ) );
+ return *mxChartShapeInfo;
+}
+
+void Shape::setDiagramType()
+{
+ OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setDiagramType - multiple frame types" );
+ meFrameType = FRAMETYPE_DIAGRAM;
+ msServiceName = CREATE_OUSTRING( "com.sun.star.drawing.GroupShape" );
+ mnSubType = 0;
+}
+
+void Shape::setTableType()
+{
+ OSL_ENSURE( meFrameType == FRAMETYPE_GENERIC, "Shape::setTableType - multiple frame types" );
+ meFrameType = FRAMETYPE_TABLE;
+ msServiceName = CREATE_OUSTRING( "com.sun.star.drawing.TableShape" );
+ mnSubType = 0;
+}
+
void Shape::setServiceName( const sal_Char* pServiceName )
{
if ( pServiceName )
@@ -137,7 +157,7 @@ const ShapeStyleRef* Shape::getShapeStyleRef( sal_Int32 nRefType ) const
}
void Shape::addShape(
- const ::oox::core::XmlFilterBase& rFilterBase,
+ ::oox::core::XmlFilterBase& rFilterBase,
const Theme* pTheme,
const Reference< XShapes >& rxShapes,
const awt::Rectangle* pShapeRect,
@@ -189,7 +209,7 @@ void Shape::applyShapeReference( const Shape& rReferencedShape )
// for group shapes, the following method is also adding each child
void Shape::addChildren(
- const ::oox::core::XmlFilterBase& rFilterBase,
+ XmlFilterBase& rFilterBase,
Shape& rMaster,
const Theme* pTheme,
const Reference< XShapes >& rxShapes,
@@ -247,7 +267,7 @@ void Shape::addChildren(
}
Reference< XShape > Shape::createAndInsert(
- const ::oox::core::XmlFilterBase& rFilterBase,
+ ::oox::core::XmlFilterBase& rFilterBase,
const rtl::OUString& rServiceName,
const Theme* pTheme,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
@@ -256,11 +276,10 @@ Reference< XShape > Shape::createAndInsert(
{
awt::Size aSize( pShapeRect ? awt::Size( pShapeRect->Width, pShapeRect->Height ) : maSize );
awt::Point aPosition( pShapeRect ? awt::Point( pShapeRect->X, pShapeRect->Y ) : maPosition );
+ awt::Rectangle aShapeRectHmm( aPosition.X / 360, aPosition.Y / 360, aSize.Width / 360, aSize.Height / 360 );
- OUString aServiceName = rServiceName;
- if( mxCreateCallback.get() )
- aServiceName = mxCreateCallback->onCreateXShape( aServiceName, awt::Rectangle( aPosition.X / 360, aPosition.Y / 360, aSize.Width / 360, aSize.Height / 360 ) );
- sal_Bool bIsCustomShape = aServiceName == OUString::createFromAscii( "com.sun.star.drawing.CustomShape" );
+ OUString aServiceName = finalizeServiceName( rFilterBase, rServiceName, aShapeRectHmm );
+ sal_Bool bIsCustomShape = aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.CustomShape" ) );
basegfx::B2DHomMatrix aTransformation;
if( aSize.Width != 1 || aSize.Height != 1)
@@ -432,13 +451,6 @@ Reference< XShape > Shape::createAndInsert(
PropertyMap aShapeProperties;
PropertyMap::const_iterator aShapePropIter;
- if( mxCreateCallback.get() )
- {
- for ( aShapePropIter = mxCreateCallback->getShapeProperties().begin();
- aShapePropIter != mxCreateCallback->getShapeProperties().end(); aShapePropIter++ )
- aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second;
- }
-
// add properties from textbody to shape properties
if( mpTextBody.get() )
{
@@ -502,9 +514,8 @@ Reference< XShape > Shape::createAndInsert(
xLockable->removeActionLock();
}
- // use a callback for further processing on the XShape (e.g. charts)
- if( mxShape.is() && mxCreateCallback.get() )
- mxCreateCallback->onXShapeCreated( mxShape, rxShapes );
+ if( mxShape.is() )
+ finalizeXShape( rFilterBase, rxShapes );
return mxShape;
}
@@ -537,5 +548,77 @@ void Shape::setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle
mpMasterTextListStyle = pMasterTextListStyle;
}
+OUString Shape::finalizeServiceName( XmlFilterBase& rFilter, const OUString& rServiceName, const Rectangle& rShapeRect )
+{
+ OUString aServiceName = rServiceName;
+ switch( meFrameType )
+ {
+ case FRAMETYPE_OLEOBJECT:
+ {
+ Size aOleSize( rShapeRect.Width, rShapeRect.Height );
+ if( rFilter.getOleObjectHelper().importOleObject( maShapeProperties, *mxOleObjectInfo, aOleSize ) )
+ aServiceName = CREATE_OUSTRING( "com.sun.star.drawing.OLE2Shape" );
+
+ // get the path to the representation graphic
+ OUString aGraphicPath;
+ if( mxOleObjectInfo->maShapeId.getLength() > 0 )
+ if( ::oox::vml::Drawing* pVmlDrawing = rFilter.getVmlDrawing() )
+ if( const ::oox::vml::ShapeBase* pVmlShape = pVmlDrawing->getShapes().getShapeById( mxOleObjectInfo->maShapeId, true ) )
+ aGraphicPath = pVmlShape->getGraphicPath();
+
+ // import and store the graphic
+ if( aGraphicPath.getLength() > 0 )
+ {
+ Reference< graphic::XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath );
+ if( xGraphic.is() )
+ maShapeProperties[ PROP_Graphic ] <<= xGraphic;
+ }
+ }
+ break;
+
+ default:;
+ }
+ return aServiceName;
+}
+
+void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& rxShapes )
+{
+ switch( meFrameType )
+ {
+ case FRAMETYPE_CHART:
+ {
+ OSL_ENSURE( mxChartShapeInfo->maFragmentPath.getLength() > 0, "Shape::finalizeXShape - missing chart fragment" );
+ if( mxShape.is() && (mxChartShapeInfo->maFragmentPath.getLength() > 0) ) try
+ {
+ // set the chart2 OLE class ID at the OLE shape
+ PropertySet aShapeProp( mxShape );
+ aShapeProp.setProperty( PROP_CLSID, CREATE_OUSTRING( "12dcae26-281f-416f-a234-c3086127382e" ) );
+
+ // get the XModel interface of the embedded object from the OLE shape
+ Reference< frame::XModel > xDocModel;
+ aShapeProp.getProperty( xDocModel, PROP_Model );
+ Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW );
+
+ // load the chart data from the XML fragment
+ chart::ChartSpaceModel aModel;
+ rFilter.importFragment( new chart::ChartSpaceFragment( rFilter, mxChartShapeInfo->maFragmentPath, aModel ) );
+
+ // convert imported chart model to chart document
+ Reference< drawing::XShapes > xExternalPage;
+ if( !mxChartShapeInfo->mbEmbedShapes )
+ xExternalPage = rxShapes;
+ rFilter.getChartConverter().convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ break;
+
+ default:;
+ }
+}
+
+// ============================================================================
} }
diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx
index a5f3b1598447..d4781fdaa436 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ b/oox/source/drawingml/shapecontext.cxx
@@ -34,13 +34,11 @@
#include "oox/helper/attributelist.hxx"
#include "oox/drawingml/shapecontext.hxx"
#include "oox/drawingml/shapestylecontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/customshapegeometry.hxx"
#include "oox/drawingml/textbodycontext.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace oox::core;
@@ -80,7 +78,7 @@ Reference< XFastContextHandler > ShapeContext::createFastChildContext( sal_Int32
{
Reference< XFastContextHandler > xRet;
- switch( getToken( aElementToken ) )
+ switch( getBaseToken( aElementToken ) )
{
// nvSpPr CT_ShapeNonVisual begin
// case XML_drElemPr:
diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx
index e1bd51f852ad..183302667066 100644
--- a/oox/source/drawingml/shapegroupcontext.cxx
+++ b/oox/source/drawingml/shapegroupcontext.cxx
@@ -37,8 +37,6 @@
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/customshapegeometry.hxx"
#include "oox/drawingml/textbodycontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace oox::core;
@@ -68,7 +66,7 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_
{
Reference< XFastContextHandler > xRet;
- switch( getToken( aElementToken ) )
+ switch( getBaseToken( aElementToken ) )
{
case XML_cNvPr:
{
@@ -108,7 +106,7 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_
xRet.set( new GraphicShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ) ) );
break;
case XML_graphicFrame: // CT_GraphicalObjectFrame
- xRet.set( new GraphicalObjectFrameContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.OLE2Shape" ) ), true ) );
+ xRet.set( new GraphicalObjectFrameContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ), true ) );
break;
}
if( !xRet.is() )
diff --git a/oox/source/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx
index dd1814ac23cf..13fd8c421784 100644
--- a/oox/source/drawingml/shapepropertiescontext.cxx
+++ b/oox/source/drawingml/shapepropertiescontext.cxx
@@ -33,12 +33,10 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XNamed.hpp>
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/linepropertiescontext.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/transform2dcontext.hxx"
#include "oox/drawingml/customshapegeometry.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace oox::core;
@@ -68,17 +66,17 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext(
switch( aElementToken )
{
// CT_Transform2D
- case NMSP_DRAWINGML|XML_xfrm:
+ case A_TOKEN( xfrm ):
xRet.set( new Transform2DContext( *this, xAttribs, mrShape ) );
break;
// GeometryGroup
- case NMSP_DRAWINGML|XML_custGeom: // custom geometry "CT_CustomGeometry2D"
+ case A_TOKEN( custGeom ): // custom geometry "CT_CustomGeometry2D"
xRet.set( new CustomShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
break;
- case NMSP_DRAWINGML|XML_prstGeom: // preset geometry "CT_PresetGeometry2D"
+ case A_TOKEN( prstGeom ): // preset geometry "CT_PresetGeometry2D"
{
sal_Int32 nToken = xAttribs->getOptionalValueToken( XML_prst, 0 );
if ( nToken == XML_line )
@@ -90,24 +88,24 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext(
}
break;
- case NMSP_DRAWINGML|XML_prstTxWarp:
+ case A_TOKEN( prstTxWarp ):
xRet.set( new PresetTextShapeContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
break;
// CT_LineProperties
- case NMSP_DRAWINGML|XML_ln:
+ case A_TOKEN( ln ):
xRet.set( new LinePropertiesContext( *this, xAttribs, mrShape.getLineProperties() ) );
break;
// EffectPropertiesGroup
// todo not supported by core
- case NMSP_DRAWINGML|XML_effectLst: // CT_EffectList
- case NMSP_DRAWINGML|XML_effectDag: // CT_EffectContainer
+ case A_TOKEN( effectLst ): // CT_EffectList
+ case A_TOKEN( effectDag ): // CT_EffectContainer
break;
// todo
- case NMSP_DRAWINGML|XML_scene3d: // CT_Scene3D
- case NMSP_DRAWINGML|XML_sp3d: // CT_Shape3D
+ case A_TOKEN( scene3d ): // CT_Scene3D
+ case A_TOKEN( sp3d ): // CT_Shape3D
break;
}
diff --git a/oox/source/drawingml/shapestylecontext.cxx b/oox/source/drawingml/shapestylecontext.cxx
index 13f15783e49b..a1ae5df43cda 100644
--- a/oox/source/drawingml/shapestylecontext.cxx
+++ b/oox/source/drawingml/shapestylecontext.cxx
@@ -28,9 +28,7 @@
#include "oox/drawingml/shapestylecontext.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/colorchoicecontext.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -67,12 +65,12 @@ Reference< XFastContextHandler > ShapeStyleContext::createFastChildContext( sal_
AttributeList aAttribs( rxAttributes );
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_lnRef : // CT_StyleMatrixReference
- case NMSP_DRAWINGML|XML_fillRef : // CT_StyleMatrixReference
- case NMSP_DRAWINGML|XML_effectRef : // CT_StyleMatrixReference
- case NMSP_DRAWINGML|XML_fontRef : // CT_FontReference
+ case A_TOKEN( lnRef ) : // CT_StyleMatrixReference
+ case A_TOKEN( fillRef ) : // CT_StyleMatrixReference
+ case A_TOKEN( effectRef ) : // CT_StyleMatrixReference
+ case A_TOKEN( fontRef ) : // CT_FontReference
{
- sal_Int32 nToken = getToken( aElementToken );
+ sal_Int32 nToken = getBaseToken( aElementToken );
ShapeStyleRef& rStyleRef = mrShape.getShapeStyleRefs()[ nToken ];
rStyleRef.mnThemedIdx = (nToken == XML_fontRef) ? aAttribs.getToken( XML_idx, XML_none ) : aAttribs.getInteger( XML_idx, 0 );
xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) );
diff --git a/oox/source/drawingml/spdefcontext.cxx b/oox/source/drawingml/spdefcontext.cxx
index d85fe2ceb2bb..da86e031ddec 100644
--- a/oox/source/drawingml/spdefcontext.cxx
+++ b/oox/source/drawingml/spdefcontext.cxx
@@ -30,8 +30,6 @@
#include "oox/drawingml/textbody.hxx"
#include "oox/drawingml/textbodypropertiescontext.hxx"
#include "oox/drawingml/textliststylecontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::oox::core;
@@ -51,22 +49,22 @@ Reference< XFastContextHandler > spDefContext::createFastChildContext( sal_Int32
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_spPr:
+ case A_TOKEN( spPr ):
{
xRet = new ShapePropertiesContext( *this, mrDefaultObject );
break;
}
- case NMSP_DRAWINGML|XML_bodyPr:
+ case A_TOKEN( bodyPr ):
{
TextBodyPtr xTextBody( new TextBody );
mrDefaultObject.setTextBody( xTextBody );
xRet = new TextBodyPropertiesContext( *this, xAttribs, xTextBody->getTextProperties() );
break;
}
- case NMSP_DRAWINGML|XML_lstStyle:
+ case A_TOKEN( lstStyle ):
xRet.set( new TextListStyleContext( *this, *mrDefaultObject.getMasterTextListStyle() ) );
break;
- case NMSP_DRAWINGML|XML_style:
+ case A_TOKEN( style ):
break;
}
if( !xRet.is() )
diff --git a/oox/source/drawingml/table/tablebackgroundstylecontext.cxx b/oox/source/drawingml/table/tablebackgroundstylecontext.cxx
index c9be0287a7cc..075e8ded9b31 100644
--- a/oox/source/drawingml/table/tablebackgroundstylecontext.cxx
+++ b/oox/source/drawingml/table/tablebackgroundstylecontext.cxx
@@ -29,9 +29,8 @@
#include "oox/drawingml/table/tablebackgroundstylecontext.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/attributelist.hxx"
-#include "tokens.hxx"
+
using namespace ::oox::core;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -60,14 +59,14 @@ TableBackgroundStyleContext::createFastChildContext( ::sal_Int32 aElementToken,
switch( aElementToken )
{
// EG_ThemeableFillStyle (choice)
- case NMSP_DRAWINGML|XML_fill: // CT_FillProperties
+ case A_TOKEN( fill ): // CT_FillProperties
{
boost::shared_ptr< FillProperties >& rxFillProperties = mrTableStyle.getBackgroundFillProperties();
rxFillProperties.reset( new FillProperties );
xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) );
}
break;
- case NMSP_DRAWINGML|XML_fillRef: // CT_StyleMatrixReference
+ case A_TOKEN( fillRef ): // CT_StyleMatrixReference
{
ShapeStyleRef& rStyleRef = mrTableStyle.getBackgroundFillStyleRef();
rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
@@ -76,9 +75,9 @@ TableBackgroundStyleContext::createFastChildContext( ::sal_Int32 aElementToken,
break;
// EG_ThemeableEffectStyle (choice)
- case NMSP_DRAWINGML|XML_effect: // CT_EffectProperties
+ case A_TOKEN( effect ): // CT_EffectProperties
break;
- case NMSP_DRAWINGML|XML_effectRef: // CT_StyleMatrixReference
+ case A_TOKEN( effectRef ): // CT_StyleMatrixReference
break;
}
if( !xRet.is() )
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index ee3ac495f4d6..f381b20d5383 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -28,10 +28,7 @@
#include "oox/drawingml/table/tablecell.hxx"
#include "oox/drawingml/table/tableproperties.hxx"
#include "oox/drawingml/textbody.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
#include "oox/helper/propertyset.hxx"
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
diff --git a/oox/source/drawingml/table/tablecellcontext.cxx b/oox/source/drawingml/table/tablecellcontext.cxx
index 68e3cd3a864a..844f134c3e85 100644
--- a/oox/source/drawingml/table/tablecellcontext.cxx
+++ b/oox/source/drawingml/table/tablecellcontext.cxx
@@ -31,7 +31,6 @@
#include "oox/drawingml/textbodycontext.hxx"
#include "oox/drawingml/linepropertiescontext.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/attributelist.hxx"
using namespace ::oox::core;
@@ -66,7 +65,7 @@ TableCellContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_txBody: // CT_TextBody
+ case A_TOKEN( txBody ): // CT_TextBody
{
oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody );
mrTableCell.setTextBody( xTextBody );
@@ -74,7 +73,7 @@ TableCellContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::
}
break;
- case NMSP_DRAWINGML|XML_tcPr: // CT_TableCellProperties
+ case A_TOKEN( tcPr ): // CT_TableCellProperties
{
AttributeList aAttribs( xAttribs );
mrTableCell.setLeftMargin( aAttribs.getInteger( XML_marL, 91440 ) );
@@ -87,28 +86,28 @@ TableCellContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::
mrTableCell.setHorzOverflowToken( xAttribs->getOptionalValueToken( XML_horzOverflow, XML_clip ) ); // ST_TextHorzOverflowType
}
break;
- case NMSP_DRAWINGML|XML_lnL:
+ case A_TOKEN( lnL ):
xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesLeft ) );
break;
- case NMSP_DRAWINGML|XML_lnR:
+ case A_TOKEN( lnR ):
xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesRight ) );
break;
- case NMSP_DRAWINGML|XML_lnT:
+ case A_TOKEN( lnT ):
xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesTop ) );
break;
- case NMSP_DRAWINGML|XML_lnB:
+ case A_TOKEN( lnB ):
xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesBottom ) );
break;
- case NMSP_DRAWINGML|XML_lnTlToBr:
+ case A_TOKEN( lnTlToBr ):
xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesTopLeftToBottomRight ) );
break;
- case NMSP_DRAWINGML|XML_lnBlToTr:
+ case A_TOKEN( lnBlToTr ):
xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesBottomLeftToTopRight ) );
break;
- case NMSP_DRAWINGML|XML_cell3D: // CT_Cell3D
+ case A_TOKEN( cell3D ): // CT_Cell3D
break;
- case NMSP_DRAWINGML|XML_extLst: // CT_OfficeArtExtensionList
+ case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
break;
default:
diff --git a/oox/source/drawingml/table/tablecontext.cxx b/oox/source/drawingml/table/tablecontext.cxx
index b194fdc9ee26..f7e7af620428 100644
--- a/oox/source/drawingml/table/tablecontext.cxx
+++ b/oox/source/drawingml/table/tablecontext.cxx
@@ -32,7 +32,6 @@
#include "oox/drawingml/table/tableproperties.hxx"
#include "oox/drawingml/table/tablestylecontext.hxx"
#include "oox/drawingml/table/tablerowcontext.hxx"
-#include "oox/core/namespaces.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star;
@@ -44,8 +43,7 @@ TableContext::TableContext( ContextHandler& rParent, ShapePtr pShapePtr )
: ShapeContext( rParent, ShapePtr(), pShapePtr )
, mrTableProperties( *pShapePtr->getTableProperties().get() )
{
- pShapePtr->setServiceName( "com.sun.star.drawing.TableShape" );
- pShapePtr->setSubType( 0 );
+ pShapePtr->setTableType();
}
TableContext::~TableContext()
@@ -60,7 +58,7 @@ TableContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Refe
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_tblPr: // CT_TableProperties
+ case A_TOKEN( tblPr ): // CT_TableProperties
{
AttributeList aAttribs( xAttribs );
mrTableProperties.isRtl() = aAttribs.getBool( XML_rtl, sal_False );
@@ -72,26 +70,26 @@ TableContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Refe
mrTableProperties.isBandCol() = aAttribs.getBool( XML_bandCol, sal_False );
}
break;
- case NMSP_DRAWINGML|XML_tableStyle: // CT_TableStyle
+ case A_TOKEN( tableStyle ): // CT_TableStyle
{
boost::shared_ptr< TableStyle >& rTableStyle = mrTableProperties.getTableStyle();
rTableStyle.reset( new TableStyle() );
xRet = new TableStyleContext( *this, xAttribs, *rTableStyle );
}
break;
- case NMSP_DRAWINGML|XML_tableStyleId: // ST_Guid
+ case A_TOKEN( tableStyleId ): // ST_Guid
xRet.set( new oox::drawingml::GuidContext( *this, mrTableProperties.getStyleId() ) );
break;
- case NMSP_DRAWINGML|XML_tblGrid: // CT_TableGrid
+ case A_TOKEN( tblGrid ): // CT_TableGrid
break;
- case NMSP_DRAWINGML|XML_gridCol: // CT_TableCol
+ case A_TOKEN( gridCol ): // CT_TableCol
{
std::vector< sal_Int32 >& rvTableGrid( mrTableProperties.getTableGrid() );
rvTableGrid.push_back( xAttribs->getOptionalValue( XML_w ).toInt32() );
}
break;
- case NMSP_DRAWINGML|XML_tr: // CT_TableRow
+ case A_TOKEN( tr ): // CT_TableRow
{
std::vector< TableRow >& rvTableRows( mrTableProperties.getTableRows() );
rvTableRows.resize( rvTableRows.size() + 1 );
diff --git a/oox/source/drawingml/table/tablepartstylecontext.cxx b/oox/source/drawingml/table/tablepartstylecontext.cxx
index 92e314d6afa7..1d48cbcf2a18 100644
--- a/oox/source/drawingml/table/tablepartstylecontext.cxx
+++ b/oox/source/drawingml/table/tablepartstylecontext.cxx
@@ -30,8 +30,7 @@
#include "oox/drawingml/table/tablepartstylecontext.hxx"
#include "oox/drawingml/table/tablestyletextstylecontext.hxx"
#include "oox/drawingml/table/tablestylecellstylecontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
+
using namespace ::oox::core;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -59,10 +58,10 @@ TablePartStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_tcTxStyle: // CT_TableStyleTextStyle
+ case A_TOKEN( tcTxStyle ): // CT_TableStyleTextStyle
xRet.set( new TableStyleTextStyleContext( *this, xAttribs, mrTableStylePart ) );
break;
- case NMSP_DRAWINGML|XML_tcStyle: // CT_TableStyleCellStyle
+ case A_TOKEN( tcStyle ): // CT_TableStyleCellStyle
xRet.set( new TableStyleCellStyleContext( *this, mrTableStylePart ) );
break;
}
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index 136754fbccc3..e0d0ac91c2ab 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -33,10 +33,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/table/XMergeableCellRange.hpp>
#include <com/sun/star/table/BorderLine.hpp>
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/helper/propertyset.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::oox::core;
diff --git a/oox/source/drawingml/table/tablerow.cxx b/oox/source/drawingml/table/tablerow.cxx
index 8986a6e35d08..3c4af56a5d42 100644
--- a/oox/source/drawingml/table/tablerow.cxx
+++ b/oox/source/drawingml/table/tablerow.cxx
@@ -27,8 +27,6 @@
#include "oox/drawingml/table/tablerow.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include "oox/helper/propertyset.hxx"
diff --git a/oox/source/drawingml/table/tablerowcontext.cxx b/oox/source/drawingml/table/tablerowcontext.cxx
index 7e0ff052bb4e..1a6c38167a8d 100644
--- a/oox/source/drawingml/table/tablerowcontext.cxx
+++ b/oox/source/drawingml/table/tablerowcontext.cxx
@@ -30,8 +30,6 @@
#include "oox/drawingml/table/tablerowcontext.hxx"
#include "oox/drawingml/table/tablecellcontext.hxx"
#include "oox/drawingml/table/tablerow.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star;
@@ -58,14 +56,14 @@ TableRowContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::R
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_tc: // CT_TableCell
+ case A_TOKEN( tc ): // CT_TableCell
{
std::vector< TableCell >& rvTableCells = mrTableRow.getTableCells();
rvTableCells.resize( rvTableCells.size() + 1 );
xRet.set( new TableCellContext( *this, xAttribs, rvTableCells.back() ) );
}
break;
- case NMSP_DRAWINGML|XML_extLst: // CT_OfficeArtExtensionList
+ case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
default:
break;
}
diff --git a/oox/source/drawingml/table/tablestylecellstylecontext.cxx b/oox/source/drawingml/table/tablestylecellstylecontext.cxx
index 47d747bf8b20..56127b0c049c 100644
--- a/oox/source/drawingml/table/tablestylecellstylecontext.cxx
+++ b/oox/source/drawingml/table/tablestylecellstylecontext.cxx
@@ -30,9 +30,8 @@
#include "oox/drawingml/table/tablestylecellstylecontext.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/linepropertiescontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/attributelist.hxx"
-#include "tokens.hxx"
+
using namespace ::oox::core;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -61,20 +60,20 @@ TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c
AttributeList aAttribs( xAttribs );
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_tcBdr: // CT_TableCellBorderStyle
+ case A_TOKEN( tcBdr ): // CT_TableCellBorderStyle
break;
- case NMSP_DRAWINGML|XML_left: // CT_ThemeableLineStyle
- case NMSP_DRAWINGML|XML_right:
- case NMSP_DRAWINGML|XML_top:
- case NMSP_DRAWINGML|XML_bottom:
- case NMSP_DRAWINGML|XML_insideH:
- case NMSP_DRAWINGML|XML_insideV:
- case NMSP_DRAWINGML|XML_tl2br:
- case NMSP_DRAWINGML|XML_tr2bl:
- mnLineType = getToken( aElementToken );
+ case A_TOKEN( left ): // CT_ThemeableLineStyle
+ case A_TOKEN( right ):
+ case A_TOKEN( top ):
+ case A_TOKEN( bottom ):
+ case A_TOKEN( insideH ):
+ case A_TOKEN( insideV ):
+ case A_TOKEN( tl2br ):
+ case A_TOKEN( tr2bl ):
+ mnLineType = getBaseToken( aElementToken );
break;
- case NMSP_DRAWINGML|XML_ln:
+ case A_TOKEN( ln ):
{
if ( mnLineType != XML_none )
{
@@ -85,7 +84,7 @@ TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c
}
}
break;
- case NMSP_DRAWINGML|XML_lnRef:
+ case A_TOKEN( lnRef ):
{
if ( mnLineType != XML_none )
{
@@ -97,14 +96,14 @@ TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c
break;
// EG_ThemeableFillStyle (choice)
- case NMSP_DRAWINGML|XML_fill: // CT_FillProperties
+ case A_TOKEN( fill ): // CT_FillProperties
{
FillPropertiesPtr& rxFillProperties = mrTableStylePart.getFillProperties();
rxFillProperties.reset( new FillProperties );
xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) );
}
break;
- case NMSP_DRAWINGML|XML_fillRef: // CT_StyleMatrixReference
+ case A_TOKEN( fillRef ): // CT_StyleMatrixReference
{
ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
@@ -112,7 +111,7 @@ TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c
}
break;
- case NMSP_DRAWINGML|XML_cell3D: // CT_Cell3D
+ case A_TOKEN( cell3D ): // CT_Cell3D
break;
}
if( !xRet.is() )
diff --git a/oox/source/drawingml/table/tablestylecontext.cxx b/oox/source/drawingml/table/tablestylecontext.cxx
index 4d0b945d3d72..aee23eaf9c7b 100644
--- a/oox/source/drawingml/table/tablestylecontext.cxx
+++ b/oox/source/drawingml/table/tablestylecontext.cxx
@@ -30,8 +30,7 @@
#include "oox/drawingml/table/tablestylecontext.hxx"
#include "oox/drawingml/table/tablebackgroundstylecontext.hxx"
#include "oox/drawingml/table/tablepartstylecontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
+
using namespace ::oox::core;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -61,49 +60,49 @@ TableStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno:
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_tblBg: // CT_TableBackgroundStyle
+ case A_TOKEN( tblBg ): // CT_TableBackgroundStyle
xRet = new TableBackgroundStyleContext( *this, mrTableStyle );
break;
- case NMSP_DRAWINGML|XML_wholeTbl: // CT_TablePartStyle
+ case A_TOKEN( wholeTbl ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getWholeTbl() );
break;
- case NMSP_DRAWINGML|XML_band1H: // CT_TablePartStyle
+ case A_TOKEN( band1H ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1H() );
break;
- case NMSP_DRAWINGML|XML_band2H: // CT_TablePartStyle
+ case A_TOKEN( band2H ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2H() );
break;
- case NMSP_DRAWINGML|XML_band1V: // CT_TablePartStyle
+ case A_TOKEN( band1V ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1V() );
break;
- case NMSP_DRAWINGML|XML_band2V: // CT_TablePartStyle
+ case A_TOKEN( band2V ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2V() );
break;
- case NMSP_DRAWINGML|XML_lastCol: // CT_TablePartStyle
+ case A_TOKEN( lastCol ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getLastCol() );
break;
- case NMSP_DRAWINGML|XML_firstCol: // CT_TablePartStyle
+ case A_TOKEN( firstCol ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstCol() );
break;
- case NMSP_DRAWINGML|XML_lastRow: // CT_TablePartStyle
+ case A_TOKEN( lastRow ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getLastRow() );
break;
- case NMSP_DRAWINGML|XML_seCell: // CT_TablePartStyle
+ case A_TOKEN( seCell ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getSeCell() );
break;
- case NMSP_DRAWINGML|XML_swCell: // CT_TablePartStyle
+ case A_TOKEN( swCell ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getSwCell() );
break;
- case NMSP_DRAWINGML|XML_firstRow: // CT_TablePartStyle
+ case A_TOKEN( firstRow ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstRow() );
break;
- case NMSP_DRAWINGML|XML_neCell: // CT_TablePartStyle
+ case A_TOKEN( neCell ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getNeCell() );
break;
- case NMSP_DRAWINGML|XML_nwCell: // CT_TablePartStyle
+ case A_TOKEN( nwCell ): // CT_TablePartStyle
xRet = new TablePartStyleContext( *this, mrTableStyle.getNwCell() );
break;
- case NMSP_DRAWINGML|XML_extLst: // CT_OfficeArtExtensionList
+ case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
break;
}
if( !xRet.is() )
diff --git a/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx b/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
index e90554409d4d..7b837d27e826 100644
--- a/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
+++ b/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx
@@ -62,10 +62,10 @@ Reference< XFastContextHandler > TableStyleListFragmentHandler::createFastChildC
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_tblStyleLst: // CT_TableStyleList
+ case A_TOKEN( tblStyleLst ): // CT_TableStyleList
mrTableStyleList.getDefaultStyleId() = xAttribs->getOptionalValue( XML_def );
break;
- case NMSP_DRAWINGML|XML_tblStyle: // CT_TableStyle
+ case A_TOKEN( tblStyle ): // CT_TableStyle
std::vector< TableStyle >& rTableStyles = mrTableStyleList.getTableStyles();
rTableStyles.resize( rTableStyles.size() + 1 );
xRet = new TableStyleContext( *this, xAttribs, rTableStyles.back() );
diff --git a/oox/source/drawingml/table/tablestylepart.cxx b/oox/source/drawingml/table/tablestylepart.cxx
index f8e700e5fccd..b4a68fd488cd 100644
--- a/oox/source/drawingml/table/tablestylepart.cxx
+++ b/oox/source/drawingml/table/tablestylepart.cxx
@@ -27,8 +27,6 @@
#include "oox/drawingml/table/tablestylepart.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::oox::core;
diff --git a/oox/source/drawingml/table/tablestyletextstylecontext.cxx b/oox/source/drawingml/table/tablestyletextstylecontext.cxx
index ec117f4ac3c1..7c04e3293eb1 100644
--- a/oox/source/drawingml/table/tablestyletextstylecontext.cxx
+++ b/oox/source/drawingml/table/tablestyletextstylecontext.cxx
@@ -29,9 +29,8 @@
#include "oox/drawingml/table/tablestyletextstylecontext.hxx"
#include "oox/drawingml/colorchoicecontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/attributelist.hxx"
-#include "tokens.hxx"
+
using namespace ::oox::core;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -73,23 +72,23 @@ TableStyleTextStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c
switch( aElementToken )
{
// EG_ThemeableFontStyles (choice)
- case NMSP_DRAWINGML|XML_font: // CT_FontCollection
+ case A_TOKEN( font ): // CT_FontCollection
xRet.set( this );
break;
- case NMSP_DRAWINGML|XML_ea: // CT_TextFont
+ case A_TOKEN( ea ): // CT_TextFont
mrTableStylePart.getAsianFont().setAttributes( aAttribs );
return 0;
- case NMSP_DRAWINGML|XML_cs: // CT_TextFont
+ case A_TOKEN( cs ): // CT_TextFont
mrTableStylePart.getComplexFont().setAttributes( aAttribs );
return 0;
- case NMSP_DRAWINGML|XML_sym: // CT_TextFont
+ case A_TOKEN( sym ): // CT_TextFont
mrTableStylePart.getSymbolFont().setAttributes( aAttribs );
return 0;
- case NMSP_DRAWINGML|XML_latin: // CT_TextFont
+ case A_TOKEN( latin ): // CT_TextFont
mrTableStylePart.getLatinFont().setAttributes( aAttribs );
return 0;
- case NMSP_DRAWINGML|XML_fontRef: // CT_FontReference
+ case A_TOKEN( fontRef ): // CT_FontReference
{
ShapeStyleRef& rFontStyle = mrTableStylePart.getStyleRefs()[ XML_fontRef ];
rFontStyle.mnThemedIdx = aAttribs.getToken( XML_idx, XML_none );
@@ -97,7 +96,7 @@ TableStyleTextStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c
}
break;
- case NMSP_DRAWINGML|XML_extLst: // CT_OfficeArtExtensionList
+ case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
break;
}
if( !xRet.is() )
diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx
index 8de730849b24..8d695e295fd4 100644
--- a/oox/source/drawingml/textbodycontext.cxx
+++ b/oox/source/drawingml/textbodycontext.cxx
@@ -33,8 +33,6 @@
#include "oox/drawingml/textliststylecontext.hxx"
#include "oox/drawingml/textfield.hxx"
#include "oox/drawingml/textfieldcontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -69,7 +67,7 @@ TextParagraphContext::TextParagraphContext( ContextHandler& rParent, TextParagra
// --------------------------------------------------------------------
void TextParagraphContext::endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException)
{
- if( aElementToken == (NMSP_DRAWINGML|XML_p) )
+ if( aElementToken == (A_TOKEN( p )) )
{
}
}
@@ -83,14 +81,14 @@ Reference< XFastContextHandler > TextParagraphContext::createFastChildContext( s
// EG_TextRun
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_r: // "CT_RegularTextRun" Regular Text Run.
+ case A_TOKEN( r ): // "CT_RegularTextRun" Regular Text Run.
{
TextRunPtr pRun( new TextRun );
mrParagraph.addRun( pRun );
xRet.set( new RegularTextRunContext( *this, pRun ) );
break;
}
- case NMSP_DRAWINGML|XML_br: // "CT_TextLineBreak" Soft return line break (vertical tab).
+ case A_TOKEN( br ): // "CT_TextLineBreak" Soft return line break (vertical tab).
{
TextRunPtr pRun( new TextRun );
pRun->setLineBreak();
@@ -98,17 +96,17 @@ Reference< XFastContextHandler > TextParagraphContext::createFastChildContext( s
xRet.set( new RegularTextRunContext( *this, pRun ) );
break;
}
- case NMSP_DRAWINGML|XML_fld: // "CT_TextField" Text Field.
+ case A_TOKEN( fld ): // "CT_TextField" Text Field.
{
TextFieldPtr pField( new TextField );
mrParagraph.addRun( pField );
xRet.set( new TextFieldContext( *this, xAttribs, *pField ) );
break;
}
- case NMSP_DRAWINGML|XML_pPr:
+ case A_TOKEN( pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrParagraph.getProperties() ) );
break;
- case NMSP_DRAWINGML|XML_endParaRPr:
+ case A_TOKEN( endParaRPr ):
xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mrParagraph.getEndProperties() ) );
break;
}
@@ -130,12 +128,12 @@ void RegularTextRunContext::endFastElement( sal_Int32 aElementToken ) throw (SAX
{
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_t:
+ case A_TOKEN( t ):
{
mbIsInText = false;
break;
}
- case NMSP_DRAWINGML|XML_r:
+ case A_TOKEN( r ):
{
break;
}
@@ -161,10 +159,10 @@ Reference< XFastContextHandler > RegularTextRunContext::createFastChildContext(
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_rPr: // "CT_TextCharPropertyBag" The text char properties of this text run.
+ case A_TOKEN( rPr ): // "CT_TextCharPropertyBag" The text char properties of this text run.
xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mpRunPtr->getTextCharacterProperties() ) );
break;
- case NMSP_DRAWINGML|XML_t: // "xsd:string" minOccurs="1" The actual text string.
+ case A_TOKEN( t ): // "xsd:string" minOccurs="1" The actual text string.
mbIsInText = true;
break;
}
@@ -194,13 +192,13 @@ Reference< XFastContextHandler > TextBodyContext::createFastChildContext( sal_In
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_bodyPr: // CT_TextBodyPropertyBag
+ case A_TOKEN( bodyPr ): // CT_TextBodyPropertyBag
xRet.set( new TextBodyPropertiesContext( *this, xAttribs, mrTextBody.getTextProperties() ) );
break;
- case NMSP_DRAWINGML|XML_lstStyle: // CT_TextListStyle
+ case A_TOKEN( lstStyle ): // CT_TextListStyle
xRet.set( new TextListStyleContext( *this, mrTextBody.getTextListStyle() ) );
break;
- case NMSP_DRAWINGML|XML_p: // CT_TextParagraph
+ case A_TOKEN( p ): // CT_TextParagraph
xRet.set( new TextParagraphContext( *this, mrTextBody.addParagraph() ) );
break;
}
diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx
index 6cec7643e58e..4339c93aa0ae 100644
--- a/oox/source/drawingml/textbodyproperties.cxx
+++ b/oox/source/drawingml/textbodyproperties.cxx
@@ -27,8 +27,7 @@
#include "oox/drawingml/textbodyproperties.hxx"
#include <com/sun/star/text/WritingMode.hpp>
-#include "properties.hxx"
-#include "tokens.hxx"
+#include "oox/token/tokens.hxx"
namespace oox {
namespace drawingml {
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index 668266f2f679..f22258075e16 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -36,9 +36,6 @@
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertymap.hxx"
-#include "oox/core/namespaces.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -156,27 +153,27 @@ Reference< XFastContextHandler > TextBodyPropertiesContext::createFastChildConte
switch( aElementToken )
{
// Sequence
- case NMSP_DRAWINGML|XML_prstTxWarp: // CT_PresetTextShape
- case NMSP_DRAWINGML|XML_prot: // CT_TextProtectionProperty
+ case A_TOKEN( prstTxWarp ): // CT_PresetTextShape
+ case A_TOKEN( prot ): // CT_TextProtectionProperty
break;
// EG_TextAutofit
- case NMSP_DRAWINGML|XML_noAutofit:
+ case A_TOKEN( noAutofit ):
mrTextBodyProp.maPropertyMap[ PROP_TextAutoGrowHeight ] <<= false; // CT_TextNoAutofit
break;
- case NMSP_DRAWINGML|XML_normAutofit: // CT_TextNormalAutofit
+ case A_TOKEN( normAutofit ): // CT_TextNormalAutofit
mrTextBodyProp.maPropertyMap[ PROP_TextFitToSize ] <<= true;
mrTextBodyProp.maPropertyMap[ PROP_TextAutoGrowHeight ] <<= false;
break;
- case NMSP_DRAWINGML|XML_spAutoFit:
+ case A_TOKEN( spAutoFit ):
mrTextBodyProp.maPropertyMap[ PROP_TextAutoGrowHeight ] <<= true;
break;
- case NMSP_DRAWINGML|XML_scene3d: // CT_Scene3D
+ case A_TOKEN( scene3d ): // CT_Scene3D
// EG_Text3D
- case NMSP_DRAWINGML|XML_sp3d: // CT_Shape3D
- case NMSP_DRAWINGML|XML_flatTx: // CT_FlatText
+ case A_TOKEN( sp3d ): // CT_Shape3D
+ case A_TOKEN( flatTx ): // CT_FlatText
break;
}
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 9750375f97dd..61333535c38f 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -33,8 +33,7 @@
#include "oox/helper/propertyset.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
+#include "oox/token/tokens.hxx"
using ::rtl::OUString;
using ::oox::core::XmlFilterBase;
diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index cfba04a7b44b..f3be44773a39 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -32,10 +32,8 @@
#include "oox/drawingml/colorchoicecontext.hxx"
#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/textparagraphproperties.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/relations.hxx"
#include "hyperlinkcontext.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -76,21 +74,21 @@ TextCharacterPropertiesContext::TextCharacterPropertiesContext(
// ST_TextNonNegativePoint
const OUString sCharKerning( CREATE_OUSTRING( "CharKerning" ) );
- //case NMSP_DRAWINGML|XML_kern:
+ //case A_TOKEN( kern ):
// ST_TextLanguageID
OUString sAltLang = rXAttributes->getOptionalValue( XML_altLang );
- case NMSP_DRAWINGML|XML_kumimoji: // xsd:boolean
+ case A_TOKEN( kumimoji ): // xsd:boolean
break;
- case NMSP_DRAWINGML|XML_spc: // ST_TextPoint
- case NMSP_DRAWINGML|XML_normalizeH: // xsd:boolean
- case NMSP_DRAWINGML|XML_baseline: // ST_Percentage
- case NMSP_DRAWINGML|XML_noProof: // xsd:boolean
- case NMSP_DRAWINGML|XML_dirty: // xsd:boolean
- case NMSP_DRAWINGML|XML_err: // xsd:boolean
- case NMSP_DRAWINGML|XML_smtClean: // xsd:boolean
- case NMSP_DRAWINGML|XML_smtId: // xsd:unsignedInt
+ case A_TOKEN( spc ): // ST_TextPoint
+ case A_TOKEN( normalizeH ): // xsd:boolean
+ case A_TOKEN( baseline ): // ST_Percentage
+ case A_TOKEN( noProof ): // xsd:boolean
+ case A_TOKEN( dirty ): // xsd:boolean
+ case A_TOKEN( err ): // xsd:boolean
+ case A_TOKEN( smtClean ): // xsd:boolean
+ case A_TOKEN( smtId ): // xsd:unsignedInt
break;
*/
@@ -115,56 +113,56 @@ Reference< XFastContextHandler > TextCharacterPropertiesContext::createFastChild
switch( aElementToken )
{
// TODO unsupported yet
-// case NMSP_DRAWINGML|XML_ln: // CT_LineProperties
+// case A_TOKEN( ln ): // CT_LineProperties
// xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maTextOutlineProperties ) );
// break;
- case NMSP_DRAWINGML|XML_solidFill: // EG_FillProperties
+ case A_TOKEN( solidFill ): // EG_FillProperties
xRet.set( new ColorContext( *this, mrTextCharacterProperties.maCharColor ) );
break;
// EG_EffectProperties
- case NMSP_DRAWINGML|XML_effectDag: // CT_EffectContainer 5.1.10.25
- case NMSP_DRAWINGML|XML_effectLst: // CT_EffectList 5.1.10.26
+ case A_TOKEN( effectDag ): // CT_EffectContainer 5.1.10.25
+ case A_TOKEN( effectLst ): // CT_EffectList 5.1.10.26
break;
- case NMSP_DRAWINGML|XML_highlight: // CT_Color
+ case A_TOKEN( highlight ): // CT_Color
xRet.set( new ColorContext( *this, mrTextCharacterProperties.maHighlightColor ) );
break;
// EG_TextUnderlineLine
- case NMSP_DRAWINGML|XML_uLnTx: // CT_TextUnderlineLineFollowText
+ case A_TOKEN( uLnTx ): // CT_TextUnderlineLineFollowText
mrTextCharacterProperties.moUnderlineLineFollowText = true;
break;
// TODO unsupported yet
-// case NMSP_DRAWINGML|XML_uLn: // CT_LineProperties
+// case A_TOKEN( uLn ): // CT_LineProperties
// xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maUnderlineProperties ) );
// break;
// EG_TextUnderlineFill
- case NMSP_DRAWINGML|XML_uFillTx: // CT_TextUnderlineFillFollowText
+ case A_TOKEN( uFillTx ): // CT_TextUnderlineFillFollowText
mrTextCharacterProperties.moUnderlineFillFollowText = true;
break;
- case NMSP_DRAWINGML|XML_uFill: // CT_TextUnderlineFillGroupWrapper->EG_FillProperties (not supported)
+ case A_TOKEN( uFill ): // CT_TextUnderlineFillGroupWrapper->EG_FillProperties (not supported)
xRet.set( new SimpleFillPropertiesContext( *this, mrTextCharacterProperties.maUnderlineColor ) );
break;
// CT_FontCollection
- case NMSP_DRAWINGML|XML_latin: // CT_TextFont
+ case A_TOKEN( latin ): // CT_TextFont
mrTextCharacterProperties.maLatinFont.setAttributes( aAttribs );
break;
- case NMSP_DRAWINGML|XML_ea: // CT_TextFont
+ case A_TOKEN( ea ): // CT_TextFont
mrTextCharacterProperties.maAsianFont.setAttributes( aAttribs );
break;
- case NMSP_DRAWINGML|XML_cs: // CT_TextFont
+ case A_TOKEN( cs ): // CT_TextFont
mrTextCharacterProperties.maComplexFont.setAttributes( aAttribs );
break;
- case NMSP_DRAWINGML|XML_sym: // CT_TextFont
+ case A_TOKEN( sym ): // CT_TextFont
mrTextCharacterProperties.maSymbolFont.setAttributes( aAttribs );
break;
- case NMSP_DRAWINGML|XML_hlinkClick: // CT_Hyperlink
- case NMSP_DRAWINGML|XML_hlinkMouseOver: // CT_Hyperlink
+ case A_TOKEN( hlinkClick ): // CT_Hyperlink
+ case A_TOKEN( hlinkMouseOver ): // CT_Hyperlink
xRet.set( new HyperLinkContext( *this, xAttributes, mrTextCharacterProperties.maHyperlinkPropertyMap ) );
break;
}
diff --git a/oox/source/drawingml/textfieldcontext.cxx b/oox/source/drawingml/textfieldcontext.cxx
index 2c993af562bf..4e9f576a0ca9 100644
--- a/oox/source/drawingml/textfieldcontext.cxx
+++ b/oox/source/drawingml/textfieldcontext.cxx
@@ -29,8 +29,6 @@
#include "oox/drawingml/textparagraphpropertiescontext.hxx"
#include "oox/drawingml/textcharacterpropertiescontext.hxx"
#include "oox/drawingml/textfield.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -52,7 +50,7 @@ TextFieldContext::TextFieldContext( ContextHandler& rParent,
void TextFieldContext::endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException)
{
- if( aElementToken == (NMSP_DRAWINGML|XML_t) )
+ if( aElementToken == (A_TOKEN( t )) )
{
mbIsInText = false;
}
@@ -72,13 +70,13 @@ Reference< XFastContextHandler > TextFieldContext::createFastChildContext( sal_I
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_rPr:
+ case A_TOKEN( rPr ):
xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mrTextField.getTextCharacterProperties() ) );
break;
- case NMSP_DRAWINGML|XML_pPr:
+ case A_TOKEN( pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrTextField.getTextParagraphProperties() ) );
break;
- case NMSP_DRAWINGML|XML_t:
+ case A_TOKEN( t ):
mbIsInText = true;
break;
}
diff --git a/oox/source/drawingml/textfont.cxx b/oox/source/drawingml/textfont.cxx
index 8d58787e544a..b4f9d359fb14 100644
--- a/oox/source/drawingml/textfont.cxx
+++ b/oox/source/drawingml/textfont.cxx
@@ -31,7 +31,6 @@
#include "oox/drawingml/theme.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/helper/attributelist.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using ::oox::core::XmlFilterBase;
diff --git a/oox/source/drawingml/textliststyle.cxx b/oox/source/drawingml/textliststyle.cxx
index 901db49802d9..8a491076909f 100644
--- a/oox/source/drawingml/textliststyle.cxx
+++ b/oox/source/drawingml/textliststyle.cxx
@@ -65,15 +65,4 @@ void TextListStyle::apply( const TextListStyle& rTextListStyle )
applyStyleList( rTextListStyle.getListStyle(), getListStyle() );
}
-#if OSL_DEBUG_LEVEL > 0
-void TextListStyle::dump( int nLevels )
-{
- for ( int i = 0; i < nLevels; i++ )
- {
- OSL_TRACE("level: %d", i);
- maListStyle[ i ]->dump();
- }
-}
-#endif
-
} }
diff --git a/oox/source/drawingml/textliststylecontext.cxx b/oox/source/drawingml/textliststylecontext.cxx
index 693957490579..21afc698d730 100644
--- a/oox/source/drawingml/textliststylecontext.cxx
+++ b/oox/source/drawingml/textliststylecontext.cxx
@@ -27,9 +27,7 @@
#include "oox/drawingml/textliststylecontext.hxx"
#include "oox/drawingml/textparagraphpropertiescontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/attributelist.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -64,40 +62,40 @@ Reference< XFastContextHandler > TextListStyleContext::createFastChildContext( s
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_defPPr: // CT_TextParagraphProperties
+ case A_TOKEN( defPPr ): // CT_TextParagraphProperties
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 0 ] ) );
break;
- case NMSP_DRAWINGML|XML_outline1pPr:
+ case A_TOKEN( outline1pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getAggregationListStyle()[ 0 ] ) );
break;
- case NMSP_DRAWINGML|XML_outline2pPr:
+ case A_TOKEN( outline2pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getAggregationListStyle()[ 1 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl1pPr:
+ case A_TOKEN( lvl1pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 0 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl2pPr:
+ case A_TOKEN( lvl2pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 1 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl3pPr:
+ case A_TOKEN( lvl3pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 2 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl4pPr:
+ case A_TOKEN( lvl4pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 3 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl5pPr:
+ case A_TOKEN( lvl5pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 4 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl6pPr:
+ case A_TOKEN( lvl6pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 5 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl7pPr:
+ case A_TOKEN( lvl7pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 6 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl8pPr:
+ case A_TOKEN( lvl8pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 7 ] ) );
break;
- case NMSP_DRAWINGML|XML_lvl9pPr:
+ case A_TOKEN( lvl9pPr ):
xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 8 ] ) );
break;
}
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index 2f5954168d37..cd969874513e 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -37,11 +37,8 @@
#include "oox/helper/helper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::oox::core;
diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx
index 3c41fef69a76..eb888867556b 100644
--- a/oox/source/drawingml/textparagraphpropertiescontext.cxx
+++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx
@@ -34,11 +34,8 @@
#include "oox/drawingml/textcharacterpropertiescontext.hxx"
#include "oox/drawingml/fillproperties.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
-#include "properties.hxx"
#include "textspacingcontext.hxx"
#include "texttabstoplistcontext.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -187,49 +184,49 @@ Reference< XFastContextHandler > TextParagraphPropertiesContext::createFastChild
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_lnSpc: // CT_TextSpacing
+ case A_TOKEN( lnSpc ): // CT_TextSpacing
xRet.set( new TextSpacingContext( *this, maLineSpacing ) );
break;
- case NMSP_DRAWINGML|XML_spcBef: // CT_TextSpacing
+ case A_TOKEN( spcBef ): // CT_TextSpacing
xRet.set( new TextSpacingContext( *this, mrSpaceBefore ) );
break;
- case NMSP_DRAWINGML|XML_spcAft: // CT_TextSpacing
+ case A_TOKEN( spcAft ): // CT_TextSpacing
xRet.set( new TextSpacingContext( *this, mrSpaceAfter ) );
break;
// EG_TextBulletColor
- case NMSP_DRAWINGML|XML_buClrTx: // CT_TextBulletColorFollowText ???
+ case A_TOKEN( buClrTx ): // CT_TextBulletColorFollowText ???
mrBulletList.mbBulletColorFollowText <<= sal_True;
break;
- case NMSP_DRAWINGML|XML_buClr: // CT_Color
+ case A_TOKEN( buClr ): // CT_Color
xRet.set( new ColorContext( *this, *mrBulletList.maBulletColorPtr ) );
break;
// EG_TextBulletSize
- case NMSP_DRAWINGML|XML_buSzTx: // CT_TextBulletSizeFollowText
+ case A_TOKEN( buSzTx ): // CT_TextBulletSizeFollowText
mrBulletList.setBulletSize(100);
break;
- case NMSP_DRAWINGML|XML_buSzPct: // CT_TextBulletSizePercent
+ case A_TOKEN( buSzPct ): // CT_TextBulletSizePercent
mrBulletList.setBulletSize( static_cast<sal_Int16>( GetPercent( rXAttributes->getOptionalValue( XML_val ) ) / 1000 ) );
break;
- case NMSP_DRAWINGML|XML_buSzPts: // CT_TextBulletSizePoint
+ case A_TOKEN( buSzPts ): // CT_TextBulletSizePoint
mrBulletList.setBulletSize(0);
mrBulletList.setFontSize( static_cast<sal_Int16>(GetTextSize( rXAttributes->getOptionalValue( XML_val ) ) ) );
break;
// EG_TextBulletTypeface
- case NMSP_DRAWINGML|XML_buFontTx: // CT_TextBulletTypefaceFollowText
+ case A_TOKEN( buFontTx ): // CT_TextBulletTypefaceFollowText
mrBulletList.mbBulletFontFollowText <<= sal_True;
break;
- case NMSP_DRAWINGML|XML_buFont: // CT_TextFont
+ case A_TOKEN( buFont ): // CT_TextFont
mrBulletList.maBulletFont.setAttributes( aAttribs );
break;
// EG_TextBullet
- case NMSP_DRAWINGML|XML_buNone: // CT_TextNoBullet
+ case A_TOKEN( buNone ): // CT_TextNoBullet
mrBulletList.setNone();
break;
- case NMSP_DRAWINGML|XML_buAutoNum: // CT_TextAutonumberBullet
+ case A_TOKEN( buAutoNum ): // CT_TextAutonumberBullet
{
AttributeList attribs( rXAttributes );
try {
@@ -252,7 +249,7 @@ Reference< XFastContextHandler > TextParagraphPropertiesContext::createFastChild
}
break;
}
- case NMSP_DRAWINGML|XML_buChar: // CT_TextCharBullet
+ case A_TOKEN( buChar ): // CT_TextCharBullet
try {
mrBulletList.setBulletChar( rXAttributes->getValue( XML_char ) );
}
@@ -261,17 +258,17 @@ Reference< XFastContextHandler > TextParagraphPropertiesContext::createFastChild
OSL_TRACE("OOX: SAXException in XML_buChar");
}
break;
- case NMSP_DRAWINGML|XML_buBlip: // CT_TextBlipBullet
+ case A_TOKEN( buBlip ): // CT_TextBlipBullet
{
mxBlipProps.reset( new BlipFillProperties );
xRet.set( new BlipFillContext( *this, rXAttributes, *mxBlipProps ) );
}
break;
- case NMSP_DRAWINGML|XML_tabLst: // CT_TextTabStopList
+ case A_TOKEN( tabLst ): // CT_TextTabStopList
xRet.set( new TextTabStopListContext( *this, maTabList ) );
break;
- case NMSP_DRAWINGML|XML_defRPr: // CT_TextCharacterProperties
+ case A_TOKEN( defRPr ): // CT_TextCharacterProperties
xRet.set( new TextCharacterPropertiesContext( *this, rXAttributes, mrTextParagraphProperties.getTextCharacterProperties() ) );
break;
}
diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx
index cb8304b76d04..1e435defaa2d 100644
--- a/oox/source/drawingml/textrun.cxx
+++ b/oox/source/drawingml/textrun.cxx
@@ -35,7 +35,6 @@
#include "oox/helper/helper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/core/xmlfilterbase.hxx"
-#include "properties.hxx"
using ::rtl::OUString;
using namespace ::com::sun::star::uno;
diff --git a/oox/source/drawingml/textspacingcontext.cxx b/oox/source/drawingml/textspacingcontext.cxx
index 6bc6b79497d6..5eb5f3d77f82 100644
--- a/oox/source/drawingml/textspacingcontext.cxx
+++ b/oox/source/drawingml/textspacingcontext.cxx
@@ -27,10 +27,7 @@
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/textspacing.hxx"
-#include "oox/core/namespaces.hxx"
#include "textspacingcontext.hxx"
-#include "tokens.hxx"
-
using namespace ::oox::core;
using namespace ::com::sun::star::xml::sax;
@@ -52,17 +49,17 @@ namespace oox { namespace drawingml {
}
Reference< XFastContextHandler > TextSpacingContext::createFastChildContext( ::sal_Int32 aElement,
- const Reference< XFastAttributeList >& xAttribs )
+ const Reference< XFastAttributeList >& xAttribs )
throw ( SAXException, RuntimeException )
{
Reference< XFastContextHandler > xRet;
switch( aElement )
{
- case NMSP_DRAWINGML|XML_spcPct:
+ case A_TOKEN( spcPct ):
maSpacing.nUnit = TextSpacing::PERCENT;
maSpacing.nValue = GetPercent( xAttribs->getValue( XML_val ) );
break;
- case NMSP_DRAWINGML|XML_spcPts:
+ case A_TOKEN( spcPts ):
maSpacing.nUnit = TextSpacing::POINTS;
maSpacing.nValue = GetTextSpacingPoint( xAttribs->getValue( XML_val ) );
break;
diff --git a/oox/source/drawingml/texttabstoplistcontext.cxx b/oox/source/drawingml/texttabstoplistcontext.cxx
index 1a8affa898bb..78248fd0b6f7 100644
--- a/oox/source/drawingml/texttabstoplistcontext.cxx
+++ b/oox/source/drawingml/texttabstoplistcontext.cxx
@@ -30,10 +30,8 @@
#include <rtl/ustring.hxx>
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "texttabstoplistcontext.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -66,7 +64,7 @@ namespace oox { namespace drawingml {
Reference< XFastContextHandler > xRet;
switch( aElement )
{
- case NMSP_DRAWINGML|XML_tab:
+ case A_TOKEN( tab ):
{
OUString sValue;
TabStop aTabStop;
diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx
index 59245201eb61..b37ccdbaf13c 100644
--- a/oox/source/drawingml/theme.cxx
+++ b/oox/source/drawingml/theme.cxx
@@ -26,7 +26,6 @@
************************************************************************/
#include "oox/drawingml/theme.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
diff --git a/oox/source/drawingml/themeelementscontext.cxx b/oox/source/drawingml/themeelementscontext.cxx
index 7e8b5177498f..a27afdbc0ea3 100644
--- a/oox/source/drawingml/themeelementscontext.cxx
+++ b/oox/source/drawingml/themeelementscontext.cxx
@@ -32,9 +32,7 @@
#include "oox/drawingml/fillproperties.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/theme.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/attributelist.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -67,12 +65,12 @@ Reference< XFastContextHandler > FillStyleListContext::createFastChildContext( s
{
switch( nElement )
{
- case NMSP_DRAWINGML|XML_noFill:
- case NMSP_DRAWINGML|XML_solidFill:
- case NMSP_DRAWINGML|XML_gradFill:
- case NMSP_DRAWINGML|XML_blipFill:
- case NMSP_DRAWINGML|XML_pattFill:
- case NMSP_DRAWINGML|XML_grpFill:
+ case A_TOKEN( noFill ):
+ case A_TOKEN( solidFill ):
+ case A_TOKEN( gradFill ):
+ case A_TOKEN( blipFill ):
+ case A_TOKEN( pattFill ):
+ case A_TOKEN( grpFill ):
mrFillStyleList.push_back( FillPropertiesPtr( new FillProperties ) );
return FillPropertiesContext::createFillContext( *this, nElement, xAttribs, *mrFillStyleList.back() );
}
@@ -102,7 +100,7 @@ Reference< XFastContextHandler > LineStyleListContext::createFastChildContext( s
{
switch( nElement )
{
- case NMSP_DRAWINGML|XML_ln:
+ case A_TOKEN( ln ):
mrLineStyleList.push_back( LinePropertiesPtr( new LineProperties ) );
return new LinePropertiesContext( *this, xAttribs, *mrLineStyleList.back() );
}
@@ -131,7 +129,7 @@ Reference< XFastContextHandler > EffectStyleListContext::createFastChildContext(
{
switch( nElement )
{
- case NMSP_DRAWINGML|XML_effectStyle:
+ case A_TOKEN( effectStyle ):
mrEffectStyleList.push_back( EffectStyleList::value_type( new PropertyMap ) );
// TODO: import effect styles
return 0;
@@ -165,24 +163,24 @@ Reference< XFastContextHandler > FontSchemeContext::createFastChildContext( sal_
AttributeList aAttribs( rxAttribs );
switch( nElement )
{
- case NMSP_DRAWINGML|XML_majorFont:
+ case A_TOKEN( majorFont ):
mxCharProps.reset( new TextCharacterProperties );
mrFontScheme[ XML_major ] = mxCharProps;
return this;
- case NMSP_DRAWINGML|XML_minorFont:
+ case A_TOKEN( minorFont ):
mxCharProps.reset( new TextCharacterProperties );
mrFontScheme[ XML_minor ] = mxCharProps;
return this;
- case NMSP_DRAWINGML|XML_latin:
+ case A_TOKEN( latin ):
if( mxCharProps.get() )
mxCharProps->maLatinFont.setAttributes( aAttribs );
break;
- case NMSP_DRAWINGML|XML_ea:
+ case A_TOKEN( ea ):
if( mxCharProps.get() )
mxCharProps->maAsianFont.setAttributes( aAttribs );
break;
- case NMSP_DRAWINGML|XML_cs:
+ case A_TOKEN( cs ):
if( mxCharProps.get() )
mxCharProps->maComplexFont.setAttributes( aAttribs );
break;
@@ -194,8 +192,8 @@ void FontSchemeContext::endFastElement( sal_Int32 nElement ) throw (SAXException
{
switch( nElement )
{
- case NMSP_DRAWINGML|XML_majorFont:
- case NMSP_DRAWINGML|XML_minorFont:
+ case A_TOKEN( majorFont ):
+ case A_TOKEN( minorFont ):
mxCharProps.reset();
break;
}
@@ -215,22 +213,22 @@ Reference< XFastContextHandler > ThemeElementsContext::createFastChildContext( s
Reference< XFastContextHandler > xRet;
switch( nElement )
{
- case NMSP_DRAWINGML|XML_clrScheme: // CT_ColorScheme
+ case A_TOKEN( clrScheme ): // CT_ColorScheme
return new clrSchemeContext( *this, mrTheme.getClrScheme() );
- case NMSP_DRAWINGML|XML_fontScheme: // CT_FontScheme
+ case A_TOKEN( fontScheme ): // CT_FontScheme
return new FontSchemeContext( *this, mrTheme.getFontScheme() );
- case NMSP_DRAWINGML|XML_fmtScheme: // CT_StyleMatrix
+ case A_TOKEN( fmtScheme ): // CT_StyleMatrix
mrTheme.setStyleName( xAttribs->getOptionalValue( XML_name ) );
return this;
- case NMSP_DRAWINGML|XML_fillStyleLst: // CT_FillStyleList
+ case A_TOKEN( fillStyleLst ): // CT_FillStyleList
return new FillStyleListContext( *this, mrTheme.getFillStyleList() );
- case NMSP_DRAWINGML|XML_lnStyleLst: // CT_LineStyleList
+ case A_TOKEN( lnStyleLst ): // CT_LineStyleList
return new LineStyleListContext( *this, mrTheme.getLineStyleList() );
- case NMSP_DRAWINGML|XML_effectStyleLst: // CT_EffectStyleList
+ case A_TOKEN( effectStyleLst ): // CT_EffectStyleList
return new EffectStyleListContext( *this, mrTheme.getEffectStyleList() );
- case NMSP_DRAWINGML|XML_bgFillStyleLst: // CT_BackgroundFillStyleList
+ case A_TOKEN( bgFillStyleLst ): // CT_BackgroundFillStyleList
return new FillStyleListContext( *this, mrTheme.getBgFillStyleList() );
}
return 0;
diff --git a/oox/source/drawingml/themefragmenthandler.cxx b/oox/source/drawingml/themefragmenthandler.cxx
index 160db1881a25..3cae10e40b4f 100644
--- a/oox/source/drawingml/themefragmenthandler.cxx
+++ b/oox/source/drawingml/themefragmenthandler.cxx
@@ -56,23 +56,23 @@ ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, con
case XML_ROOT_CONTEXT:
switch( nElement )
{
- case NMSP_DRAWINGML|XML_theme:
+ case A_TOKEN( theme ):
return this;
}
break;
- case NMSP_DRAWINGML|XML_theme:
+ case A_TOKEN( theme ):
switch( nElement )
{
- case NMSP_DRAWINGML|XML_themeElements: // CT_BaseStyles
+ case A_TOKEN( themeElements ): // CT_BaseStyles
return new ThemeElementsContext( *this, mrTheme );
- case NMSP_DRAWINGML|XML_objectDefaults: // CT_ObjectStyleDefaults
+ case A_TOKEN( objectDefaults ): // CT_ObjectStyleDefaults
return new objectDefaultContext( *this, mrTheme );
- case NMSP_DRAWINGML|XML_extraClrSchemeLst: // CT_ColorSchemeList
+ case A_TOKEN( extraClrSchemeLst ): // CT_ColorSchemeList
return 0;
- case NMSP_DRAWINGML|XML_custClrLst: // CustomColorList
+ case A_TOKEN( custClrLst ): // CustomColorList
return 0;
- case NMSP_DRAWINGML|XML_ext: // CT_OfficeArtExtension
+ case A_TOKEN( ext ): // CT_OfficeArtExtension
return 0;
}
break;
diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index 43748bd1089a..c686feed165c 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -26,7 +26,6 @@
************************************************************************/
#include "oox/drawingml/transform2dcontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/drawingml/shape.hxx"
@@ -58,15 +57,15 @@ Reference< XFastContextHandler > Transform2DContext::createFastChildContext( sal
{
switch( aElementToken )
{
- case NMSP_DRAWINGML|XML_off: // horz/vert translation
+ case A_TOKEN( off ): // horz/vert translation
mrShape.setPosition( Point( xAttribs->getOptionalValue( XML_x ).toInt32(), xAttribs->getOptionalValue( XML_y ).toInt32() ) );
break;
- case NMSP_DRAWINGML|XML_ext: // horz/vert size
+ case A_TOKEN( ext ): // horz/vert size
mrShape.setSize( Size( xAttribs->getOptionalValue( XML_cx ).toInt32(), xAttribs->getOptionalValue( XML_cy ).toInt32() ) );
break;
/* todo: what to do?
- case NMSP_DRAWINGML|XML_chOff: // horz/vert translation of children
- case NMSP_DRAWINGML|XML_chExt: // horz/vert size of children
+ case A_TOKEN( chOff ): // horz/vert translation of children
+ case A_TOKEN( chExt ): // horz/vert size of children
break;
*/
}
diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx
index b78c993a0968..4e9156b5cc03 100644
--- a/oox/source/dump/biffdumper.cxx
+++ b/oox/source/dump/biffdumper.cxx
@@ -29,8 +29,8 @@
#include <osl/thread.h>
#include <rtl/tencinfo.h>
-#include "oox/dump/oledumper.hxx"
#include "oox/core/filterbase.hxx"
+#include "oox/dump/oledumper.hxx"
#include "oox/ole/olestorage.hxx"
#include "oox/xls/biffdetector.hxx"
#include "oox/xls/biffinputstream.hxx"
@@ -38,23 +38,27 @@
#if OOX_INCLUDE_DUMPER
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
+namespace oox {
+namespace dump {
+namespace biff {
+
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::oox::xls;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::FilterBase;
using ::rtl::OString;
using ::rtl::OStringBuffer;
using ::rtl::OStringToOUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::util::DateTime;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::io::XInputStream;
-using ::comphelper::MediaDescriptor;
-using ::oox::core::FilterBase;
-
-using namespace ::oox::xls;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
-namespace oox {
-namespace dump {
-namespace biff {
+// ============================================================================
namespace {
@@ -93,12 +97,7 @@ const sal_uInt16 BIFF_STYLE_BUILTIN = 0x8000;
const sal_uInt16 BIFF_PT_NOSTRING = 0xFFFF;
-} // namespace
-
-// ============================================================================
-// ============================================================================
-
-namespace {
+// ----------------------------------------------------------------------------
void lclDumpDffClientPos( const OutputRef& rxOut, const BinaryInputStreamRef& rxStrm, const String& rName, sal_uInt16 nSubScale )
{
@@ -128,7 +127,8 @@ void lclDumpDffClientRect( const OutputRef& rxOut, const BinaryInputStreamRef& r
} // namespace
-// ----------------------------------------------------------------------------
+// ============================================================================
+// ============================================================================
BiffDffStreamObject::BiffDffStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
{
@@ -537,6 +537,26 @@ OUString BiffObjectBase::dumpString( const String& rName, BiffStringFlags nByteF
return (getBiff() == BIFF8) ? dumpUniString( rName, nUniFlags ) : dumpByteString( rName, nByteFlags, eDefaultTextEnc );
}
+OUString BiffObjectBase::dumpSegmentedUniString( const String& rName )
+{
+ sal_Int32 nLength = mxBiffStrm->readInt32();
+ OUStringBuffer aBuffer;
+ while( !mxBiffStrm->isEof() && (aBuffer.getLength() < nLength) )
+ aBuffer.append( mxBiffStrm->readUniString() );
+ OUString aString = aBuffer.makeStringAndClear();
+ writeStringItem( rName, aString );
+ return aString;
+}
+
+void BiffObjectBase::dumpSegmentedUniStringArray( const String& rName )
+{
+ writeEmptyItem( rName );
+ IndentGuard aIndGuard( mxOut );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !mxBiffStrm->isEof() && (nIndex < nCount); ++nIndex )
+ dumpSegmentedUniString( "#entry" );
+}
+
sal_uInt8 BiffObjectBase::dumpBoolean( const String& rName )
{
sal_uInt8 nBool;
@@ -2066,6 +2086,69 @@ void WorkbookStreamObject::implDumpRecordBody()
dumpBool< sal_uInt32 >( "recommend-compress-pics" );
break;
+ case BIFF_ID_CONNECTION:
+ {
+ dumpFrHeader( true, false );
+ sal_uInt16 nType = dumpDec< sal_uInt16 >( "data-source-type", "CONNECTION-SOURCETYPE" );
+ sal_uInt16 nFlags1 = dumpHex< sal_uInt16 >( "flags", "CONNECTION-FLAGS" );
+ dumpDec< sal_uInt16 >( "param-count" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "querytable-flags", "QUERYTABLESETTINGS-FLAGS" );
+ switch( nType )
+ {
+ case 4: dumpHex< sal_uInt16 >( "html-flags", "QUERYTABLESETTINGS-HTML-FLAGS" ); break;
+ case 5: dumpHex< sal_uInt16 >( "oledb-flags", "QUERYTABLESETTINGS-OLEDB-FLAGS" ); break;
+ case 7: dumpHex< sal_uInt16 >( "ado-flags", "QUERYTABLESETTINGS-ADO-FLAGS" ); break;
+ default: dumpUnused( 2 );
+ }
+ dumpDec< sal_uInt8 >( "edited-version" );
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpDec< sal_uInt16 >( "refresh-interval", "QUERYTABLESETTINGS-INTERVAL" );
+ dumpDec< sal_uInt16 >( "html-format", "QUERYTABLESETTINGS-HTMLFORMAT" );
+ dumpDec< sal_Int32 >( "reconnect-type", "CONNECTION-RECONNECTTYPE" );
+ dumpDec< sal_uInt8 >( "credentials", "CONNECTION-CREDENTIALS" );
+ dumpUnused( 1 );
+ dumpSegmentedUniString( "source-file" );
+ dumpSegmentedUniString( "source-conn-file" );
+ dumpSegmentedUniString( "name" );
+ dumpSegmentedUniString( "description" );
+ dumpSegmentedUniString( "sso-id" );
+ if( nFlags1 & 0x0004 ) dumpSegmentedUniString( "table-names" );
+ if( nFlags1 & 0x0010 )
+ {
+ break; // TODO: parameter array structure
+ }
+ bool bEscape = false;
+ switch( nType )
+ {
+ case 1:
+ dumpSegmentedUniString( "connection-string" );
+ break;
+ case 4:
+ dumpSegmentedUniStringArray( "urls" );
+ dumpSegmentedUniStringArray( "post-method" );
+ break;
+ case 5:
+ bEscape = true;
+ break;
+ case 6:
+ bEscape = true;
+ break;
+ }
+ if( bEscape )
+ break;
+ dumpSegmentedUniStringArray( "sql-command" );
+ dumpSegmentedUniStringArray( "orig-sql-command" );
+ dumpSegmentedUniStringArray( "webquery-dialog-url" );
+ switch( dumpDec< sal_uInt8 >( "linked-object-type", "CONNECTION-LINKEDOBJECTTYPE" ) )
+ {
+ case 1: dumpSegmentedUniString( "defined-name" ); break;
+ case 2: dumpHex< sal_uInt16 >( "cache-id" ); break;
+ }
+ }
+ break;
+
case BIFF_ID_CONT:
if( (eBiff == BIFF8) && (getLastRecId() == BIFF_ID_OBJ) )
dumpEmbeddedDff();
@@ -2177,6 +2260,21 @@ void WorkbookStreamObject::implDumpRecordBody()
dumpDec< sal_uInt16 >( "#cell-offset" );
break;
+ case BIFF_ID_DBQUERY:
+ if( eBiff == BIFF8 )
+ {
+ if( (getLastRecId() != BIFF_ID_PCITEM_STRING) && (getLastRecId() != BIFF_ID_DBQUERY) )
+ {
+ dumpHex< sal_uInt16 >( "flags", "DBQUERY-FLAGS" );
+ dumpDec< sal_uInt16 >( "sql-param-count" );
+ dumpDec< sal_uInt16 >( "command-count" );
+ dumpDec< sal_uInt16 >( "post-method-count" );
+ dumpDec< sal_uInt16 >( "server-sql-count" );
+ dumpDec< sal_uInt16 >( "odbc-connection-count" );
+ }
+ }
+ break;
+
case BIFF2_ID_DEFINEDNAME:
case BIFF3_ID_DEFINEDNAME:
{
@@ -2335,6 +2433,19 @@ void WorkbookStreamObject::implDumpRecordBody()
dumpString( "password-creator", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
break;
+ case BIFF_ID_FILTERCOLUMN:
+ {
+ dumpDec< sal_uInt16 >( "column-index" );
+ dumpHex< sal_uInt16 >( "flags", "FILTERCOLUMN-FLAGS" );
+ sal_uInt8 nStrLen1 = dumpFilterColumnOperator( "operator-1" );
+ sal_uInt8 nStrLen2 = dumpFilterColumnOperator( "operator-2" );
+ bool bBiff8 = eBiff == BIFF8;
+ rtl_TextEncoding eTextEnc = getBiffData().getTextEncoding();
+ if( nStrLen1 > 0 ) writeStringItem( "string-1", bBiff8 ? rStrm.readUniStringBody( nStrLen1, true ) : rStrm.readCharArrayUC( nStrLen1, eTextEnc, true ) );
+ if( nStrLen2 > 0 ) writeStringItem( "string-2", bBiff8 ? rStrm.readUniStringBody( nStrLen2, true ) : rStrm.readCharArrayUC( nStrLen2, eTextEnc, true ) );
+ }
+ break;
+
case BIFF2_ID_FONT:
case BIFF3_ID_FONT:
dumpFontRec();
@@ -2715,6 +2826,58 @@ void WorkbookStreamObject::implDumpRecordBody()
}
break;
+ case BIFF_ID_QUERYTABLE:
+ dumpHex< sal_uInt16 >( "flags", "QUERYTABLE-FLAGS" );
+ dumpDec< sal_uInt16 >( "autoformat-id" );
+ dumpHex< sal_uInt16 >( "autoformat-flags", "QUERYTABLE-AUTOFORMAT-FLAGS" );
+ dumpUnused( 4 );
+ dumpUniString( "defined-name" );
+ dumpUnused( 2 );
+ break;
+
+ case BIFF_ID_QUERYTABLEREFRESH:
+ {
+ dumpFrHeader( true, false );
+ bool bPivot = dumpBool< sal_uInt16 >( "pivot-table" );
+ dumpHex< sal_uInt16 >( "flags", "QUERYTABLEREFRESH-FLAGS" );
+ dumpHex< sal_uInt32 >( bPivot ? "pivottable-flags" : "querytable-flags", bPivot ? "QUERYTABLEREFRESH-PTFLAGS" : "QUERYTABLEREFRESH-QTFLAGS" );
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpUnused( 2 );
+ dumpUniString( "table-name" );
+ dumpUnused( 2 );
+ }
+ break;
+
+ case BIFF_ID_QUERYTABLESETTINGS:
+ {
+ dumpFrHeader( true, false );
+ sal_uInt16 nType = dumpDec< sal_uInt16 >( "data-source-type", "CONNECTION-SOURCETYPE" );
+ dumpHex< sal_uInt16 >( "flags-1", "QUERYTABLESETTINGS-FLAGS" );
+ switch( nType )
+ {
+ case 4: dumpHex< sal_uInt16 >( "html-flags", "QUERYTABLESETTINGS-HTML-FLAGS" ); break;
+ case 5: dumpHex< sal_uInt16 >( "oledb-flags", "QUERYTABLESETTINGS-OLEDB-FLAGS" ); break;
+ case 7: dumpHex< sal_uInt16 >( "ado-flags", "QUERYTABLESETTINGS-ADO-FLAGS" ); break;
+ default: dumpUnused( 2 );
+ }
+ dumpHex< sal_uInt16 >( "ext-flags", "QUERYTABLESETTINGS-EXT-FLAGS" );
+ dumpDec< sal_uInt8 >( "edited-version" );
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpUnused( 3 );
+ dumpDec< sal_uInt16 >( "oledb-count" );
+ dumpDec< sal_uInt16 >( "future-data-size" );
+ dumpDec< sal_uInt16 >( "refresh-interval", "QUERYTABLESETTINGS-INTERVAL" );
+ dumpDec< sal_uInt16 >( "html-format", "QUERYTABLESETTINGS-HTMLFORMAT" );
+ }
+ break;
+
+ case BIFF_ID_QUERYTABLESTRING:
+ dumpFrHeader( true, false );
+ dumpUniString( "connection-string" );
+ break;
+
case BIFF_ID_RECALCID:
dumpFrHeader( true, false );
dumpDec< sal_uInt32 >( "recalc-engine-id" );
@@ -2896,18 +3059,6 @@ void WorkbookStreamObject::implDumpRecordBody()
dumpDxfProp();
break;
- case BIFF_ID_SXEXT:
- if( eBiff == BIFF8 )
- {
- dumpHex< sal_uInt16 >( "flags", "SXEXT-FLAGS" );
- dumpDec< sal_uInt16 >( "param-string-count" );
- dumpDec< sal_uInt16 >( "sql-statement-string-count" );
- dumpDec< sal_uInt16 >( "webquery-postmethod-string-count" );
- dumpDec< sal_uInt16 >( "server-pagefields-string-count" );
- dumpDec< sal_uInt16 >( "odbc-connection-string-count" );
- }
- break;
-
case BIFF_ID_TABLESTYLES:
{
dumpFrHeader( true, true );
@@ -3122,6 +3273,38 @@ void WorkbookStreamObject::dumpExtGradientHead()
dumpDec< double >( "pos-bottom" );
}
+sal_uInt8 WorkbookStreamObject::dumpFilterColumnOperator( const String& rName )
+{
+ sal_uInt8 nStrLen = 0;
+ writeEmptyItem( rName );
+ IndentGuard aIndGuard( mxOut );
+ sal_uInt8 nType = dumpDec< sal_uInt8 >( "data-type", "FILTERCOLUMN-DATATYPE" );
+ dumpDec< sal_uInt8 >( "operator", "FILTERCOLUMN-OPERATOR" );
+ switch( nType )
+ {
+ case 2:
+ dumpRk( "value" );
+ dumpUnused( 4 );
+ break;
+ case 4:
+ dumpDec< double >( "value" );
+ break;
+ case 6:
+ dumpUnused( 4 );
+ nStrLen = dumpDec< sal_uInt8 >( "length" );
+ dumpBoolean( "simple" );
+ dumpUnused( 2 );
+ break;
+ case 8:
+ dumpBoolErr();
+ dumpUnused( 6 );
+ break;
+ default:
+ dumpUnused( 8 );
+ }
+ return nStrLen;
+}
+
OUString WorkbookStreamObject::dumpPivotString( const String& rName, sal_uInt16 nStrLen )
{
OUString aString;
@@ -3151,9 +3334,9 @@ void WorkbookStreamObject::dumpBoolErr()
{
MultiItemsGuard aMultiGuard( mxOut );
sal_uInt8 nValue = dumpHex< sal_uInt8 >( "value" );
- bool bErrCode = dumpBool< sal_uInt8 >( "is-errorcode" );
+ bool bErrCode = dumpBool< sal_uInt8 >( "is-error-code" );
if( bErrCode )
- writeErrorCodeItem( "errorcode", nValue );
+ writeErrorCodeItem( "error-code", nValue );
else
writeBooleanItem( "boolean", nValue );
}
@@ -4362,10 +4545,10 @@ void Dumper::implDump()
}
// ============================================================================
+// ============================================================================
} // namespace biff
} // namespace dump
} // namespace oox
#endif
-
diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini
index d4b862825b3c..f32ed89334f8 100644
--- a/oox/source/dump/biffdumper.ini
+++ b/oox/source/dump/biffdumper.ini
@@ -344,14 +344,14 @@ multilist=RECORD-NAMES-BIFF5
0x0018=DEFINEDNAME
0x0023=EXTERNALNAME
0x0031=FONT
- 0x0098=,,,FILTERMODE,,AUTOFILTERINFO,AUTOFILTER,
+ 0x0098=,,,FILTERMODE,,AUTOFILTER,FILTERCOLUMN,
0x00A8=,,,,,,SCENARIOS,SCENARIO
0x00B0=PTDEFINITION,PTFIELD,PTFITEM,,PTROWCOLFIELDS,PTROWCOLITEMS,PTPAGEFIELDS,
0x00B8=DOCROUTE,RECIPNAME,,,,MULTRK,MULTBLANK,TOOLBARHDR
0x00C0=TOOLBAREND,MMS,ADDMENU,DELMENU,,PTDATAFIELD,PCDEFINITION,PCDFIELD
0x00C8=PCITEM_INDEXLIST,PCITEM_DOUBLE,PCITEM_BOOL,PCITEM_ERROR,PCITEM_INTEGER,PCITEM_STRING,PCITEM_DATE,PCITEM_MISSING
0x00D0=SXTBL,SXTBRGITEM,SXTBPG,VBAPROJECT,,PIVOTCACHE,RSTRING,DBCELL
- 0x00D8=PCDFRANGEPR,PCDFDISCRETEPR,BOOKBOOL,REVERT,SXEXT|PARAMQRY,SCENPROTECT,OLESIZE,UDDESC
+ 0x00D8=PCDFRANGEPR,PCDFDISCRETEPR,BOOKBOOL,REVERT,DBORPARAMQUERY,SCENPROTECT,OLESIZE,UDDESC
0x00E0=XF,INTERFACEHDR,INTERFACEEND,PCDSOURCE,,,,
0x0206=FORMULA
0x04BC=SHAREDFMLA
@@ -379,17 +379,18 @@ multilist=RECORD-NAMES-BIFF8
0x0158=,,,,,,,LABELRANGES
0x0160=USESELFS,DSF,XL5MODIFY,,,,,
0x0190=,,,,,,CHTRHEADER,
- 0x01A8=,USERBVIEW,USERSVIEWBEGIN,USERSVIEWEND,,QSI,EXTERNALBOOK,PROT4REV
+ 0x01A8=,USERBVIEW,USERSVIEWBEGIN,USERSVIEWEND,,QUERYTABLE,EXTERNALBOOK,PROT4REV
0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBINAME,TXO,REFRESHALL
0x01B8=HYPERLINK,NLRDELNAME,CODENAME,PCDFSQLTYPE,PROT4REVPASS,VBAPROJECTEMPTY,DATAVALIDATION,
0x01C0=XL9FILE,RECALCID,INTCACHEDDATA,,,,,
# future records
- 0x0800=SCREENTIP,,,WEBQRYSETTINGS,WEBQRYTABLES,,,
+ 0x0800=SCREENTIP,,QUERYTABLEREFRESH,QUERYTABLESETTINGS,QUERYTABLESTRING,,,
0x0850=CHFRINFO,CHFRWRAPPER,CHFRBLOCKBEGIN,CHFRBLOCKEND,,,CHFRCATEGORYPROPS,CHFRUNITPROPS
0x0858=CHPIVOTREF,CHPIVOTFLAGS,,,,,,
0x0860=,,SHEETEXT,BOOKEXT,,,,SHAREDFEATHEAD
0x0868=,,,CHFRLABELPROPS,,,,
- 0x0878=,,CFRULE12,CFRULEEXT,XFCRC,XFEXT,,
+ 0x0870=,,,,,,CONNECTION,
+ 0x0878=,,CFRULE12,CFRULEEXT,XFCRC,XFEXT,FILTERCOLUMN12,CONTINUE12
0x0888=,,,PAGELAYOUTVIEW,CHECKCOMPAT,DXF,TABLESTYLES,
0x0890=,,STYLEEXT,,,,THEME,
0x0898=,,MTHREADSETTINGS,COMPRESSPICS,HEADERFOOTER,CHFRLAYOUT,CHFREXTPROPS,CHFREXTPROPSCONT
@@ -464,6 +465,7 @@ end
constlist=SIMPLE-RECORDS-BIFF5
include=SIMPLE-RECORDS-BIFF4
+ 0x009D=uint16,dec,column-count
0x00C9=double,dec,value
0x00CA=uint16,bool,value
0x00CB=uint16,hex,error-code,ERRORCODES
@@ -1229,6 +1231,26 @@ combilist=COLINFO-FLAGS
0x1000=outline-collapsed
end
+# CONNECTION -----------------------------------------------------------------
+
+shortlist=CONNECTION-SOURCETYPE,1,odbc,dao,file,html,ole-db,text,ado,dsp
+
+flagslist=CONNECTION-FLAGS
+ 0x0001=save-password
+ 0x0002=html-tables
+ 0x0004=table-names
+ 0x0008=deleted
+ 0x0010=stand-alone
+ 0x0020=only-use-conn-file
+ 0x0040=background
+ 0x0080=refresh-on-load
+ 0x0100=save-data
+end
+
+shortlist=CONNECTION-RECONNECTTYPE,0,as-required,always,never
+shortlist=CONNECTION-CREDENTIALS,0,integrated,none,stored-sso,prompt
+shortlist=CONNECTION-LINKEDOBJECTTYPE,0,none,query-table,pivot-cache
+
# DATATABLE ------------------------------------------------------------------
flagslist=DATATABLE-FLAGS-BIFF3
@@ -1273,6 +1295,18 @@ end
shortlist=DATEMODE,0,1899-12-31,1904-01-01
+# DBQUERY --------------------------------------------------------------------
+
+combilist=DBQUERY-FLAGS
+ 0x0007=uint8,dec,source-type,CONNECTION-SOURCETYPE
+ 0x0008=odbc-connection
+ 0x0010=sql-query
+ 0x0020=server-sql
+ 0x0040=html-query
+ 0x0080=save-password
+ 0x0100=html-tables
+end
+
# DEFINEDNAME ----------------------------------------------------------------
flagslist=DEFINEDNAME-FLAGS-BIFF2
@@ -1380,6 +1414,30 @@ end
shortlist=FILEPASS-TYPE,0,xor,rc4
shortlist=FILEPASS-MAJOR,1,rc4,crypto-api-2003,crypto-api-2007
+# FILTERCOLUMN ---------------------------------------------------------------
+
+combilist=FILTERCOLUMN-FLAGS
+ 0x0001=!and!or
+ 0x0004=op-1-simple
+ 0x0008=op-2-simple
+ 0x0010=top-10
+ 0x0020=!bottom!top
+ 0x0040=percent
+ 0xFF80=uint16,dec,top-10-count
+end
+
+constlist=FILTERCOLUMN-DATATYPE
+ 0=none
+ 2=rk
+ 4=double
+ 6=string
+ 8=boolean
+ 12=blank
+ 14=not-blank
+end
+
+shortlist=FILTERCOLUMN-OPERATOR,0,none,less,equal,less-equal,greater,not-equal,greater-equal
+
# FONT -----------------------------------------------------------------------
flagslist=FONT-FLAGS
@@ -1874,6 +1932,101 @@ combilist=PTROWCOLITEMS-FLAGS
0x1000=multi-data
end
+# QUERYTABLE -----------------------------------------------------------------
+
+combilist=QUERYTABLE-FLAGS
+ 0x0001=headers
+ 0x0002=row-numbers
+ 0x0004=disable-refresh
+ 0x0008=background
+ 0x0010=first-background
+ 0x0020=refresh-on-load
+ 0x0040=delete-unused
+ 0x0080=fill-formulas
+ 0x0100=adjust-column-width
+ 0x0200=save-data
+ 0x0400=disable-edit
+ 0x2000=overwrite-existing
+end
+
+combilist=QUERYTABLE-AUTOFORMAT-FLAGS
+ 0x0001=apply-num-fmt
+ 0x0002=apply-font
+ 0x0004=apply-alignment
+ 0x0008=apply-border
+ 0x0010=apply-fill
+ 0x0020=apply-protection
+end
+
+# QUERYTABLEREFRESH ----------------------------------------------------------
+
+flagslist=QUERYTABLEREFRESH-FLAGS
+ 0x0001=enable-refresh
+ 0x0002=pivot-cache-invalid
+ 0x0004=olap-pivot-table
+end
+
+flagslist=QUERYTABLEREFRESH-PTFLAGS
+ 0x00000001=disable-draw-drop
+ 0x00000002=hide-totals-annotation
+ 0x00000008=include-empty-rows
+ 0x00000010=include-empty-columns
+end
+
+flagslist=QUERYTABLEREFRESH-QTFLAGS
+ 0x00000001=preserve-formatting
+ 0x00000002=adjust-column-width
+ 0x00000010=ext-data-list
+ 0x00000040=create-table-list
+ 0x00000080=create-dummy-list
+end
+
+# QUERYTABLESETTINGS ---------------------------------------------------------
+
+flagslist=QUERYTABLESETTINGS-FLAGS
+ 0x0001=keep-alive
+ 0x0002=new
+ 0x0004=source-data
+ 0x0008=web-based-prov
+ 0x0010=reinit-list
+ 0x0080=xml
+end
+
+flagslist=QUERYTABLESETTINGS-HTML-FLAGS
+ 0x0001=parse-pre
+ 0x0002=consecutive-delimiters
+ 0x0004=first-row
+ 0x0008=xl97-created
+ 0x0010=text-dates
+ 0x0020=xl2000-refreshed
+end
+
+combilist=QUERYTABLESETTINGS-OLEDB-FLAGS
+ 0x0007=uint8,dec,command-type,QUERYTABLESETTINGS-OLEDB-COMMANDTYPE
+ 0x0008=alt-connection-string
+ 0x0010=no-refresh-cube
+ 0x0020=olap-has-locale
+ 0x0040=server-num-fmt
+ 0x0080=server-fill-color
+ 0x0100=server-font-color
+ 0x0200=server-font-format
+ 0x0400=olap-member-l10n
+end
+
+shortlist=QUERYTABLESETTINGS-OLEDB-COMMANDTYPE,0,none,cube,sql,table,default,list
+
+flagslist=QUERYTABLESETTINGS-ADO-FLAGS
+ 0x0100=ado-refreshable
+end
+
+flagslist=QUERYTABLESETTINGS-EXT-FLAGS
+ 0x0001=text-query
+ 0x0002=table-names
+end
+
+unitconverter=QUERYTABLESETTINGS-INTERVAL,60,sec
+shortlist=QUERYTABLESETTINGS-HTMLFORMAT,1,none,rtf,all
+
# REFMODE --------------------------------------------------------------------
shortlist=REFMODE,0,R1C1,A1
@@ -1998,20 +2151,6 @@ multilist=STYLEEXT-BUILTIN
50=20%-accent6,40%-accent6,60%-accent6,explanatory-text
end
-# SXEXT ----------------------------------------------------------------------
-
-combilist=SXEXT-FLAGS
- 0x0007=uint8,dec,source-type,SXEXT-SOURCETYPE
- 0x0008=odbc-connection
- 0x0010=odbc-sql
- 0x0020=server-pagefields
- 0x0040=webquery
- 0x0080=save-password
- 0x0100=tables-html-only
-end
-
-shortlist=SXEXT-SOURCETYPE,1,odbc,dao,,webquery
-
# THEME ----------------------------------------------------------------------
constlist=THEME-VERSION
@@ -2235,4 +2374,3 @@ multilist=XFEXT-SUBREC
end
# ============================================================================
-
diff --git a/oox/source/dump/dffdumper.cxx b/oox/source/dump/dffdumper.cxx
index 8730698561ce..01994865c69d 100644
--- a/oox/source/dump/dffdumper.cxx
+++ b/oox/source/dump/dffdumper.cxx
@@ -29,13 +29,15 @@
#if OOX_INCLUDE_DUMPER
-using ::rtl::OUString;
-
namespace oox {
namespace dump {
// ============================================================================
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
const sal_uInt16 DFF_ID_BSE = 0xF007; /// BLIP store entry.
@@ -320,4 +322,3 @@ sal_uInt16 DffStreamObject::dumpDffOptPropHeader()
} // namespace oox
#endif
-
diff --git a/oox/source/dump/dffdumper.ini b/oox/source/dump/dffdumper.ini
index c33d733c6bd8..5526663e0e15 100644
--- a/oox/source/dump/dffdumper.ini
+++ b/oox/source/dump/dffdumper.ini
@@ -648,4 +648,3 @@ combilist=DFFSPLITMENUC-RECORD-INST
end
# ============================================================================
-
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index 53452765288a..f7c6c6102b1d 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -29,46 +29,45 @@
#include <algorithm>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XTextInputStream.hpp>
#include <com/sun/star/io/XTextOutputStream.hpp>
-#include <rtl/math.hxx>
-#include <osl/file.hxx>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <comphelper/docpasswordhelper.hxx>
+#include <osl/file.hxx>
+#include <rtl/math.hxx>
+#include "oox/core/filterbase.hxx"
#include "oox/helper/binaryoutputstream.hxx"
#include "oox/helper/textinputstream.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/xls/biffhelper.hxx"
#if OOX_INCLUDE_DUMPER
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::FilterBase;
using ::rtl::OString;
using ::rtl::OStringBuffer;
using ::rtl::OStringToOUString;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::rtl::OUStringToOString;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::util::DateTime;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::ucb::XSimpleFileAccess;
-using ::com::sun::star::io::XActiveDataSink;
-using ::com::sun::star::io::XActiveDataSource;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XTextInputStream;
-using ::com::sun::star::io::XTextOutputStream;
-using ::comphelper::MediaDescriptor;
-using ::oox::core::FilterBase;
-using namespace ::com::sun::star;
+// ============================================================================
-namespace oox {
-namespace dump {
+namespace {
const sal_Unicode OOX_DUMP_BOM = 0xFEFF;
const sal_Int32 OOX_DUMP_MAXSTRLEN = 80;
@@ -81,6 +80,8 @@ const sal_Unicode OOX_DUMP_ITEMSEP = '=';
const sal_Int32 OOX_DUMP_BYTESPERLINE = 16;
const sal_Int64 OOX_DUMP_MAXARRAY = 16;
+} // namespace
+
// ============================================================================
// ============================================================================
@@ -1583,16 +1584,16 @@ NameListRef SharedConfigData::getNameList( const OUString& rListName ) const
return xList;
}
-uno::Sequence< beans::NamedValue > SharedConfigData::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier )
+Sequence< NamedValue > SharedConfigData::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier )
{
- uno::Sequence< beans::NamedValue > aEncryptionData;
+ Sequence< NamedValue > aEncryptionData;
if( !mbPwCancelled )
{
::std::vector< OUString > aDefaultPasswords;
aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) );
aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
rVerifier, mrMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords );
- mbPwCancelled = aEncryptionData.getLength() == 0;
+ mbPwCancelled = !aEncryptionData.hasElements();
}
return aEncryptionData;
}
@@ -1714,7 +1715,7 @@ void Config::construct( const Config& rParent )
void Config::construct( const sal_Char* pcEnvVar, const FilterBase& rFilter )
{
if( rFilter.getFileUrl().getLength() > 0 )
- construct( pcEnvVar, rFilter.getGlobalFactory(), rFilter.getStorage(), rFilter.getFileUrl(), rFilter.getMediaDescriptor() );
+ construct( pcEnvVar, rFilter.getServiceFactory(), rFilter.getStorage(), rFilter.getFileUrl(), rFilter.getMediaDescriptor() );
}
void Config::construct( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc )
@@ -1766,7 +1767,7 @@ NameListRef Config::getNameList( const String& rListName ) const
return implGetNameList( rListName );
}
-uno::Sequence< beans::NamedValue > Config::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier )
+Sequence< NamedValue > Config::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier )
{
return mxCfgData->requestEncryptionData( rVerifier );
}
@@ -3214,4 +3215,3 @@ void DumperBase::construct( const ConfigRef& rxConfig )
} // namespace oox
#endif
-
diff --git a/oox/source/dump/dumperbase.ini b/oox/source/dump/dumperbase.ini
index 34ef302c784c..28aa59a03b81 100644
--- a/oox/source/dump/dumperbase.ini
+++ b/oox/source/dump/dumperbase.ini
@@ -393,4 +393,3 @@ multilist=SYSTEMCOLOR
end
# ============================================================================
-
diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx
index cc49ee050ea6..bd2a0e05ecce 100644
--- a/oox/source/dump/oledumper.cxx
+++ b/oox/source/dump/oledumper.cxx
@@ -26,30 +26,33 @@
************************************************************************/
#include "oox/dump/oledumper.hxx"
+
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
-#include <osl/thread.h>
#include <osl/file.hxx>
+#include <osl/thread.h>
#include <rtl/tencinfo.h>
-#include "oox/helper/binaryoutputstream.hxx"
#include "oox/core/filterbase.hxx"
+#include "oox/helper/binaryoutputstream.hxx"
#include "oox/ole/olestorage.hxx"
#include "oox/ole/vbainputstream.hxx"
#if OOX_INCLUDE_DUMPER
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::rtl::OString;
-using ::rtl::OStringToOUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-
namespace oox {
namespace dump {
// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OString;
+using ::rtl::OStringToOUString;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
// ============================================================================
OUString OleInputObjectBase::dumpAnsiString32( const String& rName )
@@ -302,28 +305,32 @@ namespace {
const sal_Int32 OLEPROP_ID_DICTIONARY = 0;
const sal_Int32 OLEPROP_ID_CODEPAGE = 1;
-const sal_Int32 OLEPROP_TYPE_INT16 = 2;
-const sal_Int32 OLEPROP_TYPE_INT32 = 3;
-const sal_Int32 OLEPROP_TYPE_FLOAT = 4;
-const sal_Int32 OLEPROP_TYPE_DOUBLE = 5;
-const sal_Int32 OLEPROP_TYPE_DATE = 7;
-const sal_Int32 OLEPROP_TYPE_STRING = 8;
-const sal_Int32 OLEPROP_TYPE_STATUS = 10;
-const sal_Int32 OLEPROP_TYPE_BOOL = 11;
-const sal_Int32 OLEPROP_TYPE_VARIANT = 12;
-const sal_Int32 OLEPROP_TYPE_INT8 = 16;
-const sal_Int32 OLEPROP_TYPE_UINT8 = 17;
-const sal_Int32 OLEPROP_TYPE_UINT16 = 18;
-const sal_Int32 OLEPROP_TYPE_UINT32 = 19;
-const sal_Int32 OLEPROP_TYPE_INT64 = 20;
-const sal_Int32 OLEPROP_TYPE_UINT64 = 21;
-const sal_Int32 OLEPROP_TYPE_STRING8 = 30;
-const sal_Int32 OLEPROP_TYPE_STRING16 = 31;
-const sal_Int32 OLEPROP_TYPE_FILETIME = 64;
-const sal_Int32 OLEPROP_TYPE_BLOB = 65;
-const sal_Int32 OLEPROP_TYPE_STREAM = 66;
-const sal_Int32 OLEPROP_TYPE_STORAGE = 67;
-const sal_Int32 OLEPROP_TYPE_CLIPFMT = 71;
+const sal_uInt16 OLEPROP_TYPE_INT16 = 2;
+const sal_uInt16 OLEPROP_TYPE_INT32 = 3;
+const sal_uInt16 OLEPROP_TYPE_FLOAT = 4;
+const sal_uInt16 OLEPROP_TYPE_DOUBLE = 5;
+const sal_uInt16 OLEPROP_TYPE_DATE = 7;
+const sal_uInt16 OLEPROP_TYPE_STRING = 8;
+const sal_uInt16 OLEPROP_TYPE_STATUS = 10;
+const sal_uInt16 OLEPROP_TYPE_BOOL = 11;
+const sal_uInt16 OLEPROP_TYPE_VARIANT = 12;
+const sal_uInt16 OLEPROP_TYPE_INT8 = 16;
+const sal_uInt16 OLEPROP_TYPE_UINT8 = 17;
+const sal_uInt16 OLEPROP_TYPE_UINT16 = 18;
+const sal_uInt16 OLEPROP_TYPE_UINT32 = 19;
+const sal_uInt16 OLEPROP_TYPE_INT64 = 20;
+const sal_uInt16 OLEPROP_TYPE_UINT64 = 21;
+const sal_uInt16 OLEPROP_TYPE_STRING8 = 30;
+const sal_uInt16 OLEPROP_TYPE_STRING16 = 31;
+const sal_uInt16 OLEPROP_TYPE_FILETIME = 64;
+const sal_uInt16 OLEPROP_TYPE_BLOB = 65;
+const sal_uInt16 OLEPROP_TYPE_STREAM = 66;
+const sal_uInt16 OLEPROP_TYPE_STORAGE = 67;
+const sal_uInt16 OLEPROP_TYPE_CLIPFMT = 71;
+
+const sal_uInt16 OLEPROP_TYPE_SIMPLE = 0x0000;
+const sal_uInt16 OLEPROP_TYPE_VECTOR = 0x1000;
+const sal_uInt16 OLEPROP_TYPE_ARRAY = 0x2000;
const sal_uInt16 CODEPAGE_UNICODE = 1200;
@@ -458,7 +465,7 @@ void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos )
IndentGuard aIndGuard( mxOut );
if( startElement( nStartPos ) )
{
- sal_Int32 nType = dumpPropertyType();
+ sal_uInt16 nType = dumpPropertyType();
if( nType == OLEPROP_TYPE_INT16 )
{
sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" );
@@ -493,28 +500,21 @@ void OlePropertyStreamObject::dumpDictionaryProperty( sal_uInt32 nStartPos )
mxOut->emptyLine();
}
-void OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
+sal_uInt16 OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
{
- sal_Int32 nType = dumpPropertyType();
- if( getFlag< sal_Int32 >( nType, 0x1000 ) ) // vector
+ sal_uInt16 nType = dumpPropertyType();
+ sal_uInt16 nBaseType = static_cast< sal_uInt16 >( nType & 0x0FFF );
+ sal_uInt16 nArrayType = static_cast< sal_uInt16 >( nType & 0xF000 );
+ switch( nArrayType )
{
- sal_Int32 nBaseType = nType & 0x0FFF;
- sal_Int32 nElemCount = dumpDec< sal_Int32 >( "element-count" );
- for( sal_Int32 nElemIdx = 0; !mxStrm->isEof() && (nElemIdx < nElemCount); ++nElemIdx )
- {
- mxOut->resetItemIndex( nElemIdx );
- writeEmptyItem( "#element" );
- IndentGuard aIndGuard( mxOut );
- dumpPropertyValue( nPropId, nBaseType );
- }
- }
- else if( !getFlag< sal_Int32 >( nType, 0x7000 ) )
- {
- dumpPropertyValue( nPropId, nType );
+ case OLEPROP_TYPE_SIMPLE: dumpPropertyValue( nPropId, nBaseType ); break;
+ case OLEPROP_TYPE_VECTOR: dumpPropertyVector( nPropId, nBaseType ); break;
+ case OLEPROP_TYPE_ARRAY: dumpPropertyArray( nPropId, nBaseType ); break;
}
+ return nType;
}
-void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType )
+void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType )
{
switch( nBaseType )
{
@@ -536,23 +536,46 @@ void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nB
case OLEPROP_TYPE_STRING8: dumpString8( "value" ); break;
case OLEPROP_TYPE_STRING16: dumpString16( "value" ); break;
case OLEPROP_TYPE_FILETIME: dumpFileTime( "file-time" ); break;
- case OLEPROP_TYPE_BLOB: dumpBlob( "data" ); break;
+ case OLEPROP_TYPE_BLOB: dumpBlob( nPropId, "data" ); break;
case OLEPROP_TYPE_STREAM: dumpString8( "stream-name" ); break;
case OLEPROP_TYPE_STORAGE: dumpString8( "storage-name" ); break;
- case OLEPROP_TYPE_CLIPFMT: dumpBlob( "clip-data" ); break;
+ case OLEPROP_TYPE_CLIPFMT: dumpBlob( nPropId, "clip-data" ); break;
}
}
-sal_Int32 OlePropertyStreamObject::dumpPropertyType()
+void OlePropertyStreamObject::dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType )
{
- return dumpHex< sal_Int32 >( "type", "OLEPROP-TYPE" );
+ sal_Int32 nElemCount = dumpDec< sal_Int32 >( "element-count" );
+ for( sal_Int32 nElemIdx = 0; !mxStrm->isEof() && (nElemIdx < nElemCount); ++nElemIdx )
+ {
+ mxOut->resetItemIndex( nElemIdx );
+ writeEmptyItem( "#element" );
+ IndentGuard aIndGuard( mxOut );
+ dumpPropertyValue( nPropId, nBaseType );
+ }
+}
+
+void OlePropertyStreamObject::dumpPropertyArray( sal_Int32 /*nPropId*/, sal_uInt16 /*nBaseType*/ )
+{
+ // TODO
+}
+
+sal_uInt16 OlePropertyStreamObject::dumpPropertyType()
+{
+ return static_cast< sal_uInt16 >( dumpHex< sal_Int32 >( "type", "OLEPROP-TYPE" ) & 0xFFFF );
}
-void OlePropertyStreamObject::dumpBlob( const String& rName )
+void OlePropertyStreamObject::dumpBlob( sal_Int32 nPropId, const String& rName )
{
sal_Int32 nSize = dumpDec< sal_Int32 >( "data-size" );
if( nSize > 0 )
- dumpBinary( rName, nSize );
+ {
+ OUString aPropName = mxPropIds->getName( cfg(), nPropId );
+ if( aPropName == CREATE_OUSTRING( "'_PID_HLINKS'" ) )
+ dumpHlinks( nSize );
+ else
+ dumpBinary( rName, nSize );
+ }
}
OUString OlePropertyStreamObject::dumpString8( const String& rName )
@@ -596,6 +619,33 @@ OUString OlePropertyStreamObject::dumpCharArray16( const String& rName, sal_Int3
return aData;
}
+bool OlePropertyStreamObject::dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType )
+{
+ writeEmptyItem( rName );
+ IndentGuard aIndGuard( mxOut );
+ return (dumpPropertyContents( -1 ) == nExpectedType) && !mxStrm->isEof();
+}
+
+void OlePropertyStreamObject::dumpHlinks( sal_Int32 nSize )
+{
+ sal_Int64 nEndPos = mxStrm->tell() + nSize;
+ sal_Int32 nCount = dumpDec< sal_Int32 >( "property-count" );
+ bool bValid = true;
+ for( sal_Int32 nHlinkIndex = 0, nHlinkCount = nCount / 6; bValid && !mxStrm->isEof() && (nHlinkIndex < nHlinkCount); ++nHlinkIndex )
+ {
+ writeEmptyItem( "HYPERLINK" );
+ IndentGuard aIndGuard( mxOut );
+ bValid =
+ dumpTypedProperty( "hash", OLEPROP_TYPE_INT32 ) &&
+ dumpTypedProperty( "app", OLEPROP_TYPE_INT32 ) &&
+ dumpTypedProperty( "shape-id", OLEPROP_TYPE_INT32 ) &&
+ dumpTypedProperty( "info", OLEPROP_TYPE_INT32 ) &&
+ dumpTypedProperty( "target", OLEPROP_TYPE_STRING16 ) &&
+ dumpTypedProperty( "location", OLEPROP_TYPE_STRING16 );
+ }
+ dumpRemainingTo( nEndPos );
+}
+
bool OlePropertyStreamObject::startElement( sal_uInt32 nStartPos )
{
mxStrm->seek( nStartPos );
@@ -2312,4 +2362,3 @@ void ActiveXStorageObject::implDumpBaseStream( const BinaryInputStreamRef& rxStr
} // namespace oox
#endif
-
diff --git a/oox/source/dump/oledumper.ini b/oox/source/dump/oledumper.ini
index 13478464e6b3..c8461d4b28a7 100644
--- a/oox/source/dump/oledumper.ini
+++ b/oox/source/dump/oledumper.ini
@@ -885,4 +885,3 @@ end
shortlist=VBA-DIR-PROJECTSYSKIND-PLATFORM,0,16-bit-windows,32-bit-windows,macintosh
# ============================================================================
-
diff --git a/oox/source/dump/pptxdumper.cxx b/oox/source/dump/pptxdumper.cxx
index e01d7d349855..39e0ccc2be55 100644
--- a/oox/source/dump/pptxdumper.cxx
+++ b/oox/source/dump/pptxdumper.cxx
@@ -26,27 +26,31 @@
************************************************************************/
#include "oox/dump/pptxdumper.hxx"
-#include "oox/helper/zipstorage.hxx"
-#include "oox/ole/olestorage.hxx"
+
#include "oox/dump/biffdumper.hxx"
#include "oox/dump/oledumper.hxx"
#include "oox/dump/xlsbdumper.hxx"
+#include "oox/helper/zipstorage.hxx"
+#include "oox/ole/olestorage.hxx"
#if OOX_INCLUDE_DUMPER
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::io::XInputStream;
-using ::comphelper::MediaDescriptor;
-using ::oox::core::FilterBase;
-
namespace oox {
namespace dump {
namespace pptx {
// ============================================================================
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::FilterBase;
+using ::rtl::OUString;
+
+// ============================================================================
+
RootStorageObject::RootStorageObject( const DumperBase& rParent )
{
StorageObjectBase::construct( rParent );
@@ -144,4 +148,3 @@ void Dumper::implDump()
} // namespace oox
#endif
-
diff --git a/oox/source/dump/pptxdumper.ini b/oox/source/dump/pptxdumper.ini
index fa03953b7113..f3c058ecfbf5 100644
--- a/oox/source/dump/pptxdumper.ini
+++ b/oox/source/dump/pptxdumper.ini
@@ -16,4 +16,3 @@ include-config-file=dumperbase.ini
# enable-import=1
# ============================================================================
-
diff --git a/oox/source/dump/xlsbdumper.cxx b/oox/source/dump/xlsbdumper.cxx
index dd78ac3c4e2e..3dc2974420a6 100644
--- a/oox/source/dump/xlsbdumper.cxx
+++ b/oox/source/dump/xlsbdumper.cxx
@@ -26,12 +26,13 @@
************************************************************************/
#include "oox/dump/xlsbdumper.hxx"
+
#include <com/sun/star/io/XTextInputStream.hpp>
+#include "oox/core/filterbase.hxx"
#include "oox/dump/biffdumper.hxx"
#include "oox/dump/oledumper.hxx"
#include "oox/dump/pptxdumper.hxx"
#include "oox/helper/zipstorage.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/ole/olestorage.hxx"
#include "oox/xls/biffhelper.hxx"
#include "oox/xls/formulabase.hxx"
@@ -39,34 +40,31 @@
#if OOX_INCLUDE_DUMPER
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::util::DateTime;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::io::XInputStream;
-using ::comphelper::MediaDescriptor;
-using ::oox::core::FilterBase;
-
-using namespace ::oox::xls;
-
namespace oox {
namespace dump {
namespace xlsb {
// ============================================================================
-namespace {
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::oox::xls;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::FilterBase;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
-const sal_uInt8 OOBIN_STRINGFLAG_FONTS = 0x01;
-const sal_uInt8 OOBIN_STRINGFLAG_PHONETICS = 0x02;
+// ============================================================================
+
+namespace {
-const sal_uInt8 OOBIN_TOK_ARRAY_DOUBLE = 0;
-const sal_uInt8 OOBIN_TOK_ARRAY_STRING = 1;
-const sal_uInt8 OOBIN_TOK_ARRAY_BOOL = 2;
-const sal_uInt8 OOBIN_TOK_ARRAY_ERROR = 4;
+const sal_uInt8 BIFF12_STRINGFLAG_FONTS = 0x01;
+const sal_uInt8 BIFF12_STRINGFLAG_PHONETICS = 0x02;
-const sal_uInt16 OOBIN_OLEOBJECT_LINKED = 0x0001;
+const sal_uInt16 BIFF12_OLEOBJECT_LINKED = 0x0001;
} // namespace
@@ -82,7 +80,7 @@ RecordObjectBase::~RecordObjectBase()
void RecordObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
{
- mxBiffStrm.reset( new RecordInputStream( getRecordDataSequence() ) );
+ mxBiffStrm.reset( new SequenceInputStream( getRecordDataSequence() ) );
SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxBiffStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
if( SequenceRecordObjectBase::implIsValid() )
mxErrCodes = cfg().getNameList( "ERRORCODES" );
@@ -200,11 +198,11 @@ OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32
{
sal_uInt8 nFlags = bRich ? dumpHex< sal_uInt8 >( "flags", "STRING-FLAGS" ) : 0;
- OUString aString = mxBiffStrm->readString( b32BitLen );
+ OUString aString = BiffHelper::readString( *mxBiffStrm, b32BitLen );
writeStringItem( rName( "text" ), aString );
// --- formatting ---
- if( getFlag( nFlags, OOBIN_STRINGFLAG_FONTS ) )
+ if( getFlag( nFlags, BIFF12_STRINGFLAG_FONTS ) )
{
IndentGuard aIndGuard( mxOut );
FontPortionModelList aPortions;
@@ -213,7 +211,7 @@ OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32
}
// --- phonetic text ---
- if( getFlag( nFlags, OOBIN_STRINGFLAG_PHONETICS ) )
+ if( getFlag( nFlags, BIFF12_STRINGFLAG_PHONETICS ) )
{
IndentGuard aIndGuard( mxOut );
dumpString( "phonetic-text" );
@@ -489,7 +487,7 @@ void FormulaObject::constructFmlaObj()
{
if( RecordObjectBase::implIsValid() )
{
- mxFuncProv.reset( new FunctionProvider( FILTER_OOX, BIFF_UNKNOWN, true ) );
+ mxFuncProv.reset( new FunctionProvider( FILTER_OOXML, BIFF_UNKNOWN, true ) );
Config& rCfg = cfg();
mxClasses = rCfg.getNameList( "TOKENCLASSES" );
@@ -567,7 +565,7 @@ OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo*
ItemGuard aItem( mxOut, "func-id" );
writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
OUStringBuffer aBuffer;
- const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromOobFuncId( nFuncId );
+ const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromBiff12FuncId( nFuncId );
if( pFuncInfo )
aBuffer.append( pFuncInfo->maOoxFuncName );
else
@@ -588,9 +586,9 @@ OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo*
sal_Int32 FormulaObject::dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR )
{
sal_uInt16 nCol = dumpHex< sal_uInt16 >( rName, mxRelFlags );
- rbRelC = getFlag( nCol, OOBIN_TOK_REF_COLREL );
- rbRelR = getFlag( nCol, OOBIN_TOK_REF_ROWREL );
- nCol &= OOBIN_TOK_REF_COLMASK;
+ rbRelC = getFlag( nCol, BIFF12_TOK_REF_COLREL );
+ rbRelR = getFlag( nCol, BIFF12_TOK_REF_ROWREL );
+ nCol &= BIFF12_TOK_REF_COLMASK;
return nCol;
}
@@ -821,17 +819,17 @@ bool FormulaObject::dumpTableToken()
StringHelper::appendIndex( aColRange, mxOut->getLastItemValue() );
OUStringBuffer aParams;
size_t nParams = 0;
- if( getFlag( nFlags, OOBIN_TOK_TABLE_ALL ) && ++nParams )
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_ALL ) && ++nParams )
StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#All]" ) );
- if( getFlag( nFlags, OOBIN_TOK_TABLE_HEADERS ) && ++nParams )
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_HEADERS ) && ++nParams )
StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Headers]" ) );
- if( getFlag( nFlags, OOBIN_TOK_TABLE_DATA ) && ++nParams )
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_DATA ) && ++nParams )
StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Data]" ) );
- if( getFlag( nFlags, OOBIN_TOK_TABLE_TOTALS ) && ++nParams )
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_TOTALS ) && ++nParams )
StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Totals]" ) );
- if( getFlag( nFlags, OOBIN_TOK_TABLE_THISROW ) && ++nParams )
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_THISROW ) && ++nParams )
StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#This Row]" ) );
- if( (getFlag( nFlags, OOBIN_TOK_TABLE_COLUMN ) || getFlag( nFlags, OOBIN_TOK_TABLE_COLRANGE )) && ++nParams )
+ if( (getFlag( nFlags, BIFF12_TOK_TABLE_COLUMN ) || getFlag( nFlags, BIFF12_TOK_TABLE_COLRANGE )) && ++nParams )
StringHelper::appendToken( aParams, aColRange.makeStringAndClear() );
OUStringBuffer aOp;
StringHelper::appendIndexedText( aOp, CREATE_OUSTRING( "TABLE" ), nTabId );
@@ -849,13 +847,13 @@ bool FormulaObject::dumpAttrToken()
sal_uInt8 nType = dumpHex< sal_uInt8 >( "type", mxAttrTypes );
switch( nType )
{
- case OOBIN_TOK_ATTR_VOLATILE:
+ case BIFF_TOK_ATTR_VOLATILE:
dumpUnused( 2 );
break;
- case OOBIN_TOK_ATTR_IF:
+ case BIFF_TOK_ATTR_IF:
dumpDec< sal_uInt16 >( "skip" );
break;
- case OOBIN_TOK_ATTR_CHOOSE:
+ case BIFF_TOK_ATTR_CHOOSE:
{
sal_uInt16 nCount = dumpDec< sal_uInt16 >( "choices" );
mxOut->resetItemIndex();
@@ -864,22 +862,22 @@ bool FormulaObject::dumpAttrToken()
dumpDec< sal_uInt16 >( "skip-err" );
}
break;
- case OOBIN_TOK_ATTR_SKIP:
+ case BIFF_TOK_ATTR_SKIP:
dumpDec< sal_uInt16 >( "skip" );
break;
- case OOBIN_TOK_ATTR_SUM:
+ case BIFF_TOK_ATTR_SUM:
dumpUnused( 2 );
mxStack->pushFuncOp( CREATE_OUSTRING( "SUM" ), OUString( OOX_DUMP_BASECLASS ), 1 );
break;
- case OOBIN_TOK_ATTR_ASSIGN:
+ case BIFF_TOK_ATTR_ASSIGN:
dumpUnused( 2 );
break;
- case OOBIN_TOK_ATTR_SPACE:
- case OOBIN_TOK_ATTR_SPACE | BIFF_TOK_ATTR_VOLATILE:
+ case BIFF_TOK_ATTR_SPACE:
+ case BIFF_TOK_ATTR_SPACE | BIFF_TOK_ATTR_VOLATILE:
dumpDec< sal_uInt8 >( "char-type", mxSpTypes );
dumpDec< sal_uInt8 >( "char-count" );
break;
- case OOBIN_TOK_ATTR_IFERROR:
+ case BIFF_TOK_ATTR_IFERROR:
dumpDec< sal_uInt16 >( "skip" );
break;
default:
@@ -967,19 +965,19 @@ OUString FormulaObject::dumpaddDataArrayValue()
OUStringBuffer aValue;
switch( dumpDec< sal_uInt8 >( "type", "ARRAYVALUE-TYPE" ) )
{
- case OOBIN_TOK_ARRAY_DOUBLE:
+ case BIFF_TOK_ARRAY_DOUBLE:
dumpDec< double >( "value" );
aValue.append( mxOut->getLastItemValue() );
break;
- case OOBIN_TOK_ARRAY_STRING:
+ case BIFF_TOK_ARRAY_STRING:
aValue.append( dumpString( "value", false, false ) );
StringHelper::enclose( aValue, OOX_DUMP_STRQUOTE );
break;
- case OOBIN_TOK_ARRAY_BOOL:
+ case BIFF_TOK_ARRAY_BOOL:
dumpBoolean( "value" );
aValue.append( mxOut->getLastItemValue() );
break;
- case OOBIN_TOK_ARRAY_ERROR:
+ case BIFF_TOK_ARRAY_ERROR:
dumpErrorCode( "value" );
aValue.append( mxOut->getLastItemValue() );
dumpUnused( 3 );
@@ -1006,18 +1004,22 @@ void RecordStreamObject::implDumpRecordBody()
{
switch( getRecId() )
{
- case OOBIN_ID_ARRAY:
+ case BIFF12_ID_ARRAY:
dumpRange( "array-range" );
dumpHex< sal_uInt8 >( "flags", "ARRAY-FLAGS" );
mxFmlaObj->dumpCellFormula();
break;
- case OOBIN_ID_BINARYINDEXBLOCK:
+ case BIFF12_ID_AUTOFILTER:
+ dumpRange( "filter-range" );
+ break;
+
+ case BIFF12_ID_BINARYINDEXBLOCK:
dumpRowRange( "row-range" );
dumpUnknown( 12 );
break;
- case OOBIN_ID_BINARYINDEXROWS:
+ case BIFF12_ID_BINARYINDEXROWS:
{
sal_uInt32 nUsedRows = dumpBin< sal_uInt32 >( "used-rows" );
dumpDec< sal_Int64 >( "stream-offset" );
@@ -1027,7 +1029,7 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_BORDER:
+ case BIFF12_ID_BORDER:
dumpHex< sal_uInt8 >( "flags", "BORDER-FLAGS" );
dumpDec< sal_uInt16 >( "top-style", "BORDERSTYLES" );
dumpColor( "top-color" );
@@ -1041,7 +1043,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpColor( "diag-color" );
break;
- case OOBIN_ID_BRK:
+ case BIFF12_ID_BRK:
dumpDec< sal_Int32 >( "id" );
dumpDec< sal_Int32 >( "min" );
dumpDec< sal_Int32 >( "max" );
@@ -1049,7 +1051,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_Int32 >( "pivot-break", "BOOLEAN" );
break;
- case OOBIN_ID_CALCPR:
+ case BIFF12_ID_CALCPR:
dumpDec< sal_Int32 >( "calc-id" );
dumpDec< sal_Int32 >( "calc-mode", "CALCPR-CALCMODE" );
dumpDec< sal_Int32 >( "iteration-count" );
@@ -1058,46 +1060,46 @@ void RecordStreamObject::implDumpRecordBody()
dumpHex< sal_uInt16 >( "flags", "CALCPR-FLAGS" );
break;
- case OOBIN_ID_CELL_BLANK:
+ case BIFF12_ID_CELL_BLANK:
dumpCellHeader( true );
break;
- case OOBIN_ID_CELL_BOOL:
+ case BIFF12_ID_CELL_BOOL:
dumpCellHeader( true );
dumpBoolean();
break;
- case OOBIN_ID_CELL_DOUBLE:
+ case BIFF12_ID_CELL_DOUBLE:
dumpCellHeader( true );
dumpDec< double >( "value" );
break;
- case OOBIN_ID_CELL_ERROR:
+ case BIFF12_ID_CELL_ERROR:
dumpCellHeader( true );
dumpErrorCode();
break;
- case OOBIN_ID_CELL_RK:
+ case BIFF12_ID_CELL_RK:
dumpCellHeader( true );
dumpRk( "value" );
break;
- case OOBIN_ID_CELL_RSTRING:
+ case BIFF12_ID_CELL_RSTRING:
dumpCellHeader( true );
dumpString( "value", true );
break;
- case OOBIN_ID_CELL_SI:
+ case BIFF12_ID_CELL_SI:
dumpCellHeader( true );
dumpDec< sal_Int32 >( "string-id" );
break;
- case OOBIN_ID_CELL_STRING:
+ case BIFF12_ID_CELL_STRING:
dumpCellHeader( true );
dumpString( "value" );
break;
- case OOBIN_ID_CELLSTYLE:
+ case BIFF12_ID_CELLSTYLE:
dumpDec< sal_Int32 >( "xf-id" );
dumpHex< sal_uInt16 >( "flags", "CELLSTYLE-FLAGS" );
dumpDec< sal_uInt8 >( "builtin-id", "CELLSTYLE-BUILTIN" );
@@ -1105,11 +1107,11 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "name" );
break;
- case OOBIN_ID_CFCOLOR:
+ case BIFF12_ID_CFCOLOR:
dumpColor();
break;
- case OOBIN_ID_CFRULE:
+ case BIFF12_ID_CFRULE:
{
// type/subtype/operator is a mess...
dumpDec< sal_Int32 >( "type", "CFRULE-TYPE" );
@@ -1153,7 +1155,7 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_CHARTPAGESETUP:
+ case BIFF12_ID_CHARTPAGESETUP:
dumpDec< sal_Int32 >( "paper-size", "PAGESETUP-PAPERSIZE" );
dumpDec< sal_Int32 >( "horizontal-res", "PAGESETUP-DPI" );
dumpDec< sal_Int32 >( "vertical-res", "PAGESETUP-DPI" );
@@ -1163,75 +1165,110 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "printer-settings-rel-id" );
break;
- case OOBIN_ID_CHARTPROTECTION:
+ case BIFF12_ID_CHARTPROTECTION:
dumpHex< sal_uInt16 >( "password-hash" );
// no flags field for the boolean flags?!?
dumpDec< sal_Int32 >( "content-locked", "BOOLEAN" );
dumpDec< sal_Int32 >( "objects-locked", "BOOLEAN" );
break;
- case OOBIN_ID_CHARTSHEETPR:
+ case BIFF12_ID_CHARTSHEETPR:
dumpHex< sal_uInt16 >( "flags", "CHARTSHEETPR-FLAGS" );
dumpColor( "tab-color" );
dumpString( "codename" );
break;
- case OOBIN_ID_CHARTSHEETVIEW:
+ case BIFF12_ID_CHARTSHEETVIEW:
dumpHex< sal_uInt16 >( "flags", "CHARTSHEETVIEW-FLAGS" );
dumpDec< sal_Int32 >( "zoom-scale", "CONV-PERCENT" );
dumpDec< sal_Int32 >( "workbookview-id" );
break;
- case OOBIN_ID_COL:
+ case BIFF12_ID_COL:
dumpColRange();
dumpDec< sal_Int32 >( "col-width", "CONV-COLWIDTH" );
dumpDec< sal_Int32 >( "custom-xf-id" );
dumpHex< sal_uInt16 >( "flags", "COL-FLAGS" );
break;
- case OOBIN_ID_COLBREAKS:
+ case BIFF12_ID_COLBREAKS:
dumpDec< sal_Int32 >( "count" );
dumpDec< sal_Int32 >( "manual-count" );
break;
- case OOBIN_ID_COLOR:
+ case BIFF12_ID_COLOR:
dumpColor();
break;
- case OOBIN_ID_COMMENT:
+ case BIFF12_ID_COMMENT:
dumpDec< sal_Int32 >( "author-id" );
dumpRange( "ref" );
dumpGuid();
break;
- case OOBIN_ID_COMMENTAUTHOR:
+ case BIFF12_ID_COMMENTAUTHOR:
dumpString( "author" );
break;
- case OOBIN_ID_COMMENTTEXT:
+ case BIFF12_ID_COMMENTTEXT:
dumpString( "text", true );
break;
- case OOBIN_ID_CONDFORMATTING:
+ case BIFF12_ID_CONDFORMATTING:
dumpDec< sal_Int32 >( "cfrule-count" );
dumpDec< sal_Int32 >( "pivot-table", "BOOLEAN" );
dumpRangeList();
break;
- case OOBIN_ID_CONTROL:
+ case BIFF12_ID_CONNECTION:
+ {
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpDec< sal_uInt8 >( "save-password", "CONNECTION-SAVEPASSWORD" );
+ dumpUnused( 1 );
+ dumpDec< sal_uInt16 >( "refresh-interval", "CONNECTION-INTERVAL" );
+ dumpHex< sal_uInt16 >( "flags", "CONNECTION-FLAGS" );
+ sal_uInt16 nStrFlags = dumpHex< sal_uInt16 >( "string-flags", "CONNECTION-STRINGFLAGS" );
+ dumpDec< sal_Int32 >( "data-source-type", "CONNECTION-SOURCETYPE" );
+ dumpDec< sal_Int32 >( "reconnect-type", "CONNECTION-RECONNECTTYPE" );
+ dumpDec< sal_Int32 >( "id" );
+ dumpDec< sal_uInt8 >( "credentials", "CONNECTION-CREDENTIALS" );
+ if( nStrFlags & 0x0001 ) dumpString( "source-file" );
+ if( nStrFlags & 0x0002 ) dumpString( "source-conn-file" );
+ if( nStrFlags & 0x0004 ) dumpString( "description" );
+ if( nStrFlags & 0x0008 ) dumpString( "name" );
+ if( nStrFlags & 0x0010 ) dumpString( "sso-id" );
+ }
+ break;
+
+ case BIFF12_ID_CONTROL:
dumpDec< sal_Int32 >( "shape-id" );
dumpString( "rel-id" );
dumpString( "name" );
break;
- case OOBIN_ID_DATATABLE:
+ case BIFF12_ID_CUSTOMFILTER:
+ {
+ sal_uInt8 nType = dumpDec< sal_uInt8 >( "data-type", "CUSTOMFILTER-DATATYPE" );
+ dumpDec< sal_uInt8 >( "operator", "CUSTOMFILTER-OPERATOR" );
+ switch( nType )
+ {
+ case 4: dumpDec< double >( "value" ); break;
+ case 6: dumpUnused( 8 ); dumpString( "value" ); break;
+ case 8: dumpBoolean( "value" ); dumpUnused( 7 ); break;
+ default: dumpUnused( 8 );
+ }
+ }
+ break;
+
+ case BIFF12_ID_DATATABLE:
dumpRange( "table-range" );
dumpAddress( "ref1" );
dumpAddress( "ref2" );
dumpHex< sal_uInt8 >( "flags", "DATATABLE-FLAGS" );
break;
- case OOBIN_ID_DATAVALIDATION:
+ case BIFF12_ID_DATAVALIDATION:
dumpHex< sal_uInt32 >( "flags", "DATAVALIDATION-FLAGS" );
dumpRangeList();
dumpString( "error-title" );
@@ -1242,7 +1279,7 @@ void RecordStreamObject::implDumpRecordBody()
mxFmlaObj->dumpNameFormula( "formula2" );
break;
- case OOBIN_ID_DATAVALIDATIONS:
+ case BIFF12_ID_DATAVALIDATIONS:
dumpHex< sal_uInt16 >( "flags", "DATAVALIDATIONS-FLAGS" );
dumpDec< sal_Int32 >( "input-x" );
dumpDec< sal_Int32 >( "input-y" );
@@ -1250,16 +1287,16 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_Int32 >( "count" );
break;
- case OOBIN_ID_DDEITEMVALUES:
+ case BIFF12_ID_DDEITEMVALUES:
dumpDec< sal_Int32 >( "rows" );
dumpDec< sal_Int32 >( "columns" );
break;
- case OOBIN_ID_DDEITEM_STRING:
+ case BIFF12_ID_DDEITEM_STRING:
dumpString( "value" );
break;
- case OOBIN_ID_DEFINEDNAME:
+ case BIFF12_ID_DEFINEDNAME:
dumpHex< sal_uInt32 >( "flags", "DEFINEDNAME-FLAGS" );
dumpChar( "accelerator", RTL_TEXTENCODING_ISO_8859_1 );
dumpDec< sal_Int32 >( "sheet-id", "DEFINEDNAME-SHEETID" );
@@ -1272,15 +1309,24 @@ void RecordStreamObject::implDumpRecordBody()
if( mxStrm->getRemaining() >= 4 ) dumpString( "statusbar-text" );
break;
- case OOBIN_ID_DIMENSION:
+ case BIFF12_ID_DIMENSION:
dumpRange( "used-range" );
break;
- case OOBIN_ID_DRAWING:
+ case BIFF12_ID_DISCRETEFILTER:
+ dumpString( "value" );
+ break;
+
+ case BIFF12_ID_DISCRETEFILTERS:
+ dumpBool< sal_Int32 >( "show-blank" );
+ dumpDec< sal_Int32 >( "calendar-type", "DISCRETEFILTERS-CALTYPE" );
+ break;
+
+ case BIFF12_ID_DRAWING:
dumpString( "rel-id" );
break;
- case OOBIN_ID_DXF:
+ case BIFF12_ID_DXF:
dumpHex< sal_uInt32 >( "flags", "DXF-FLAGS" );
for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !mxStrm->isEof() && (nIndex < nCount); ++nIndex )
{
@@ -1377,27 +1423,27 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_EXTCELL_BOOL:
+ case BIFF12_ID_EXTCELL_BOOL:
dumpColIndex();
dumpBoolean();
break;
- case OOBIN_ID_EXTCELL_DOUBLE:
+ case BIFF12_ID_EXTCELL_DOUBLE:
dumpColIndex();
dumpDec< double >( "value" );
break;
- case OOBIN_ID_EXTCELL_ERROR:
+ case BIFF12_ID_EXTCELL_ERROR:
dumpColIndex();
dumpErrorCode();
break;
- case OOBIN_ID_EXTCELL_STRING:
+ case BIFF12_ID_EXTCELL_STRING:
dumpColIndex();
dumpString( "value" );
break;
- case OOBIN_ID_EXTERNALBOOK:
+ case BIFF12_ID_EXTERNALBOOK:
switch( dumpDec< sal_uInt16 >( "type", "EXTERNALBOOK-TYPE" ) )
{
case 0:
@@ -1415,21 +1461,21 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_EXTERNALNAME:
+ case BIFF12_ID_EXTERNALNAME:
dumpString( "name" );
break;
- case OOBIN_ID_EXTERNALNAMEFLAGS:
+ case BIFF12_ID_EXTERNALNAMEFLAGS:
dumpHex< sal_uInt16 >( "flags", "EXTERNALNAMEFLAGS-FLAGS" );
dumpDec< sal_Int32 >( "sheet-id" );
dumpBoolean( "is-dde-ole" );
break;
- case OOBIN_ID_EXTERNALREF:
+ case BIFF12_ID_EXTERNALREF:
dumpString( "rel-id" );
break;
- case OOBIN_ID_EXTERNALSHEETS:
+ case BIFF12_ID_EXTERNALSHEETS:
{
sal_Int32 nCount = dumpDec< sal_Int32 >( "ref-count" );
TableGuard aTabGuard( mxOut, 13, 17, 24 );
@@ -1445,28 +1491,28 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_EXTROW:
+ case BIFF12_ID_EXTROW:
dumpRowIndex();
break;
- case OOBIN_ID_EXTSHEETDATA:
+ case BIFF12_ID_EXTSHEETDATA:
dumpDec< sal_Int32 >( "sheet-id" );
dumpHex< sal_uInt8 >( "flags", "EXTSHEETDATA-FLAGS" );
break;
- case OOBIN_ID_EXTSHEETNAMES:
+ case BIFF12_ID_EXTSHEETNAMES:
mxOut->resetItemIndex();
for( sal_Int32 nSheet = 0, nCount = dumpDec< sal_Int32 >( "sheet-count" ); !mxStrm->isEof() && (nSheet < nCount); ++nSheet )
dumpString( "#sheet-name" );
break;
- case OOBIN_ID_FILESHARING:
+ case BIFF12_ID_FILESHARING:
dumpBool< sal_uInt16 >( "recommend-read-only" );
dumpHex< sal_uInt16 >( "password-hash" );
dumpString( "password-creator" );
break;
- case OOBIN_ID_FILL:
+ case BIFF12_ID_FILL:
dumpDec< sal_Int32 >( "fill-pattern", "FILLPATTERNS" );
dumpColor( "fg-color" );
dumpColor( "bg-color" );
@@ -1481,7 +1527,7 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_FILEVERSION:
+ case BIFF12_ID_FILEVERSION:
dumpGuid( "codename" );
dumpString( "app-name" );
dumpString( "last-edited" );
@@ -1489,7 +1535,12 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "build-version" );
break;
- case OOBIN_ID_FONT:
+ case BIFF12_ID_FILTERCOLUMN:
+ dumpDec< sal_Int32 >( "column-index" );
+ dumpHex< sal_uInt16 >( "flags", "FILTERCOLUMN-FLAGS" );
+ break;
+
+ case BIFF12_ID_FONT:
dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
dumpHex< sal_uInt16 >( "flags", "FONT-FLAGS" );
dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
@@ -1503,39 +1554,39 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "name" );
break;
- case OOBIN_ID_FORMULA_BOOL:
+ case BIFF12_ID_FORMULA_BOOL:
dumpCellHeader( true );
dumpBoolean();
dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
mxFmlaObj->dumpCellFormula();
break;
- case OOBIN_ID_FORMULA_DOUBLE:
+ case BIFF12_ID_FORMULA_DOUBLE:
dumpCellHeader( true );
dumpDec< double >( "value" );
dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
mxFmlaObj->dumpCellFormula();
break;
- case OOBIN_ID_FORMULA_ERROR:
+ case BIFF12_ID_FORMULA_ERROR:
dumpCellHeader( true );
dumpErrorCode();
dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
mxFmlaObj->dumpCellFormula();
break;
- case OOBIN_ID_FORMULA_STRING:
+ case BIFF12_ID_FORMULA_STRING:
dumpCellHeader( true );
dumpString( "value" );
dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
mxFmlaObj->dumpCellFormula();
break;
- case OOBIN_ID_FUNCTIONGROUP:
+ case BIFF12_ID_FUNCTIONGROUP:
dumpString( "name" );
break;
- case OOBIN_ID_HEADERFOOTER:
+ case BIFF12_ID_HEADERFOOTER:
dumpHex< sal_uInt16 >( "flags", "HEADERFOOTER-FLAGS" );
dumpString( "odd-header" );
dumpString( "odd-footer" );
@@ -1545,7 +1596,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "first-footer" );
break;
- case OOBIN_ID_HYPERLINK:
+ case BIFF12_ID_HYPERLINK:
dumpRange();
dumpString( "rel-id" );
dumpString( "location" );
@@ -1553,84 +1604,84 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "display" );
break;
- case OOBIN_ID_INPUTCELLS:
+ case BIFF12_ID_INPUTCELLS:
dumpAddress( "pos" );
dumpUnused( 8 );
dumpDec< sal_uInt16 >( "numfmt-id" );
dumpString( "value" );
break;
- case OOBIN_ID_LEGACYDRAWING:
+ case BIFF12_ID_LEGACYDRAWING:
dumpString( "rel-id" );
break;
- case OOBIN_ID_MERGECELL:
+ case BIFF12_ID_MERGECELL:
dumpRange();
break;
- case OOBIN_ID_MULTCELL_BLANK:
+ case BIFF12_ID_MULTCELL_BLANK:
dumpCellHeader( false );
break;
- case OOBIN_ID_MULTCELL_BOOL:
+ case BIFF12_ID_MULTCELL_BOOL:
dumpCellHeader( false );
dumpBoolean();
break;
- case OOBIN_ID_MULTCELL_DOUBLE:
+ case BIFF12_ID_MULTCELL_DOUBLE:
dumpCellHeader( false );
dumpDec< double >( "value" );
break;
- case OOBIN_ID_MULTCELL_ERROR:
+ case BIFF12_ID_MULTCELL_ERROR:
dumpCellHeader( false );
dumpErrorCode();
break;
- case OOBIN_ID_MULTCELL_RK:
+ case BIFF12_ID_MULTCELL_RK:
dumpCellHeader( false );
dumpRk( "value" );
break;
- case OOBIN_ID_MULTCELL_RSTRING:
+ case BIFF12_ID_MULTCELL_RSTRING:
dumpCellHeader( false );
dumpString( "value", true );
break;
- case OOBIN_ID_MULTCELL_SI:
+ case BIFF12_ID_MULTCELL_SI:
dumpCellHeader( false );
dumpDec< sal_Int32 >( "string-id" );
break;
- case OOBIN_ID_MULTCELL_STRING:
+ case BIFF12_ID_MULTCELL_STRING:
dumpCellHeader( false );
dumpString( "value" );
break;
- case OOBIN_ID_NUMFMT:
+ case BIFF12_ID_NUMFMT:
dumpDec< sal_uInt16 >( "numfmt-id" );
dumpString( "format" );
break;
- case OOBIN_ID_OLEOBJECT:
+ case BIFF12_ID_OLEOBJECT:
{
dumpDec< sal_Int32 >( "aspect", "OLEOBJECT-ASPECT" );
dumpDec< sal_Int32 >( "update", "OLEOBJECT-UPDATE" );
dumpDec< sal_Int32 >( "shape-id" );
sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "OLEOBJECT-FLAGS" );
dumpString( "prog-id" );
- if( getFlag( nFlags, OOBIN_OLEOBJECT_LINKED ) )
+ if( getFlag( nFlags, BIFF12_OLEOBJECT_LINKED ) )
mxFmlaObj->dumpNameFormula( "link" );
else
dumpString( "rel-id" );
}
break;
- case OOBIN_ID_OLESIZE:
+ case BIFF12_ID_OLESIZE:
dumpRange( "visible-range" );
break;
- case OOBIN_ID_PAGEMARGINS:
+ case BIFF12_ID_PAGEMARGINS:
dumpDec< double >( "left-margin" );
dumpDec< double >( "right-margin" );
dumpDec< double >( "top-margin" );
@@ -1639,7 +1690,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< double >( "footer-margin" );
break;
- case OOBIN_ID_PAGESETUP:
+ case BIFF12_ID_PAGESETUP:
dumpDec< sal_Int32 >( "paper-size", "PAGESETUP-PAPERSIZE" );
dumpDec< sal_Int32 >( "scaling", "CONV-PERCENT" );
dumpDec< sal_Int32 >( "horizontal-res", "PAGESETUP-DPI" );
@@ -1652,7 +1703,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "printer-settings-rel-id" );
break;
- case OOBIN_ID_PANE:
+ case BIFF12_ID_PANE:
dumpDec< double >( "x-split-pos" );
dumpDec< double >( "y-split-pos" );
dumpAddress( "second-top-left" );
@@ -1660,7 +1711,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpHex< sal_uInt8 >( "flags", "PANE-FLAGS" );
break;
- case OOBIN_ID_PCDEFINITION:
+ case BIFF12_ID_PCDEFINITION:
{
dumpDec< sal_uInt8 >( "refreshed-version" );
dumpDec< sal_uInt8 >( "min-refresh-version" );
@@ -1675,7 +1726,7 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PCDFIELD:
+ case BIFF12_ID_PCDFIELD:
{
sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PCDFIELD-FLAGS" );
dumpDec< sal_Int32 >( "numfmt-id" );
@@ -1695,12 +1746,12 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PCDFIELDGROUP:
+ case BIFF12_ID_PCDFIELDGROUP:
dumpDec< sal_Int32 >( "parent-field" );
dumpDec< sal_Int32 >( "base-field" );
break;
- case OOBIN_ID_PCDFRANGEPR:
+ case BIFF12_ID_PCDFRANGEPR:
dumpDec< sal_uInt8 >( "group-by", "PCDFRANGEPR-GROUPBY" );
dumpHex< sal_uInt8 >( "flags", "PCDFRANGEPR-FLAGS" );
dumpDec< double >( "start-value" );
@@ -1708,7 +1759,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< double >( "interval" );
break;
- case OOBIN_ID_PCDFSHAREDITEMS:
+ case BIFF12_ID_PCDFSHAREDITEMS:
{
sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PCDFSHAREDITEMS-FLAGS" );
dumpDec< sal_Int32 >( "count" );
@@ -1717,7 +1768,7 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PCDSHEETSOURCE:
+ case BIFF12_ID_PCDSHEETSOURCE:
{
sal_uInt8 nIsDefName = dumpBoolean( "is-def-name" );
dumpBoolean( "is-builtin-def-name" );
@@ -1728,12 +1779,12 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PCDSOURCE:
+ case BIFF12_ID_PCDSOURCE:
dumpDec< sal_Int32 >( "source-type", "PCDSOURCE-TYPE" );
dumpDec< sal_Int32 >( "connection-id" );
break;
- case OOBIN_ID_PCITEM_ARRAY:
+ case BIFF12_ID_PCITEM_ARRAY:
{
sal_uInt16 nType = dumpDec< sal_uInt16 >( "type", "PCITEM_ARRAY-TYPE" );
sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
@@ -1752,97 +1803,97 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PCITEM_BOOL:
+ case BIFF12_ID_PCITEM_BOOL:
dumpBoolean( "value" );
break;
- case OOBIN_ID_PCITEM_DATE:
+ case BIFF12_ID_PCITEM_DATE:
dumpPivotDateTime( "value" );
break;
- case OOBIN_ID_PCITEM_DOUBLE:
+ case BIFF12_ID_PCITEM_DOUBLE:
dumpDec< double >( "value" );
// TODO: server formatting
break;
- case OOBIN_ID_PCITEM_ERROR:
+ case BIFF12_ID_PCITEM_ERROR:
dumpErrorCode( "value" );
// TODO: server formatting
break;
- case OOBIN_ID_PCITEM_INDEX:
+ case BIFF12_ID_PCITEM_INDEX:
dumpDec< sal_Int32 >( "index" );
break;
- case OOBIN_ID_PCITEM_MISSING:
+ case BIFF12_ID_PCITEM_MISSING:
// TODO: server formatting
break;
- case OOBIN_ID_PCITEM_STRING:
+ case BIFF12_ID_PCITEM_STRING:
dumpString( "value" );
// TODO: server formatting
break;
- case OOBIN_ID_PCITEMA_BOOL:
+ case BIFF12_ID_PCITEMA_BOOL:
dumpBoolean( "value" );
// TODO: additional info
break;
- case OOBIN_ID_PCITEMA_DATE:
+ case BIFF12_ID_PCITEMA_DATE:
dumpPivotDateTime( "value" );
// TODO: additional info
break;
- case OOBIN_ID_PCITEMA_DOUBLE:
+ case BIFF12_ID_PCITEMA_DOUBLE:
dumpDec< double >( "value" );
// TODO: additional info
break;
- case OOBIN_ID_PCITEMA_ERROR:
+ case BIFF12_ID_PCITEMA_ERROR:
dumpErrorCode( "value" );
// TODO: additional info
break;
- case OOBIN_ID_PCITEMA_MISSING:
+ case BIFF12_ID_PCITEMA_MISSING:
// TODO: additional info
break;
- case OOBIN_ID_PCITEMA_STRING:
+ case BIFF12_ID_PCITEMA_STRING:
dumpString( "value" );
// TODO: additional info
break;
- case OOBIN_ID_PHONETICPR:
+ case BIFF12_ID_PHONETICPR:
dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
dumpDec< sal_Int32 >( "type", "PHONETICPR-TYPE" );
dumpDec< sal_Int32 >( "alignment", "PHONETICPR-ALIGNMENT" );
break;
- case OOBIN_ID_PICTURE:
+ case BIFF12_ID_PICTURE:
dumpString( "rel-id" );
break;
- case OOBIN_ID_PIVOTAREA:
+ case BIFF12_ID_PIVOTAREA:
dumpDec< sal_Int32 >( "field" );
dumpDec< sal_uInt8 >( "type", "PIVOTAREA-TYPE" );
dumpHex< sal_uInt8 >( "flags-1", "PIVOTAREA-FLAGS1" );
dumpHex< sal_uInt16 >( "flags-2", "PIVOTAREA-FLAGS2" );
break;
- case OOBIN_ID_PIVOTCACHE:
+ case BIFF12_ID_PIVOTCACHE:
dumpDec< sal_Int32 >( "cache-id" );
dumpString( "rel-id" );
break;
- case OOBIN_ID_PTCOLFIELDS:
+ case BIFF12_ID_PTCOLFIELDS:
dumpDec< sal_Int32 >( "count" );
mxOut->resetItemIndex();
while( mxStrm->getRemaining() >= 4 )
dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
break;
- case OOBIN_ID_PTDATAFIELD:
+ case BIFF12_ID_PTDATAFIELD:
dumpDec< sal_Int32 >( "field" );
dumpDec< sal_Int32 >( "subtotal", "PTDATAFIELD-SUBTOTAL" );
dumpDec< sal_Int32 >( "show-data-as", "PTDATAFIELD-SHOWDATAAS" );
@@ -1853,7 +1904,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "name" );
break;
- case OOBIN_ID_PTDEFINITION:
+ case BIFF12_ID_PTDEFINITION:
{
dumpDec< sal_uInt8 >( "created-version" );
dumpHex< sal_uInt8 >( "flags-1", "PTDEFINITION-FLAGS1" );
@@ -1883,7 +1934,7 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PTFIELD:
+ case BIFF12_ID_PTFIELD:
dumpHex< sal_uInt32 >( "flags-1", "PTFIELD-FLAGS1" );
dumpDec< sal_Int32 >( "num-fmt" );
dumpHex< sal_uInt32 >( "flags-2", "PTFIELD-FLAGS2" );
@@ -1891,7 +1942,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_Int32 >( "autoshow-datafield-idx" );
break;
- case OOBIN_ID_PTFILTER:
+ case BIFF12_ID_PTFILTER:
{
dumpDec< sal_Int32 >( "field" );
dumpDec< sal_Int32 >( "member-prop-field" );
@@ -1908,7 +1959,7 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PTFITEM:
+ case BIFF12_ID_PTFITEM:
{
dumpDec< sal_uInt8 >( "type", "PTFITEM-TYPE" );
sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PTFITEM-FLAGS" );
@@ -1917,7 +1968,7 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PTLOCATION:
+ case BIFF12_ID_PTLOCATION:
dumpRange( "location" );
dumpDec< sal_Int32 >( "first-header-row" );
dumpDec< sal_Int32 >( "first-data-row" );
@@ -1926,7 +1977,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_Int32 >( "page-col-count" );
break;
- case OOBIN_ID_PTPAGEFIELD:
+ case BIFF12_ID_PTPAGEFIELD:
{
dumpDec< sal_Int32 >( "field" );
dumpDec< sal_Int32 >( "cache-item", "PTPAGEFIELD-ITEM" );
@@ -1937,21 +1988,28 @@ void RecordStreamObject::implDumpRecordBody()
}
break;
- case OOBIN_ID_PTREFERENCE:
+ case BIFF12_ID_PTREFERENCE:
dumpDec< sal_Int32 >( "field", "PT-FIELDINDEX" );
dumpDec< sal_Int32 >( "item-count" );
dumpHex< sal_uInt16 >( "flags-1", "PTREFERENCE-FLAGS1" );
dumpHex< sal_uInt8 >( "flags-2", "PTREFERENCE-FLAGS2" );
break;
- case OOBIN_ID_PTROWFIELDS:
+ case BIFF12_ID_PTROWFIELDS:
dumpDec< sal_Int32 >( "count" );
mxOut->resetItemIndex();
while( mxStrm->getRemaining() >= 4 )
dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
break;
- case OOBIN_ID_ROW:
+ case BIFF12_ID_QUERYTABLE:
+ dumpHex< sal_uInt32 >( "flags", "QUERYTABLE-FLAGS" );
+ dumpDec< sal_uInt16 >( "autoformat-id" );
+ dumpDec< sal_Int32 >( "connection-id" );
+ dumpString( "defined-name" );
+ break;
+
+ case BIFF12_ID_ROW:
dumpRowIndex();
dumpDec< sal_Int32 >( "custom-xf-id" );
dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
@@ -1962,12 +2020,12 @@ void RecordStreamObject::implDumpRecordBody()
dumpRowRange( "#row-spans" );
break;
- case OOBIN_ID_ROWBREAKS:
+ case BIFF12_ID_ROWBREAKS:
dumpDec< sal_Int32 >( "count" );
dumpDec< sal_Int32 >( "manual-count" );
break;
- case OOBIN_ID_SCENARIO:
+ case BIFF12_ID_SCENARIO:
dumpDec< sal_uInt16 >( "cell-count" );
// two longs instead of flag field
dumpDec< sal_Int32 >( "locked", "BOOLEAN" );
@@ -1977,32 +2035,32 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "user" );
break;
- case OOBIN_ID_SCENARIOS:
+ case BIFF12_ID_SCENARIOS:
dumpDec< sal_uInt16 >( "selected" );
dumpDec< sal_uInt16 >( "shown" );
dumpRangeList( "result-cells" );
break;
- case OOBIN_ID_SELECTION:
+ case BIFF12_ID_SELECTION:
dumpDec< sal_Int32 >( "pane", "PANE-ID" );
dumpAddress( "active-cell" );
dumpDec< sal_Int32 >( "active-cell-id" );
dumpRangeList( "selection" );
break;
- case OOBIN_ID_SHAREDFMLA:
+ case BIFF12_ID_SHAREDFMLA:
dumpRange( "formula-range" );
mxFmlaObj->dumpCellFormula();
break;
- case OOBIN_ID_SHEET:
+ case BIFF12_ID_SHEET:
dumpDec< sal_Int32 >( "sheet-state", "SHEET-STATE" );
dumpDec< sal_Int32 >( "sheet-id" );
dumpString( "rel-id" );
dumpString( "sheet-name" );
break;
- case OOBIN_ID_SHEETFORMATPR:
+ case BIFF12_ID_SHEETFORMATPR:
dumpDec< sal_Int32 >( "default-col-width", "CONV-COLWIDTH" );
dumpDec< sal_uInt16 >( "base-col-width" );
dumpDec< sal_uInt16 >( "default-row-height", "CONV-TWIP-TO-PT" );
@@ -2011,7 +2069,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_uInt8 >( "max-col-outline" );
break;
- case OOBIN_ID_SHEETPR:
+ case BIFF12_ID_SHEETPR:
dumpHex< sal_uInt16 >( "flags1", "SHEETPR-FLAGS1" );
dumpHex< sal_uInt8 >( "flags2", "SHEETPR-FLAGS2" );
dumpColor( "tab-color" );
@@ -2019,7 +2077,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "codename" );
break;
- case OOBIN_ID_SHEETPROTECTION:
+ case BIFF12_ID_SHEETPROTECTION:
dumpHex< sal_uInt16 >( "password-hash" );
// no flags field for all these boolean flags?!?
dumpDec< sal_Int32 >( "sheet-locked", "BOOLEAN" );
@@ -2040,7 +2098,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_Int32 >( "select-unlocked-cells-locked", "BOOLEAN" );
break;
- case OOBIN_ID_SHEETVIEW:
+ case BIFF12_ID_SHEETVIEW:
dumpHex< sal_uInt16 >( "flags", "SHEETVIEW-FLAGS" );
dumpDec< sal_Int32 >( "view-type", "SHEETVIEW-TYPE" );
dumpAddress( "top-left" );
@@ -2052,16 +2110,16 @@ void RecordStreamObject::implDumpRecordBody()
dumpDec< sal_Int32 >( "workbookview-id" );
break;
- case OOBIN_ID_SI:
+ case BIFF12_ID_SI:
dumpString( "string", true );
break;
- case OOBIN_ID_SST:
+ case BIFF12_ID_SST:
dumpDec< sal_Int32 >( "string-cell-count" );
dumpDec< sal_Int32 >( "sst-size" );
break;
- case OOBIN_ID_TABLE:
+ case BIFF12_ID_TABLE:
dumpRange();
dumpDec< sal_Int32 >( "type", "TABLE-TYPE" );
dumpDec< sal_Int32 >( "id" );
@@ -2083,41 +2141,51 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "totalsrow-cell-style" );
break;
- case OOBIN_ID_TABLEPART:
+ case BIFF12_ID_TABLEPART:
dumpString( "rel-id" );
break;
- case OOBIN_ID_TABLESTYLEINFO:
+ case BIFF12_ID_TABLESTYLEINFO:
dumpHex< sal_uInt16 >( "flags", "TABLESTYLEINFO-FLAGS" );
dumpString( "style-name" );
break;
- case OOBIN_ID_TOP10FILTER:
+ case BIFF12_ID_TOP10FILTER:
dumpHex< sal_uInt8 >( "flags", "TOP10FILTER-FLAGS" );
dumpDec< double >( "value" );
dumpDec< double >( "cell-value" );
break;
- case OOBIN_ID_VOLTYPEMAIN:
+ case BIFF12_ID_VOLTYPEMAIN:
dumpString( "first" );
break;
- case OOBIN_ID_VOLTYPESTP:
+ case BIFF12_ID_VOLTYPESTP:
dumpString( "topic-value" );
break;
- case OOBIN_ID_VOLTYPETR:
+ case BIFF12_ID_VOLTYPETR:
dumpAddress( "ref" );
dumpDec< sal_Int32 >( "sheet-id" );
break;
- case OOBIN_ID_WORKBOOKPR:
+ case BIFF12_ID_WEBPR:
+ {
+ dumpHex< sal_uInt32 >( "flags", "WEBPR-FLAGS" );
+ sal_uInt8 nStrFlags = dumpHex< sal_uInt8 >( "string-flags", "WEBPR-STRINGFLAGS" );
+ if( nStrFlags & 0x04 ) dumpString( "url" );
+ if( nStrFlags & 0x01 ) dumpString( "post-method" );
+ if( nStrFlags & 0x02 ) dumpString( "edit-page" );
+ }
+ break;
+
+ case BIFF12_ID_WORKBOOKPR:
dumpHex< sal_uInt32 >( "flags", "WORKBBOKPR-FLAGS" );
dumpDec< sal_Int32 >( "default-theme-version" );
dumpString( "codename" );
break;
- case OOBIN_ID_WORKBOOKVIEW:
+ case BIFF12_ID_WORKBOOKVIEW:
dumpDec< sal_Int32 >( "x-window" );
dumpDec< sal_Int32 >( "y-window" );
dumpDec< sal_Int32 >( "win-width" );
@@ -2128,7 +2196,7 @@ void RecordStreamObject::implDumpRecordBody()
dumpHex< sal_uInt8 >( "flags", "WORKBOOKVIEW-FLAGS" );
break;
- case OOBIN_ID_XF:
+ case BIFF12_ID_XF:
dumpDec< sal_uInt16 >( "parent-xf-id" );
dumpDec< sal_uInt16 >( "numfmt-id" );
dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
@@ -2219,6 +2287,7 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons
rStrgPath.equalsAscii( "xl/macrosheets" ) ||
rStrgPath.equalsAscii( "xl/pivotCache" ) ||
rStrgPath.equalsAscii( "xl/pivotTables" ) ||
+ rStrgPath.equalsAscii( "xl/queryTables" ) ||
rStrgPath.equalsAscii( "xl/tables" ) ||
rStrgPath.equalsAscii( "xl/worksheets" ) )
{
@@ -2269,4 +2338,3 @@ void Dumper::implDump()
} // namespace oox
#endif
-
diff --git a/oox/source/dump/xlsbdumper.ini b/oox/source/dump/xlsbdumper.ini
index f2ac3b49b4d6..3490111c4ba5 100644
--- a/oox/source/dump/xlsbdumper.ini
+++ b/oox/source/dump/xlsbdumper.ini
@@ -174,18 +174,20 @@ multilist=RECORD-NAMES
0x0088=BOOKVIEWS_END,SHEETVIEW,SHEETVIEW_END,CHARTSHEETVIEWS,CHARTSHEETVIEWS_END,CHARTSHEETVIEW,CHARTSHEETVIEW_END,SHEETS
0x0090=SHEETS_END,SHEETDATA,SHEETDATA_END,SHEETPR,DIMENSION,,,PANE
0x0098=SELECTION,WORKBOOKPR,SMARTTAGPR,FILERECOVERYPR,SHEET,CALCPR,WORKBOOKVIEW,SST
- 0x00A0=SST_END,AUTOFILTER,AUTOFILTER_END,FILTERCOLUMN,FILTERCOLUMN_END,FILTERS,FILTERS_END,FILTER
- 0x00A8=COLORFILTER,ICONFILTER,TOP10FILTER,DYNAMICFILTER,CUSTOMFILTERS,CUSTOMFILTERS_END,CUSTOMFILTER,AUTOFILTERDATEGROUPITEM
+ 0x00A0=SST_END,AUTOFILTER,AUTOFILTER_END,FILTERCOLUMN,FILTERCOLUMN_END,DISCRETEFILTERS,DISCRETEFILTERS_END,DISCRETEFILTER
+ 0x00A8=COLORFILTER,ICONFILTER,TOP10FILTER,DYNAMICFILTER,CUSTOMFILTERS,CUSTOMFILTERS_END,CUSTOMFILTER,AFDATEGROUPITEM
0x00B0=MERGECELL,MERGECELLS,MERGECELLS_END,PCDEFINITION,PCDEFINITION_END,PCDFIELDS,PCDFIELDS_END,PCDFIELD
0x00B8=PCDFIELD_END,PCDSOURCE,PCDSOURCE_END,PCDSHEETSOURCE,PCDSHEETSOURCE_END,PCDFSHAREDITEMS,PCDFSHAREDITEMS_END,PCITEM_ARRAY
0x00C0=PCITEM_ARRAY_END,PCRECORDS,PCRECORDS_END,,,,,
+ 0x00C8=,CONNECTION,CONNECTION_END,,,,,
0x00D8=,,,PCDFIELDGROUP,PCDFIELDGROUP_END,PCDFGROUPITEMS,PCDFGROUPITEMS_END,PCDFRANGEPR
0x00E0=PCDFRANGEPR_END,PCDFDISCRETEPR,PCDFDISCRETEPR_END,,,,,
0x00F0=,,,,,,,PIVOTAREA
0x00F8=PIVOTAREA_END,PTREFERENCES,PTREFERENCES_END,PTREFERENCE,PTREFERENCE_END,,,
-
+ 0x0100=,,,,,WEBPR,WEBPR_END,WEBPRTABLES
+ 0x0108=WEBPRTABLES_END,,,,,,,
0x0110=,,,,,BINARYINDEX_END,STYLESHEET,STYLESHEET_END
0x0118=PTDEFINITION,PTFITEM_END,PTFITEM,PTFITEMS,PTFITEMS_END,PTFIELD,PTFIELD_END,PTFIELDS
0x0120=PTFIELDS_END,PTPAGEFIELD,PTPAGEFIELD_END,PTPAGEFIELDS,PTPAGEFIELDS_END,PTDATAFIELD,PTDATAFIELD_END,PTDATAFIELDS
@@ -203,8 +205,10 @@ multilist=RECORD-NAMES
0x0188=ROWBREAKS,ROWBREAKS_END,COLBREAKS,COLBREAKS_END,BRK,CUSTOMWORKBOOKVIEW,,
0x01A0=,,,,,,CUSTOMSHEETVIEWS,CUSTOMSHEETVIEW
- 0x01A8=CUSTOMSHEETVIEW_END,CUSTOMSHEETVIEWS_END,ARRAY,SHAREDFMLA,DATATABLE,,,
+ 0x01A8=CUSTOMSHEETVIEW_END,CUSTOMSHEETVIEWS_END,ARRAY,SHAREDFMLA,DATATABLE,CONNECTIONS,CONNECTIONS_END,
+ 0x01B8=,,,,,,,QUERYTABLE
+ 0x01C0=QUERYTABLE_END,QUERYTABLEREFRESH,QUERYTABLEREFRESH_END,,,,,
0x01C8=,,,AUTOSORTSCOPE,AUTOSORTSCOPE_END,CONDFORMATTING,CONDFORMATTING_END,CFRULE
0x01D0=CFRULE_END,ICONSET,ICONSET_END,DATABAR,DATABAR_END,COLORSCALE,COLORSCALE_END,CFVO
0x01D8=,COLORS,COLORS_END,RGBCOLOR,PAGEMARGINS,PRINTOPTIONS,PAGESETUP,HEADERFOOTER
@@ -238,11 +242,13 @@ end
constlist=SIMPLE-RECORDS
0x001A=int32,dec,item-index
+ 0x00AC=int32,dec,relation,CUSTOMFILTERS-RELATION
0x00B5=int32,dec,count
0x00C1=int32,dec,count
0x00DD=int32,dec,count
0x00E1=int32,dec,count
0x00F9=int32,dec,count
+ 0x0107=int32,dec,count
0x011B=int32,dec,count
0x011F=int32,dec,count
0x0123=int32,dec,count
@@ -374,6 +380,48 @@ combilist=COL-FLAGS
0x1000=outline-collapsed
end
+# CONNECTION -----------------------------------------------------------------
+
+shortlist=CONNECTION-SAVEPASSWORD,1,on,off
+unitconverter=CONNECTION-INTERVAL,60,sec
+shortlist=CONNECTION-SOURCETYPE,1,odbc,dao,file,html,ole-db,text,ado,dsp
+shortlist=CONNECTION-RECONNECTTYPE,1,as-required,always,never
+shortlist=CONNECTION-CREDENTIALS,0,integrated,none,stored-sso,prompt
+
+flagslist=CONNECTION-FLAGS
+ 0x0001=keep-alive
+ 0x0002=new
+ 0x0004=deleted
+ 0x0008=only-use-conn-file
+ 0x0010=background
+ 0x0020=refresh-on-load
+ 0x0040=save-data
+end
+
+flagslist=CONNECTION-STRINGFLAGS
+ 0x0001=has-source-file
+ 0x0002=has-source-conn-file
+ 0x0004=has-description
+ 0x0008=has-name
+ 0x0010=has-sso-id
+end
+
+# CUSTOMFILTER ---------------------------------------------------------------
+
+constlist=CUSTOMFILTER-DATATYPE
+ 4=double
+ 6=string
+ 8=boolean
+ 12=blank
+ 14=not-blank
+end
+
+shortlist=CUSTOMFILTER-OPERATOR,1,less,equal,less-equal,greater,not-equal,greater-equal
+
+# CUSTOMFILTERS --------------------------------------------------------------
+
+shortlist=CUSTOMFILTERS-RELATION,0,and,or
+
# DATATABLE ------------------------------------------------------------------
flagslist=DATATABLE-FLAGS
@@ -428,6 +476,10 @@ constlist=DEFINEDNAME-SHEETID
-1=global
end
+# DISCRETEFILTERS --------------------------------------------------------------------
+
+shortlist=DISCRETEFILTERS-CALTYPE,0,none,gregorian,gregorian-us,japan,taiwan,korea,hijri,thai,hebrew,gregorian-mideast-fr,gregorian-ar,gregorian-xlit-en,gregorian-xlit-fr
+
# DXF ------------------------------------------------------------------------
flagslist=DXF-FLAGS
@@ -478,6 +530,13 @@ end
shortlist=FILL-GRADIENTTYPE,0,linear,path
+# FILTERCOLUMN ---------------------------------------------------------------
+
+flagslist=FILTERCOLUMN-FLAGS
+ 0x0001=hidden-button
+ 0x0002=show-button
+end
+
# FONT -----------------------------------------------------------------------
flagslist=FONT-FLAGS
@@ -741,7 +800,7 @@ flagslist=PTDEFINITION-FLAGS3
0x00004000=col-grand-totals
0x00008000=field-print-titles
0x00020000=item-print-titles
- 0x00040000=merge-labels
+ 0x00040000=merge-item
0x00080000=has-data-caption
0x00100000=has-grand-total-caption
0x00200000=has-page-field-style
@@ -751,8 +810,8 @@ flagslist=PTDEFINITION-FLAGS3
0x02000000=apply-font
0x04000000=apply-alignment
0x08000000=apply-border
- 0x10000000=apply-pattern
- 0x20000000=protected
+ 0x10000000=apply-fill
+ 0x20000000=apply-protection
0x40000000=has-tag
end
@@ -905,6 +964,32 @@ flagslist=PTREFERENCE-FLAGS2
0x01=selected
end
+# QUERYTABLE -----------------------------------------------------------------
+
+combilist=QUERYTABLE-FLAGS
+ 0x00000001=headers
+ 0x00000002=row-numbers
+ 0x00000004=disable-refresh
+ 0x00000008=background
+ 0x00000010=first-background
+ 0x00000020=refresh-on-load
+ 0x000000C0=uint8,dec,grow-shrink,QUERYTABLE-GROWSHRINK
+ 0x00000100=fill-formulas
+ 0x00000200=save-data
+ 0x00000400=disable-edit
+ 0x00000800=preserve-formatting
+ 0x00001000=adjust-column-width
+ 0x00002000=intermediate
+ 0x00004000=apply-num-fmt
+ 0x00008000=apply-font
+ 0x00010000=apply-alignment
+ 0x00020000=apply-border
+ 0x00040000=apply-fill
+ 0x00080000=apply-protection
+end
+
+shortlist=QUERYTABLE-GROWSHRINK,0,insert-clear,insert-delete,overwrite-clear
+
# ROW ------------------------------------------------------------------------
combilist=ROW-FLAGS1
@@ -1012,6 +1097,29 @@ end
shortlist=VOLTYPE-TYPE,0,realtime-data,olap-functions
+# WEBPR ----------------------------------------------------------------------
+
+combilist=WEBPR-FLAGS
+ 0x000000FF=uint8,dec,html-format,WEBPR-HTMLFORMAT
+ 0x00000100=xml
+ 0x00000200=source-data
+ 0x00000400=parse-pre
+ 0x00000800=consecutive-delimiters
+ 0x00001000=first-row
+ 0x00002000=xl97-created
+ 0x00004000=text-dates
+ 0x00008000=xl2000-refreshed
+ 0x00010000=html-tables
+end
+
+shortlist=WEBPR-HTMLFORMAT,0,none,rtf,all
+
+flagslist=WEBPR-STRINGFLAGS
+ 0x01=has-post-method
+ 0x02=has-edit-page
+ 0x04=has-url
+end
+
# WORKBBOKPR -----------------------------------------------------------------
combilist=WORKBBOKPR-FLAGS
@@ -1076,4 +1184,3 @@ flagslist=XF-USEDFLAGS
end
# ============================================================================
-
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5aeb56883d2d..85ef2519f029 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -25,7 +25,6 @@
*
************************************************************************/
-#include "tokens.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/export/drawingml.hxx"
#include "oox/export/utils.hxx"
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index d33572230f1d..0d07e6cf5226 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -25,7 +25,6 @@
*
************************************************************************/
-#include "tokens.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/export/shapes.hxx"
#include "oox/export/utils.hxx"
diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx
index 5479fae46f82..ae10c290b425 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -26,17 +26,21 @@
************************************************************************/
#include "oox/helper/attributelist.hxx"
+
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
+#include "oox/token/tokenmap.hxx"
+
+namespace oox {
+
+// ============================================================================
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::xml::sax;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::util::DateTime;
-using ::com::sun::star::xml::sax::XFastAttributeList;
-
-namespace oox {
// ============================================================================
@@ -74,6 +78,11 @@ sal_Unicode lclGetXChar( const sal_Unicode*& rpcStr, const sal_Unicode* pcEnd )
// ----------------------------------------------------------------------------
+sal_Int32 AttributeConversion::decodeToken( const OUString& rValue )
+{
+ return StaticTokenMap::get().getTokenFromUnicode( rValue );
+}
+
OUString AttributeConversion::decodeXString( const OUString& rValue )
{
// string shorter than one encoded character - no need to decode
@@ -314,4 +323,3 @@ DateTime AttributeList::getDateTime( sal_Int32 nAttrToken, const DateTime& rDefa
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/binaryinputstream.cxx b/oox/source/helper/binaryinputstream.cxx
index a5a3cf9a2c30..2d547cdbf724 100644
--- a/oox/source/helper/binaryinputstream.cxx
+++ b/oox/source/helper/binaryinputstream.cxx
@@ -26,27 +26,32 @@
************************************************************************/
#include "oox/helper/binaryinputstream.hxx"
+
#include <string.h>
#include <vector>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include "oox/helper/binaryoutputstream.hxx"
+namespace oox {
+
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
using ::rtl::OString;
using ::rtl::OStringBuffer;
using ::rtl::OStringToOUString;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XSeekable;
-namespace oox {
+namespace {
const sal_Int32 INPUTSTREAM_BUFFERSIZE = 0x8000;
+} // namespace
+
// ============================================================================
OString BinaryInputStream::readNulCharArray()
@@ -330,4 +335,3 @@ void RelativeInputStream::skip( sal_Int32 nBytes )
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/binaryoutputstream.cxx b/oox/source/helper/binaryoutputstream.cxx
index f39ac9d8f1b2..f4ea9378aa90 100644
--- a/oox/source/helper/binaryoutputstream.cxx
+++ b/oox/source/helper/binaryoutputstream.cxx
@@ -26,19 +26,23 @@
************************************************************************/
#include "oox/helper/binaryoutputstream.hxx"
+
#include <osl/diagnose.h>
#include <string.h>
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XSeekable;
-
namespace oox {
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
+namespace {
+
const sal_Int32 OUTPUTSTREAM_BUFFERSIZE = 0x8000;
+} // namespace
+
// ============================================================================
void BinaryOutputStream::writeAtom( const void* pMem, sal_uInt8 nSize )
diff --git a/oox/source/helper/binarystreambase.cxx b/oox/source/helper/binarystreambase.cxx
index a8f9320ffc94..d1e11850a68c 100644
--- a/oox/source/helper/binarystreambase.cxx
+++ b/oox/source/helper/binarystreambase.cxx
@@ -26,16 +26,18 @@
************************************************************************/
#include "oox/helper/binarystreambase.hxx"
-#include <osl/diagnose.h>
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::io::XSeekable;
+#include <osl/diagnose.h>
namespace oox {
// ============================================================================
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
+// ============================================================================
+
BinaryStreamBase::~BinaryStreamBase()
{
}
@@ -158,4 +160,3 @@ void SequenceSeekableStream::seek( sal_Int64 nPos )
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/containerhelper.cxx b/oox/source/helper/containerhelper.cxx
index 359bc87e09e9..e7f322ff10e3 100644
--- a/oox/source/helper/containerhelper.cxx
+++ b/oox/source/helper/containerhelper.cxx
@@ -26,25 +26,23 @@
************************************************************************/
#include "oox/helper/containerhelper.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <rtl/ustrbuf.hxx>
#include "oox/helper/helper.hxx"
+namespace oox {
+
+// ============================================================================
+
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::container::XIndexContainer;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNameContainer;
-
-namespace oox {
// ============================================================================
@@ -162,63 +160,4 @@ OUString ContainerHelper::insertByUnusedName(
// ============================================================================
-ObjectContainer::ObjectContainer( const Reference< XMultiServiceFactory >& rxFactory, const OUString& rServiceName ) :
- mxFactory( rxFactory ),
- maServiceName( rServiceName ),
- mnIndex( 0 )
-{
- OSL_ENSURE( mxFactory.is(), "ObjectContainer::ObjectContainer - missing service factory" );
-}
-
-ObjectContainer::~ObjectContainer()
-{
-}
-
-bool ObjectContainer::hasObject( const OUString& rObjName ) const
-{
- createContainer();
- return mxContainer.is() && mxContainer->hasByName( rObjName );
-}
-
-Any ObjectContainer::getObject( const OUString& rObjName ) const
-{
- createContainer();
- if( mxContainer.is() ) try
- {
- return mxContainer->getByName( rObjName );
- }
- catch( Exception& )
- {
- }
- return Any();
-}
-
-OUString ObjectContainer::insertObject( const OUString& rObjName, const Any& rObj, bool bInsertByUnusedName )
-{
- createContainer();
- if( mxContainer.is() )
- {
- if( bInsertByUnusedName )
- return ContainerHelper::insertByUnusedName( mxContainer, rObjName + OUString::valueOf( ++mnIndex ), ' ', rObj );
- if( ContainerHelper::insertByName( mxContainer, rObjName, rObj ) )
- return rObjName;
- }
- return OUString();
-}
-
-void ObjectContainer::createContainer() const
-{
- if( !mxContainer.is() && mxFactory.is() ) try
- {
- mxContainer.set( mxFactory->createInstance( maServiceName ), UNO_QUERY_THROW );
- }
- catch( Exception& )
- {
- }
- OSL_ENSURE( mxContainer.is(), "ObjectContainer::createContainer - container not found" );
-}
-
-// ============================================================================
-
} // namespace oox
-
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index ae664cf86668..2e5a612699e2 100644..100755
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -26,47 +26,37 @@
************************************************************************/
#include "oox/helper/graphichelper.hxx"
+
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/awt/XUnitConversion.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/graphic/GraphicObject.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/util/MeasureUnit.hpp>
-#include <comphelper/componentcontext.hxx>
#include <comphelper/seqstream.hxx>
-#include "tokens.hxx"
#include "oox/helper/containerhelper.hxx"
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-using ::rtl::OUString;
-using ::com::sun::star::awt::DeviceInfo;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::awt::XDevice;
-using ::com::sun::star::awt::XUnitConversion;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::frame::XFrame;
-using ::com::sun::star::frame::XFramesSupplier;
-using ::com::sun::star::graphic::GraphicObject;
-using ::com::sun::star::graphic::XGraphic;
-using ::com::sun::star::graphic::XGraphicObject;
-using ::com::sun::star::graphic::XGraphicProvider;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
+#include "oox/helper/propertyset.hxx"
+#include "oox/token/tokens.hxx"
namespace oox {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::graphic;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
inline sal_Int32 lclConvertScreenPixelToHmm( double fPixel, double fPixelPerHmm )
@@ -78,13 +68,17 @@ inline sal_Int32 lclConvertScreenPixelToHmm( double fPixel, double fPixelPerHmm
// ============================================================================
-GraphicHelper::GraphicHelper( const Reference< XMultiServiceFactory >& rxGlobalFactory, const Reference< XFrame >& rxTargetFrame, const StorageRef& rxStorage ) :
- mxGraphicProvider( rxGlobalFactory->createInstance( CREATE_OUSTRING( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY ),
+GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rxTargetFrame, const StorageRef& rxStorage ) :
+ mxCompContext( rxContext ),
mxStorage( rxStorage ),
maGraphicObjScheme( CREATE_OUSTRING( "vnd.sun.star.GraphicObject:" ) )
{
- ::comphelper::ComponentContext aContext( rxGlobalFactory );
- mxCompContext = aContext.getUNOContext();
+ OSL_ENSURE( mxCompContext.is(), "GraphicHelper::GraphicHelper - missing component context" );
+ Reference< XMultiServiceFactory > xFactory( mxCompContext->getServiceManager(), UNO_QUERY_THROW );
+ OSL_ENSURE( xFactory.is(), "GraphicHelper::GraphicHelper - missing service factory" );
+
+ if( xFactory.is() )
+ mxGraphicProvider.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY );
//! TODO: get colors from system
maSystemPalette[ XML_3dDkShadow ] = 0x716F64;
@@ -121,9 +115,9 @@ GraphicHelper::GraphicHelper( const Reference< XMultiServiceFactory >& rxGlobalF
// if no target frame has been passed (e.g. OLE objects), try to fallback to the active frame
// TODO: we need some mechanism to keep and pass the parent frame
Reference< XFrame > xFrame = rxTargetFrame;
- if( !xFrame.is() && rxGlobalFactory.is() ) try
+ if( !xFrame.is() && xFactory.is() ) try
{
- Reference< XFramesSupplier > xFramesSupp( rxGlobalFactory->createInstance( CREATE_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW );
+ Reference< XFramesSupplier > xFramesSupp( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW );
xFrame = xFramesSupp->getActiveFrame();
}
catch( Exception& )
@@ -356,28 +350,17 @@ OUString GraphicHelper::importEmbeddedGraphicObject( const OUString& rStreamName
Size GraphicHelper::getOriginalSize( const Reference< XGraphic >& xGraphic ) const
{
- Size aSize100thMM( 0, 0 );
- Reference< XPropertySet > xGraphicPropertySet( xGraphic, UNO_QUERY_THROW );
- if ( xGraphicPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size100thMM" ) ) ) >>= aSize100thMM )
+ Size aSizeHmm;
+ PropertySet aPropSet( xGraphic );
+ if( aPropSet.getProperty( aSizeHmm, PROP_Size100thMM ) && (aSizeHmm.Width == 0) && (aSizeHmm.Height == 0) ) // MAPMODE_PIXEL used?
{
- if ( !aSize100thMM.Width && !aSize100thMM.Height )
- { // MAPMODE_PIXEL USED :-(
- Size aSourceSizePixel( 0, 0 );
- if ( xGraphicPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SizePixel" ) ) ) >>= aSourceSizePixel )
- {
- const DeviceInfo& rDeviceInfo = getDeviceInfo();
- if ( rDeviceInfo.PixelPerMeterX && rDeviceInfo.PixelPerMeterY )
- {
- aSize100thMM.Width = static_cast< sal_Int32 >( ( aSourceSizePixel.Width * 100000.0 ) / rDeviceInfo.PixelPerMeterX );
- aSize100thMM.Height = static_cast< sal_Int32 >( ( aSourceSizePixel.Height * 100000.0 ) / rDeviceInfo.PixelPerMeterY );
- }
- }
- }
+ Size aSizePixel( 0, 0 );
+ if( aPropSet.getProperty( aSizePixel, PROP_SizePixel ) )
+ aSizeHmm = convertScreenPixelToHmm( aSizePixel );
}
- return aSize100thMM;
+ return aSizeHmm;
}
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/makefile.mk b/oox/source/helper/makefile.mk
index 3518db0c6d7c..f31736faac8d 100644
--- a/oox/source/helper/makefile.mk
+++ b/oox/source/helper/makefile.mk
@@ -51,7 +51,6 @@ SLOFILES = \
$(SLO)$/progressbar.obj \
$(SLO)$/propertymap.obj \
$(SLO)$/propertyset.obj \
- $(SLO)$/recordinputstream.obj \
$(SLO)$/storagebase.obj \
$(SLO)$/textinputstream.obj \
$(SLO)$/zipstorage.obj
diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx
index 6528fea5634d..7fdbe4b38134 100644
--- a/oox/source/helper/modelobjecthelper.cxx
+++ b/oox/source/helper/modelobjecthelper.cxx
@@ -26,21 +26,83 @@
************************************************************************/
#include "oox/helper/modelobjecthelper.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/helper.hxx"
+namespace oox {
+
+// ============================================================================
+
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::awt::Gradient;
-using ::com::sun::star::drawing::LineDash;
-using ::com::sun::star::drawing::PolyPolygonBezierCoords;
-namespace oox {
+// ============================================================================
+
+ObjectContainer::ObjectContainer( const Reference< XMultiServiceFactory >& rxFactory, const OUString& rServiceName ) :
+ mxFactory( rxFactory ),
+ maServiceName( rServiceName ),
+ mnIndex( 0 )
+{
+ OSL_ENSURE( mxFactory.is(), "ObjectContainer::ObjectContainer - missing service factory" );
+}
+
+ObjectContainer::~ObjectContainer()
+{
+}
+
+bool ObjectContainer::hasObject( const OUString& rObjName ) const
+{
+ createContainer();
+ return mxContainer.is() && mxContainer->hasByName( rObjName );
+}
+
+Any ObjectContainer::getObject( const OUString& rObjName ) const
+{
+ createContainer();
+ if( mxContainer.is() ) try
+ {
+ return mxContainer->getByName( rObjName );
+ }
+ catch( Exception& )
+ {
+ }
+ return Any();
+}
+
+OUString ObjectContainer::insertObject( const OUString& rObjName, const Any& rObj, bool bInsertByUnusedName )
+{
+ createContainer();
+ if( mxContainer.is() )
+ {
+ if( bInsertByUnusedName )
+ return ContainerHelper::insertByUnusedName( mxContainer, rObjName + OUString::valueOf( ++mnIndex ), ' ', rObj );
+ if( ContainerHelper::insertByName( mxContainer, rObjName, rObj ) )
+ return rObjName;
+ }
+ return OUString();
+}
+
+void ObjectContainer::createContainer() const
+{
+ if( !mxContainer.is() && mxFactory.is() ) try
+ {
+ mxContainer.set( mxFactory->createInstance( maServiceName ), UNO_QUERY_THROW );
+ }
+ catch( Exception& )
+ {
+ }
+ OSL_ENSURE( mxContainer.is(), "ObjectContainer::createContainer - container not found" );
+}
// ============================================================================
@@ -88,4 +150,3 @@ OUString ModelObjectHelper::insertFillBitmap( const OUString& rGraphicUrl )
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/progressbar.cxx b/oox/source/helper/progressbar.cxx
index 6934f2dcf8d3..1ef6531d3fb0 100644
--- a/oox/source/helper/progressbar.cxx
+++ b/oox/source/helper/progressbar.cxx
@@ -26,17 +26,19 @@
************************************************************************/
#include "oox/helper/progressbar.hxx"
+
#include <com/sun/star/task/XStatusIndicator.hpp>
#include "oox/helper/helper.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::task::XStatusIndicator;
-
namespace oox {
// ============================================================================
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
namespace {
const sal_Int32 PROGRESS_RANGE = 1000000;
@@ -182,4 +184,3 @@ ISegmentProgressBarRef SegmentProgressBar::createSegment( double fLength )
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index 31072fe449e5..0c4e2cb07549 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -26,62 +26,37 @@
************************************************************************/
#include "oox/helper/propertymap.hxx"
-#include <osl/mutex.hxx>
-#include <cppuhelper/implbase2.hxx>
+
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include "properties.hxx"
-#include "oox/token/propertylist.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::IllegalArgumentException;
-using ::com::sun::star::lang::WrappedTargetException;
-using ::com::sun::star::beans::Property;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::beans::PropertyVetoException;
-using ::com::sun::star::beans::UnknownPropertyException;
-using ::com::sun::star::beans::XPropertyChangeListener;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::beans::XPropertySetInfo;
-using ::com::sun::star::beans::XVetoableChangeListener;
-
-#if OSL_DEBUG_LEVEL > 0
-#include <cstdio>
-#include <com/sun/star/style/LineSpacing.hpp>
-#include <com/sun/star/style/LineSpacingMode.hpp>
-#include <com/sun/star/text/WritingMode.hpp>
-#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using ::rtl::OString;
-using ::com::sun::star::style::LineSpacing;
-using ::com::sun::star::text::WritingMode;
-#endif
+#include <cppuhelper/implbase2.hxx>
+#include <osl/mutex.hxx>
+#include "oox/token/propertynames.hxx"
namespace oox {
// ============================================================================
-namespace {
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
-/** Thread-save singleton of a vector of all supported property names. */
-struct StaticPropertyList : public ::rtl::Static< PropertyList, StaticPropertyList > {};
+using ::rtl::OString;
+using ::rtl::OUString;
-// ----------------------------------------------------------------------------
+// ============================================================================
+
+namespace {
-typedef ::cppu::WeakImplHelper2< XPropertySet, XPropertySetInfo > GenericPropertySetImplBase;
+typedef ::cppu::WeakImplHelper2< XPropertySet, XPropertySetInfo > GenericPropertySetBase;
/** This class implements a generic XPropertySet.
Properties of all names and types can be set and later retrieved.
TODO: move this to comphelper or better find an existing implementation
*/
-class GenericPropertySet : public GenericPropertySetImplBase, private ::osl::Mutex
+class GenericPropertySet : public GenericPropertySetBase, private ::osl::Mutex
{
public:
explicit GenericPropertySet();
@@ -114,7 +89,7 @@ GenericPropertySet::GenericPropertySet()
GenericPropertySet::GenericPropertySet( const PropertyMap& rPropMap )
{
- const PropertyList& rPropNames = StaticPropertyList::get();
+ const PropertyNameVector& rPropNames = StaticPropertyNameVector::get();
for( PropertyMap::const_iterator aIt = rPropMap.begin(), aEnd = rPropMap.end(); aIt != aEnd; ++aIt )
maPropMap[ rPropNames[ aIt->first ] ] = aIt->second;
}
@@ -182,7 +157,7 @@ sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& rProper
// ============================================================================
PropertyMap::PropertyMap() :
- mpPropNames( &StaticPropertyList::get() )
+ mpPropNames( &StaticPropertyNameVector::get() ) // pointer instead reference to get compiler generated copy c'tor and operator=
{
}
@@ -193,7 +168,7 @@ PropertyMap::~PropertyMap()
/*static*/ const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
{
OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" );
- return StaticPropertyList::get()[ nPropId ];
+ return StaticPropertyNameVector::get()[ nPropId ];
}
const Any* PropertyMap::getProperty( sal_Int32 nPropId ) const
@@ -241,67 +216,6 @@ Reference< XPropertySet > PropertyMap::makePropertySet() const
return new GenericPropertySet( *this );
}
-#if OSL_DEBUG_LEVEL > 0
-void PropertyMap::dump( Reference< XPropertySet > rXPropSet )
-{
- Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
- Sequence< beans::Property > props = info->getProperties ();
-
- OSL_TRACE("dump props, len: %d", props.getLength ());
-
- for (int i=0; i < props.getLength (); i++) {
- OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
- fprintf (stderr,"%30s = ", name.getStr() );
-
- try {
- Any value = rXPropSet->getPropertyValue( props [i].Name );
-
- OUString strValue;
- sal_Int32 intValue = 0;
- sal_uInt32 uintValue = 0;
- sal_Int16 int16Value = 0;
- sal_uInt16 uint16Value = 0;
- bool boolValue = false;
- LineSpacing spacing;
-// RectanglePoint pointValue;
- WritingMode aWritingMode;
-
- if( value >>= strValue )
- fprintf (stderr,"\"%s\"\n", USS( strValue ) );
- else if( value >>= intValue )
- fprintf (stderr,"%"SAL_PRIdINT32" (hex: %"SAL_PRIxUINT32")\n", intValue, intValue);
- else if( value >>= uintValue )
- fprintf (stderr,"%"SAL_PRIdINT32" (hex: %"SAL_PRIxUINT32")\n", uintValue, uintValue);
- else if( value >>= int16Value )
- fprintf (stderr,"%d (hex: %x)\n", int16Value, int16Value);
- else if( value >>= uint16Value )
- fprintf (stderr,"%d (hex: %x)\n", uint16Value, uint16Value);
- else if( value >>= boolValue )
- fprintf (stderr,"%d (bool)\n", boolValue);
- else if( value >>= aWritingMode )
- fprintf (stderr, "%d writing mode\n", aWritingMode);
- else if( value >>= spacing ) {
- fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
- } else if( value.isExtractableTo(::getCppuType((const sal_Int32*)0))) {
- fprintf (stderr,"is extractable to int32\n");
- }
-// else if( value >>= pointValue )
-// fprintf (stderr,"%d (RectanglePoint)\n", pointValue);
- else
- fprintf (stderr,"??? <unhandled type %s>\n", USS(value.getValueTypeName()));
- } catch(Exception e) {
- fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
- }
- }
-}
-
-void PropertyMap::dump()
-{
- dump( Reference< XPropertySet >( makePropertySet(), UNO_QUERY ) );
-}
-#endif
-
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx
index e7071ba402a2..4812fdf35aa5 100644
--- a/oox/source/helper/propertyset.cxx
+++ b/oox/source/helper/propertyset.cxx
@@ -26,21 +26,21 @@
************************************************************************/
#include "oox/helper/propertyset.hxx"
-#include <rtl/strbuf.hxx>
+
#include <osl/diagnose.h>
+#include <rtl/strbuf.hxx>
#include "oox/helper/propertymap.hxx"
-using ::rtl::OUString;
+namespace oox {
+
+// ============================================================================
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
using ::rtl::OStringBuffer;
+using ::rtl::OUString;
using ::rtl::OUStringToOString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::beans::XPropertySet;
-
-namespace oox {
// ============================================================================
@@ -172,14 +172,6 @@ void PropertySet::setAnyProperty( const OUString& rPropName, const Any& rValue )
}
}
-#if OSL_DEBUG_LEVEL > 0
-void PropertySet::dump()
-{
- PropertyMap::dump( Reference< XPropertySet >( getXPropertySet(), UNO_QUERY ) );
-}
-#endif
-
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/storagebase.cxx b/oox/source/helper/storagebase.cxx
index 4a05f66db81b..eee2b5c5d9b2 100644
--- a/oox/source/helper/storagebase.cxx
+++ b/oox/source/helper/storagebase.cxx
@@ -26,24 +26,23 @@
************************************************************************/
#include "oox/helper/storagebase.hxx"
-#include <com/sun/star/io/XStream.hpp>
+
#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/io/XStream.hpp>
#include <rtl/ustrbuf.hxx>
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/binaryoutputstream.hxx"
+namespace oox {
+
+// ============================================================================
+
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::embed::XStorage;
-using ::com::sun::star::embed::XTransactedObject;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XStream;
-
-namespace oox {
// ============================================================================
diff --git a/oox/source/helper/textinputstream.cxx b/oox/source/helper/textinputstream.cxx
index d6d4736f3ca2..d590781c6fd3 100755
--- a/oox/source/helper/textinputstream.cxx
+++ b/oox/source/helper/textinputstream.cxx
@@ -26,17 +26,20 @@
************************************************************************/
#include "oox/helper/textinputstream.hxx"
+
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include "oox/helper/binaryinputstream.hxx"
+namespace oox {
+
+// ============================================================================
+
using ::rtl::OStringBuffer;
using ::rtl::OStringToOUString;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-namespace oox {
-
// ============================================================================
namespace {
@@ -125,4 +128,3 @@ OUString TextInputStream::readLine()
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx
index 384870430c39..8145e7c4e5ce 100644
--- a/oox/source/helper/zipstorage.cxx
+++ b/oox/source/helper/zipstorage.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/helper/zipstorage.hxx"
+
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
@@ -35,25 +36,20 @@
#include <comphelper/storagehelper.hxx>
#include "oox/helper/helper.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::container::NoSuchElementException;
-using ::com::sun::star::embed::XStorage;
-using ::com::sun::star::embed::XTransactedObject;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XStream;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-
namespace oox {
// ============================================================================
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
ZipStorage::ZipStorage(
const Reference< XMultiServiceFactory >& rxFactory,
const Reference< XInputStream >& rxInStream ) :
diff --git a/oox/source/ole/axbinaryreader.cxx b/oox/source/ole/axbinaryreader.cxx
index 68a18932bf42..493d6b68c6ff 100755..100644
--- a/oox/source/ole/axbinaryreader.cxx
+++ b/oox/source/ole/axbinaryreader.cxx
@@ -26,15 +26,18 @@
************************************************************************/
#include "oox/ole/axbinaryreader.hxx"
-#include "oox/ole/olehelper.hxx"
-using ::rtl::OUString;
+#include "oox/ole/olehelper.hxx"
namespace oox {
namespace ole {
// ============================================================================
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
const sal_uInt32 AX_STRING_SIZEMASK = 0x7FFFFFFF;
@@ -93,7 +96,8 @@ AxFontData::AxFontData() :
mnFontEffects( 0 ),
mnFontHeight( 160 ),
mnFontCharSet( WINDOWS_CHARSET_DEFAULT ),
- mnHorAlign( AX_FONTDATA_LEFT )
+ mnHorAlign( AX_FONTDATA_LEFT ),
+ mbDblUnderline( false )
{
}
@@ -121,6 +125,7 @@ bool AxFontData::importBinaryModel( BinaryInputStream& rInStrm )
aReader.skipIntProperty< sal_uInt8 >(); // font pitch/family
aReader.readIntProperty< sal_uInt8 >( mnHorAlign );
aReader.skipIntProperty< sal_uInt16 >(); // font weight
+ mbDblUnderline = false;
return aReader.finalizeImport();
}
@@ -135,6 +140,7 @@ bool AxFontData::importStdFont( BinaryInputStream& rInStrm )
setFlag( mnFontEffects, AX_FONTDATA_ITALIC, getFlag( aFontInfo.mnFlags, OLE_STDFONT_ITALIC ) );
setFlag( mnFontEffects, AX_FONTDATA_UNDERLINE, getFlag( aFontInfo.mnFlags, OLE_STDFONT_UNDERLINE ) );
setFlag( mnFontEffects, AX_FONTDATA_STRIKEOUT, getFlag( aFontInfo.mnFlags,OLE_STDFONT_STRIKE ) );
+ mbDblUnderline = false;
// StdFont stores font height in 1/10,000 of points
setHeightPoints( getLimitedValue< sal_Int16, sal_Int32 >( aFontInfo.mnHeight / 10000, 0, SAL_MAX_INT16 ) );
mnFontCharSet = aFontInfo.mnCharSet;
@@ -147,7 +153,7 @@ bool AxFontData::importStdFont( BinaryInputStream& rInStrm )
bool AxFontData::importGuidAndFont( BinaryInputStream& rInStrm )
{
OUString aGuid = OleHelper::importGuid( rInStrm );
- if( aGuid.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "{AFC20920-DA4E-11CE-B943-00AA006887B4}" ) ) )
+ if( aGuid.equalsAscii( AX_GUID_CFONT ) )
return importBinaryModel( rInStrm );
if( aGuid.equalsAscii( OLE_GUID_STDFONT ) )
return importStdFont( rInStrm );
@@ -340,4 +346,3 @@ bool AxBinaryPropertyReader::startNextProperty()
} // namespace ole
} // namespace oox
-
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 82616026a505..86cc55df3127 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -26,7 +26,7 @@
************************************************************************/
#include "oox/ole/axcontrol.hxx"
-#include <rtl/tencinfo.h>
+
#include <com/sun/star/awt/FontSlant.hpp>
#include <com/sun/star/awt/FontStrikeout.hpp>
#include <com/sun/star/awt/FontUnderline.hpp>
@@ -39,42 +39,50 @@
#include <com/sun/star/awt/TextAlign.hpp>
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/XFormComponent.hpp>
#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XListEntrySink.hpp>
+#include <com/sun/star/form/binding/XListEntrySource.hpp>
+#include <com/sun/star/form/binding/XValueBinding.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
-#include "properties.hxx"
-#include "tokens.hxx"
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <rtl/tencinfo.h>
#include "oox/helper/attributelist.hxx"
#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/graphichelper.hxx"
#include "oox/helper/propertymap.hxx"
-#include "oox/helper/propertyset.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::awt::XControlModel;
-using ::com::sun::star::container::XIndexContainer;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::drawing::XDrawPage;
-using ::com::sun::star::form::XForm;
-using ::com::sun::star::form::XFormComponent;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
namespace oox {
namespace ole {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::form::binding;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
const sal_uInt32 COMCTL_ID_SIZE = 0x12344321;
@@ -100,28 +108,6 @@ const sal_uInt32 COMCTL_ID_PROGRESSBAR_60 = 0x97AB8A01;
// ----------------------------------------------------------------------------
-const sal_uInt32 AX_FLAGS_ENABLED = 0x00000002;
-const sal_uInt32 AX_FLAGS_LOCKED = 0x00000004;
-const sal_uInt32 AX_FLAGS_OPAQUE = 0x00000008;
-const sal_uInt32 AX_FLAGS_COLUMNHEADS = 0x00000400;
-const sal_uInt32 AX_FLAGS_ENTIREROWS = 0x00000800;
-const sal_uInt32 AX_FLAGS_EXISTINGENTRIES = 0x00001000;
-const sal_uInt32 AX_FLAGS_CAPTIONLEFT = 0x00002000;
-const sal_uInt32 AX_FLAGS_EDITABLE = 0x00004000;
-const sal_uInt32 AX_FLAGS_IMEMODE_MASK = 0x00078000;
-const sal_uInt32 AX_FLAGS_DRAGENABLED = 0x00080000;
-const sal_uInt32 AX_FLAGS_ENTERASNEWLINE = 0x00100000;
-const sal_uInt32 AX_FLAGS_KEEPSELECTION = 0x00200000;
-const sal_uInt32 AX_FLAGS_TABASCHARACTER = 0x00400000;
-const sal_uInt32 AX_FLAGS_WORDWRAP = 0x00800000;
-const sal_uInt32 AX_FLAGS_BORDERSSUPPRESSED = 0x02000000;
-const sal_uInt32 AX_FLAGS_SELECTLINE = 0x04000000;
-const sal_uInt32 AX_FLAGS_SINGLECHARSELECT = 0x08000000;
-const sal_uInt32 AX_FLAGS_AUTOSIZE = 0x10000000;
-const sal_uInt32 AX_FLAGS_HIDESELECTION = 0x20000000;
-const sal_uInt32 AX_FLAGS_MAXLENAUTOTAB = 0x40000000;
-const sal_uInt32 AX_FLAGS_MULTILINE = 0x80000000;
-
const sal_uInt32 AX_CMDBUTTON_DEFFLAGS = 0x0000001B;
const sal_uInt32 AX_LABEL_DEFFLAGS = 0x0080001B;
const sal_uInt32 AX_IMAGE_DEFFLAGS = 0x0000001B;
@@ -156,30 +142,10 @@ const sal_uInt32 AX_PICPOS_BELOWRIGHT = AX_PICPOS_IMPL( TOPRIGHT, BOTTO
const sal_uInt32 AX_PICPOS_CENTER = AX_PICPOS_IMPL( CENTER, CENTER );
#undef AX_PICPOS_IMPL
-const sal_Int32 AX_DISPLAYSTYLE_TEXT = 1;
-const sal_Int32 AX_DISPLAYSTYLE_LISTBOX = 2;
-const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX = 3;
-const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX = 4;
-const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON = 5;
-const sal_Int32 AX_DISPLAYSTYLE_TOGGLE = 6;
-const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN = 7;
-
-const sal_Int32 AX_SELCTION_SINGLE = 0;
-const sal_Int32 AX_SELCTION_MULTI = 1;
-const sal_Int32 AX_SELCTION_EXTENDED = 2;
-
-const sal_Int32 AX_SCROLLBAR_NONE = 0x00;
-const sal_Int32 AX_SCROLLBAR_HORIZONTAL = 0x01;
-const sal_Int32 AX_SCROLLBAR_VERTICAL = 0x02;
-
const sal_Int32 AX_MATCHENTRY_FIRSTLETTER = 0;
const sal_Int32 AX_MATCHENTRY_COMPLETE = 1;
const sal_Int32 AX_MATCHENTRY_NONE = 2;
-const sal_Int32 AX_SHOWDROPBUTTON_NEVER = 0;
-const sal_Int32 AX_SHOWDROPBUTTON_FOCUS = 1;
-const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS = 2;
-
const sal_Int32 AX_ORIENTATION_AUTO = -1;
const sal_Int32 AX_ORIENTATION_VERTICAL = 0;
const sal_Int32 AX_ORIENTATION_HORIZONTAL = 1;
@@ -220,14 +186,70 @@ const sal_Int16 API_STATE_UNCHECKED = 0;
const sal_Int16 API_STATE_CHECKED = 1;
const sal_Int16 API_STATE_DONTKNOW = 2;
+// ----------------------------------------------------------------------------
+
+/** Tries to extract a range address from a defined name. */
+bool lclExtractRangeFromName( CellRangeAddress& orRangeAddr, const Reference< XModel >& rxDocModel, const OUString& rAddressString )
+{
+ try
+ {
+ PropertySet aPropSet( rxDocModel );
+ Reference< XNameAccess > xRangesNA( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY_THROW );
+ Reference< XCellRangeReferrer > xReferrer( xRangesNA->getByName( rAddressString ), UNO_QUERY_THROW );
+ Reference< XCellRangeAddressable > xAddressable( xReferrer->getReferredCells(), UNO_QUERY_THROW );
+ orRangeAddr = xAddressable->getRangeAddress();
+ return true;
+ }
+ catch( Exception& )
+ {
+ }
+ return false;
+}
+
+bool lclExtractAddressFromName( CellAddress& orAddress, const Reference< XModel >& rxDocModel, const OUString& rAddressString )
+{
+ CellRangeAddress aRangeAddr;
+ if( lclExtractRangeFromName( aRangeAddr, rxDocModel, rAddressString ) &&
+ (aRangeAddr.StartColumn == aRangeAddr.EndColumn) &&
+ (aRangeAddr.StartRow == aRangeAddr.EndRow) )
+ {
+ orAddress.Sheet = aRangeAddr.Sheet;
+ orAddress.Column = aRangeAddr.StartColumn;
+ orAddress.Row = aRangeAddr.StartRow;
+ return true;
+ }
+ return false;
+}
+
+void lclPrepareConverter( PropertySet& rConverter, const Reference< XModel >& rxDocModel,
+ const OUString& rAddressString, sal_Int32 nRefSheet, bool bRange )
+{
+ if( !rConverter.is() ) try
+ {
+ Reference< XMultiServiceFactory > xFactory( rxDocModel, UNO_QUERY_THROW );
+ OUString aServiceName = bRange ?
+ CREATE_OUSTRING( "com.sun.star.table.CellRangeAddressConversion" ) :
+ CREATE_OUSTRING( "com.sun.star.table.CellAddressConversion" );
+ rConverter.set( xFactory->createInstance( aServiceName ) );
+ }
+ catch( Exception& )
+ {
+ }
+ rConverter.setProperty( PROP_XLA1Representation, rAddressString );
+ rConverter.setProperty( PROP_ReferenceSheet, nRefSheet );
+}
+
} // namespace
// ============================================================================
-ControlConverter::ControlConverter( const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
+ControlConverter::ControlConverter( const Reference< XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
+ mxDocModel( rxDocModel ),
mrGraphicHelper( rGraphicHelper ),
mbDefaultColorBgr( bDefaultColorBgr )
{
+ OSL_ENSURE( mxDocModel.is(), "ControlConverter::ControlConverter - missing document model" );
}
ControlConverter::~ControlConverter()
@@ -269,11 +291,22 @@ void ControlConverter::convertPicture( PropertyMap& rPropMap, const StreamDataSe
void ControlConverter::convertOrientation( PropertyMap& rPropMap, bool bHorizontal ) const
{
- namespace AwtScrollBarOrient = ::com::sun::star::awt::ScrollBarOrientation;
- sal_Int32 nScrollOrient = bHorizontal ? AwtScrollBarOrient::HORIZONTAL : AwtScrollBarOrient::VERTICAL;
+ sal_Int32 nScrollOrient = bHorizontal ? ScrollBarOrientation::HORIZONTAL : ScrollBarOrientation::VERTICAL;
rPropMap.setProperty( PROP_Orientation, nScrollOrient );
}
+void ControlConverter::convertVerticalAlign( PropertyMap& rPropMap, sal_Int32 nVerticalAlign ) const
+{
+ VerticalAlignment eAlign = VerticalAlignment_TOP;
+ switch( nVerticalAlign )
+ {
+ case XML_Top: eAlign = VerticalAlignment_TOP; break;
+ case XML_Center: eAlign = VerticalAlignment_MIDDLE; break;
+ case XML_Bottom: eAlign = VerticalAlignment_BOTTOM; break;
+ }
+ rPropMap.setProperty( PROP_VerticalAlign, eAlign );
+}
+
void ControlConverter::convertScrollBar( PropertyMap& rPropMap,
sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const
@@ -285,6 +318,74 @@ void ControlConverter::convertScrollBar( PropertyMap& rPropMap,
rPropMap.setProperty( bAwtModel ? PROP_ScrollValue : PROP_DefaultScrollValue, nPosition );
}
+void ControlConverter::bindToSources( const Reference< XControlModel >& rxCtrlModel,
+ const OUString& rCtrlSource, const OUString& rRowSource, sal_Int32 nRefSheet ) const
+{
+ // value binding
+ if( rCtrlSource.getLength() > 0 ) try
+ {
+ // first check if the XBindableValue interface is supported
+ Reference< XBindableValue > xBindable( rxCtrlModel, UNO_QUERY_THROW );
+
+ // convert address string to cell address struct
+ CellAddress aAddress;
+ if( !lclExtractAddressFromName( aAddress, mxDocModel, rCtrlSource ) )
+ {
+ lclPrepareConverter( maAddressConverter, mxDocModel, rCtrlSource, nRefSheet, false );
+ if( !maAddressConverter.getProperty( aAddress, PROP_Address ) )
+ throw RuntimeException();
+ }
+
+ // create argument sequence
+ NamedValue aValue;
+ aValue.Name = CREATE_OUSTRING( "BoundCell" );
+ aValue.Value <<= aAddress;
+ Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= aValue;
+
+ // create the CellValueBinding instance and set at the control model
+ Reference< XMultiServiceFactory > xFactory( mxDocModel, UNO_QUERY_THROW );
+ Reference< XValueBinding > xBinding( xFactory->createInstanceWithArguments(
+ CREATE_OUSTRING( "com.sun.star.table.CellValueBinding" ), aArgs ), UNO_QUERY_THROW );
+ xBindable->setValueBinding( xBinding );
+ }
+ catch( Exception& )
+ {
+ }
+
+ // list entry source
+ if( rRowSource.getLength() > 0 ) try
+ {
+ // first check if the XListEntrySink interface is supported
+ Reference< XListEntrySink > xEntrySink( rxCtrlModel, UNO_QUERY_THROW );
+
+ // convert address string to cell range address struct
+ CellRangeAddress aRangeAddr;
+ if( !lclExtractRangeFromName( aRangeAddr, mxDocModel, rRowSource ) )
+ {
+ lclPrepareConverter( maRangeConverter, mxDocModel, rRowSource, nRefSheet, true );
+ if( !maRangeConverter.getProperty( aRangeAddr, PROP_Address ) )
+ throw RuntimeException();
+ }
+
+ // create argument sequence
+ NamedValue aValue;
+ aValue.Name = CREATE_OUSTRING( "CellRange" );
+ aValue.Value <<= aRangeAddr;
+ Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= aValue;
+
+ // create the EntrySource instance and set at the control model
+ Reference< XMultiServiceFactory > xFactory( mxDocModel, UNO_QUERY_THROW );
+ Reference< XListEntrySource > xEntrySource( xFactory->createInstanceWithArguments(
+ CREATE_OUSTRING( "com.sun.star.table.CellRangeListSource" ), aArgs ), UNO_QUERY_THROW );
+ xEntrySink->setListEntrySource( xEntrySource );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
// ActiveX (Forms 2.0) specific conversion ------------------------------------
void ControlConverter::convertAxBackground( PropertyMap& rPropMap,
@@ -319,8 +420,7 @@ void ControlConverter::convertAxBorder( PropertyMap& rPropMap,
void ControlConverter::convertAxVisualEffect( PropertyMap& rPropMap, sal_Int32 nSpecialEffect ) const
{
- namespace AwtVisualEffect = ::com::sun::star::awt::VisualEffect;
- sal_Int16 nVisualEffect = (nSpecialEffect == AX_SPECIALEFFECT_FLAT) ? AwtVisualEffect::FLAT : AwtVisualEffect::LOOK3D;
+ sal_Int16 nVisualEffect = (nSpecialEffect == AX_SPECIALEFFECT_FLAT) ? VisualEffect::FLAT : VisualEffect::LOOK3D;
rPropMap.setProperty( PROP_VisualEffect, nVisualEffect );
}
@@ -330,23 +430,22 @@ void ControlConverter::convertAxPicture( PropertyMap& rPropMap, const StreamData
convertPicture( rPropMap, rPicData );
// picture position
- namespace AwtImagePos = ::com::sun::star::awt::ImagePosition;
- sal_Int16 nImagePos = AwtImagePos::LeftCenter;
+ sal_Int16 nImagePos = ImagePosition::LeftCenter;
switch( nPicPos )
{
- case AX_PICPOS_LEFTTOP: nImagePos = AwtImagePos::LeftTop; break;
- case AX_PICPOS_LEFTCENTER: nImagePos = AwtImagePos::LeftCenter; break;
- case AX_PICPOS_LEFTBOTTOM: nImagePos = AwtImagePos::LeftBottom; break;
- case AX_PICPOS_RIGHTTOP: nImagePos = AwtImagePos::RightTop; break;
- case AX_PICPOS_RIGHTCENTER: nImagePos = AwtImagePos::RightCenter; break;
- case AX_PICPOS_RIGHTBOTTOM: nImagePos = AwtImagePos::RightBottom; break;
- case AX_PICPOS_ABOVELEFT: nImagePos = AwtImagePos::AboveLeft; break;
- case AX_PICPOS_ABOVECENTER: nImagePos = AwtImagePos::AboveCenter; break;
- case AX_PICPOS_ABOVERIGHT: nImagePos = AwtImagePos::AboveRight; break;
- case AX_PICPOS_BELOWLEFT: nImagePos = AwtImagePos::BelowLeft; break;
- case AX_PICPOS_BELOWCENTER: nImagePos = AwtImagePos::BelowCenter; break;
- case AX_PICPOS_BELOWRIGHT: nImagePos = AwtImagePos::BelowRight; break;
- case AX_PICPOS_CENTER: nImagePos = AwtImagePos::Centered; break;
+ case AX_PICPOS_LEFTTOP: nImagePos = ImagePosition::LeftTop; break;
+ case AX_PICPOS_LEFTCENTER: nImagePos = ImagePosition::LeftCenter; break;
+ case AX_PICPOS_LEFTBOTTOM: nImagePos = ImagePosition::LeftBottom; break;
+ case AX_PICPOS_RIGHTTOP: nImagePos = ImagePosition::RightTop; break;
+ case AX_PICPOS_RIGHTCENTER: nImagePos = ImagePosition::RightCenter; break;
+ case AX_PICPOS_RIGHTBOTTOM: nImagePos = ImagePosition::RightBottom; break;
+ case AX_PICPOS_ABOVELEFT: nImagePos = ImagePosition::AboveLeft; break;
+ case AX_PICPOS_ABOVECENTER: nImagePos = ImagePosition::AboveCenter; break;
+ case AX_PICPOS_ABOVERIGHT: nImagePos = ImagePosition::AboveRight; break;
+ case AX_PICPOS_BELOWLEFT: nImagePos = ImagePosition::BelowLeft; break;
+ case AX_PICPOS_BELOWCENTER: nImagePos = ImagePosition::BelowCenter; break;
+ case AX_PICPOS_BELOWRIGHT: nImagePos = ImagePosition::BelowRight; break;
+ case AX_PICPOS_CENTER: nImagePos = ImagePosition::Centered; break;
default: OSL_ENSURE( false, "ControlConverter::convertAxPicture - unknown picture position" );
}
rPropMap.setProperty( PROP_ImagePosition, nImagePos );
@@ -359,13 +458,12 @@ void ControlConverter::convertAxPicture( PropertyMap& rPropMap, const StreamData
convertPicture( rPropMap, rPicData );
// picture scale mode
- namespace AwtScaleMode = ::com::sun::star::awt::ImageScaleMode;
- sal_Int16 nScaleMode = AwtScaleMode::None;
+ sal_Int16 nScaleMode = ImageScaleMode::None;
switch( nPicSizeMode )
{
- case AX_PICSIZE_CLIP: nScaleMode = AwtScaleMode::None; break;
- case AX_PICSIZE_STRETCH: nScaleMode = AwtScaleMode::Anisotropic; break;
- case AX_PICSIZE_ZOOM: nScaleMode = AwtScaleMode::Isotropic; break;
+ case AX_PICSIZE_CLIP: nScaleMode = ImageScaleMode::None; break;
+ case AX_PICSIZE_STRETCH: nScaleMode = ImageScaleMode::Anisotropic; break;
+ case AX_PICSIZE_ZOOM: nScaleMode = ImageScaleMode::Isotropic; break;
default: OSL_ENSURE( false, "ControlConverter::convertAxPicture - unknown picture size mode" );
}
rPropMap.setProperty( PROP_ScaleMode, nScaleMode );
@@ -433,6 +531,7 @@ OUString ControlModelBase::getServiceName() const
case API_CONTROL_CHECKBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlCheckBoxModel" );
case API_CONTROL_RADIOBUTTON: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlRadioButtonModel" );
case API_CONTROL_EDIT: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlEditModel" );
+ case API_CONTROL_NUMERIC: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlNumericFieldModel" );
case API_CONTROL_LISTBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlListBoxModel" );
case API_CONTROL_COMBOBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlComboBoxModel" );
case API_CONTROL_SPINBUTTON: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlSpinButtonModel" );
@@ -450,6 +549,7 @@ OUString ControlModelBase::getServiceName() const
case API_CONTROL_CHECKBOX: return CREATE_OUSTRING( "com.sun.star.form.component.CheckBox" );
case API_CONTROL_RADIOBUTTON: return CREATE_OUSTRING( "com.sun.star.form.component.RadioButton" );
case API_CONTROL_EDIT: return CREATE_OUSTRING( "com.sun.star.form.component.TextField" );
+ case API_CONTROL_NUMERIC: return CREATE_OUSTRING( "com.sun.star.form.component.NumericField" );
case API_CONTROL_LISTBOX: return CREATE_OUSTRING( "com.sun.star.form.component.ListBox" );
case API_CONTROL_COMBOBOX: return CREATE_OUSTRING( "com.sun.star.form.component.ComboBox" );
case API_CONTROL_SPINBUTTON: return CREATE_OUSTRING( "com.sun.star.form.component.SpinButton" );
@@ -530,8 +630,8 @@ sal_uInt32 ComCtlModelBase::getDataPartId() const
{
switch( mnVersion )
{
- case 5: return mnDataPartId5;
- case 6: return mnDataPartId6;
+ case COMCTL_VERSION_50: return mnDataPartId5;
+ case COMCTL_VERSION_60: return mnDataPartId6;
}
OSL_ENSURE( false, "ComCtlObjectBase::getDataPartId - unxpected version" );
return SAL_MAX_UINT32;
@@ -652,7 +752,7 @@ void ComCtlProgressBarModel::convertProperties( PropertyMap& rPropMap, const Con
void ComCtlProgressBarModel::importControlData( BinaryInputStream& rInStrm )
{
rInStrm >> mfMin >> mfMax;
- if( mnVersion == 6 )
+ if( mnVersion == COMCTL_VERSION_60 )
rInStrm >> mnVertical >> mnSmooth;
}
@@ -708,17 +808,15 @@ bool AxFontDataModel::importBinaryModel( BinaryInputStream& rInStrm )
void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
- namespace cssa = ::com::sun::star::awt;
-
// font name
if( maFontData.maFontName.getLength() > 0 )
rPropMap.setProperty( PROP_FontName, maFontData.maFontName );
// font effects
- rPropMap.setProperty( PROP_FontWeight, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_BOLD, cssa::FontWeight::BOLD, cssa::FontWeight::NORMAL ) );
- rPropMap.setProperty( PROP_FontSlant, getFlagValue< sal_Int16 >( maFontData.mnFontEffects, AX_FONTDATA_ITALIC, cssa::FontSlant_ITALIC, cssa::FontSlant_NONE ) );
- rPropMap.setProperty( PROP_FontUnderline, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_UNDERLINE, cssa::FontUnderline::SINGLE, cssa::FontUnderline::NONE ) );
- rPropMap.setProperty( PROP_FontStrikeout, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_STRIKEOUT, cssa::FontStrikeout::SINGLE, cssa::FontStrikeout::NONE ) );
+ rPropMap.setProperty( PROP_FontWeight, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_BOLD, FontWeight::BOLD, FontWeight::NORMAL ) );
+ rPropMap.setProperty( PROP_FontSlant, getFlagValue< sal_Int16 >( maFontData.mnFontEffects, AX_FONTDATA_ITALIC, FontSlant_ITALIC, FontSlant_NONE ) );
+ rPropMap.setProperty( PROP_FontUnderline, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_UNDERLINE, maFontData.mbDblUnderline ? FontUnderline::DOUBLE : FontUnderline::SINGLE, FontUnderline::NONE ) );
+ rPropMap.setProperty( PROP_FontStrikeout, getFlagValue( maFontData.mnFontEffects, AX_FONTDATA_STRIKEOUT, FontStrikeout::SINGLE, FontStrikeout::NONE ) );
rPropMap.setProperty( PROP_FontHeight, maFontData.getHeightPoints() );
// font character set
@@ -731,12 +829,12 @@ void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlCon
// text alignment
if( mbSupportsAlign )
{
- sal_Int32 nAlign = cssa::TextAlign::LEFT;
+ sal_Int32 nAlign = TextAlign::LEFT;
switch( maFontData.mnHorAlign )
{
- case AX_FONTDATA_LEFT: nAlign = cssa::TextAlign::LEFT; break;
- case AX_FONTDATA_RIGHT: nAlign = cssa::TextAlign::RIGHT; break;
- case AX_FONTDATA_CENTER: nAlign = cssa::TextAlign::CENTER; break;
+ case AX_FONTDATA_LEFT: nAlign = TextAlign::LEFT; break;
+ case AX_FONTDATA_RIGHT: nAlign = TextAlign::RIGHT; break;
+ case AX_FONTDATA_CENTER: nAlign = TextAlign::CENTER; break;
default: OSL_ENSURE( false, "AxFontDataModel::convertProperties - unknown text alignment" );
}
// form controls expect short value
@@ -754,6 +852,7 @@ AxCommandButtonModel::AxCommandButtonModel() :
mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
mnFlags( AX_CMDBUTTON_DEFFLAGS ),
mnPicturePos( AX_PICPOS_ABOVECENTER ),
+ mnVerticalAlign( XML_Center ),
mbFocusOnClick( true )
{
}
@@ -809,8 +908,8 @@ void AxCommandButtonModel::convertProperties( PropertyMap& rPropMap, const Contr
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
rPropMap.setProperty( PROP_FocusOnClick, mbFocusOnClick );
- rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_MIDDLE );
rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
+ rConv.convertVerticalAlign( rPropMap, mnVerticalAlign );
rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
AxFontDataModel::convertProperties( rPropMap, rConv );
@@ -824,7 +923,8 @@ AxLabelModel::AxLabelModel() :
mnFlags( AX_LABEL_DEFFLAGS ),
mnBorderColor( AX_SYSCOLOR_WINDOWFRAME ),
mnBorderStyle( AX_BORDERSTYLE_NONE ),
- mnSpecialEffect( AX_SPECIALEFFECT_FLAT )
+ mnSpecialEffect( AX_SPECIALEFFECT_FLAT ),
+ mnVerticalAlign( XML_Top )
{
}
@@ -872,8 +972,8 @@ void AxLabelModel::convertProperties( PropertyMap& rPropMap, const ControlConver
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
- rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_TOP );
rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
+ rConv.convertVerticalAlign( rPropMap, mnVerticalAlign );
rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
rConv.convertAxBorder( rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
AxFontDataModel::convertProperties( rPropMap, rConv );
@@ -970,7 +1070,8 @@ AxMorphDataModelBase::AxMorphDataModelBase() :
mnShowDropButton( AX_SHOWDROPBUTTON_NEVER ),
mnMaxLength( 0 ),
mnPasswordChar( 0 ),
- mnListRows( 8 )
+ mnListRows( 8 ),
+ mnVerticalAlign( XML_Center )
{
}
@@ -1059,6 +1160,7 @@ void AxMorphDataModelBase::convertProperties( PropertyMap& rPropMap, const Contr
AxToggleButtonModel::AxToggleButtonModel()
{
+ mnDisplayStyle = AX_DISPLAYSTYLE_TOGGLE;
}
ApiControlType AxToggleButtonModel::getControlType() const
@@ -1071,8 +1173,8 @@ void AxToggleButtonModel::convertProperties( PropertyMap& rPropMap, const Contro
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
- rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_MIDDLE );
rPropMap.setProperty( PROP_Toggle, true );
+ rConv.convertVerticalAlign( rPropMap, mnVerticalAlign );
rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_NOTSUPPORTED );
rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
rConv.convertAxState( rPropMap, maValue, mnMultiSelect, API_DEFAULTSTATE_BOOLEAN, mbAwtModel );
@@ -1083,6 +1185,7 @@ void AxToggleButtonModel::convertProperties( PropertyMap& rPropMap, const Contro
AxCheckBoxModel::AxCheckBoxModel()
{
+ mnDisplayStyle = AX_DISPLAYSTYLE_CHECKBOX;
}
ApiControlType AxCheckBoxModel::getControlType() const
@@ -1095,7 +1198,7 @@ void AxCheckBoxModel::convertProperties( PropertyMap& rPropMap, const ControlCon
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
- rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_MIDDLE );
+ rConv.convertVerticalAlign( rPropMap, mnVerticalAlign );
rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
rConv.convertAxVisualEffect( rPropMap, mnSpecialEffect );
rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
@@ -1107,6 +1210,7 @@ void AxCheckBoxModel::convertProperties( PropertyMap& rPropMap, const ControlCon
AxOptionButtonModel::AxOptionButtonModel()
{
+ mnDisplayStyle = AX_DISPLAYSTYLE_OPTBUTTON;
}
ApiControlType AxOptionButtonModel::getControlType() const
@@ -1119,7 +1223,7 @@ void AxOptionButtonModel::convertProperties( PropertyMap& rPropMap, const Contro
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
- rPropMap.setProperty( PROP_VerticalAlign, ::com::sun::star::style::VerticalAlignment_MIDDLE );
+ rConv.convertVerticalAlign( rPropMap, mnVerticalAlign );
rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
rConv.convertAxVisualEffect( rPropMap, mnSpecialEffect );
rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
@@ -1131,6 +1235,7 @@ void AxOptionButtonModel::convertProperties( PropertyMap& rPropMap, const Contro
AxTextBoxModel::AxTextBoxModel()
{
+ mnDisplayStyle = AX_DISPLAYSTYLE_TEXT;
}
ApiControlType AxTextBoxModel::getControlType() const
@@ -1156,8 +1261,34 @@ void AxTextBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConv
// ============================================================================
+AxNumericFieldModel::AxNumericFieldModel()
+{
+ mnDisplayStyle = AX_DISPLAYSTYLE_TEXT;
+}
+
+ApiControlType AxNumericFieldModel::getControlType() const
+{
+ OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT, "AxNumericFieldModel::getControlType - invalid control type" );
+ return API_CONTROL_NUMERIC;
+}
+
+void AxNumericFieldModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
+{
+ rPropMap.setProperty( PROP_HideInactiveSelection, getFlag( mnFlags, AX_FLAGS_HIDESELECTION ) );
+ // TODO: OUString::toDouble() does not handle local decimal separator
+ rPropMap.setProperty( mbAwtModel ? PROP_Value : PROP_DefaultValue, maValue.toDouble() );
+ rPropMap.setProperty( PROP_Spin, getFlag( mnScrollBars, AX_SCROLLBAR_VERTICAL ) );
+ rPropMap.setProperty( PROP_Repeat, true );
+ rConv.convertAxBackground( rPropMap, mnBackColor, mnFlags, API_TRANSPARENCY_VOID );
+ rConv.convertAxBorder( rPropMap, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxMorphDataModelBase::convertProperties( rPropMap, rConv );
+}
+
+// ============================================================================
+
AxListBoxModel::AxListBoxModel()
{
+ mnDisplayStyle = AX_DISPLAYSTYLE_LISTBOX;
}
ApiControlType AxListBoxModel::getControlType() const
@@ -1180,6 +1311,7 @@ void AxListBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConv
AxComboBoxModel::AxComboBoxModel()
{
+ mnDisplayStyle = AX_DISPLAYSTYLE_COMBOBOX;
}
ApiControlType AxComboBoxModel::getControlType() const
@@ -1368,7 +1500,7 @@ void AxScrollBarModel::convertProperties( PropertyMap& rPropMap, const ControlCo
// ============================================================================
AxTabStripModel::AxTabStripModel() :
- AxFontDataModel( false ), // no support for Align property
+ AxFontDataModel( false ), // no support for alignment properties
mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
mnTextColor( AX_SYSCOLOR_BUTTONTEXT ),
mnFlags( AX_TABSTRIP_DEFFLAGS ),
@@ -1430,7 +1562,7 @@ OUString AxTabStripModel::getCaption( sal_Int32 nIndex ) const
// ============================================================================
AxContainerModelBase::AxContainerModelBase( bool bFontSupport ) :
- AxFontDataModel( false ), // no support for Align property
+ AxFontDataModel( false ), // no support for alignment properties
maLogicalSize( AX_CONTAINER_DEFWIDTH, AX_CONTAINER_DEFHEIGHT ),
maScrollPos( 0, 0 ),
mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
@@ -1623,43 +1755,26 @@ EmbeddedControl::~EmbeddedControl()
{
}
-ControlModelRef EmbeddedControl::createModel( const OUString& rClassId )
+ControlModelBase* EmbeddedControl::createModelFromGuid( const OUString& rClassId )
{
OUString aClassId = rClassId.toAsciiUpperCase();
- if( aClassId.equalsAscii( AX_GUID_COMMANDBUTTON ) )
- mxModel.reset( new AxCommandButtonModel );
- else if( aClassId.equalsAscii( AX_GUID_LABEL ) )
- mxModel.reset( new AxLabelModel );
- else if( aClassId.equalsAscii( AX_GUID_IMAGE ) )
- mxModel.reset( new AxImageModel );
- else if( aClassId.equalsAscii( AX_GUID_TOGGLEBUTTON ) )
- mxModel.reset( new AxToggleButtonModel );
- else if( aClassId.equalsAscii( AX_GUID_CHECKBOX ) )
- mxModel.reset( new AxCheckBoxModel );
- else if( aClassId.equalsAscii( AX_GUID_OPTIONBUTTON ) )
- mxModel.reset( new AxOptionButtonModel );
- else if( aClassId.equalsAscii( AX_GUID_TEXTBOX ) )
- mxModel.reset( new AxTextBoxModel );
- else if( aClassId.equalsAscii( AX_GUID_LISTBOX ) )
- mxModel.reset( new AxListBoxModel );
- else if( aClassId.equalsAscii( AX_GUID_COMBOBOX ) )
- mxModel.reset( new AxComboBoxModel );
- else if( aClassId.equalsAscii( AX_GUID_SPINBUTTON ) )
- mxModel.reset( new AxSpinButtonModel );
- else if( aClassId.equalsAscii( AX_GUID_SCROLLBAR ) )
- mxModel.reset( new AxScrollBarModel );
- else if( aClassId.equalsAscii( AX_GUID_FRAME ) )
- mxModel.reset( new AxFrameModel );
- else if( aClassId.equalsAscii( COMCTL_GUID_SCROLLBAR_60 ) )
- mxModel.reset( new ComCtlScrollBarModel( 6 ) );
- else
- mxModel.reset();
- // embedded controls are form component instances
- if( mxModel.get() )
- mxModel->setFormComponentMode();
+ if( aClassId.equalsAscii( AX_GUID_COMMANDBUTTON ) ) return &createModel< AxCommandButtonModel >();
+ if( aClassId.equalsAscii( AX_GUID_LABEL ) ) return &createModel< AxLabelModel >();
+ if( aClassId.equalsAscii( AX_GUID_IMAGE ) ) return &createModel< AxImageModel >();
+ if( aClassId.equalsAscii( AX_GUID_TOGGLEBUTTON ) ) return &createModel< AxToggleButtonModel >();
+ if( aClassId.equalsAscii( AX_GUID_CHECKBOX ) ) return &createModel< AxCheckBoxModel >();
+ if( aClassId.equalsAscii( AX_GUID_OPTIONBUTTON ) ) return &createModel< AxOptionButtonModel >();
+ if( aClassId.equalsAscii( AX_GUID_TEXTBOX ) ) return &createModel< AxTextBoxModel >();
+ if( aClassId.equalsAscii( AX_GUID_LISTBOX ) ) return &createModel< AxListBoxModel >();
+ if( aClassId.equalsAscii( AX_GUID_COMBOBOX ) ) return &createModel< AxComboBoxModel >();
+ if( aClassId.equalsAscii( AX_GUID_SPINBUTTON ) ) return &createModel< AxSpinButtonModel >();
+ if( aClassId.equalsAscii( AX_GUID_SCROLLBAR ) ) return &createModel< AxScrollBarModel >();
+ if( aClassId.equalsAscii( AX_GUID_FRAME ) ) return &createModel< AxFrameModel >();
+ if( aClassId.equalsAscii( COMCTL_GUID_SCROLLBAR_60 ) ) return &createModel< ComCtlScrollBarModel >( COMCTL_VERSION_60 );
- return mxModel;
+ mxModel.reset();
+ return 0;
}
OUString EmbeddedControl::getServiceName() const
@@ -1683,16 +1798,16 @@ bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtr
// ============================================================================
-EmbeddedForm::EmbeddedForm( const Reference< XMultiServiceFactory >& rxModelFactory,
+EmbeddedForm::EmbeddedForm( const Reference< XModel >& rxDocModel,
const Reference< XDrawPage >& rxDrawPage, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
- ControlConverter( rGraphicHelper, bDefaultColorBgr ),
- mxModelFactory( rxModelFactory ),
+ maControlConv( rxDocModel, rGraphicHelper, bDefaultColorBgr ),
+ mxModelFactory( rxDocModel, UNO_QUERY ),
mxFormsSupp( rxDrawPage, UNO_QUERY )
{
OSL_ENSURE( mxModelFactory.is(), "EmbeddedForm::EmbeddedForm - missing service factory" );
}
-Reference< XControlModel > EmbeddedForm::convertAndInsert( const EmbeddedControl& rControl )
+Reference< XControlModel > EmbeddedForm::convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex )
{
if( mxModelFactory.is() && rControl.hasModel() ) try
{
@@ -1702,12 +1817,12 @@ Reference< XControlModel > EmbeddedForm::convertAndInsert( const EmbeddedControl
Reference< XControlModel > xCtrlModel( xFormComp, UNO_QUERY_THROW );
// insert the control into the form
- Reference< XIndexContainer > xFormIC( createForm(), UNO_SET_THROW );
- sal_Int32 nNewIndex = xFormIC->getCount();
- xFormIC->insertByIndex( nNewIndex, Any( xFormComp ) );
+ Reference< XIndexContainer > xFormIC( createXForm(), UNO_SET_THROW );
+ rnCtrlIndex = xFormIC->getCount();
+ xFormIC->insertByIndex( rnCtrlIndex, Any( xFormComp ) );
// convert the control properties
- if( rControl.convertProperties( xCtrlModel, *this ) )
+ if( rControl.convertProperties( xCtrlModel, maControlConv ) )
return xCtrlModel;
}
catch( Exception& )
@@ -1716,7 +1831,7 @@ Reference< XControlModel > EmbeddedForm::convertAndInsert( const EmbeddedControl
return Reference< XControlModel >();
}
-Reference< XIndexContainer > EmbeddedForm::createForm()
+Reference< XIndexContainer > EmbeddedForm::createXForm()
{
if( mxFormsSupp.is() )
{
diff --git a/oox/source/ole/axcontrolfragment.cxx b/oox/source/ole/axcontrolfragment.cxx
index ecd782da2cb0..f45e8e2590c9 100644
--- a/oox/source/ole/axcontrolfragment.cxx
+++ b/oox/source/ole/axcontrolfragment.cxx
@@ -26,23 +26,27 @@
************************************************************************/
#include "oox/ole/axcontrolfragment.hxx"
+
+#include "oox/core/xmlfilterbase.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/binaryoutputstream.hxx"
-#include "oox/core/xmlfilterbase.hxx"
#include "oox/ole/axcontrol.hxx"
#include "oox/ole/olehelper.hxx"
#include "oox/ole/olestorage.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::uno::Reference;
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
using ::oox::core::ContextHandler2;
using ::oox::core::ContextHandlerRef;
using ::oox::core::FragmentHandler2;
using ::oox::core::XmlFilterBase;
-
-namespace oox {
-namespace ole {
+using ::rtl::OUString;
// ============================================================================
@@ -105,7 +109,7 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
switch( rAttribs.getToken( AX_TOKEN( persistence ), XML_TOKEN_INVALID ) )
{
case XML_persistPropertyBag:
- if( ControlModelBase* pModel = mrControl.createModel( aClassId ).get() )
+ if( ControlModelBase* pModel = mrControl.createModelFromGuid( aClassId ) )
return new AxControlPropertyContext( *this, *pModel );
break;
@@ -121,7 +125,7 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
OUString aStrmClassId = OleHelper::importGuid( aInStrm );
OSL_ENSURE( aClassId.equalsIgnoreAsciiCase( aStrmClassId ),
"AxControlFragment::importBinaryControl - form control class ID mismatch" );
- if( ControlModelBase* pModel = mrControl.createModel( aStrmClassId ).get() )
+ if( ControlModelBase* pModel = mrControl.createModelFromGuid( aStrmClassId ) )
pModel->importBinaryModel( aInStrm );
}
}
@@ -136,10 +140,10 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
Reference< XInputStream > xStrgStrm = getFilter().openInputStream( aFragmentPath );
if( xStrgStrm.is() )
{
- OleStorage aStorage( getFilter().getGlobalFactory(), xStrgStrm, false );
+ OleStorage aStorage( getFilter().getServiceFactory(), xStrgStrm, false );
BinaryXInputStream aInStrm( aStorage.openInputStream( CREATE_OUSTRING( "f" ) ), true );
if( !aInStrm.isEof() )
- if( AxContainerModelBase* pModel = dynamic_cast< AxContainerModelBase* >( mrControl.createModel( aClassId ).get() ) )
+ if( AxContainerModelBase* pModel = dynamic_cast< AxContainerModelBase* >( mrControl.createModelFromGuid( aClassId ) ) )
pModel->importBinaryModel( aInStrm );
}
}
diff --git a/oox/source/ole/makefile.mk b/oox/source/ole/makefile.mk
index 4e01392d4a57..a5232247cfa5 100644
--- a/oox/source/ole/makefile.mk
+++ b/oox/source/ole/makefile.mk
@@ -51,7 +51,8 @@ SLOFILES = \
$(SLO)$/vbahelper.obj \
$(SLO)$/vbainputstream.obj \
$(SLO)$/vbamodule.obj \
- $(SLO)$/vbaproject.obj
+ $(SLO)$/vbaproject.obj \
+ $(SLO)$/vbaprojectfilter.obj
# --- Targets -------------------------------------------------------
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index 0a0796e15a7e..8dfe02283cb0 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -26,19 +26,22 @@
************************************************************************/
#include "oox/ole/olehelper.hxx"
+
#include <rtl/ustrbuf.hxx>
-#include "tokens.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/graphichelper.hxx"
-
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
+#include "oox/token/tokens.hxx"
namespace oox {
namespace ole {
// ============================================================================
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
const sal_uInt32 OLE_COLORTYPE_MASK = 0xFF000000;
@@ -51,10 +54,16 @@ const sal_uInt32 OLE_PALETTECOLOR_MASK = 0x0000FFFF;
const sal_uInt32 OLE_BGRCOLOR_MASK = 0x00FFFFFF;
const sal_uInt32 OLE_SYSTEMCOLOR_MASK = 0x0000FFFF;
+/** Swaps the red and blue component of the passed color. */
+inline sal_uInt32 lclSwapRedBlue( sal_uInt32 nColor )
+{
+ return static_cast< sal_uInt32 >( (nColor & 0xFF00FF00) | ((nColor & 0x0000FF) << 16) | ((nColor & 0xFF0000) >> 16) );
+}
+
/** Returns the UNO RGB color from the passed encoded OLE BGR color. */
inline sal_Int32 lclDecodeBgrColor( sal_uInt32 nOleColor )
{
- return static_cast< sal_Int32 >( ((nOleColor & 0x0000FF) << 16) | (nOleColor & 0x00FF00) | ((nOleColor & 0xFF0000) >> 16) );
+ return static_cast< sal_Int32 >( lclSwapRedBlue( nOleColor ) & 0xFFFFFF );
}
// ----------------------------------------------------------------------------
@@ -161,6 +170,11 @@ StdFontInfo::StdFontInfo( const ::rtl::OUString& rName, sal_uInt32 nHeight,
return API_RGB_BLACK;
}
+/*static*/ sal_uInt32 OleHelper::encodeOleColor( sal_Int32 nRgbColor )
+{
+ return OLE_COLORTYPE_BGR | lclSwapRedBlue( static_cast< sal_uInt32 >( nRgbColor & 0xFFFFFF ) );
+}
+
/*static*/ OUString OleHelper::importGuid( BinaryInputStream& rInStrm )
{
OUStringBuffer aBuffer;
@@ -297,4 +311,3 @@ StdFontInfo::StdFontInfo( const ::rtl::OUString& rName, sal_uInt32 nHeight,
} // namespace ole
} // namespace oox
-
diff --git a/oox/source/ole/oleobjecthelper.cxx b/oox/source/ole/oleobjecthelper.cxx
index 5ef65fe2292e..396cd6b53874 100644
--- a/oox/source/ole/oleobjecthelper.cxx
+++ b/oox/source/ole/oleobjecthelper.cxx
@@ -26,34 +26,32 @@
************************************************************************/
#include "oox/ole/oleobjecthelper.hxx"
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
+
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
#include <com/sun/star/embed/Aspects.hpp>
-#include "properties.hxx"
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include "oox/helper/propertymap.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::lang::XComponent;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::awt::Size;
-
namespace oox {
namespace ole {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
OleObjectInfo::OleObjectInfo() :
mbLinked( false ),
mbShowAsIcon( false ),
@@ -138,4 +136,3 @@ bool OleObjectHelper::importOleObject( PropertyMap& rPropMap, const OleObjectInf
} // namespace ole
} // namespace oox
-
diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx
index 0ca2992d47ad..cf55d6463778 100755..100644
--- a/oox/source/ole/olestorage.cxx
+++ b/oox/source/ole/olestorage.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/ole/olestorage.hxx"
+
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
@@ -35,38 +36,27 @@
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <cppuhelper/implbase2.hxx>
-#include "oox/helper/helper.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/binaryoutputstream.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::embed::XStorage;
-using ::com::sun::star::embed::XTransactedObject;
-using ::com::sun::star::io::BufferSizeExceededException;
-using ::com::sun::star::io::IOException;
-using ::com::sun::star::io::NotConnectedException;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::io::XSeekable;
-using ::com::sun::star::io::XStream;
-using ::com::sun::star::lang::IllegalArgumentException;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
+#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/helper.hxx"
namespace oox {
namespace ole {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::embed;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
typedef ::cppu::WeakImplHelper2< XSeekable, XOutputStream > OleOutputStreamBase;
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 2a36cb4ff3ca..39deb77576d9 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -26,43 +26,42 @@
************************************************************************/
#include "oox/ole/vbacontrol.hxx"
+
#include <algorithm>
#include <set>
-#include <rtl/ustrbuf.hxx>
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/io/XInputStreamProvider.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/ustrbuf.hxx>
#include <xmlscript/xmldlg_imexp.hxx>
-#include "properties.hxx"
-#include "tokens.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/storagebase.hxx"
#include "oox/helper/textinputstream.hxx"
#include "oox/ole/vbahelper.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::awt::XControlModel;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::io::XInputStreamProvider;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::uno::XComponentContext;
-
namespace oox {
namespace ole {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
const sal_uInt16 VBA_SITE_CLASSIDINDEX = 0x8000;
@@ -220,8 +219,8 @@ bool VbaSiteModel::importBinaryModel( BinaryInputStream& rInStrm )
aReader.skipUndefinedProperty();
aReader.readStringProperty( maToolTip );
aReader.skipStringProperty(); // license key
- aReader.readStringProperty( maLinkedCell );
- aReader.readStringProperty( maSourceRange );
+ aReader.readStringProperty( maControlSource );
+ aReader.readStringProperty( maRowSource );
return aReader.finalizeImport();
}
@@ -337,6 +336,11 @@ void VbaSiteModel::convertProperties( PropertyMap& rPropMap,
}
}
+void VbaSiteModel::bindToSources( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv ) const
+{
+ rConv.bindToSources( rxCtrlModel, maControlSource, maRowSource );
+}
+
// ============================================================================
VbaFormControl::VbaFormControl()
@@ -750,19 +754,21 @@ bool lclEatKeyword( OUString& rCodeLine, const OUString& rKeyword )
// ----------------------------------------------------------------------------
-VbaUserForm::VbaUserForm( const Reference< XMultiServiceFactory >& rxGlobalFactory,
- const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
- ControlConverter( rGraphicHelper, bDefaultColorBgr ),
- mxGlobalFactory( rxGlobalFactory )
+VbaUserForm::VbaUserForm( const Reference< XComponentContext >& rxContext,
+ const Reference< XModel >& rxDocModel, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
+ mxCompContext( rxContext ),
+ mxDocModel( rxDocModel ),
+ maConverter( rxDocModel, rGraphicHelper, bDefaultColorBgr )
{
- OSL_ENSURE( mxGlobalFactory.is(), "VbaUserForm::VbaUserForm - missing service factory" );
+ OSL_ENSURE( mxCompContext.is(), "VbaUserForm::VbaUserForm - missing component context" );
+ OSL_ENSURE( mxDocModel.is(), "VbaUserForm::VbaUserForm - missing document model" );
}
void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib,
StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc )
{
OSL_ENSURE( rxDialogLib.is(), "VbaUserForm::importForm - missing dialog library" );
- if( !mxGlobalFactory.is() || !rxDialogLib.is() )
+ if( !mxCompContext.is() || !mxDocModel.is() || !rxDialogLib.is() )
return;
// check that the '03VBFrame' stream exists, this is required for forms
@@ -820,16 +826,15 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib,
{
// create the dialog model
OUString aServiceName = mxCtrlModel->getServiceName();
- Reference< XControlModel > xDialogModel( mxGlobalFactory->createInstance( aServiceName ), UNO_QUERY_THROW );
+ Reference< XMultiServiceFactory > xFactory( mxCompContext->getServiceManager(), UNO_QUERY_THROW );
+ Reference< XControlModel > xDialogModel( xFactory->createInstance( aServiceName ), UNO_QUERY_THROW );
Reference< XNameContainer > xDialogNC( xDialogModel, UNO_QUERY_THROW );
// convert properties and embedded controls
- if( convertProperties( xDialogModel, *this, 0 ) )
+ if( convertProperties( xDialogModel, maConverter, 0 ) )
{
// export the dialog to XML and insert it into the dialog library
- PropertySet aFactoryProps( mxGlobalFactory );
- Reference< XComponentContext > xCompContext( aFactoryProps.getAnyProperty( PROP_DefaultContext ), UNO_QUERY_THROW );
- Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, xCompContext ), UNO_SET_THROW );
+ Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, mxCompContext ), UNO_SET_THROW );
OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" );
ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) );
}
diff --git a/oox/source/ole/vbahelper.cxx b/oox/source/ole/vbahelper.cxx
index 3bf72d30bfa5..82d38d83610c 100644
--- a/oox/source/ole/vbahelper.cxx
+++ b/oox/source/ole/vbahelper.cxx
@@ -32,9 +32,12 @@
namespace oox {
namespace ole {
+// ============================================================================
+
+using namespace ::com::sun::star::uno;
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using namespace ::com::sun::star::uno;
// ============================================================================
diff --git a/oox/source/ole/vbainputstream.cxx b/oox/source/ole/vbainputstream.cxx
index b2c8d5c64859..e56e8b5fbc89 100644
--- a/oox/source/ole/vbainputstream.cxx
+++ b/oox/source/ole/vbainputstream.cxx
@@ -31,6 +31,8 @@
namespace oox {
namespace ole {
+// ============================================================================
+
namespace {
const sal_uInt8 VBASTREAM_SIGNATURE = 1;
diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx
index dbd5c9c02ced..2da92b935004 100644
--- a/oox/source/ole/vbamodule.cxx
+++ b/oox/source/ole/vbamodule.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/ole/vbamodule.hxx"
+
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
#include <com/sun/star/script/ModuleType.hpp>
@@ -36,17 +37,20 @@
#include "oox/ole/vbahelper.hxx"
#include "oox/ole/vbainputstream.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
+namespace oox {
+namespace ole {
+
+// ============================================================================
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::script;
using namespace ::com::sun::star::script::vba;
using namespace ::com::sun::star::uno;
-namespace oox {
-namespace ole {
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
// ============================================================================
diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx
index 0f7e3cb8612a..35e6b7911012 100644
--- a/oox/source/ole/vbaproject.cxx
+++ b/oox/source/ole/vbaproject.cxx
@@ -26,19 +26,21 @@
************************************************************************/
#include "oox/ole/vbaproject.hxx"
+
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-#include <rtl/tencinfo.h>
-#include <rtl/ustrbuf.h>
+#include <com/sun/star/script/vba/XVBAMacroResolver.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <comphelper/configurationhelper.hxx>
#include <comphelper/string.hxx>
-#include "properties.hxx"
-#include "tokens.hxx"
+#include <rtl/tencinfo.h>
+#include <rtl/ustrbuf.h>
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
@@ -49,9 +51,10 @@
#include "oox/ole/vbainputstream.hxx"
#include "oox/ole/vbamodule.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::comphelper::ConfigurationHelper;
+namespace oox {
+namespace ole {
+
+// ============================================================================
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::document;
@@ -63,8 +66,9 @@ using namespace ::com::sun::star::script;
using namespace ::com::sun::star::script::vba;
using namespace ::com::sun::star::uno;
-namespace oox {
-namespace ole {
+using ::comphelper::ConfigurationHelper;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
// ============================================================================
@@ -88,14 +92,15 @@ bool lclReadConfigItem( const Reference< XInterface >& rxConfigAccess, const OUS
// ----------------------------------------------------------------------------
-VbaFilterConfig::VbaFilterConfig( const Reference< XMultiServiceFactory >& rxGlobalFactory, const OUString& rConfigCompName )
+VbaFilterConfig::VbaFilterConfig( const Reference< XComponentContext >& rxContext, const OUString& rConfigCompName )
{
- OSL_ENSURE( rxGlobalFactory.is(), "VbaFilterConfig::VbaFilterConfig - missing service factory" );
- try
+ OSL_ENSURE( rxContext.is(), "VbaFilterConfig::VbaFilterConfig - missing component context" );
+ if( rxContext.is() ) try
{
OSL_ENSURE( rConfigCompName.getLength() > 0, "VbaFilterConfig::VbaFilterConfig - invalid configuration component name" );
OUString aConfigPackage = CREATE_OUSTRING( "org.openoffice.Office." ) + rConfigCompName;
- mxConfigAccess = ConfigurationHelper::openConfig( rxGlobalFactory, aConfigPackage, ConfigurationHelper::E_READONLY );
+ Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW );
+ mxConfigAccess = ConfigurationHelper::openConfig( xFactory, aConfigPackage, ConfigurationHelper::E_READONLY );
}
catch( Exception& )
{
@@ -124,13 +129,37 @@ bool VbaFilterConfig::isExportVba() const
// ============================================================================
-VbaProject::VbaProject( const Reference< XMultiServiceFactory >& rxGlobalFactory,
+VbaMacroAttacherBase::VbaMacroAttacherBase( const OUString& rMacroName ) :
+ maMacroName( rMacroName )
+{
+ OSL_ENSURE( maMacroName.getLength() > 0, "VbaMacroAttacherBase::VbaMacroAttacherBase - empty macro name" );
+}
+
+VbaMacroAttacherBase::~VbaMacroAttacherBase()
+{
+}
+
+void VbaMacroAttacherBase::resolveAndAttachMacro( const Reference< XVBAMacroResolver >& rxResolver )
+{
+ try
+ {
+ attachMacro( rxResolver->resolveVBAMacroToScriptURL( maMacroName ) );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// ============================================================================
+
+VbaProject::VbaProject( const Reference< XComponentContext >& rxContext,
const Reference< XModel >& rxDocModel, const OUString& rConfigCompName ) :
- VbaFilterConfig( rxGlobalFactory, rConfigCompName ),
- mxGlobalFactory( rxGlobalFactory ),
+ VbaFilterConfig( rxContext, rConfigCompName ),
+ mxCompContext( rxContext ),
mxDocModel( rxDocModel ),
- maLibName( CREATE_OUSTRING( "Standard" ) )
+ maPrjName( CREATE_OUSTRING( "Standard" ) )
{
+ OSL_ENSURE( mxCompContext.is(), "VbaProject::VbaProject - missing component context" );
OSL_ENSURE( mxDocModel.is(), "VbaProject::VbaProject - missing document model" );
mxBasicLib = openLibrary( PROP_BasicLibraries, false );
mxDialogLib = openLibrary( PROP_DialogLibraries, false );
@@ -153,6 +182,12 @@ void VbaProject::importVbaProject( StorageBase& rVbaPrjStrg, const GraphicHelper
}
}
+void VbaProject::registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher )
+{
+ OSL_ENSURE( rxAttacher.get(), "VbaProject::registerMacroAttacher - unexpected empty reference" );
+ maMacroAttachers.push_back( rxAttacher );
+}
+
bool VbaProject::hasModules() const
{
return mxBasicLib.is() && mxBasicLib->hasElements();
@@ -181,51 +216,6 @@ void VbaProject::addDummyModule( const OUString& rName, sal_Int32 nType )
maDummyModules[ rName ] = nType;
}
-void VbaProject::createDummyModules()
-{
- /* !! HACK !! This function is called from old XLS filter only, must be
- removed when this filter uses the OOX VBA import instead of the old SVX
- VBA import.
- */
-
- // create empty dummy modules
- typedef RefMap< OUString, VbaModule > VbaModuleMap;
- VbaModuleMap aDummyModules;
- for( DummyModuleMap::iterator aIt = maDummyModules.begin(), aEnd = maDummyModules.end(); aIt != aEnd; ++aIt )
- {
- OSL_ENSURE( !aDummyModules.has( aIt->first ), "VbaProject::createDummyModules - multiple modules with the same name" );
- VbaModuleMap::mapped_type& rxModule = aDummyModules[ aIt->first ];
- rxModule.reset( new VbaModule( mxDocModel, aIt->first, RTL_TEXTENCODING_MS_1252, isImportVbaExecutable() ) );
- rxModule->setType( aIt->second );
- }
-
- if( !aDummyModules.empty() ) try
- {
- // get the model factory and the basic library
- Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW );
- Reference< XNameContainer > xBasicLib( createBasicLibrary(), UNO_SET_THROW );
-
- // try to get access to document objects related to code modules
- Reference< XNameAccess > xDocObjectNA;
- try
- {
- xDocObjectNA.set( xModelFactory->createInstance( CREATE_OUSTRING( "ooo.vba.VBAObjectModuleObjectProvider" ) ), UNO_QUERY );
- }
- catch( Exception& )
- {
- // not all documents support this
- }
-
- // create empty dummy modules
- if( xBasicLib.is() )
- aDummyModules.forEachMem( &VbaModule::createEmptyModule,
- ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ) );
- }
- catch( Exception& )
- {
- }
-}
-
void VbaProject::prepareImport()
{
}
@@ -249,9 +239,9 @@ Reference< XNameContainer > VbaProject::openLibrary( sal_Int32 nPropId, bool bCr
try
{
Reference< XLibraryContainer > xLibContainer( getLibraryContainer( nPropId ), UNO_SET_THROW );
- if( bCreateMissing && !xLibContainer->hasByName( maLibName ) )
- xLibContainer->createLibrary( maLibName );
- xLibrary.set( xLibContainer->getByName( maLibName ), UNO_QUERY_THROW );
+ if( bCreateMissing && !xLibContainer->hasByName( CREATE_OUSTRING( "Standard" ) /*maPrjName*/ ) )
+ xLibContainer->createLibrary( CREATE_OUSTRING( "Standard" ) /*maPrjName*/ );
+ xLibrary.set( xLibContainer->getByName( CREATE_OUSTRING( "Standard" ) /*maPrjName*/ ), UNO_QUERY_THROW );
}
catch( Exception& )
{
@@ -323,6 +313,14 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
eTextEnc = eNewTextEnc;
}
break;
+ case VBA_ID_PROJECTNAME:
+ {
+ OUString aPrjName = aRecStrm.readCharArrayUC( nRecSize, eTextEnc );
+ OSL_ENSURE( aPrjName.getLength() > 0, "VbaProject::importVba - invalid project name" );
+ if( aPrjName.getLength() > 0 )
+ maPrjName = aPrjName;
+ }
+ break;
case VBA_ID_PROJECTMODULES:
OOX_ENSURE_RECORDSIZE( nRecSize == 2 );
OSL_ENSURE( aModules.empty(), "VbaProject::importVba - unexpected PROJECTMODULES record" );
@@ -420,7 +418,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
}
/* Now it is time to load the source code. All modules will be inserted
- into the Basic library of the document specified by the 'maLibName'
+ into the Basic library of the document specified by the 'maPrjName'
member. Do not create the Basic library, if there are no modules
specified. */
if( !aModules.empty() || !aDummyModules.empty() ) try
@@ -491,7 +489,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
// create and import the form
Reference< XNameContainer > xDialogLib( createDialogLibrary(), UNO_SET_THROW );
- VbaUserForm aForm( mxGlobalFactory, rGraphicHelper, bDefaultColorBgr );
+ VbaUserForm aForm( mxCompContext, mxDocModel, rGraphicHelper, bDefaultColorBgr );
aForm.importForm( xDialogLib, *xSubStrg, aModuleName, eTextEnc );
}
catch( Exception& )
@@ -500,20 +498,40 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
}
}
+ // attach macros to registered objects
+ attachMacros();
// virtual call, derived classes may do some more processing
finalizeImport();
}
+void VbaProject::attachMacros()
+{
+ if( !maMacroAttachers.empty() && mxCompContext.is() ) try
+ {
+ Reference< XMultiComponentFactory > xFactory( mxCompContext->getServiceManager(), UNO_SET_THROW );
+ Sequence< Any > aArgs( 2 );
+ aArgs[ 0 ] <<= mxDocModel;
+ aArgs[ 1 ] <<= maPrjName;
+ Reference< XVBAMacroResolver > xResolver( xFactory->createInstanceWithArgumentsAndContext(
+ CREATE_OUSTRING( "com.sun.star.script.vba.VBAMacroResolver" ), aArgs, mxCompContext ), UNO_QUERY_THROW );
+ maMacroAttachers.forEachMem( &VbaMacroAttacherBase::resolveAndAttachMacro, ::boost::cref( xResolver ) );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
void VbaProject::copyStorage( StorageBase& rVbaPrjStrg )
{
- try
+ if( mxCompContext.is() ) try
{
+ Reference< XMultiServiceFactory > xFactory( mxCompContext->getServiceManager(), UNO_QUERY_THROW );
Reference< XStorageBasedDocument > xStorageBasedDoc( mxDocModel, UNO_QUERY_THROW );
Reference< XStorage > xDocStorage( xStorageBasedDoc->getDocumentStorage(), UNO_QUERY_THROW );
{
using namespace ::com::sun::star::embed::ElementModes;
Reference< XStream > xDocStream( xDocStorage->openStreamElement( CREATE_OUSTRING( "_MS_VBA_Macros" ), SEEKABLE | WRITE | TRUNCATE ), UNO_SET_THROW );
- OleStorage aDestStorage( mxGlobalFactory, xDocStream, false );
+ OleStorage aDestStorage( xFactory, xDocStream, false );
rVbaPrjStrg.copyStorageToStorage( aDestStorage );
aDestStorage.commit();
}
diff --git a/oox/source/ole/vbaprojectfilter.cxx b/oox/source/ole/vbaprojectfilter.cxx
new file mode 100755
index 000000000000..ee5b3bf7a715
--- /dev/null
+++ b/oox/source/ole/vbaprojectfilter.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "oox/ole/vbaprojectfilter.hxx"
+
+#include "oox/ole/vbaproject.hxx"
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+VbaProjectFilterBase::VbaProjectFilterBase( const Reference< XComponentContext >& rxContext,
+ const OUString& rAppName, const OUString& rStorageName ) throw( RuntimeException ) :
+ BinaryFilterBase( rxContext ),
+ maAppName( rAppName ),
+ maStorageName( rStorageName )
+{
+}
+
+bool VbaProjectFilterBase::importDocument() throw()
+{
+ StorageRef xVbaPrjStrg = openSubStorage( maStorageName, false );
+ if( !xVbaPrjStrg || !xVbaPrjStrg->isStorage() )
+ return false;
+
+ getVbaProject().importVbaProject( *xVbaPrjStrg, getGraphicHelper() );
+ return true;
+}
+
+bool VbaProjectFilterBase::exportDocument() throw()
+{
+ return false;
+}
+
+VbaProject* VbaProjectFilterBase::implCreateVbaProject() const
+{
+ return new VbaProject( getComponentContext(), getModel(), maAppName );
+}
+
+// ============================================================================
+
+OUString SAL_CALL WordVbaProjectFilter_getImplementationName() throw()
+{
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.WordVbaProjectFilter" );
+}
+
+Sequence< OUString > SAL_CALL WordVbaProjectFilter_getSupportedServiceNames() throw()
+{
+ Sequence< OUString > aSeq( 1 );
+ aSeq[ 0 ] = CREATE_OUSTRING( "com.sun.star.document.ImportFilter" );
+ return aSeq;
+}
+
+Reference< XInterface > SAL_CALL WordVbaProjectFilter_createInstance(
+ const Reference< XComponentContext >& rxContext ) throw( Exception )
+{
+ return static_cast< ::cppu::OWeakObject* >( new WordVbaProjectFilter( rxContext ) );
+}
+
+// ----------------------------------------------------------------------------
+
+WordVbaProjectFilter::WordVbaProjectFilter( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ VbaProjectFilterBase( rxContext, CREATE_OUSTRING( "Writer" ), CREATE_OUSTRING( "Macros" ) )
+{
+}
+
+OUString WordVbaProjectFilter::implGetImplementationName() const
+{
+ return WordVbaProjectFilter_getImplementationName();
+}
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
diff --git a/oox/source/ppt/animationspersist.cxx b/oox/source/ppt/animationspersist.cxx
index 456b0616af1c..fdee865251af 100644
--- a/oox/source/ppt/animationspersist.cxx
+++ b/oox/source/ppt/animationspersist.cxx
@@ -25,8 +25,6 @@
*
************************************************************************/
-
-
#include "oox/ppt/animationspersist.hxx"
#include <rtl/ustring.hxx>
@@ -38,8 +36,6 @@
#include "oox/drawingml/shape.hxx"
-#include "tokens.hxx"
-
using rtl::OUString;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::presentation;
diff --git a/oox/source/ppt/animationtypes.cxx b/oox/source/ppt/animationtypes.cxx
index 80d87dd49ad2..6346a8058c5d 100644
--- a/oox/source/ppt/animationtypes.cxx
+++ b/oox/source/ppt/animationtypes.cxx
@@ -32,8 +32,6 @@
#include "oox/helper/attributelist.hxx"
-#include "tokens.hxx"
-
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::animations;
using namespace ::com::sun::star::xml::sax;
diff --git a/oox/source/ppt/animvariantcontext.cxx b/oox/source/ppt/animvariantcontext.cxx
index e2eca9a36dca..449c4ef73d11 100644
--- a/oox/source/ppt/animvariantcontext.cxx
+++ b/oox/source/ppt/animvariantcontext.cxx
@@ -35,12 +35,10 @@
#include <rtl/ustring.hxx>
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/fragmenthandler.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/colorchoicecontext.hxx"
#include "pptfilterhelpers.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -80,29 +78,29 @@ namespace oox { namespace ppt {
switch( aElementToken )
{
- case NMSP_PPT|XML_boolVal:
+ case PPT_TOKEN( boolVal ):
{
bool val = attribs.getBool( XML_val, false );
maValue = makeAny( val );
break;
}
- case NMSP_PPT|XML_clrVal:
+ case PPT_TOKEN( clrVal ):
xRet.set( new ::oox::drawingml::ColorContext( *this, maColor ) );
// we'll defer setting the Any until the end.
break;
- case NMSP_PPT|XML_fltVal:
+ case PPT_TOKEN( fltVal ):
{
double val = attribs.getDouble( XML_val, 0.0 );
maValue = makeAny( val );
break;
}
- case NMSP_PPT|XML_intVal:
+ case PPT_TOKEN( intVal ):
{
sal_Int32 val = attribs.getInteger( XML_val, 0 );
maValue = makeAny( val );
break;
}
- case NMSP_PPT|XML_strVal:
+ case PPT_TOKEN( strVal ):
{
OUString val = attribs.getString( XML_val, OUString() );
convertMeasure( val ); // ignore success or failure if it fails, use as is
diff --git a/oox/source/ppt/backgroundproperties.cxx b/oox/source/ppt/backgroundproperties.cxx
index 5b6fc4076a80..65664bdd3691 100644
--- a/oox/source/ppt/backgroundproperties.cxx
+++ b/oox/source/ppt/backgroundproperties.cxx
@@ -28,8 +28,6 @@
#include "oox/ppt/backgroundproperties.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using ::rtl::OUString;
using namespace ::oox::core;
@@ -51,7 +49,7 @@ Reference< XFastContextHandler > BackgroundPropertiesContext::createFastChildCon
switch( aElementToken )
{
- case NMSP_PPT|XML_fill: // a:CT_FillEffect
+ case PPT_TOKEN( fill ): // a:CT_FillEffect
break;
}
diff --git a/oox/source/ppt/buildlistcontext.cxx b/oox/source/ppt/buildlistcontext.cxx
index 61148265dfbe..3352e202e057 100644
--- a/oox/source/ppt/buildlistcontext.cxx
+++ b/oox/source/ppt/buildlistcontext.cxx
@@ -28,7 +28,6 @@
#include "buildlistcontext.hxx"
#include <rtl/ustring.hxx>
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
using namespace ::oox::core;
@@ -56,7 +55,7 @@ namespace oox { namespace ppt {
{
switch( aElement )
{
- case NMSP_PPT|XML_bldGraphic:
+ case PPT_TOKEN( bldGraphic ):
mbInBldGraphic = false;
break;
default:
@@ -72,18 +71,18 @@ namespace oox { namespace ppt {
switch( aElementToken )
{
- case NMSP_PPT|XML_bldAsOne:
+ case PPT_TOKEN( bldAsOne ):
if( mbInBldGraphic )
{
mbBuildAsOne = true;
}
break;
- case NMSP_PPT|XML_bldSub:
+ case PPT_TOKEN( bldSub ):
if( mbInBldGraphic )
{
}
break;
- case NMSP_PPT|XML_bldGraphic:
+ case PPT_TOKEN( bldGraphic ):
{
mbInBldGraphic = true;
AttributeList attribs( xAttribs );
@@ -94,9 +93,9 @@ namespace oox { namespace ppt {
// sal_uInt32 nGroupId = attribs.getUnsignedInteger( XML_grpId, 0 );
break;
}
- case NMSP_DRAWINGML|XML_bldDgm:
- case NMSP_DRAWINGML|XML_bldOleChart:
- case NMSP_DRAWINGML|XML_bldP:
+ case A_TOKEN( bldDgm ):
+ case A_TOKEN( bldOleChart ):
+ case A_TOKEN( bldP ):
break;
default:
diff --git a/oox/source/ppt/commonbehaviorcontext.cxx b/oox/source/ppt/commonbehaviorcontext.cxx
index 36841bab5aae..a4e3951228ae 100644
--- a/oox/source/ppt/commonbehaviorcontext.cxx
+++ b/oox/source/ppt/commonbehaviorcontext.cxx
@@ -34,14 +34,12 @@
#include <com/sun/star/animations/XAnimationNode.hpp>
#include <com/sun/star/animations/XAnimate.hpp>
-#include "oox/core/namespaces.hxx"
#include "oox/core/fragmenthandler.hxx"
#include "commonbehaviorcontext.hxx"
#include "commontimenodecontext.hxx"
#include "timetargetelementcontext.hxx"
#include "pptfilterhelpers.hxx"
-#include "tokens.hxx"
#include <string.h>
@@ -57,7 +55,7 @@ namespace oox { namespace ppt {
CommonBehaviorContext::CommonBehaviorContext( ContextHandler& rParent,
const Reference< XFastAttributeList >& xAttribs,
const TimeNodePtr & pNode )
- : TimeNodeContext( rParent, NMSP_PPT|XML_cBhvr, xAttribs, pNode )
+ : TimeNodeContext( rParent, PPT_TOKEN( cBhvr ), xAttribs, pNode )
, mbInAttrList( false )
, mbIsInAttrName( false )
{
@@ -75,7 +73,7 @@ namespace oox { namespace ppt {
{
switch( aElement )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
{
if( !maAttributes.empty() )
{
@@ -94,10 +92,10 @@ namespace oox { namespace ppt {
}
break;
}
- case NMSP_PPT|XML_attrNameLst:
+ case PPT_TOKEN( attrNameLst ):
mbInAttrList = false;
break;
- case NMSP_PPT|XML_attrName:
+ case PPT_TOKEN( attrName ):
if( mbIsInAttrName )
{
const ImplAttributeNameConversion *attrConv = gImplConversionList;
@@ -145,16 +143,16 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cTn:
+ case PPT_TOKEN( cTn ):
xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) );
break;
- case NMSP_PPT|XML_tgtEl:
+ case PPT_TOKEN( tgtEl ):
xRet.set( new TimeTargetElementContext( *this, mpNode->getTarget() ) );
break;
- case NMSP_PPT|XML_attrNameLst:
+ case PPT_TOKEN( attrNameLst ):
mbInAttrList = true;
break;
- case NMSP_PPT|XML_attrName:
+ case PPT_TOKEN( attrName ):
{
if( mbInAttrList )
{
diff --git a/oox/source/ppt/commontimenodecontext.cxx b/oox/source/ppt/commontimenodecontext.cxx
index d7de40255298..1057deb70c5d 100644
--- a/oox/source/ppt/commontimenodecontext.cxx
+++ b/oox/source/ppt/commontimenodecontext.cxx
@@ -42,13 +42,11 @@
#include <com/sun/star/presentation/EffectNodeType.hpp>
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/fragmenthandler.hxx"
#include "oox/ppt/pptimport.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "animationtypes.hxx"
-#include "tokens.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
@@ -619,7 +617,7 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId
void SAL_CALL CommonTimeNodeContext::endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException)
{
- if( aElement == ( NMSP_PPT|XML_iterate ) )
+ if( aElement == ( PPT_TOKEN( iterate ) ) )
{
mbIterate = false;
}
@@ -632,22 +630,22 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId
switch ( aElementToken )
{
- case NMSP_PPT|XML_childTnLst:
- case NMSP_PPT|XML_subTnLst:
+ case PPT_TOKEN( childTnLst ):
+ case PPT_TOKEN( subTnLst ):
xRet.set( new TimeNodeListContext( *this, mpNode->getChildren() ) );
break;
- case NMSP_PPT|XML_stCondLst:
+ case PPT_TOKEN( stCondLst ):
xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, mpNode->getStartCondition() ) );
break;
- case NMSP_PPT|XML_endCondLst:
+ case PPT_TOKEN( endCondLst ):
xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, mpNode->getEndCondition() ) );
break;
- case NMSP_PPT|XML_endSync:
+ case PPT_TOKEN( endSync ):
xRet.set( new CondContext( *this, xAttribs, mpNode, mpNode->getEndSyncValue() ) );
break;
- case NMSP_PPT|XML_iterate:
+ case PPT_TOKEN( iterate ):
{
sal_Int32 nVal = xAttribs->getOptionalValueToken( XML_type, XML_el );
if( nVal != 0 )
@@ -680,7 +678,7 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId
mbIterate = true;
break;
}
- case NMSP_PPT|XML_tmAbs:
+ case PPT_TOKEN( tmAbs ):
if( mbIterate )
{
AttributeList attribs( xAttribs );
@@ -689,7 +687,7 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId
mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fTime;
}
break;
- case NMSP_PPT|XML_tmPct:
+ case PPT_TOKEN( tmPct ):
if( mbIterate )
{
AttributeList attribs( xAttribs );
diff --git a/oox/source/ppt/conditioncontext.cxx b/oox/source/ppt/conditioncontext.cxx
index e52d8b27a464..5b622b6ef602 100644
--- a/oox/source/ppt/conditioncontext.cxx
+++ b/oox/source/ppt/conditioncontext.cxx
@@ -37,13 +37,11 @@
#include <com/sun/star/animations/EventTrigger.hpp>
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/contexthandler.hxx"
#include "oox/ppt/animationspersist.hxx"
#include "animationtypes.hxx"
#include "timetargetelementcontext.hxx"
-#include "tokens.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
@@ -54,7 +52,7 @@ namespace oox { namespace ppt {
CondContext::CondContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs,
const TimeNodePtr & pNode, AnimationCondition & aValue )
- : TimeNodeContext( rParent, NMSP_PPT|XML_cond, xAttribs, pNode )
+ : TimeNodeContext( rParent, PPT_TOKEN( cond ), xAttribs, pNode )
, maCond( aValue )
{
maEvent.Trigger = EventTrigger::NONE;
@@ -123,7 +121,7 @@ namespace oox { namespace ppt {
switch( aElementToken )
{
- case NMSP_PPT|XML_rtn:
+ case PPT_TOKEN( rtn ):
{
// ST_TLTriggerRuntimeNode { first, last, all }
sal_Int32 aTok;
@@ -147,7 +145,7 @@ namespace oox { namespace ppt {
maCond.maValue = makeAny( nEnum );
break;
}
- case NMSP_PPT|XML_tn:
+ case PPT_TOKEN( tn ):
{
maCond.mnType = aElementToken;
AttributeList attribs( xAttribs );
@@ -155,7 +153,7 @@ namespace oox { namespace ppt {
maCond.maValue = makeAny( nId );
break;
}
- case NMSP_PPT|XML_tgtEl:
+ case PPT_TOKEN( tgtEl ):
// CT_TLTimeTargetElement
xRet.set( new TimeTargetElementContext( *this, maCond.getTarget() ) );
break;
@@ -194,7 +192,7 @@ namespace oox { namespace ppt {
switch( aElement )
{
- case NMSP_PPT|XML_cond:
+ case PPT_TOKEN( cond ):
// add a condition to the list
maConditions.push_back( AnimationCondition() );
xRet.set( new CondContext( *this, xAttribs, mpNode, maConditions.back() ) );
diff --git a/oox/source/ppt/customshowlistcontext.cxx b/oox/source/ppt/customshowlistcontext.cxx
index 613000d07d41..f66ccb0f6084 100644
--- a/oox/source/ppt/customshowlistcontext.cxx
+++ b/oox/source/ppt/customshowlistcontext.cxx
@@ -26,9 +26,6 @@
************************************************************************/
#include "customshowlistcontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
-
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
@@ -71,8 +68,8 @@ Reference< XFastContextHandler > SAL_CALL CustomShowContext::createFastChildCont
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_PPT|XML_sld :
- mrCustomShow.maSldLst.push_back( xAttribs->getOptionalValue( NMSP_RELATIONSHIPS | XML_id ) );
+ case PPT_TOKEN( sld ) :
+ mrCustomShow.maSldLst.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) );
default:
break;
}
@@ -102,7 +99,7 @@ Reference< XFastContextHandler > SAL_CALL CustomShowListContext::createFastChild
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_PPT|XML_custShow :
+ case PPT_TOKEN( custShow ) :
{
CustomShow aCustomShow;
mrCustomShowList.push_back( aCustomShow );
diff --git a/oox/source/ppt/headerfootercontext.cxx b/oox/source/ppt/headerfootercontext.cxx
index 69f23b77c0da..2089b019c58c 100644
--- a/oox/source/ppt/headerfootercontext.cxx
+++ b/oox/source/ppt/headerfootercontext.cxx
@@ -26,9 +26,7 @@
************************************************************************/
#include "headerfootercontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/helper/attributelist.hxx"
-#include "tokens.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
diff --git a/oox/source/ppt/layoutfragmenthandler.cxx b/oox/source/ppt/layoutfragmenthandler.cxx
index d291550ac321..152beb280bd7 100644
--- a/oox/source/ppt/layoutfragmenthandler.cxx
+++ b/oox/source/ppt/layoutfragmenthandler.cxx
@@ -34,8 +34,6 @@
#include "headerfootercontext.hxx"
#include "oox/ppt/layoutfragmenthandler.hxx"
#include "oox/drawingml/shapegroupcontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::com::sun::star;
@@ -67,10 +65,10 @@ Reference< XFastContextHandler > LayoutFragmentHandler::createFastChildContext(
Reference< XFastContextHandler > xRet = getFastContextHandler();
switch( aElementToken )
{
- case NMSP_PPT|XML_sldLayout: // CT_SlideLayout
+ case PPT_TOKEN( sldLayout ): // CT_SlideLayout
mpSlidePersistPtr->setLayoutValueToken( xAttribs->getOptionalValueToken( XML_type, 0 ) ); // CT_SlideLayoutType
break;
- case NMSP_PPT|XML_hf: // CT_HeaderFooter
+ case PPT_TOKEN( hf ): // CT_HeaderFooter
xRet.set( new HeaderFooterContext( *this, xAttribs, mpSlidePersistPtr->getHeaderFooter() ) );
break;
default:
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index d60629b4481b..625e4e662e3c 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -30,6 +30,7 @@
#include "oox/dump/pptxdumper.hxx"
#include "oox/drawingml/table/tablestylelistfragmenthandler.hxx"
#include "oox/helper/graphichelper.hxx"
+#include "oox/ole/vbaproject.hxx"
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -41,24 +42,25 @@ namespace oox { namespace ppt {
OUString SAL_CALL PowerPointImport_getImplementationName() throw()
{
- return CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.PowerPointImport" );
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.ppt.PowerPointImport" );
}
uno::Sequence< OUString > SAL_CALL PowerPointImport_getSupportedServiceNames() throw()
{
- const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx" );
- const Sequence< OUString > aSeq( &aServiceName, 1 );
+ Sequence< OUString > aSeq( 2 );
+ aSeq[ 0 ] = CREATE_OUSTRING( "com.sun.star.document.ImportFilter" );
+ aSeq[ 1 ] = CREATE_OUSTRING( "com.sun.star.document.ExportFilter" );
return aSeq;
}
-uno::Reference< uno::XInterface > SAL_CALL PowerPointImport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
+uno::Reference< uno::XInterface > SAL_CALL PowerPointImport_createInstance( const Reference< XComponentContext >& rxContext ) throw( Exception )
{
- return (cppu::OWeakObject*)new PowerPointImport( rSMgr );
+ return static_cast< ::cppu::OWeakObject* >( new PowerPointImport( rxContext ) );
}
-PowerPointImport::PowerPointImport( const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
- : XmlFilterBase( rSMgr )
- , mxChartConv( new ::oox::drawingml::chart::ChartConverter )
+PowerPointImport::PowerPointImport( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ XmlFilterBase( rxContext ),
+ mxChartConv( new ::oox::drawingml::chart::ChartConverter )
{
}
@@ -73,9 +75,9 @@ bool PowerPointImport::importDocument() throw()
file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
- OUString aFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "officeDocument" ) );
+ OUString aFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "officeDocument" ) );
FragmentHandlerRef xPresentationFragmentHandler( new PresentationFragmentHandler( *this, aFragmentPath ) );
- maTableStyleListPath = xPresentationFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "tableStyles" ) );
+ maTableStyleListPath = xPresentationFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "tableStyles" ) );
return importFragment( xPresentationFragmentHandler );
@@ -163,7 +165,7 @@ private:
};
PptGraphicHelper::PptGraphicHelper( const PowerPointImport& rFilter ) :
- GraphicHelper( rFilter.getGlobalFactory(), rFilter.getTargetFrame(), rFilter.getStorage() ),
+ GraphicHelper( rFilter.getComponentContext(), rFilter.getTargetFrame(), rFilter.getStorage() ),
mrFilter( rFilter )
{
}
@@ -180,6 +182,11 @@ GraphicHelper* PowerPointImport::implCreateGraphicHelper() const
return new PptGraphicHelper( *this );
}
+::oox::ole::VbaProject* PowerPointImport::implCreateVbaProject() const
+{
+ return new ::oox::ole::VbaProject( getComponentContext(), getModel(), CREATE_OUSTRING( "Impress" ) );
+}
+
OUString PowerPointImport::implGetImplementationName() const
{
return PowerPointImport_getImplementationName();
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index bfe3ead6ca04..7437b378b324 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -26,10 +26,8 @@
************************************************************************/
#include "oox/ppt/pptshape.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/textbody.hxx"
-#include "tokens.hxx"
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
@@ -64,7 +62,7 @@ PPTShape::~PPTShape()
}
void PPTShape::addShape(
- const oox::core::XmlFilterBase& rFilterBase,
+ oox::core::XmlFilterBase& rFilterBase,
const SlidePersist& rSlidePersist,
const oox::drawingml::Theme* pTheme,
const Reference< XShapes >& rxShapes,
diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx
index c59638553018..7df41ac3d714 100644
--- a/oox/source/ppt/pptshapecontext.cxx
+++ b/oox/source/ppt/pptshapecontext.cxx
@@ -37,14 +37,11 @@
#include "oox/ppt/pptshapepropertiescontext.hxx"
#include "oox/ppt/slidepersist.hxx"
#include "oox/drawingml/shapestylecontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/customshapegeometry.hxx"
#include "oox/drawingml/textbodycontext.hxx"
-#include "tokens.hxx"
-#include "properties.hxx"
using rtl::OUString;
using namespace oox::core;
@@ -102,9 +99,9 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In
switch( aElementToken )
{
// nvSpPr CT_ShapeNonVisual begin
- // case NMSP_PPT|XML_drElemPr:
+ // case PPT_TOKEN( drElemPr ):
// break;
- case NMSP_PPT|XML_cNvPr:
+ case PPT_TOKEN( cNvPr ):
{
AttributeList aAttribs( xAttribs );
mpShapePtr->setHidden( aAttribs.getBool( XML_hidden, false ) );
@@ -112,7 +109,7 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In
mpShapePtr->setName( xAttribs->getOptionalValue( XML_name ) );
break;
}
- case NMSP_PPT|XML_ph:
+ case PPT_TOKEN( ph ):
{
sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) );
mpShapePtr->setSubType( nSubType );
@@ -191,15 +188,15 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In
// nvSpPr CT_ShapeNonVisual end
- case NMSP_PPT|XML_spPr:
+ case PPT_TOKEN( spPr ):
xRet = new PPTShapePropertiesContext( *this, *mpShapePtr );
break;
- case NMSP_PPT|XML_style:
+ case PPT_TOKEN( style ):
xRet = new oox::drawingml::ShapeStyleContext( *this, *mpShapePtr );
break;
- case NMSP_PPT|XML_txBody:
+ case PPT_TOKEN( txBody ):
{
oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody );
xTextBody->getTextProperties().maPropertyMap[ PROP_FontIndependentLineSpacing ] <<= static_cast< sal_Bool >( sal_True );
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index 074393874264..0ba36ee99417 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -39,8 +39,6 @@
#include "oox/drawingml/customshapegeometry.hxx"
#include "oox/drawingml/textbodycontext.hxx"
#include "oox/drawingml/connectorshapecontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace oox::core;
@@ -71,7 +69,7 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s
switch( aElementToken )
{
- case NMSP_PPT|XML_cNvPr:
+ case PPT_TOKEN( cNvPr ):
{
AttributeList aAttribs( xAttribs );
mpGroupShapePtr->setHidden( aAttribs.getBool( XML_hidden, false ) );
@@ -79,36 +77,36 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s
mpGroupShapePtr->setName( xAttribs->getOptionalValue( XML_name ) );
break;
}
- case NMSP_PPT|XML_ph:
+ case PPT_TOKEN( ph ):
mpGroupShapePtr->setSubType( xAttribs->getOptionalValueToken( XML_type, FastToken::DONTKNOW ) );
mpGroupShapePtr->setSubTypeIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );
break;
// nvSpPr CT_ShapeNonVisual end
- case NMSP_PPT|XML_grpSpPr:
+ case PPT_TOKEN( grpSpPr ):
xRet = new oox::drawingml::ShapePropertiesContext( *this, *mpGroupShapePtr );
break;
- case NMSP_PPT|XML_spPr:
+ case PPT_TOKEN( spPr ):
xRet = new oox::drawingml::ShapePropertiesContext( *this, *mpGroupShapePtr );
break;
/*
- case NMSP_PPT|XML_style:
+ case PPT_TOKEN( style ):
xRet = new ShapeStyleContext( getParser() );
break;
*/
- case NMSP_PPT|XML_cxnSp: // connector shape
+ case PPT_TOKEN( cxnSp ): // connector shape
xRet.set( new oox::drawingml::ConnectorShapeContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.ConnectorShape" ) ) ) );
break;
- case NMSP_PPT|XML_grpSp: // group shape
+ case PPT_TOKEN( grpSp ): // group shape
xRet.set( new PPTShapeGroupContext( *this, mpSlidePersistPtr, meShapeLocation, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) ) ) );
break;
- case NMSP_PPT|XML_sp: // Shape
+ case PPT_TOKEN( sp ): // Shape
xRet.set( new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) ) ) );
break;
- case NMSP_PPT|XML_pic: // CT_Picture
+ case PPT_TOKEN( pic ): // CT_Picture
xRet.set( new oox::drawingml::GraphicShapeContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GraphicObjectShape" ) ) ) );
break;
- case NMSP_PPT|XML_graphicFrame: // CT_GraphicalObjectFrame
+ case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame
xRet.set( new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) ), true ) );
break;
diff --git a/oox/source/ppt/pptshapepropertiescontext.cxx b/oox/source/ppt/pptshapepropertiescontext.cxx
index b4af0f08a555..bddd74f4837a 100644
--- a/oox/source/ppt/pptshapepropertiescontext.cxx
+++ b/oox/source/ppt/pptshapepropertiescontext.cxx
@@ -35,14 +35,11 @@
#include "oox/ppt/pptshapepropertiescontext.hxx"
#include "oox/ppt/slidepersist.hxx"
#include "oox/drawingml/shapestylecontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/customshapegeometry.hxx"
#include "oox/drawingml/textbodycontext.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace oox::core;
@@ -68,7 +65,7 @@ Reference< XFastContextHandler > PPTShapePropertiesContext::createFastChildConte
switch( aElementToken )
{
- case NMSP_DRAWINGML | XML_xfrm:
+ case A_TOKEN( xfrm ):
{
mrShape.getShapeProperties()[ PROP_IsPlaceholderDependent ] <<= sal_False;
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 786836fbc554..6976c965ad83 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -46,8 +46,6 @@
#include "oox/ppt/slidefragmenthandler.hxx"
#include "oox/ppt/layoutfragmenthandler.hxx"
#include "oox/ppt/pptimport.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::com::sun::star;
@@ -182,12 +180,12 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce
FragmentHandlerRef xSlideFragmentHandler( new SlideFragmentHandler( rFilter, aSlideFragmentPath, pSlidePersistPtr, Slide ) );
// importing the corresponding masterpage/layout
- OUString aLayoutFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "slideLayout" ) );
+ OUString aLayoutFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "slideLayout" ) );
if ( aLayoutFragmentPath.getLength() > 0 )
{
// importing layout
RelationsRef xLayoutRelations = rFilter.importRelations( aLayoutFragmentPath );
- OUString aMasterFragmentPath = xLayoutRelations->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "slideMaster" ) );
+ OUString aMasterFragmentPath = xLayoutRelations->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "slideMaster" ) );
if( aMasterFragmentPath.getLength() )
{
// check if the corresponding masterpage+layout has already been imported
@@ -221,7 +219,7 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce
FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, aMasterFragmentPath, pMasterPersistPtr, Master ) );
// set the correct theme
- OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "theme" ) );
+ OUString aThemeFragmentPath = xMasterFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) );
if( aThemeFragmentPath.getLength() > 0 )
{
std::map< OUString, oox::drawingml::ThemePtr >& rThemes( rFilter.getThemes() );
@@ -259,7 +257,7 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce
pSlidePersistPtr->createXShapes( rFilter );
// now importing the notes page
- OUString aNotesFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "notesSlide" ) );
+ OUString aNotesFragmentPath = xSlideFragmentHandler->getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "notesSlide" ) );
if( aNotesFragmentPath.getLength() > 0 )
{
Reference< XPresentationPage > xPresentationPage( xSlide, UNO_QUERY );
@@ -305,30 +303,30 @@ Reference< XFastContextHandler > PresentationFragmentHandler::createFastChildCon
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_PPT|XML_presentation:
- case NMSP_PPT|XML_sldMasterIdLst:
- case NMSP_PPT|XML_notesMasterIdLst:
- case NMSP_PPT|XML_sldIdLst:
+ case PPT_TOKEN( presentation ):
+ case PPT_TOKEN( sldMasterIdLst ):
+ case PPT_TOKEN( notesMasterIdLst ):
+ case PPT_TOKEN( sldIdLst ):
break;
- case NMSP_PPT|XML_sldMasterId:
- maSlideMasterVector.push_back( xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_id ) );
+ case PPT_TOKEN( sldMasterId ):
+ maSlideMasterVector.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) );
break;
- case NMSP_PPT|XML_sldId:
- maSlidesVector.push_back( xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_id ) );
+ case PPT_TOKEN( sldId ):
+ maSlidesVector.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) );
break;
- case NMSP_PPT|XML_notesMasterId:
- maNotesMasterVector.push_back( xAttribs->getOptionalValue(NMSP_RELATIONSHIPS|XML_id ) );
+ case PPT_TOKEN( notesMasterId ):
+ maNotesMasterVector.push_back( xAttribs->getOptionalValue(R_TOKEN( id ) ) );
break;
- case NMSP_PPT|XML_sldSz:
+ case PPT_TOKEN( sldSz ):
maSlideSize = GetSize2D( xAttribs );
break;
- case NMSP_PPT|XML_notesSz:
+ case PPT_TOKEN( notesSz ):
maNotesSize = GetSize2D( xAttribs );
break;
- case NMSP_PPT|XML_custShowLst:
+ case PPT_TOKEN( custShowLst ):
xRet.set( new CustomShowListContext( *this, maCustomShowList ) );
break;
- case NMSP_PPT|XML_defaultTextStyle:
+ case PPT_TOKEN( defaultTextStyle ):
xRet.set( new TextListStyleContext( *this, *mpTextListStyle ) );
break;
}
diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx
index 7e77f5a54938..1d25abe5c941 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -31,10 +31,7 @@
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/container/XNamed.hpp>
-#include "tokens.hxx"
-#include "properties.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "headerfootercontext.hxx"
#include "oox/ppt/backgroundproperties.hxx"
@@ -65,7 +62,7 @@ SlideFragmentHandler::SlideFragmentHandler( XmlFilterBase& rFilter, const OUStri
, mpSlidePersistPtr( pPersistPtr )
, meShapeLocation( eShapeLocation )
{
- OUString aVMLDrawingFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "vmlDrawing" ) );
+ OUString aVMLDrawingFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "vmlDrawing" ) );
if( aVMLDrawingFragmentPath.getLength() > 0 )
getFilter().importFragment( new oox::vml::DrawingFragment(
getFilter(), aVMLDrawingFragmentPath, *pPersistPtr->getDrawing() ) );
@@ -84,9 +81,9 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s
switch( aElementToken )
{
- case NMSP_PPT|XML_sldMaster: // CT_SlideMaster
- case NMSP_PPT|XML_handoutMaster: // CT_HandoutMaster
- case NMSP_PPT|XML_sld: // CT_CommonSlideData
+ case PPT_TOKEN( sldMaster ): // CT_SlideMaster
+ case PPT_TOKEN( handoutMaster ): // CT_HandoutMaster
+ case PPT_TOKEN( sld ): // CT_CommonSlideData
{
AttributeList attribs( xAttribs );
@@ -99,14 +96,14 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s
break;
}
- case NMSP_PPT|XML_notes: // CT_NotesSlide
- case NMSP_PPT|XML_notesMaster: // CT_NotesMaster
+ case PPT_TOKEN( notes ): // CT_NotesSlide
+ case PPT_TOKEN( notesMaster ): // CT_NotesMaster
break;
- case NMSP_PPT|XML_cSld: // CT_CommonSlideData
+ case PPT_TOKEN( cSld ): // CT_CommonSlideData
maSlideName = xAttribs->getOptionalValue(XML_name);
break;
- case NMSP_PPT|XML_spTree: // CT_GroupShape
+ case PPT_TOKEN( spTree ): // CT_GroupShape
{
xRet.set( new PPTShapeGroupContext(
*this, mpSlidePersistPtr, meShapeLocation, mpSlidePersistPtr->getShapes(),
@@ -114,10 +111,10 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s
}
break;
- case NMSP_PPT|XML_controls:
+ case PPT_TOKEN( controls ):
xRet = getFastContextHandler();
break;
- case NMSP_PPT|XML_control:
+ case PPT_TOKEN( control ):
{
::oox::vml::ControlInfo aInfo;
aInfo.setShapeId( aAttribs.getInteger( XML_spid, 0 ) );
@@ -127,18 +124,18 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s
}
return xRet;
- case NMSP_PPT|XML_timing: // CT_SlideTiming
+ case PPT_TOKEN( timing ): // CT_SlideTiming
xRet.set( new SlideTimingContext( *this, mpSlidePersistPtr->getTimeNodeList() ) );
break;
- case NMSP_PPT|XML_transition: // CT_SlideTransition
+ case PPT_TOKEN( transition ): // CT_SlideTransition
xRet.set( new SlideTransitionContext( *this, xAttribs, maSlideProperties ) );
break;
- case NMSP_PPT|XML_hf:
+ case PPT_TOKEN( hf ):
xRet.set( new HeaderFooterContext( *this, xAttribs, mpSlidePersistPtr->getHeaderFooter() ) );
break;
// BackgroundGroup
- case NMSP_PPT|XML_bgPr: // CT_BackgroundProperties
+ case PPT_TOKEN( bgPr ): // CT_BackgroundProperties
{
FillPropertiesPtr pFillPropertiesPtr( new FillProperties );
xRet.set( new BackgroundPropertiesContext( *this, *pFillPropertiesPtr ) );
@@ -146,7 +143,7 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s
}
break;
- case NMSP_PPT|XML_bgRef: // a:CT_StyleMatrixReference
+ case PPT_TOKEN( bgRef ): // a:CT_StyleMatrixReference
{
FillPropertiesPtr pFillPropertiesPtr( new FillProperties(
*mpSlidePersistPtr->getTheme()->getFillStyle( xAttribs->getOptionalValue( XML_idx ).toInt32() ) ) );
@@ -155,21 +152,21 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s
}
break;
- case NMSP_PPT|XML_clrMap: // CT_ColorMapping
+ case PPT_TOKEN( clrMap ): // CT_ColorMapping
{
oox::drawingml::ClrMapPtr pClrMapPtr( new oox::drawingml::ClrMap() );
xRet.set( new oox::drawingml::clrMapContext( *this, xAttribs, *pClrMapPtr ) );
mpSlidePersistPtr->setClrMap( pClrMapPtr );
}
break;
- case NMSP_PPT|XML_clrMapOvr: // CT_ColorMappingOverride
- case NMSP_PPT|XML_sldLayoutIdLst: // CT_SlideLayoutIdList
+ case PPT_TOKEN( clrMapOvr ): // CT_ColorMappingOverride
+ case PPT_TOKEN( sldLayoutIdLst ): // CT_SlideLayoutIdList
break;
- case NMSP_PPT|XML_txStyles: // CT_SlideMasterTextStyles
+ case PPT_TOKEN( txStyles ): // CT_SlideMasterTextStyles
xRet.set( new SlideMasterTextStylesContext( *this, mpSlidePersistPtr ) );
break;
- case NMSP_PPT|XML_custDataLst: // CT_CustomerDataList
- case NMSP_PPT|XML_tagLst: // CT_TagList
+ case PPT_TOKEN( custDataLst ): // CT_CustomerDataList
+ case PPT_TOKEN( tagLst ): // CT_TagList
break;
}
diff --git a/oox/source/ppt/slidemastertextstylescontext.cxx b/oox/source/ppt/slidemastertextstylescontext.cxx
index 773730417a27..d4c777102a0a 100644
--- a/oox/source/ppt/slidemastertextstylescontext.cxx
+++ b/oox/source/ppt/slidemastertextstylescontext.cxx
@@ -28,8 +28,6 @@
#include "oox/drawingml/textliststyle.hxx"
#include "oox/drawingml/textliststylecontext.hxx"
#include "oox/ppt/slidemastertextstylescontext.hxx"
-#include "oox/core/namespaces.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::oox::core;
@@ -54,22 +52,22 @@ Reference< XFastContextHandler > SlideMasterTextStylesContext::createFastChildCo
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_PPT|XML_titleStyle:
+ case PPT_TOKEN( titleStyle ):
{
aTextListStylePtr = mpSlidePersistPtr->getTitleTextStyle();
break;
}
- case NMSP_PPT|XML_bodyStyle:
+ case PPT_TOKEN( bodyStyle ):
{
aTextListStylePtr = mpSlidePersistPtr->getBodyTextStyle();
break;
}
- case NMSP_PPT|XML_notesStyle:
+ case PPT_TOKEN( notesStyle ):
{
aTextListStylePtr = mpSlidePersistPtr->getNotesTextStyle();
break;
}
- case NMSP_PPT|XML_otherStyle:
+ case PPT_TOKEN( otherStyle ):
{
aTextListStylePtr = mpSlidePersistPtr->getOtherTextStyle();
break;
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 8555ba371b77..7f8fba345bd6 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -31,9 +31,7 @@
#include "oox/ppt/slidepersist.hxx"
#include "oox/drawingml/fillproperties.hxx"
#include "oox/vml/vmldrawing.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
-#include "tokens.hxx"
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
@@ -129,7 +127,7 @@ sal_Int16 SlidePersist::getLayoutFromValueToken()
return nLayout;
}
-void SlidePersist::createXShapes( const XmlFilterBase& rFilterBase )
+void SlidePersist::createXShapes( XmlFilterBase& rFilterBase )
{
applyTextStyles( rFilterBase );
diff --git a/oox/source/ppt/slidetimingcontext.cxx b/oox/source/ppt/slidetimingcontext.cxx
index b64d79c949cf..4357e14ea08e 100644
--- a/oox/source/ppt/slidetimingcontext.cxx
+++ b/oox/source/ppt/slidetimingcontext.cxx
@@ -34,10 +34,8 @@
#include "oox/ppt/slidefragmenthandler.hxx"
#include "oox/drawingml/shapegroupcontext.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/ppt/timenodelistcontext.hxx"
#include "buildlistcontext.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::com::sun::star;
@@ -72,12 +70,12 @@ Reference< XFastContextHandler > SlideTimingContext::createFastChildContext( sal
switch( aElementToken )
{
- case NMSP_PPT|XML_bldLst:
+ case PPT_TOKEN( bldLst ):
xRet.set( new BuildListContext( *this, xAttribs, maTimeNodeList ) );
break;
- case NMSP_PPT|XML_extLst:
+ case PPT_TOKEN( extLst ):
return xRet;
- case NMSP_PPT|XML_tnLst:
+ case PPT_TOKEN( tnLst ):
// timing nodes
{
xRet.set( new TimeNodeListContext( *this, maTimeNodeList ) );
diff --git a/oox/source/ppt/slidetransition.cxx b/oox/source/ppt/slidetransition.cxx
index ee889e13d840..a380a4d945e1 100644
--- a/oox/source/ppt/slidetransition.cxx
+++ b/oox/source/ppt/slidetransition.cxx
@@ -35,10 +35,9 @@
#include "oox/helper/helper.hxx"
#include "oox/helper/propertymap.hxx"
-#include "oox/core/namespaces.hxx"
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
#include "pptfilterhelpers.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::com::sun::star::uno;
@@ -256,11 +255,11 @@ namespace oox { namespace ppt {
{
switch( OoxType )
{
- case NMSP_PPT|XML_blinds:
+ case PPT_TOKEN( blinds ):
mnTransitionType = TransitionType::BLINDSWIPE;
mnTransitionSubType = ooxToOdpDirection( param1 );
break;
- case NMSP_PPT|XML_checker:
+ case PPT_TOKEN( checker ):
mnTransitionType = TransitionType::CHECKERBOARDWIPE;
switch ( param1 )
{
@@ -274,7 +273,7 @@ namespace oox { namespace ppt {
break;
}
break;
- case NMSP_PPT|XML_comb:
+ case PPT_TOKEN( comb ):
mnTransitionType = TransitionType::PUSHWIPE;
switch( param1 )
{
@@ -288,16 +287,16 @@ namespace oox { namespace ppt {
break;
}
break;
- case NMSP_PPT|XML_cover:
+ case PPT_TOKEN( cover ):
mnTransitionType = TransitionType::SLIDEWIPE;
mnTransitionSubType = ooxToOdpEightDirections( param1 );
break;
- case NMSP_PPT|XML_pull: // uncover
+ case PPT_TOKEN( pull ): // uncover
mnTransitionType = TransitionType::SLIDEWIPE;
mnTransitionSubType = ooxToOdpEightDirections( param1 );
mbTransitionDirectionNormal = false;
break;
- case NMSP_PPT|XML_cut:
+ case PPT_TOKEN( cut ):
// The binfilter seems to ignore this transition.
// Fade to black instead if thrBlk is true.
if( param1 )
@@ -307,7 +306,7 @@ namespace oox { namespace ppt {
}
OSL_TRACE( "OOX: cut transition fallback." );
break;
- case NMSP_PPT|XML_fade:
+ case PPT_TOKEN( fade ):
mnTransitionType = TransitionType::FADE;
if( param1 )
{
@@ -318,16 +317,16 @@ namespace oox { namespace ppt {
mnTransitionSubType = TransitionSubType::CROSSFADE;
}
break;
- case NMSP_PPT|XML_push:
+ case PPT_TOKEN( push ):
mnTransitionType = TransitionType::PUSHWIPE;
mnTransitionSubType = ooxToOdpBorderDirections( param1 );
break;
- case NMSP_PPT|XML_wipe:
+ case PPT_TOKEN( wipe ):
mnTransitionType = TransitionType::BARWIPE;
mnTransitionSubType = ooxToOdpSideDirections( param1 );
mbTransitionDirectionNormal = ooxToOdpSideDirectionsDirectionNormal( param1 );
break;
- case NMSP_PPT|XML_split:
+ case PPT_TOKEN( split ):
mnTransitionType = TransitionType::BARNDOORWIPE;
mnTransitionSubType = ooxToOdpDirection( param1 );
if( param2 == XML_in )
@@ -336,7 +335,7 @@ namespace oox { namespace ppt {
mbTransitionDirectionNormal = false;
}
break;
- case NMSP_PPT|XML_wheel:
+ case PPT_TOKEN( wheel ):
mnTransitionType = TransitionType::PINWHEELWIPE;
switch( param1 )
{
@@ -372,40 +371,40 @@ namespace oox { namespace ppt {
break;
}
break;
- case NMSP_PPT|XML_randomBar:
+ case PPT_TOKEN( randomBar ):
mnTransitionType = TransitionType::RANDOMBARWIPE;
mnTransitionSubType = ooxToOdpDirection( param1 );
break;
- case NMSP_PPT|XML_circle:
+ case PPT_TOKEN( circle ):
mnTransitionType = TransitionType::ELLIPSEWIPE;
mnTransitionSubType = TransitionSubType::CIRCLE;
break;
- case NMSP_PPT|XML_diamond:
+ case PPT_TOKEN( diamond ):
mnTransitionType = TransitionType::IRISWIPE;
mnTransitionSubType = TransitionSubType::DIAMOND;
break;
- case NMSP_PPT|XML_dissolve:
+ case PPT_TOKEN( dissolve ):
mnTransitionType = TransitionType::DISSOLVE;
mnTransitionSubType = TransitionSubType::DEFAULT;
break;
- case NMSP_PPT|XML_newsflash:
+ case PPT_TOKEN( newsflash ):
// this is what the PPT binary filter does.... not sure I agree.
mnTransitionType = TransitionType::FOURBOXWIPE;
mnTransitionSubType = TransitionSubType::CORNERSOUT;
break;
- case NMSP_PPT|XML_plus:
+ case PPT_TOKEN( plus ):
mnTransitionType = TransitionType::FOURBOXWIPE;
mnTransitionSubType = TransitionSubType::CORNERSOUT;
break;
- case NMSP_PPT|XML_random:
+ case PPT_TOKEN( random ):
mnTransitionType = TransitionType::RANDOM;
mnTransitionSubType = TransitionSubType::DEFAULT;
break;
- case NMSP_PPT|XML_wedge:
+ case PPT_TOKEN( wedge ):
mnTransitionType = TransitionType::FANWIPE;
mnTransitionSubType = TransitionSubType::CENTERTOP;
break;
- case NMSP_PPT|XML_zoom:
+ case PPT_TOKEN( zoom ):
mnTransitionType = TransitionType::ZOOM;
mnTransitionSubType = TransitionSubType::DEFAULT;
break;
diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx
index 92993d754ada..4c5ae7dcc65f 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -38,9 +38,6 @@
#include "oox/ppt/soundactioncontext.hxx"
#include "oox/drawingml/shapegroupcontext.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
-
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::com::sun::star;
@@ -86,10 +83,10 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
switch( aElementToken )
{
- case NMSP_PPT|XML_blinds:
- case NMSP_PPT|XML_checker:
- case NMSP_PPT|XML_comb:
- case NMSP_PPT|XML_randomBar:
+ case PPT_TOKEN( blinds ):
+ case PPT_TOKEN( checker ):
+ case PPT_TOKEN( comb ):
+ case PPT_TOKEN( randomBar ):
if (!mbHasTransition)
{
mbHasTransition = true;
@@ -97,8 +94,8 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
// ST_Direction { XML_horz, XML_vert }
}
break;
- case NMSP_PPT|XML_cover:
- case NMSP_PPT|XML_pull:
+ case PPT_TOKEN( cover ):
+ case PPT_TOKEN( pull ):
if (!mbHasTransition)
{
mbHasTransition = true;
@@ -109,8 +106,8 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
// XML_ld, XML_lu, XML_rd, XML_ru }
}
break;
- case NMSP_PPT|XML_cut:
- case NMSP_PPT|XML_fade:
+ case PPT_TOKEN( cut ):
+ case PPT_TOKEN( fade ):
if (!mbHasTransition)
{
mbHasTransition = true;
@@ -119,8 +116,8 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
maTransition.setOoxTransitionType( aElementToken, attribs.getBool( XML_thruBlk, false ), 0);
}
break;
- case NMSP_PPT|XML_push:
- case NMSP_PPT|XML_wipe:
+ case PPT_TOKEN( push ):
+ case PPT_TOKEN( wipe ):
if (!mbHasTransition)
{
mbHasTransition = true;
@@ -128,7 +125,7 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
// ST_TransitionSideDirectionType { XML_d, XML_l, XML_r, XML_u }
}
break;
- case NMSP_PPT|XML_split:
+ case PPT_TOKEN( split ):
if (!mbHasTransition)
{
mbHasTransition = true;
@@ -137,7 +134,7 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
// ST_TransitionInOutDirectionType { XML_out, XML_in }
}
break;
- case NMSP_PPT|XML_zoom:
+ case PPT_TOKEN( zoom ):
if (!mbHasTransition)
{
mbHasTransition = true;
@@ -145,7 +142,7 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
// ST_TransitionInOutDirectionType { XML_out, XML_in }
}
break;
- case NMSP_PPT|XML_wheel:
+ case PPT_TOKEN( wheel ):
if (!mbHasTransition)
{
mbHasTransition = true;
@@ -154,13 +151,13 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
// unsignedInt
}
break;
- case NMSP_PPT|XML_circle:
- case NMSP_PPT|XML_diamond:
- case NMSP_PPT|XML_dissolve:
- case NMSP_PPT|XML_newsflash:
- case NMSP_PPT|XML_plus:
- case NMSP_PPT|XML_random:
- case NMSP_PPT|XML_wedge:
+ case PPT_TOKEN( circle ):
+ case PPT_TOKEN( diamond ):
+ case PPT_TOKEN( dissolve ):
+ case PPT_TOKEN( newsflash ):
+ case PPT_TOKEN( plus ):
+ case PPT_TOKEN( random ):
+ case PPT_TOKEN( wedge ):
// CT_Empty
if (!mbHasTransition)
{
@@ -170,11 +167,11 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
break;
- case NMSP_PPT|XML_sndAc: // CT_TransitionSoundAction
+ case PPT_TOKEN( sndAc ): // CT_TransitionSoundAction
//"Sound"
xRet.set( new SoundActionContext ( *this, maSlideProperties ) );
break;
- case NMSP_PPT|XML_extLst: // CT_OfficeArtExtensionList
+ case PPT_TOKEN( extLst ): // CT_OfficeArtExtensionList
return xRet;
default:
break;
@@ -188,7 +185,7 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext(
void SlideTransitionContext::endFastElement( sal_Int32 aElement ) throw (::com::sun::star::xml::sax::SAXException, RuntimeException)
{
- if( aElement == (NMSP_PPT|XML_transition) )
+ if( aElement == (PPT_TOKEN( transition )) )
{
if( mbHasTransition )
{
diff --git a/oox/source/ppt/soundactioncontext.cxx b/oox/source/ppt/soundactioncontext.cxx
index 281eb848629c..e9b955a73e15 100644
--- a/oox/source/ppt/soundactioncontext.cxx
+++ b/oox/source/ppt/soundactioncontext.cxx
@@ -32,10 +32,7 @@
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertymap.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/embeddedwavaudiofile.hxx"
-#include "properties.hxx"
-#include "tokens.hxx"
using rtl::OUString;
using namespace ::oox::core;
@@ -63,7 +60,7 @@ namespace oox { namespace ppt {
void SoundActionContext::endFastElement( sal_Int32 aElement ) throw (SAXException, RuntimeException)
{
- if ( aElement == ( NMSP_PPT|XML_sndAc ) )
+ if ( aElement == PPT_TOKEN( sndAc ) )
{
if( mbHasStartSound )
{
@@ -106,7 +103,7 @@ namespace oox { namespace ppt {
switch( aElement )
{
- case NMSP_PPT|XML_snd:
+ case PPT_TOKEN( snd ):
if( mbHasStartSound )
{
drawingml::EmbeddedWAVAudioFile aAudio;
@@ -115,11 +112,11 @@ namespace oox { namespace ppt {
msSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed );
}
break;
- case NMSP_PPT|XML_endSnd:
+ case PPT_TOKEN( endSnd ):
// CT_Empty
mbStopSound = true;
break;
- case NMSP_PPT|XML_stSnd:
+ case PPT_TOKEN( stSnd ):
mbHasStartSound = true;
mbLoopSound = attribs.getBool( XML_loop, false );
default:
diff --git a/oox/source/ppt/timeanimvaluecontext.cxx b/oox/source/ppt/timeanimvaluecontext.cxx
index 5699d8a44cc3..185897f2e101 100644
--- a/oox/source/ppt/timeanimvaluecontext.cxx
+++ b/oox/source/ppt/timeanimvaluecontext.cxx
@@ -27,12 +27,8 @@
#include "timeanimvaluecontext.hxx"
-#include "oox/core/namespaces.hxx"
#include "animvariantcontext.hxx"
-#include "tokens.hxx"
-
-
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
@@ -57,7 +53,7 @@ namespace oox { namespace ppt {
void SAL_CALL TimeAnimValueListContext::endFastElement( sal_Int32 aElement )
throw ( SAXException, RuntimeException)
{
- if( aElement == ( NMSP_PPT|XML_tav ) )
+ if( aElement == PPT_TOKEN( tav ) )
{
mbInValue = false;
}
@@ -72,7 +68,7 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_tav:
+ case PPT_TOKEN( tav ):
{
mbInValue = true;
TimeAnimationValue val;
@@ -81,7 +77,7 @@ namespace oox { namespace ppt {
maTavList.push_back( val );
break;
}
- case NMSP_PPT|XML_val:
+ case PPT_TOKEN( val ):
if( mbInValue )
{
// CT_TLAnimVariant
diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx
index 51a53d9631a2..6887bcfdf3a3 100644
--- a/oox/source/ppt/timenode.cxx
+++ b/oox/source/ppt/timenode.cxx
@@ -588,7 +588,7 @@ namespace oox { namespace ppt {
const Reference< XAnimationNode >& rxNode )
{
try {
- Reference< XAnimationNode > xNode ( rFilter.getGlobalFactory()->createInstance(rServiceName ), UNO_QUERY_THROW );
+ Reference< XAnimationNode > xNode ( rFilter.getServiceFactory()->createInstance( rServiceName ), UNO_QUERY_THROW );
Reference< XTimeContainer > xParentContainer( rxNode, UNO_QUERY_THROW );
xParentContainer->appendChild( xNode );
diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx
index 7e40e3be4db4..6a82dc29c1de 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -47,12 +47,10 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/colorchoicecontext.hxx"
#include "oox/ppt/slidetransition.hxx"
-#include "tokens.hxx"
#include "animvariantcontext.hxx"
#include "commonbehaviorcontext.hxx"
@@ -129,10 +127,10 @@ namespace oox { namespace ppt {
switch( aElement )
{
- case NMSP_PPT|XML_audio:
+ case PPT_TOKEN( audio ):
mbIsNarration = attribs.getBool( XML_isNarration, false );
break;
- case NMSP_PPT|XML_video:
+ case PPT_TOKEN( video ):
mbFullScrn = attribs.getBool( XML_fullScrn, false );
break;
default:
@@ -143,11 +141,11 @@ namespace oox { namespace ppt {
virtual void SAL_CALL endFastElement( sal_Int32 aElement )
throw ( SAXException, RuntimeException)
{
- if( aElement == ( NMSP_PPT|XML_audio ) )
+ if( aElement == PPT_TOKEN( audio ) )
{
// TODO deal with mbIsNarration
}
- else if( aElement == ( NMSP_PPT|XML_video ) )
+ else if( aElement == PPT_TOKEN( video ) )
{
// TODO deal with mbFullScrn
}
@@ -161,7 +159,7 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
default:
@@ -227,10 +225,10 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
- case NMSP_PPT|XML_to:
+ case PPT_TOKEN( to ):
// CT_TLAnimVariant
xRet.set( new AnimVariantContext( *this, aElementToken, maTo ) );
break;
@@ -261,7 +259,7 @@ namespace oox { namespace ppt {
{
switch ( aElement )
{
- case NMSP_PPT|XML_cmd:
+ case PPT_TOKEN( cmd ):
msCommand = xAttribs->getOptionalValue( XML_cmd );
maType = xAttribs->getOptionalValueToken( XML_type, 0 );
break;
@@ -277,7 +275,7 @@ namespace oox { namespace ppt {
virtual void SAL_CALL endFastElement( sal_Int32 aElement )
throw ( SAXException, RuntimeException)
{
- if( aElement == ( NMSP_PPT|XML_cmd ) )
+ if( aElement == PPT_TOKEN( cmd ) )
{
try {
// see sd/source/filter/ppt/pptinanimations.cxx
@@ -356,7 +354,7 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
default:
@@ -409,14 +407,14 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cTn:
+ case PPT_TOKEN( cTn ):
xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) );
break;
- case NMSP_PPT|XML_nextCondLst:
+ case PPT_TOKEN( nextCondLst ):
xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode,
mpNode->getNextCondition() ) );
break;
- case NMSP_PPT|XML_prevCondLst:
+ case PPT_TOKEN( prevCondLst ):
xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode,
mpNode->getPrevCondition() ) );
break;
@@ -457,7 +455,7 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cTn:
+ case PPT_TOKEN( cTn ):
xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) );
break;
default:
@@ -521,7 +519,7 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_hsl:
+ case PPT_TOKEN( hsl ):
// CT_TLByHslColorTransform
{
if( mbHasByColor )
@@ -534,7 +532,7 @@ namespace oox { namespace ppt {
xRet.set(this);
break;
}
- case NMSP_PPT|XML_rgb:
+ case PPT_TOKEN( rgb ):
{
if( mbHasByColor )
{
@@ -547,19 +545,19 @@ namespace oox { namespace ppt {
xRet.set(this);
break;
}
- case NMSP_PPT|XML_by:
+ case PPT_TOKEN( by ):
// CT_TLByAnimateColorTransform
mbHasByColor = true;
xRet.set(this);
break;
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
- case NMSP_PPT|XML_to:
+ case PPT_TOKEN( to ):
// CT_Color
xRet.set( new ColorContext( *this, maToClr ) );
break;
- case NMSP_PPT|XML_from:
+ case PPT_TOKEN( from ):
// CT_Color
xRet.set( new ColorContext( *this, maFromClr ) );
break;
@@ -678,10 +676,10 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
- case NMSP_PPT|XML_tavLst:
+ case PPT_TOKEN( tavLst ):
xRet.set( new TimeAnimValueListContext ( *this, xAttribs, maTavList ) );
break;
default:
@@ -748,10 +746,10 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
- case NMSP_PPT|XML_to:
+ case PPT_TOKEN( to ):
{
// CT_TLPoint
Point p = GetPointPercent( xAttribs );
@@ -759,7 +757,7 @@ namespace oox { namespace ppt {
maTo <<= p.Y;
break;
}
- case NMSP_PPT|XML_from:
+ case PPT_TOKEN( from ):
{
// CT_TLPoint
Point p = GetPointPercent( xAttribs );
@@ -767,7 +765,7 @@ namespace oox { namespace ppt {
maFrom <<= p.Y;
break;
}
- case NMSP_PPT|XML_by:
+ case PPT_TOKEN( by ):
{
// CT_TLPoint
Point p = GetPointPercent( xAttribs );
@@ -834,7 +832,7 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
default:
@@ -902,10 +900,10 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
- case NMSP_PPT|XML_to:
+ case PPT_TOKEN( to ):
{
// CT_TLPoint
Point p = GetPointPercent( xAttribs );
@@ -915,7 +913,7 @@ namespace oox { namespace ppt {
mpNode->setTo( rAny );
break;
}
- case NMSP_PPT|XML_from:
+ case PPT_TOKEN( from ):
{
// CT_TLPoint
Point p = GetPointPercent( xAttribs );
@@ -925,7 +923,7 @@ namespace oox { namespace ppt {
mpNode->setFrom( rAny );
break;
}
- case NMSP_PPT|XML_by:
+ case PPT_TOKEN( by ):
{
// CT_TLPoint
Point p = GetPointPercent( xAttribs );
@@ -935,7 +933,7 @@ namespace oox { namespace ppt {
mpNode->setBy( rAny );
break;
}
- case NMSP_PPT|XML_rCtr:
+ case PPT_TOKEN( rCtr ):
{
// CT_TLPoint
Point p = GetPointPercent( xAttribs );
@@ -993,10 +991,10 @@ namespace oox { namespace ppt {
switch ( aElementToken )
{
- case NMSP_PPT|XML_cBhvr:
+ case PPT_TOKEN( cBhvr ):
xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
break;
- case NMSP_PPT|XML_progress:
+ case PPT_TOKEN( progress ):
xRet.set( new AnimVariantContext( *this, aElementToken, maProgress ) );
// TODO handle it.
break;
@@ -1025,41 +1023,41 @@ namespace oox { namespace ppt {
TimeNodeContext *pCtx = NULL;
switch( aElement )
{
- case NMSP_PPT|XML_animClr:
+ case PPT_TOKEN( animClr ):
pCtx = new AnimColorContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_par:
+ case PPT_TOKEN( par ):
pCtx = new ParallelExclTimeNodeContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_seq:
+ case PPT_TOKEN( seq ):
pCtx = new SequenceTimeNodeContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_excl:
+ case PPT_TOKEN( excl ):
pCtx = new ParallelExclTimeNodeContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_anim:
+ case PPT_TOKEN( anim ):
pCtx = new AnimContext ( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_animEffect:
+ case PPT_TOKEN( animEffect ):
pCtx = new AnimEffectContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_animMotion:
+ case PPT_TOKEN( animMotion ):
pCtx = new AnimMotionContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_animRot:
+ case PPT_TOKEN( animRot ):
pCtx = new AnimRotContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_animScale:
+ case PPT_TOKEN( animScale ):
pCtx = new AnimScaleContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_cmd:
+ case PPT_TOKEN( cmd ):
pCtx = new CmdTimeNodeContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_set:
+ case PPT_TOKEN( set ):
pCtx = new SetTimeNodeContext( rParent, aElement, xAttribs, pNode );
break;
- case NMSP_PPT|XML_audio:
- case NMSP_PPT|XML_video:
+ case PPT_TOKEN( audio ):
+ case PPT_TOKEN( video ):
pCtx = new MediaNodeContext( rParent, aElement, xAttribs, pNode );
break;
default:
@@ -1106,43 +1104,43 @@ namespace oox { namespace ppt {
switch( aElementToken )
{
- case NMSP_PPT|XML_par:
+ case PPT_TOKEN( par ):
nNodeType = AnimationNodeType::PAR;
break;
- case NMSP_PPT|XML_seq:
+ case PPT_TOKEN( seq ):
nNodeType = AnimationNodeType::SEQ;
break;
- case NMSP_PPT|XML_excl:
+ case PPT_TOKEN( excl ):
// TODO pick the right type. We choose parallel for now as
// there does not seem to be an "Exclusive"
nNodeType = AnimationNodeType::PAR;
break;
- case NMSP_PPT|XML_anim:
+ case PPT_TOKEN( anim ):
nNodeType = AnimationNodeType::ANIMATE;
break;
- case NMSP_PPT|XML_animClr:
+ case PPT_TOKEN( animClr ):
nNodeType = AnimationNodeType::ANIMATECOLOR;
break;
- case NMSP_PPT|XML_animEffect:
+ case PPT_TOKEN( animEffect ):
nNodeType = AnimationNodeType::TRANSITIONFILTER;
break;
- case NMSP_PPT|XML_animMotion:
+ case PPT_TOKEN( animMotion ):
nNodeType = AnimationNodeType::ANIMATEMOTION;
break;
- case NMSP_PPT|XML_animRot:
- case NMSP_PPT|XML_animScale:
+ case PPT_TOKEN( animRot ):
+ case PPT_TOKEN( animScale ):
nNodeType = AnimationNodeType::ANIMATETRANSFORM;
break;
- case NMSP_PPT|XML_cmd:
+ case PPT_TOKEN( cmd ):
nNodeType = AnimationNodeType::COMMAND;
break;
- case NMSP_PPT|XML_set:
+ case PPT_TOKEN( set ):
nNodeType = AnimationNodeType::SET;
break;
- case NMSP_PPT|XML_audio:
+ case PPT_TOKEN( audio ):
nNodeType = AnimationNodeType::AUDIO;
break;
- case NMSP_PPT|XML_video:
+ case PPT_TOKEN( video ):
nNodeType = AnimationNodeType::AUDIO;
OSL_TRACE( "OOX: video requested, gave Audio instead" );
break;
diff --git a/oox/source/ppt/timetargetelementcontext.cxx b/oox/source/ppt/timetargetelementcontext.cxx
index 884b6d30fa61..81320bef5e89 100644
--- a/oox/source/ppt/timetargetelementcontext.cxx
+++ b/oox/source/ppt/timetargetelementcontext.cxx
@@ -34,9 +34,7 @@
#include <com/sun/star/uno/Any.hxx>
#include "oox/helper/attributelist.hxx"
-#include "oox/core/namespaces.hxx"
#include "oox/drawingml/embeddedwavaudiofile.hxx"
-#include "tokens.hxx"
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
@@ -67,29 +65,29 @@ namespace oox { namespace ppt {
switch( aElementToken )
{
- case NMSP_PPT|XML_bg:
+ case PPT_TOKEN( bg ):
bTargetSet = true;
maShapeTarget.mnType = XML_bg;
break;
- case NMSP_PPT|XML_txEl:
+ case PPT_TOKEN( txEl ):
bTargetSet = true;
maShapeTarget.mnType = XML_txEl;
break;
- case NMSP_PPT|XML_subSp:
+ case PPT_TOKEN( subSp ):
bTargetSet = true;
maShapeTarget.mnType = XML_subSp;
maShapeTarget.msSubShapeId = xAttribs->getOptionalValue( XML_spid );
break;
- case NMSP_PPT|XML_graphicEl:
- case NMSP_PPT|XML_oleChartEl:
+ case PPT_TOKEN( graphicEl ):
+ case PPT_TOKEN( oleChartEl ):
bTargetSet = true;
// TODO
break;
- case NMSP_PPT|XML_charRg:
- case NMSP_PPT|XML_pRg:
+ case PPT_TOKEN( charRg ):
+ case PPT_TOKEN( pRg ):
if( bTargetSet && maShapeTarget.mnType == XML_txEl )
{
- maShapeTarget.mnRangeType = getToken( aElementToken );
+ maShapeTarget.mnRangeType = getBaseToken( aElementToken );
maShapeTarget.maRange = drawingml::GetIndexRange( xAttribs );
}
break;
@@ -130,7 +128,7 @@ namespace oox { namespace ppt {
switch( aElementToken )
{
- case NMSP_PPT|XML_inkTgt:
+ case PPT_TOKEN( inkTgt ):
{
mpTarget->mnType = XML_inkTgt;
OUString aId = xAttribs->getOptionalValue( XML_spid );
@@ -140,10 +138,10 @@ namespace oox { namespace ppt {
}
break;
}
- case NMSP_PPT|XML_sldTgt:
+ case PPT_TOKEN( sldTgt ):
mpTarget->mnType = XML_sldTgt;
break;
- case NMSP_PPT|XML_sndTgt:
+ case PPT_TOKEN( sndTgt ):
{
mpTarget->mnType = XML_sndTgt;
drawingml::EmbeddedWAVAudioFile aAudio;
@@ -153,7 +151,7 @@ namespace oox { namespace ppt {
mpTarget->msValue = sSndName;
break;
}
- case NMSP_PPT|XML_spTgt:
+ case PPT_TOKEN( spTgt ):
{
mpTarget->mnType = XML_spTgt;
OUString aId = xAttribs->getOptionalValue( XML_spid );
@@ -162,7 +160,7 @@ namespace oox { namespace ppt {
break;
}
default:
- OSL_TRACE( "OOX: unhandled tag %ld in TL_TimeTargetElement.", getToken( aElementToken ) );
+ OSL_TRACE( "OOX: unhandled tag %ld in TL_TimeTargetElement.", getBaseToken( aElementToken ) );
break;
}
diff --git a/oox/source/shape/FastTokenHandlerService.cxx b/oox/source/shape/FastTokenHandlerService.cxx
deleted file mode 100644
index 6c6fcfa53d6e..000000000000
--- a/oox/source/shape/FastTokenHandlerService.cxx
+++ /dev/null
@@ -1,116 +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.
- *
- ************************************************************************/
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include "FastTokenHandlerService.hxx"
-
-namespace oox {
-namespace shape {
-
-using namespace ::com::sun::star;
-
-FastTokenHandlerService::FastTokenHandlerService(uno::Reference< uno::XComponentContext > const & context) :
- m_xContext(context)
-{}
-
-// com.sun.star.uno.XServiceInfo:
-::rtl::OUString SAL_CALL FastTokenHandlerService::getImplementationName() throw (uno::RuntimeException)
-{
- return FastTokenHandlerService_getImplementationName();
-}
-
-::sal_Bool SAL_CALL FastTokenHandlerService::supportsService(::rtl::OUString const & serviceName) throw (uno::RuntimeException)
-{
- uno::Sequence< ::rtl::OUString > serviceNames = FastTokenHandlerService_getSupportedServiceNames();
- for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
- if (serviceNames[i] == serviceName)
- return sal_True;
- }
- return sal_False;
-}
-
-uno::Sequence< ::rtl::OUString > SAL_CALL FastTokenHandlerService::getSupportedServiceNames() throw (uno::RuntimeException)
-{
- return FastTokenHandlerService_getSupportedServiceNames();
-}
-
-::sal_Int32 SAL_CALL FastTokenHandlerService::getToken(const ::rtl::OUString & Identifier) throw (::com::sun::star::uno::RuntimeException)
-{
- return mFastTokenHandler.getToken(Identifier);
-}
-
-::rtl::OUString SAL_CALL FastTokenHandlerService::getIdentifier(::sal_Int32 Token) throw (::com::sun::star::uno::RuntimeException)
-{
- return mFastTokenHandler.getIdentifier(Token);
-}
-
-::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL FastTokenHandlerService::getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException)
-{
- return mFastTokenHandler.getUTF8Identifier(Token);
-}
-
-::sal_Int32 SAL_CALL FastTokenHandlerService::getTokenFromUTF8(const ::com::sun::star::uno::Sequence< ::sal_Int8 > & Identifier) throw (::com::sun::star::uno::RuntimeException)
-{
- return mFastTokenHandler.getTokenFromUTF8(Identifier);
-}
-
-::rtl::OUString SAL_CALL FastTokenHandlerService_getImplementationName() {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.oox.FastTokenHandlerService"));
-}
-
-uno::Sequence< ::rtl::OUString > SAL_CALL FastTokenHandlerService_getSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > s(1);
- s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.xml.sax.FastTokenHandler"));
- return s;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL FastTokenHandlerService_create(
- const uno::Reference< uno::XComponentContext > & context)
- SAL_THROW((uno::Exception))
-{
- return static_cast< ::cppu::OWeakObject * >(new FastTokenHandlerService(context));
-}
-
-uno::Reference< uno::XInterface > SAL_CALL
-FastTokenHandlerService_createInstance
-( const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
-throw( uno::Exception )
-{
- uno::Reference<beans::XPropertySet>
- xPropertySet(rSMgr, uno::UNO_QUERY_THROW);
- uno::Any aDefaultContext = xPropertySet->getPropertyValue
- (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")));
-
- uno::Reference<uno::XComponentContext> xContext;
- aDefaultContext >>= xContext;
-
- return FastTokenHandlerService_create(xContext);
-}
-
-}}
diff --git a/oox/source/shape/FastTokenHandlerService.hxx b/oox/source/shape/FastTokenHandlerService.hxx
deleted file mode 100644
index b822654fdcfb..000000000000
--- a/oox/source/shape/FastTokenHandlerService.hxx
+++ /dev/null
@@ -1,81 +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_SHAPE_FASTTOKENHANDLERSERVICE_HXX
-#define OOX_SHAPE_FASTTOKENHANDLERSERVICE_HXX
-
-#include <sal/config.h>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implementationentry.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include "oox/core/fasttokenhandler.hxx"
-
-namespace css = ::com::sun::star;
-
-namespace oox {
-namespace shape {
-
-class FastTokenHandlerService:
- public ::cppu::WeakImplHelper2<
- css::lang::XServiceInfo,
- css::xml::sax::XFastTokenHandler>
-{
-public:
- explicit FastTokenHandlerService(css::uno::Reference< css::uno::XComponentContext > const & context);
-
- // ::com::sun::star::lang::XServiceInfo:
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException);
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException);
-
- // ::com::sun::star::xml::sax::XFastTokenHandler:
- virtual ::sal_Int32 SAL_CALL getToken(const ::rtl::OUString & Identifier) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getIdentifier(::sal_Int32 Token) throw (css::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getTokenFromUTF8(const css::uno::Sequence< ::sal_Int8 > & Identifier) throw (css::uno::RuntimeException);
-
-private:
- FastTokenHandlerService(FastTokenHandlerService &); // not defined
- void operator =(FastTokenHandlerService &); // not defined
-
- virtual ~FastTokenHandlerService() {}
-
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- ::oox::core::FastTokenHandler mFastTokenHandler;
-};
-
-::rtl::OUString SAL_CALL FastTokenHandlerService_getImplementationName();
-
-css::uno::Sequence< ::rtl::OUString > SAL_CALL FastTokenHandlerService_getSupportedServiceNames();
-
-css::uno::Reference< css::uno::XInterface > SAL_CALL _FastTokenHandlerService_create(
- const css::uno::Reference< css::uno::XComponentContext > & context)
- SAL_THROW((css::uno::Exception));
-
-}}
-#endif // OOX_SHAPE_FAST_TOKEN_HANDLER_SERVICE_HXX
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index e253d43e56e7..31ab343e0ebc 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -29,7 +29,6 @@
#include "oox/vml/vmldrawingfragment.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
-#include "tokens.hxx"
namespace oox { namespace shape {
@@ -37,15 +36,34 @@ using namespace ::com::sun::star;
using namespace core;
using namespace drawingml;
+::rtl::OUString SAL_CALL ShapeContextHandler_getImplementationName()
+{
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.ShapeContextHandler" );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL
+ShapeContextHandler_getSupportedServiceNames()
+{
+ uno::Sequence< ::rtl::OUString > s(1);
+ s[0] = CREATE_OUSTRING( "com.sun.star.xml.sax.FastShapeContextHandler" );
+ return s;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL
+ShapeContextHandler_createInstance( const uno::Reference< uno::XComponentContext > & context)
+ SAL_THROW((uno::Exception))
+{
+ return static_cast< ::cppu::OWeakObject* >( new ShapeContextHandler(context) );
+}
+
+
ShapeContextHandler::ShapeContextHandler
(uno::Reference< uno::XComponentContext > const & context) :
mnStartToken(0), m_xContext(context)
{
try
{
- uno::Reference<lang::XMultiServiceFactory>
- xFactory(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
- mxFilterBase.set( new ShapeFilterBase(xFactory) );
+ mxFilterBase.set( new ShapeFilterBase(context) );
}
catch( uno::Exception& )
{
@@ -68,7 +86,7 @@ ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element )
switch (Element & 0xffff)
{
case XML_graphic:
- mpShape.reset(new Shape("com.sun.star.drawing.OLE2Shape" ));
+ mpShape.reset(new Shape("com.sun.star.drawing.GraphicObjectShape" ));
mxGraphicShapeContext.set
(new GraphicalObjectFrameContext(*rFragmentHandler, pMasterShape, mpShape, true));
break;
@@ -105,10 +123,10 @@ ShapeContextHandler::getContextHandler()
{
uno::Reference<xml::sax::XFastContextHandler> xResult;
- switch (mnStartToken & NMSP_MASK)
+ switch (getNamespace( mnStartToken ))
{
- case NMSP_DOC:
- case NMSP_VML:
+ case NMSP_doc:
+ case NMSP_vml:
xResult.set(getDrawingShapeContext());
break;
default:
@@ -320,11 +338,6 @@ uno::Sequence< ::rtl::OUString > ShapeContextHandler::getSupportedServiceNames()
return ShapeContextHandler_getSupportedServiceNames();
}
-::rtl::OUString SAL_CALL ShapeContextHandler_getImplementationName() {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.oox.ShapeContextHandler"));
-}
-
::sal_Bool SAL_CALL ShapeContextHandler::supportsService
(const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException)
{
@@ -336,38 +349,4 @@ uno::Sequence< ::rtl::OUString > ShapeContextHandler::getSupportedServiceNames()
return sal_False;
}
-uno::Sequence< ::rtl::OUString > SAL_CALL
-ShapeContextHandler_getSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > s(1);
- s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.xml.sax.FastShapeContextHandler"));
- return s;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL
-ShapeContextHandler_create(
- const uno::Reference< uno::XComponentContext > & context)
- SAL_THROW((uno::Exception))
-{
- return static_cast< ::cppu::OWeakObject * >
- (new ShapeContextHandler(context));
-}
-
-uno::Reference< uno::XInterface > SAL_CALL
-ShapeContextHandler_createInstance
-( const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
-throw( uno::Exception )
-{
- uno::Reference<beans::XPropertySet>
- xPropertySet(rSMgr, uno::UNO_QUERY_THROW);
- uno::Any aDefaultContext = xPropertySet->getPropertyValue
- (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")));
-
- uno::Reference<uno::XComponentContext> xContext;
- aDefaultContext >>= xContext;
-
- return ShapeContextHandler_create(xContext);
-}
-
}}
diff --git a/oox/source/shape/ShapeContextHandler.hxx b/oox/source/shape/ShapeContextHandler.hxx
index c9cf67283c37..b794c2f879c1 100644
--- a/oox/source/shape/ShapeContextHandler.hxx
+++ b/oox/source/shape/ShapeContextHandler.hxx
@@ -28,10 +28,9 @@
#define OOX_SHAPE_SHAPE_CONTEXT_HANDLER_HXX
#include <boost/shared_ptr.hpp>
-#include "sal/config.h"
-#include "com/sun/star/uno/XComponentContext.hpp"
-#include "cppuhelper/implbase1.hxx"
-#include "com/sun/star/xml/sax/XFastShapeContextHandler.hpp"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/xml/sax/XFastShapeContextHandler.hpp>
#include "oox/drawingml/graphicshapecontext.hxx"
#include "oox/drawingml/shape.hxx"
#include "oox/drawingml/theme.hxx"
@@ -43,21 +42,6 @@ namespace css = ::com::sun::star;
namespace oox { namespace shape {
-// component and service helper functions:
-::rtl::OUString SAL_CALL ShapeContextHandler_getImplementationName();
-
-css::uno::Sequence< ::rtl::OUString > SAL_CALL
-ShapeContextHandler_getSupportedServiceNames();
-
-css::uno::Reference< css::uno::XInterface > SAL_CALL
-ShapeContextHandler_create
-( css::uno::Reference< css::uno::XComponentContext > const & context );
-
-css::uno::Reference< css::uno::XInterface > SAL_CALL
-ShapeContextHandler_createInstance
-( const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr)
-throw( css::uno::Exception );
-
class ShapeFragmentHandler : public core::FragmentHandler
{
public:
diff --git a/oox/source/shape/ShapeFilterBase.cxx b/oox/source/shape/ShapeFilterBase.cxx
index 7ed001ffc96c..68e0d0002392 100644
--- a/oox/source/shape/ShapeFilterBase.cxx
+++ b/oox/source/shape/ShapeFilterBase.cxx
@@ -27,17 +27,16 @@
#include "ShapeFilterBase.hxx"
#include "oox/drawingml/chart/chartconverter.hxx"
+#include "oox/ole/vbaproject.hxx"
namespace oox {
namespace shape {
using namespace ::com::sun::star;
-ShapeFilterBase::ShapeFilterBase
-(const uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
- rxFactory)
-: XmlFilterBase(rxFactory)
-, mxChartConv( new ::oox::drawingml::chart::ChartConverter )
+ShapeFilterBase::ShapeFilterBase( const uno::Reference< uno::XComponentContext >& rxContext ) throw( uno::RuntimeException ) :
+ XmlFilterBase( rxContext ),
+ mxChartConv( new ::oox::drawingml::chart::ChartConverter )
{
}
@@ -65,6 +64,11 @@ const ::oox::drawingml::table::TableStyleListPtr ShapeFilterBase::getTableStyles
return *mxChartConv;
}
+::oox::ole::VbaProject* ShapeFilterBase::implCreateVbaProject() const
+{
+ return new ::oox::ole::VbaProject( getComponentContext(), getModel(), CREATE_OUSTRING( "Writer" ) );
+}
+
::rtl::OUString ShapeFilterBase::implGetImplementationName() const
{
return ::rtl::OUString();
diff --git a/oox/source/shape/ShapeFilterBase.hxx b/oox/source/shape/ShapeFilterBase.hxx
index 09cbc75e01aa..a21357c16079 100644
--- a/oox/source/shape/ShapeFilterBase.hxx
+++ b/oox/source/shape/ShapeFilterBase.hxx
@@ -45,7 +45,8 @@ public:
typedef boost::shared_ptr<ShapeFilterBase> Pointer_t;
explicit ShapeFilterBase(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
virtual ~ShapeFilterBase();
@@ -60,12 +61,13 @@ public:
virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
- virtual rtl::OUString implGetImplementationName() const;
-
virtual bool importDocument() { return true; }
virtual bool exportDocument() { return true; }
private:
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+ virtual rtl::OUString implGetImplementationName() const;
+
::boost::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
};
diff --git a/oox/source/shape/makefile.mk b/oox/source/shape/makefile.mk
index f5a3af5542c0..c6534b3a8a6f 100644
--- a/oox/source/shape/makefile.mk
+++ b/oox/source/shape/makefile.mk
@@ -42,8 +42,7 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES = \
$(SLO)$/ShapeContextHandler.obj \
- $(SLO)$/ShapeFilterBase.obj \
- $(SLO)$/FastTokenHandlerService.obj
+ $(SLO)$/ShapeFilterBase.obj
# --- Targets -------------------------------------------------------
diff --git a/oox/source/token/gennamespaces.pl b/oox/source/token/gennamespaces.pl
deleted file mode 100644
index 2a7f2e2423bb..000000000000
--- a/oox/source/token/gennamespaces.pl
+++ /dev/null
@@ -1,66 +0,0 @@
-$ARGV0 = shift @ARGV;
-$ARGV1 = shift @ARGV;
-
-open ( NAMESPACES, $ARGV0 ) || die "can't open namespaces file: $!";
-
-
-open ( HXX, ">$ARGV1" ) or die "can't open namespaces.hxx file: $!";
-
-print ( HXX "#ifndef OOX_NAMESPACES_HXX\n" );
-print ( HXX "#define OOX_NAMESPACES_HXX\n\n" );
-print ( HXX "#include <sal/types.h>\n\n" );
-print ( HXX "namespace oox {\n\n" );
-
-$group = 0;
-$i = 1;
-while ( <NAMESPACES> )
-{
- chomp( $_ );
- $_ =~ s/\s*//g;
- if ( $_ =~ m/^$/ )
- {
- # Start a new group
- print ( HXX "\n" );
- $i = 0;
- $group++;
- }
- elsif ( $_ =~ m/^[^#]/ )
- {
- # Neither an empty line nor a comment
- $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Invalid namespace token $_";
- $id = "NMSP_$_";
- $id =~ s/-/_/g;
- $no = $group*10 + $i;
- print ( HXX "const sal_Int32 $id = $no << 16;\n" );
- ++$i;
- }
-}
-close ( NAMESPACES );
-
-print ( HXX "\nconst sal_Int32 TOKEN_MASK = SAL_MAX_UINT16;\n" );
-print ( HXX "const sal_Int32 NMSP_MASK = SAL_MAX_INT16 << 16;\n" );
-
-print ( HXX "/** Returns the token identifier of the passed element without namespace. */\n" );
-print ( HXX "inline sal_Int32 getToken( sal_Int32 nElement ) { return nElement & TOKEN_MASK; }\n\n" );
-
-print ( HXX "/** Returns the namespace of the passed element without token identifier. */\n" );
-print ( HXX "inline sal_Int32 getNamespace( sal_Int32 nElement ) { return nElement & NMSP_MASK; }\n\n" );
-
-print ( HXX "// defines for tokens with specific namespaces, can be used in switch/cases\n\n" );
-print ( HXX "#define A_TOKEN( token ) (::oox::NMSP_DRAWINGML | XML_##token)\n" );
-print ( HXX "#define AX_TOKEN( token ) (::oox::NMSP_AX | XML_##token)\n" );
-print ( HXX "#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token)\n" );
-print ( HXX "#define CDR_TOKEN( token ) (::oox::NMSP_CDR | XML_##token)\n" );
-print ( HXX "#define O_TOKEN( token ) (::oox::NMSP_OFFICE | XML_##token)\n" );
-print ( HXX "#define PPT_TOKEN( token ) (::oox::NMSP_PPT | XML_##token)\n" );
-print ( HXX "#define R_TOKEN( token ) (::oox::NMSP_RELATIONSHIPS | XML_##token)\n" );
-print ( HXX "#define VML_TOKEN( token ) (::oox::NMSP_VML | XML_##token)\n" );
-print ( HXX "#define VMLX_TOKEN( token ) (::oox::NMSP_VML_XLS | XML_##token)\n" );
-print ( HXX "#define XDR_TOKEN( token ) (::oox::NMSP_XDR | XML_##token)\n" );
-print ( HXX "#define XLS_TOKEN( token ) (::oox::NMSP_XLS | XML_##token)\n" );
-print ( HXX "#define XM_TOKEN( token ) (::oox::NMSP_XM | XML_##token)\n" );
-print ( HXX "#define XML_TOKEN( token ) (::oox::NMSP_XML | XML_##token)\n" );
-
-
-print ( HXX "} // namespace oox\n\n" );
-print ( HXX "#endif // OOX_NAMESPACES_HXX\n" );
diff --git a/oox/source/token/genproperties.pl b/oox/source/token/genproperties.pl
deleted file mode 100644
index 9dbe15c8ac12..000000000000
--- a/oox/source/token/genproperties.pl
+++ /dev/null
@@ -1,46 +0,0 @@
-$ARGV0 = shift @ARGV;
-$ARGV1 = shift @ARGV;
-$ARGV2 = shift @ARGV;
-
-open ( PROPS, $ARGV0 ) || die "can't open properties source file: $!";
-my %props;
-
-while ( <PROPS> )
-{
- chomp( $_ );
- $_ =~ s/\s*//g;
- $_ =~ /^[A-Z][a-zA-Z0-9]*$/ or die "invalid character in property '$_'";
- $id = "PROP_$_";
- $props{$_} = $id;
-}
-close ( TOKENS );
-
-open ( HXX, ">$ARGV1" ) or die "can't open properties.hxx file: $!";
-open ( WORDS, ">$ARGV2" ) or die "can't open propertynames.inc file: $!";
-
-print ( HXX "#ifndef OOX_PROPERTIES_HXX\n" );
-print ( HXX "#define OOX_PROPERTIES_HXX\n\n" );
-print ( HXX "#include <sal/types.h>\n" );
-print ( HXX "namespace oox {\n\n" );
-
-print ( WORDS "static const sal_Char* propertywordlist[] = {\n" );
-
-$i = 0;
-foreach( sort( keys( %props ) ) )
-{
- print ( HXX "const sal_Int32 $props{$_} = $i;\n" );
- print ( WORDS " \"$_\",\n" );
- ++$i;
-}
-
-print ( HXX "const sal_Int32 PROP_COUNT = $i;\n" );
-print ( HXX "const sal_Int32 PROP_INVALID = -1;\n\n" );
-print ( HXX "} // namespace oox\n" );
-print ( HXX "#endif\n" );
-
-print ( WORDS " \"\"\n" );
-print ( WORDS "};\n" );
-
-close ( HXX );
-close ( WORDS );
-
diff --git a/oox/source/token/gentoken.pl b/oox/source/token/gentoken.pl
deleted file mode 100644
index 196ac37ebb5c..000000000000
--- a/oox/source/token/gentoken.pl
+++ /dev/null
@@ -1,61 +0,0 @@
-$ARGV0 = shift @ARGV;
-$ARGV1 = shift @ARGV;
-$ARGV2 = shift @ARGV;
-$ARGV3 = shift @ARGV;
-
-open ( TOKENS, $ARGV0 ) || die "can't open $ARGV0 file: $!";
-my %tokens;
-
-while ( <TOKENS> )
-{
- chomp( $_ );
- $_ =~ s/\s*//g;
- $_ =~ /^[a-zA-Z0-9-_]+$/ or die "invalid character in token '$_'";
- $id = "XML_$_";
- $id =~ s/-/_/g;
- $tokens{$_} = $id;
-}
-close ( TOKENS );
-
-open ( HXX, ">$ARGV1" ) or die "can't open $ARGV1 file: $!";
-open ( WORDS, ">$ARGV2" ) or die "can't open $ARGV2 file: $!";
-open ( GPERF, ">$ARGV3" ) or die "can't open $ARGV3 file: $!";
-
-print ( HXX "#ifndef OOX_TOKENS_HXX\n" );
-print ( HXX "#define OOX_TOKENS_HXX\n\n" );
-print ( HXX "#include <com/sun/star/xml/sax/FastToken.hpp>\n" );
-
-print ( WORDS "static const sal_Char* xmltokenwordlist[] = {\n" );
-
-print ( GPERF "%language=C++\n" );
-print ( GPERF "%global-table\n" );
-print ( GPERF "%null-strings\n" );
-print ( GPERF "%struct-type\n" );
-print ( GPERF "struct xmltoken {\n" );
-print ( GPERF " const sal_Char *name;\n" );
-print ( GPERF " sal_Int32 nToken;\n" );
-print ( GPERF "};\n" );
-print ( GPERF "%%\n" );
-
-$i = 0;
-foreach( sort( keys( %tokens ) ) )
-{
- print ( HXX "const sal_Int32 $tokens{$_} = $i;\n" );
- print ( WORDS " \"$_\",\n" );
- print ( GPERF "$_,$tokens{$_}\n" );
- ++$i;
-}
-
-print ( HXX "const sal_Int32 XML_TOKEN_COUNT = $i;\n" );
-print ( HXX "const sal_Int32 XML_TOKEN_INVALID = ::com::sun::star::xml::sax::FastToken::DONTKNOW;\n\n" );
-print ( HXX "const sal_Int32 XML_ROOT_CONTEXT = SAL_MAX_INT32;\n\n" );
-print ( HXX "#endif\n" );
-
-print ( WORDS " \"\"\n" );
-print ( WORDS "};\n" );
-
-print ( GPERF "%%\n" );
-
-close ( HXX );
-close ( WORDS );
-close ( GPERF );
diff --git a/oox/source/token/makefile.mk b/oox/source/token/makefile.mk
index 7884c375fde6..ff42967f0bb1 100644
--- a/oox/source/token/makefile.mk
+++ b/oox/source/token/makefile.mk
@@ -39,40 +39,40 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
-SLOFILES = \
- $(SLO)$/propertylist.obj \
- $(SLO)$/tokenmap.obj
+SLOFILES = \
+ $(SLO)$/namespacemap.obj \
+ $(SLO)$/propertynames.obj \
+ $(SLO)$/tokenmap.obj
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
-$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.hxx $(INCCOM)$/oox$/core$/namespaces.hxx :
- @@noop $(assign do_phony:=.PHONY)
+GENHEADERPATH = $(INCCOM)$/oox$/token
-$(MISC)$/do_tokens $(do_phony) : tokens.txt gentoken.pl $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx
- @@-$(RM) $@
- $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@
+$(MISC)$/tokenhash.gperf $(INCCOM)$/tokennames.inc $(GENHEADERPATH)$/tokens.hxx $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx :
+ @@noop $(assign do_phony:=.PHONY)
-$(INCCOM)$/oox:
- $(MKDIR) $(INCCOM)$/oox
+$(SLO)$/tokenmap.obj : $(INCCOM)$/tokenhash.inc $(INCCOM)$/tokennames.inc $(GENHEADERPATH)$/tokens.hxx $(MISC)$/do_tokens
-$(INCCOM)$/oox$/core: $(INCCOM)$/oox
- $(MKDIR) $(INCCOM)$/oox$/core
+$(INCCOM)$/tokenhash.inc : $(MISC)$/tokenhash.gperf $(MISC)$/do_tokens
+ $(AUGMENT_LIBRARY_PATH) gperf --compare-strncmp $(MISC)$/tokenhash.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokenhash.inc
-$(MISC)$/do_namespaces $(do_phony) : namespaces.txt gennamespaces.pl
+$(MISC)$/do_tokens $(do_phony) : tokens.txt tokens.pl tokens.hxx.head tokens.hxx.tail $(GENHEADERPATH)$/tokens.hxx $(INCCOM)$/tokennames.inc $(MISC)$/tokenhash.gperf
@@-$(RM) $@
- $(MKDIRHIER) $(INCCOM)$/oox$/core
- $(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@
+ $(MKDIRHIER) $(GENHEADERPATH)
+ $(PERL) tokens.pl tokens.txt $(MISC)$/tokenids.inc $(INCCOM)$/tokennames.inc $(MISC)$/tokenhash.gperf && $(TYPE) tokens.hxx.head $(MISC)$/tokenids.inc tokens.hxx.tail > $(GENHEADERPATH)$/tokens.hxx && $(TOUCH) $@
-$(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf $(MISC)$/do_tokens
- $(AUGMENT_LIBRARY_PATH) gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc
+$(SLO)$/namespacemap.obj : $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx $(MISC)$/do_namespaces
-$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx $(MISC)$/do_tokens $(MISC)$/do_namespaces
-
-$(MISC)$/do_properties $(do_phony) : properties.txt genproperties.pl $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc
+$(MISC)$/do_namespaces $(do_phony) : namespaces.txt namespaces.pl namespaces.hxx.head namespaces.hxx.tail $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt $(GENHEADERPATH)$/namespaces.hxx
@@-$(RM) $@
- $(PERL) genproperties.pl properties.txt $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc && $(TOUCH) $@
+ $(MKDIRHIER) $(GENHEADERPATH)
+ $(PERL) namespaces.pl namespaces.txt $(MISC)$/namespaceids.inc $(INCCOM)$/namespacenames.inc $(MISC)$/namespaces.txt && $(TYPE) namespaces.hxx.head $(MISC)$/namespaceids.inc namespaces.hxx.tail > $(GENHEADERPATH)$/namespaces.hxx && $(TOUCH) $@
-$(SLO)$/propertylist.obj : $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.hxx $(MISC)$/do_properties
+$(SLO)$/propertynames.obj : $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx $(MISC)$/do_properties
+$(MISC)$/do_properties $(do_phony) : properties.txt properties.pl properties.hxx.head properties.hxx.tail $(INCCOM)$/propertynames.inc $(GENHEADERPATH)$/properties.hxx
+ @@-$(RM) $@
+ $(MKDIRHIER) $(GENHEADERPATH)
+ $(PERL) properties.pl properties.txt $(MISC)$/propertyids.inc $(INCCOM)$/propertynames.inc && $(TYPE) properties.hxx.head $(MISC)$/propertyids.inc properties.hxx.tail > $(GENHEADERPATH)$/properties.hxx && $(TOUCH) $@
diff --git a/oox/inc/oox/helper/recordinputstream.hxx b/oox/source/token/namespacemap.cxx
index ee05ce480a75..0f4373d2dc59 100644..100755
--- a/oox/inc/oox/helper/recordinputstream.hxx
+++ b/oox/source/token/namespacemap.cxx
@@ -25,34 +25,25 @@
*
************************************************************************/
-#ifndef OOX_HELPER_RECORDINPUTSTREAM_HXX
-#define OOX_HELPER_RECORDINPUTSTREAM_HXX
-
-#include "oox/helper/binaryinputstream.hxx"
+#include "oox/token/namespacemap.hxx"
namespace oox {
// ============================================================================
-/** Reads the contents of a record from a binary OOBIN stream. */
-class RecordInputStream : public SequenceInputStream
+NamespaceMap::NamespaceMap()
{
-public:
- explicit RecordInputStream( const StreamDataSequence& rData );
-
- /** Reads a string with leading 16-bit or 32-bit length field. */
- ::rtl::OUString readString( bool b32BitLen = true );
+ static const struct NamespaceUrl { sal_Int32 mnId; const sal_Char* mpcUrl; } spNamespaceUrls[] =
+ {
+// include auto-generated C array with namespace URLs as C strings
+#include "namespacenames.inc"
+ { -1, "" }
+ };
- /** Stream operator for integral types. */
- template< typename Type >
- inline RecordInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
- /** Stream operator for an ::rtl::OUString, reads 32-bit string length and Unicode array. */
- inline RecordInputStream& operator>>( ::rtl::OUString& orString ) { orString = readString(); return *this; }
-};
+ for( const NamespaceUrl* pNamespaceUrl = spNamespaceUrls; pNamespaceUrl->mnId != -1; ++pNamespaceUrl )
+ operator[]( pNamespaceUrl->mnId ) = ::rtl::OUString::createFromAscii( pNamespaceUrl->mpcUrl );
+}
// ============================================================================
} // namespace oox
-
-#endif
-
diff --git a/oox/source/token/namespaces.hxx.head b/oox/source/token/namespaces.hxx.head
new file mode 100755
index 000000000000..351bf2558303
--- /dev/null
+++ b/oox/source/token/namespaces.hxx.head
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_TOKEN_NAMESPACES_HXX
+#define OOX_TOKEN_NAMESPACES_HXX
+
+#include <sal/types.h>
+
+namespace oox {
+
+// ============================================================================
+
diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail
new file mode 100755
index 000000000000..651fc38511d4
--- /dev/null
+++ b/oox/source/token/namespaces.hxx.tail
@@ -0,0 +1,35 @@
+
+// ============================================================================
+
+const sal_Int32 TOKEN_MASK = static_cast< sal_Int32 >( (1 << NMSP_SHIFT) - 1 );
+const sal_Int32 NMSP_MASK = static_cast< sal_Int32 >( SAL_MAX_INT16 & ~TOKEN_MASK );
+
+/** Returns the raw token identifier without namespace of the passed token. */
+inline sal_Int32 getBaseToken( sal_Int32 nToken ) { return nToken & TOKEN_MASK; }
+
+/** Returns the namespace without token identifier of the passed token. */
+inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; }
+
+// defines for tokens with specific namespaces
+#define A_TOKEN( token ) (::oox::NMSP_dml | XML_##token)
+#define AX_TOKEN( token ) (::oox::NMSP_ax | XML_##token)
+#define C_TOKEN( token ) (::oox::NMSP_dmlChart | XML_##token)
+#define CDR_TOKEN( token ) (::oox::NMSP_dmlChartDr | XML_##token)
+#define DGM_TOKEN( token ) (::oox::NMSP_dmlDiagram | XML_##token)
+#define O_TOKEN( token ) (::oox::NMSP_vmlOffice | XML_##token)
+#define PC_TOKEN( token ) (::oox::NMSP_packageContentTypes | XML_##token)
+#define PPT_TOKEN( token ) (::oox::NMSP_ppt | XML_##token)
+#define PR_TOKEN( token ) (::oox::NMSP_packageRel | XML_##token)
+#define R_TOKEN( token ) (::oox::NMSP_officeRel | XML_##token)
+#define VML_TOKEN( token ) (::oox::NMSP_vml | XML_##token)
+#define VMLX_TOKEN( token ) (::oox::NMSP_vmlExcel | XML_##token)
+#define XDR_TOKEN( token ) (::oox::NMSP_dmlSpreadDr | XML_##token)
+#define XLS_TOKEN( token ) (::oox::NMSP_xls | XML_##token)
+#define XM_TOKEN( token ) (::oox::NMSP_xm | XML_##token)
+#define XML_TOKEN( token ) (::oox::NMSP_xml | XML_##token)
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
diff --git a/oox/source/token/namespaces.pl b/oox/source/token/namespaces.pl
new file mode 100644
index 000000000000..3c741fa7b2af
--- /dev/null
+++ b/oox/source/token/namespaces.pl
@@ -0,0 +1,79 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$ARGV0 = shift @ARGV;
+$ARGV1 = shift @ARGV;
+$ARGV2 = shift @ARGV;
+$ARGV3 = shift @ARGV;
+
+# parse input file
+
+open( INFILE, $ARGV0 ) or die "cannot open input file: $!";
+my %namespaces;
+while( <INFILE> )
+{
+ # trim newline
+ chomp( $_ );
+ # trim leading/trailing whitespace
+ $_ =~ s/^\s*//g;
+ $_ =~ s/\s*$//g;
+ # trim comments
+ $_ =~ s/^#.*//;
+ # skip empty lines
+ if( $_ )
+ {
+ # check for valid characters
+ $_ =~ /^([a-zA-Z]+)\s+([a-zA-Z0-9-.:\/]+)\s*$/ or die "Error: invalid character in input data";
+ $namespaces{$1} = $2;
+ }
+}
+close( INFILE );
+
+# generate output files
+
+open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!";
+open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!";
+open( TXTFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!";
+
+# number of bits to shift the namespace identifier
+$shift = 16;
+
+print ( IDFILE "const size_t NMSP_SHIFT = $shift;\n" );
+
+$i = 1;
+foreach( keys( %namespaces ) )
+{
+ print( IDFILE "const sal_Int32 NMSP_$_ = $i << NMSP_SHIFT;\n" );
+ $id = $i << $shift;
+ print( NAMEFILE "{ $id, \"$namespaces{$_}\" },\n" );
+ print( TXTFILE "$id $_ $namespaces{$_}\n" );
+ ++$i;
+}
+
+close( IDFILE );
+close( nameFILE );
+close( TXTFILE );
diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt
index 45bb59541b1b..81b568067470 100644
--- a/oox/source/token/namespaces.txt
+++ b/oox/source/token/namespaces.txt
@@ -1,49 +1,52 @@
-# Relations, XML
-XML
-PACKAGE_RELATIONSHIPS
-RELATIONSHIPS
-CONTENT_TYPES
-
-# Office global
-THEME
-ACTIVATION
-MATH
-
-#DrawingML
-DRAWINGML
-PICTURE
-DIAGRAM
-CHART
-CDR
-DOC_DRAWINGML
-
-# VML
-VML
-OFFICE
-VML_DOC
-VML_XLS
-VML_PPT
-AX
-
-#SpreadsheetML
-XLS
-XDR
-XM
-
-#PresentationML
-PPT
-
-#WordprocessingML
-DOC
-SML
-
-# Document properties
-COREPR
-DC
-DCTERMS
-EXTPR
-CUSTPR
-VT
-
-# Other elements: used by writerfilter
-SPRM
+
+# generic XML -----------------------------------------------------------------
+
+xml http://www.w3.org/XML/1998/namespace
+schema http://schemas.openxmlformats.org/schemaLibrary/2006/main
+
+# package ---------------------------------------------------------------------
+
+packageContentTypes http://schemas.openxmlformats.org/package/2006/content-types
+packageMetaCorePr http://schemas.openxmlformats.org/package/2006/metadata/core-properties
+packageRel http://schemas.openxmlformats.org/package/2006/relationships
+
+# office shared ---------------------------------------------------------------
+
+officeCustomPr http://schemas.openxmlformats.org/officeDocument/2006/custom-properties
+officeDocPropsVT http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes
+officeExtPr http://schemas.openxmlformats.org/officeDocument/2006/extended-properties
+officeMath http://schemas.openxmlformats.org/officeDocument/2006/math
+officeRel http://schemas.openxmlformats.org/officeDocument/2006/relationships
+officeRelTheme http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme
+
+# applications ----------------------------------------------------------------
+
+doc http://schemas.openxmlformats.org/wordprocessingml/2006/main
+xls http://schemas.openxmlformats.org/spreadsheetml/2006/main
+ppt http://schemas.openxmlformats.org/presentationml/2006/main
+
+# drawing ---------------------------------------------------------------------
+
+dml http://schemas.openxmlformats.org/drawingml/2006/main
+dmlChart http://schemas.openxmlformats.org/drawingml/2006/chart
+dmlChartDr http://schemas.openxmlformats.org/drawingml/2006/chartDrawing
+dmlDiagram http://schemas.openxmlformats.org/drawingml/2006/diagram
+dmlPicture http://schemas.openxmlformats.org/drawingml/2006/picture
+dmlSpreadDr http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing
+dmlWordDr http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing
+
+# VML -------------------------------------------------------------------------
+
+vml urn:schemas-microsoft-com:vml
+vmlExcel urn:schemas-microsoft-com:office:excel
+vmlOffice urn:schemas-microsoft-com:office:office
+vmlPowerpoint urn:schemas-microsoft-com:office:powerpoint
+vmlWord urn:schemas-microsoft-com:office:word
+
+# other -----------------------------------------------------------------------
+
+ax http://schemas.microsoft.com/office/2006/activeX
+dc http://purl.org/dc/elements/1.1/
+dcTerms http://purl.org/dc/terms/
+xm http://schemas.microsoft.com/office/excel/2006/main
+sprm http://sprm
diff --git a/oox/source/token/parsexsd.pl b/oox/source/token/parsexsd.pl
index 3b6745121e4c..8fed059bbc44 100644
--- a/oox/source/token/parsexsd.pl
+++ b/oox/source/token/parsexsd.pl
@@ -1,3 +1,30 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
$ARGV = shift @ARGV;
my %tokens;
diff --git a/oox/source/token/properties.hxx.head b/oox/source/token/properties.hxx.head
new file mode 100755
index 000000000000..25817b5e72f3
--- /dev/null
+++ b/oox/source/token/properties.hxx.head
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_TOKEN_PROPERTIES_HXX
+#define OOX_TOKEN_PROPERTIES_HXX
+
+#include <sal/types.h>
+
+namespace oox {
+
+// ============================================================================
+
diff --git a/oox/source/token/properties.hxx.tail b/oox/source/token/properties.hxx.tail
new file mode 100755
index 000000000000..f647337e529c
--- /dev/null
+++ b/oox/source/token/properties.hxx.tail
@@ -0,0 +1,6 @@
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
diff --git a/oox/source/token/properties.pl b/oox/source/token/properties.pl
new file mode 100644
index 000000000000..f341924bbb90
--- /dev/null
+++ b/oox/source/token/properties.pl
@@ -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.
+#
+#*************************************************************************
+
+$ARGV0 = shift @ARGV;
+$ARGV1 = shift @ARGV;
+$ARGV2 = shift @ARGV;
+
+# parse input file
+
+open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!";
+my %props;
+while( <INFILE> )
+{
+ # trim newline
+ chomp( $_ );
+ # trim leading/trailing whitespace
+ $_ =~ s/^\s*//g;
+ $_ =~ s/\s*$//g;
+ # check for valid characters
+ $_ =~ /^[A-Z][a-zA-Z0-9]*$/ or die "Error: invalid character in property '$_'";
+ $id = "PROP_$_";
+ $props{$_} = $id;
+}
+close( INFILE );
+
+# generate output files
+
+open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!";
+open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!";
+
+$i = 0;
+foreach( sort( keys( %props ) ) )
+{
+ print( IDFILE "const sal_Int32 $props{$_} = $i;\n" );
+ print( NAMEFILE "/* $i */ \"$_\",\n" );
+ ++$i;
+}
+
+print( IDFILE "const sal_Int32 PROP_COUNT = $i;\n" );
+print( IDFILE "const sal_Int32 PROP_INVALID = -1;\n" );
+
+close( IDFILE );
+close( NAMEFILE );
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index ba51c3577a8e..7d41b89bfa68 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -2,12 +2,15 @@ AbsoluteName
Action
ActiveSplitRange
ActiveTable
+Address
Adjust
AdjustContrast
AdjustLuminance
AdjustmentValues
Align
AnchorPosition
+ApplyFormDesignMode
+AreaLinks
ArrangeOrder
Aspect
AttachedAxisIndex
@@ -87,6 +90,7 @@ ContainsHeader
Coordinates
CopyBack
CopyFormulas
+CopyOutputData
CopyStyles
CrossoverPosition
CrossoverValue
@@ -104,11 +108,11 @@ D3DSceneShadeMode
DDELinks
DatabaseRanges
Decoration
-DefaultContext
DefaultScrollValue
DefaultSpinValue
DefaultState
DefaultText
+DefaultValue
DiagonalBLTR
DiagonalTLBR
DialogLibraries
@@ -143,6 +147,9 @@ FillGradient
FillGradientName
FillStyle
FillTransparence
+Filter
+FilterCriteriaSource
+FilterOptions
FirstLineOffset
FirstPageNumber
FocusOnClick
@@ -208,6 +215,7 @@ InputMessage
InputTitle
IsActive
IsAdjustHeightEnabled
+IsCaseSensitive
IsCellBackgroundTransparent
IsChangeReadOnlyEnabled
IsDate
@@ -280,6 +288,7 @@ NumberingType
Offset
OpCodeMap
Orientation
+OutputPosition
OverlapSequence
PageScale
PageStyle
@@ -331,6 +340,8 @@ RefX
RefY
Reference
ReferenceDevice
+ReferenceSheet
+RefreshPeriod
RegularExpressions
RelId
RelativeHorizontalTabbarWidth
@@ -350,6 +361,7 @@ RotationHorizontal
RotationVertical
RowGrand
RowLabelRanges
+SaveOutputPosition
ScaleMode
ScaleToPages
ScaleToPagesX
@@ -382,10 +394,14 @@ ShowPositiveError
ShowZeroValues
ShrinkToFit
Size
+Size100thMM
+SizePixel
+SkipDuplicates
SortInfo
Sound
SoundOn
Speed
+Spin
SpinIncrement
SpinValue
SpinValueMax
@@ -439,11 +455,14 @@ Transparency
TriState
Type
URL
+Url
+UseFilterCriteriaSource
UseRegularExpressions
UseRings
UseSelectedPage
VScroll
Validation
+Value
VaryColorsByPoint
VertJustify
VerticalAlign
@@ -458,5 +477,6 @@ Weight
WhiteDay
Width
WritingMode
+XLA1Representation
ZoomType
ZoomValue
diff --git a/oox/source/token/propertynames.cxx b/oox/source/token/propertynames.cxx
new file mode 100644
index 000000000000..401d168fe696
--- /dev/null
+++ b/oox/source/token/propertynames.cxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/token/propertynames.hxx"
+
+namespace oox {
+
+// ============================================================================
+
+PropertyNameVector::PropertyNameVector()
+{
+ static const sal_Char* sppcPropertyNames[] =
+ {
+ // include auto-generated C array with property names as C strings
+#include "propertynames.inc"
+ ""
+ };
+
+ size_t nArraySize = (sizeof( sppcPropertyNames ) / sizeof( *sppcPropertyNames )) - 1;
+ reserve( nArraySize );
+ for( size_t nIndex = 0; nIndex < nArraySize; ++nIndex )
+ push_back( ::rtl::OUString::createFromAscii( sppcPropertyNames[ nIndex ] ) );
+}
+
+// ============================================================================
+
+} // namespace oox
diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx
index b5ed8e9a9323..a5189269c3c8 100644
--- a/oox/source/token/tokenmap.cxx
+++ b/oox/source/token/tokenmap.cxx
@@ -26,28 +26,25 @@
************************************************************************/
#include "oox/token/tokenmap.hxx"
+
#include <string.h>
#include <rtl/strbuf.hxx>
#include <rtl/string.hxx>
-#include "tokens.hxx"
-#include "oox/helper/containerhelper.hxx"
+#include "oox/token/tokens.hxx"
-#include <string.h>
+namespace oox {
+// ============================================================================
+
+using ::com::sun::star::uno::Sequence;
using ::rtl::OString;
using ::rtl::OUString;
-using ::com::sun::star::uno::Sequence;
-
-namespace oox {
// ============================================================================
namespace {
-
-// include auto-generated token lists
-#include "tokens.inc"
-#include "tokenwords.inc"
-
+// include auto-generated Perfect_Hash
+#include "tokenhash.inc"
} // namespace
// ============================================================================
@@ -55,10 +52,17 @@ namespace {
TokenMap::TokenMap() :
maTokenNames( static_cast< size_t >( XML_TOKEN_COUNT ) )
{
- const sal_Char* const* ppcTokenWord = xmltokenwordlist;
- for( TokenNameVector::iterator aIt = maTokenNames.begin(), aEnd = maTokenNames.end(); aIt != aEnd; ++aIt, ++ppcTokenWord )
+ static const sal_Char* sppcTokenNames[] =
{
- OString aUtf8Token( *ppcTokenWord );
+// include auto-generated C array with token names as C strings
+#include "tokennames.inc"
+ ""
+ };
+
+ const sal_Char* const* ppcTokenName = sppcTokenNames;
+ for( TokenNameVector::iterator aIt = maTokenNames.begin(), aEnd = maTokenNames.end(); aIt != aEnd; ++aIt, ++ppcTokenName )
+ {
+ OString aUtf8Token( *ppcTokenName );
aIt->maUniName = OStringToOUString( aUtf8Token, RTL_TEXTENCODING_UTF8 );
aIt->maUtf8Name = Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aUtf8Token.getStr() ), aUtf8Token.getLength() );
}
@@ -72,7 +76,7 @@ TokenMap::TokenMap() :
OString aUtf8Name = OUStringToOString( maTokenNames[ nToken ].maUniName, RTL_TEXTENCODING_UTF8 );
struct xmltoken* pToken = Perfect_Hash::in_word_set( aUtf8Name.getStr(), aUtf8Name.getLength() );
bOk = pToken && (pToken->nToken == nToken);
- OSL_ENSURE( bOk, ::rtl::OStringBuffer( "FastTokenHandler::FastTokenHandler - token list broken, #" ).
+ OSL_ENSURE( bOk, ::rtl::OStringBuffer( "TokenMap::TokenMap - token list broken, #" ).
append( nToken ).append( ", '" ).append( aUtf8Name ).append( '\'' ).getStr() );
}
#endif
@@ -84,8 +88,9 @@ TokenMap::~TokenMap()
OUString TokenMap::getUnicodeTokenName( sal_Int32 nToken ) const
{
- const TokenName* pTokenName = ContainerHelper::getVectorElement( maTokenNames, nToken );
- return pTokenName ? pTokenName->maUniName : OUString();
+ if( (0 <= nToken) && (static_cast< size_t >( nToken ) < maTokenNames.size()) )
+ return maTokenNames[ static_cast< size_t >( nToken ) ].maUniName;
+ return OUString();
}
sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) const
@@ -97,8 +102,9 @@ sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) const
Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const
{
- const TokenName* pTokenName = ContainerHelper::getVectorElement( maTokenNames, nToken );
- return pTokenName ? pTokenName->maUtf8Name : Sequence< sal_Int8 >();
+ if( (0 <= nToken) && (static_cast< size_t >( nToken ) < maTokenNames.size()) )
+ return maTokenNames[ static_cast< size_t >( nToken ) ].maUtf8Name;
+ return Sequence< sal_Int8 >();
}
sal_Int32 TokenMap::getTokenFromUtf8( const Sequence< sal_Int8 >& rUtf8Name ) const
@@ -111,4 +117,3 @@ sal_Int32 TokenMap::getTokenFromUtf8( const Sequence< sal_Int8 >& rUtf8Name ) co
// ============================================================================
} // namespace oox
-
diff --git a/oox/source/token/tokens.hxx.head b/oox/source/token/tokens.hxx.head
new file mode 100755
index 000000000000..dd201caeb1d9
--- /dev/null
+++ b/oox/source/token/tokens.hxx.head
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_TOKEN_TOKENS_HXX
+#define OOX_TOKEN_TOKENS_HXX
+
+#include <com/sun/star/xml/sax/FastToken.hpp>
+
+namespace oox {
+
+// ============================================================================
+
diff --git a/oox/source/token/tokens.hxx.tail b/oox/source/token/tokens.hxx.tail
new file mode 100755
index 000000000000..df4b5ef1a955
--- /dev/null
+++ b/oox/source/token/tokens.hxx.tail
@@ -0,0 +1,8 @@
+
+const sal_Int32 XML_TOKEN_INVALID = ::com::sun::star::xml::sax::FastToken::DONTKNOW;
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
diff --git a/oox/source/token/tokens.pl b/oox/source/token/tokens.pl
new file mode 100644
index 000000000000..a951cee80db2
--- /dev/null
+++ b/oox/source/token/tokens.pl
@@ -0,0 +1,80 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$ARGV0 = shift @ARGV;
+$ARGV1 = shift @ARGV;
+$ARGV2 = shift @ARGV;
+$ARGV3 = shift @ARGV;
+
+open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!";
+my %tokens;
+while ( <INFILE> )
+{
+ # trim newline
+ chomp( $_ );
+ # trim leading/trailing whitespace
+ $_ =~ s/^\s*//g;
+ $_ =~ s/\s*$//g;
+ # check for valid characters
+ $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid character in token '$_'";
+ $id = "XML_$_";
+ $id =~ s/-/_/g;
+ $tokens{$_} = $id;
+}
+close ( INFILE );
+
+# generate output files
+
+open ( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!";
+open ( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!";
+open ( GPERFFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!";
+
+print( GPERFFILE "%language=C++\n" );
+print( GPERFFILE "%global-table\n" );
+print( GPERFFILE "%null-strings\n" );
+print( GPERFFILE "%struct-type\n" );
+print( GPERFFILE "struct xmltoken {\n" );
+print( GPERFFILE " const sal_Char *name;\n" );
+print( GPERFFILE " sal_Int32 nToken;\n" );
+print( GPERFFILE "};\n" );
+print( GPERFFILE "%%\n" );
+
+$i = 0;
+foreach( sort( keys( %tokens ) ) )
+{
+ print( IDFILE "const sal_Int32 $tokens{$_} = $i;\n" );
+ print( NAMEFILE "\"$_\",\n" );
+ print( GPERFFILE "$_,$tokens{$_}\n" );
+ ++$i;
+}
+
+print( IDFILE "const sal_Int32 XML_TOKEN_COUNT = $i;\n" );
+print( GPERFFILE "%%\n" );
+
+close( IDFILE );
+close( NAMEFILE );
+close( GPERFFILE );
diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index b05a21152722..13c1a10ff9b4 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -63,6 +63,7 @@ BookSection
BookTitle
BorderColor
BorderStyle
+Bottom
BroadcastTitle
Broadcaster
Button
@@ -72,6 +73,7 @@ Cancel
Caption
Case
CaseNumber
+Center
ChapterNumber
Characters
CharactersWithSpaces
@@ -82,6 +84,8 @@ ClientData
ColHidden
Colored
Column
+Combo
+ComboEdit
Comments
Company
Compiler
@@ -116,6 +120,7 @@ Director
Disabled
Dismiss
DisplayStyle
+Distributed
Distributor
DocSecurity
DocumentFromInternetSite
@@ -134,6 +139,7 @@ Editor
ElectronicSource
Embed
EnhancedMetaFile
+Extend
Extension
External
False
@@ -190,11 +196,13 @@ Issue
JournalArticle
JournalName
JustLastX
+Justify
LCID
LCT
Label
LargeChange
Last
+Left
LineA
Lines
Link
@@ -239,6 +247,7 @@ MouseIcon
MousePointer
MoveWithCells
Movie
+Multi
MultiLine
MultiSel
MultiSelect
@@ -315,6 +324,7 @@ Relationships
RelationshipsGroupReference
Report
Reporter
+Right
RootElement
Row
RowHidden
@@ -340,6 +350,8 @@ ShortTitle
ShowDropButtonWhen
ShowImportExportValidationErrors
SignatureTime
+Simple
+Single
Size
SizeMode
SizeWithCells
@@ -367,6 +379,7 @@ Theater
ThesisType
Title
TitlesOfParts
+Top
TotalTime
Translator
True
@@ -2087,6 +2100,7 @@ fNode
fPr
fPrintsWithSheet
fPublished
+face
facet
fact
factor
@@ -2249,6 +2263,7 @@ followColorScheme
followSib
followedHyperlink
font
+font4
fontAlgn
fontColor
fontId
diff --git a/oox/source/vml/makefile.mk b/oox/source/vml/makefile.mk
index 2b47a1c930db..094d37cd8c1c 100644
--- a/oox/source/vml/makefile.mk
+++ b/oox/source/vml/makefile.mk
@@ -41,13 +41,15 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
SLOFILES = \
- $(SLO)$/vmldrawing.obj \
- $(SLO)$/vmldrawingfragment.obj \
- $(SLO)$/vmlformatting.obj \
- $(SLO)$/vmlinputstream.obj \
- $(SLO)$/vmlshape.obj \
- $(SLO)$/vmlshapecontainer.obj \
- $(SLO)$/vmlshapecontext.obj
+ $(SLO)$/vmldrawing.obj \
+ $(SLO)$/vmldrawingfragment.obj \
+ $(SLO)$/vmlformatting.obj \
+ $(SLO)$/vmlinputstream.obj \
+ $(SLO)$/vmlshape.obj \
+ $(SLO)$/vmlshapecontainer.obj \
+ $(SLO)$/vmlshapecontext.obj \
+ $(SLO)$/vmltextbox.obj \
+ $(SLO)$/vmltextboxcontext.obj
# --- Targets -------------------------------------------------------
diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index 1cc74c32aa2d..ccf0fe567235 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -26,28 +26,32 @@
************************************************************************/
#include "oox/vml/vmldrawing.hxx"
+
+#include <algorithm>
+#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
-#include "tokens.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include "oox/core/xmlfilterbase.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/ole/axcontrol.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::awt::XControlModel;
-using ::com::sun::star::drawing::XDrawPage;
-using ::com::sun::star::drawing::XShape;
-using ::com::sun::star::drawing::XShapes;
-using ::oox::core::XmlFilterBase;
-
namespace oox {
namespace vml {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::XmlFilterBase;
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
/** Returns the textual representation of a numeric VML shape identifier. */
@@ -57,6 +61,13 @@ OUString lclGetShapeId( sal_Int32 nShapeId )
return CREATE_OUSTRING( "\0s" ) + OUString::valueOf( nShapeId );
}
+/** Returns the numeric VML shape identifier from its textual representation. */
+sal_Int32 lclGetShapeId( const OUString& rShapeId )
+{
+ // identifier consists of a literal NUL character, a lowercase 's', and the id
+ return ((rShapeId.getLength() >= 3) && (rShapeId[ 0 ] == '\0') && (rShapeId[ 1 ] == 's')) ? rShapeId.copy( 2 ).toInt32() : -1;
+}
+
} // namespace
// ============================================================================
@@ -102,10 +113,22 @@ Drawing::~Drawing()
{
if( !mxCtrlForm.get() )
mxCtrlForm.reset( new ::oox::ole::EmbeddedForm(
- mrFilter.getModelFactory(), mxDrawPage, mrFilter.getGraphicHelper() ) );
+ mrFilter.getModel(), mxDrawPage, mrFilter.getGraphicHelper() ) );
return *mxCtrlForm;
}
+void Drawing::registerBlockId( sal_Int32 nBlockId )
+{
+ OSL_ENSURE( nBlockId > 0, "Drawing::registerBlockId - invalid block index" );
+ if( nBlockId > 0 )
+ {
+ // lower_bound() returns iterator pointing to element equal to nBlockId, if existing
+ BlockIdVector::iterator aIt = ::std::lower_bound( maBlockIds.begin(), maBlockIds.end(), nBlockId );
+ if( (aIt == maBlockIds.end()) || (nBlockId != *aIt) )
+ maBlockIds.insert( aIt, nBlockId );
+ }
+}
+
void Drawing::registerOleObject( const OleObjectInfo& rOleObject )
{
OSL_ENSURE( rOleObject.maShapeId.getLength() > 0, "Drawing::registerOleObject - missing OLE object shape id" );
@@ -132,6 +155,47 @@ void Drawing::convertAndInsert() const
mxShapes->convertAndInsert( xShapes );
}
+sal_Int32 Drawing::getLocalShapeIndex( const OUString& rShapeId ) const
+{
+ sal_Int32 nShapeId = lclGetShapeId( rShapeId );
+ if( nShapeId <= 0 ) return -1;
+
+ /* Shapes in a drawing are counted per registered shape identifier blocks
+ as stored in the o:idmap element. The contents of this element have
+ been stored in our member maBlockIds. Each block represents 1024 shape
+ identifiers, starting with identifier 1 for the block #0. This means,
+ block #0 represents the identifiers 1-1024, block #1 represents the
+ identifiers 1025-2048, and so on. The local shape index has to be
+ calculated according to all blocks registered for this drawing.
+
+ Example:
+ Registered for this drawing are blocks #1 and #3 (shape identifiers
+ 1025-2048 and 3073-4096).
+ Shape identifier 1025 -> local shape index 1.
+ Shape identifier 1026 -> local shape index 2.
+ ...
+ Shape identifier 2048 -> local shape index 1024.
+ Shape identifier 3073 -> local shape index 1025.
+ ...
+ Shape identifier 4096 -> local shape index 2048.
+ */
+
+ // get block id from shape id and find its index in the list of used blocks
+ sal_Int32 nBlockId = (nShapeId - 1) / 1024;
+ BlockIdVector::iterator aIt = ::std::lower_bound( maBlockIds.begin(), maBlockIds.end(), nBlockId );
+ sal_Int32 nIndex = static_cast< sal_Int32 >( aIt - maBlockIds.begin() );
+
+ // block id not found in set -> register it now (value of nIndex remains valid)
+ if( (aIt == maBlockIds.end()) || (*aIt != nBlockId) )
+ maBlockIds.insert( aIt, nBlockId );
+
+ // get one-based offset of shape id in its block
+ sal_Int32 nBlockOffset = (nShapeId - 1) % 1024 + 1;
+
+ // calculate the local shape index
+ return 1024 * nIndex + nBlockOffset;
+}
+
const OleObjectInfo* Drawing::getOleObjectInfo( const OUString& rShapeId ) const
{
return ContainerHelper::getMapElement( maOleObjects, rShapeId );
@@ -142,21 +206,72 @@ const ControlInfo* Drawing::getControlInfo( const OUString& rShapeId ) const
return ContainerHelper::getMapElement( maControls, rShapeId );
}
+Reference< XShape > Drawing::createAndInsertXShape( const OUString& rService,
+ const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const
+{
+ OSL_ENSURE( rService.getLength() > 0, "Drawing::createAndInsertXShape - missing UNO shape service name" );
+ OSL_ENSURE( rxShapes.is(), "Drawing::createAndInsertXShape - missing XShapes container" );
+ Reference< XShape > xShape;
+ if( (rService.getLength() > 0) && rxShapes.is() ) try
+ {
+ Reference< XMultiServiceFactory > xFactory( mrFilter.getModelFactory(), UNO_SET_THROW );
+ xShape.set( xFactory->createInstance( rService ), UNO_QUERY_THROW );
+ // insert shape into passed shape collection (maybe drawpage or group shape)
+ rxShapes->add( xShape );
+ xShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) );
+ xShape->setSize( Size( rShapeRect.Width, rShapeRect.Height ) );
+ }
+ catch( Exception& )
+ {
+ }
+ OSL_ENSURE( xShape.is(), "Drawing::createAndInsertXShape - cannot instanciate shape object" );
+ return xShape;
+}
+
+Reference< XShape > Drawing::createAndInsertXControlShape( const ::oox::ole::EmbeddedControl& rControl,
+ const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect, sal_Int32& rnCtrlIndex ) const
+{
+ Reference< XShape > xShape;
+ try
+ {
+ // create control model and insert it into the form of the draw page
+ Reference< XControlModel > xCtrlModel( getControlForm().convertAndInsert( rControl, rnCtrlIndex ), UNO_SET_THROW );
+
+ // create the control shape
+ xShape = createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.ControlShape" ), rxShapes, rShapeRect );
+
+ // set the control model at the shape
+ Reference< XControlShape >( xShape, UNO_QUERY_THROW )->setControl( xCtrlModel );
+ }
+ catch( Exception& )
+ {
+ }
+ return xShape;
+}
+
bool Drawing::isShapeSupported( const ShapeBase& /*rShape*/ ) const
{
return true;
}
-bool Drawing::convertShapeClientAnchor( Rectangle& /*orShapeRect*/, const OUString& /*rShapeAnchor*/ ) const
+OUString Drawing::getShapeBaseName( const ShapeBase& /*rShape*/ ) const
+{
+ return OUString();
+}
+
+bool Drawing::convertClientAnchor( Rectangle& /*orShapeRect*/, const OUString& /*rShapeAnchor*/ ) const
{
return false;
}
-void Drawing::convertControlClientData( const Reference< XControlModel >& /*rxCtrlModel*/, const ShapeClientData& /*rClientData*/ ) const
+Reference< XShape > Drawing::createAndInsertClientXShape( const ShapeBase& /*rShape*/,
+ const Reference< XShapes >& /*rxShapes*/, const Rectangle& /*rShapeRect*/ ) const
{
+ return Reference< XShape >();
}
-void Drawing::notifyShapeInserted( const Reference< XShape >& /*rxShape*/, const Rectangle& /*rShapeRect*/ )
+void Drawing::notifyXShapeInserted( const Reference< XShape >& /*rxShape*/,
+ const Rectangle& /*rShapeRect*/, const ShapeBase& /*rShape*/, bool /*bGroupChild*/ )
{
}
@@ -164,4 +279,3 @@ void Drawing::notifyShapeInserted( const Reference< XShape >& /*rxShape*/, const
} // namespace vml
} // namespave oox
-
diff --git a/oox/source/vml/vmldrawingfragment.cxx b/oox/source/vml/vmldrawingfragment.cxx
index 333df72bbaf7..dc5c82515691 100644
--- a/oox/source/vml/vmldrawingfragment.cxx
+++ b/oox/source/vml/vmldrawingfragment.cxx
@@ -26,24 +26,26 @@
************************************************************************/
#include "oox/vml/vmldrawingfragment.hxx"
+
#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmlinputstream.hxx"
#include "oox/vml/vmlshapecontext.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::io::XInputStream;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::FragmentHandler2;
-using ::oox::core::XmlFilterBase;
-
namespace oox {
namespace vml {
// ============================================================================
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
DrawingFragment::DrawingFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, Drawing& rDrawing ) :
- FragmentHandler2( rFilter, rFragmentPath ),
+ FragmentHandler2( rFilter, rFragmentPath, false ), // do not trim whitespace, has been preprocessed by the input stream
mrDrawing( rDrawing )
{
}
@@ -61,7 +63,7 @@ ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 nElement, const At
// DOCX filter handles plain shape elements with this fragment handler
case VMLDRAWING_WORD:
if( isRootElement() )
- return ShapeContextBase::createShapeContext( *this, nElement, rAttribs, mrDrawing.getShapes() );
+ return ShapeContextBase::createShapeContext( *this, mrDrawing.getShapes(), nElement, rAttribs );
break;
// XLSX and PPTX filters load the entire VML fragment
@@ -73,7 +75,7 @@ ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 nElement, const At
if( nElement == XML_xml ) return this;
break;
case XML_xml:
- return ShapeContextBase::createShapeContext( *this, nElement, rAttribs, mrDrawing.getShapes() );
+ return ShapeContextBase::createShapeContext( *this, mrDrawing.getShapes(), nElement, rAttribs );
}
break;
}
@@ -90,4 +92,3 @@ void DrawingFragment::finalizeImport()
} // namespace vml
} // namespace oox
-
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 827930c22496..cd280d041eb9 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -26,26 +26,29 @@
************************************************************************/
#include "oox/vml/vmlformatting.hxx"
+
#include <rtl/strbuf.hxx>
-#include "tokens.hxx"
-#include "oox/token/tokenmap.hxx"
-#include "oox/helper/graphichelper.hxx"
-#include "oox/helper/propertymap.hxx"
#include "oox/drawingml/color.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/fillproperties.hxx"
#include "oox/drawingml/lineproperties.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/graphichelper.hxx"
+#include "oox/helper/propertymap.hxx"
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+using namespace ::com::sun::star::geometry;
-using ::rtl::OStringBuffer;
-using ::rtl::OUString;
-using ::com::sun::star::geometry::IntegerRectangle2D;
using ::oox::drawingml::Color;
using ::oox::drawingml::FillProperties;
using ::oox::drawingml::LineArrowProperties;
using ::oox::drawingml::LineProperties;
-
-namespace oox {
-namespace vml {
+using ::rtl::OStringBuffer;
+using ::rtl::OUString;
// ============================================================================
@@ -81,8 +84,9 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
/*static*/ bool ConversionHelper::decodeBool( const OUString& rValue )
{
+ sal_Int32 nToken = AttributeConversion::decodeToken( rValue );
// anything else than 't' or 'true' is considered to be false, as specified
- return ((rValue.getLength() == 1) && (rValue[ 0 ] == 't')) || (rValue == CREATE_OUSTRING( "true" ));
+ return (nToken == XML_t) || (nToken == XML_true);
}
/*static*/ double ConversionHelper::decodePercent( const OUString& rValue, double fDefValue )
@@ -171,58 +175,35 @@ bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, const OUString& r
return (decodeMeasureToEmu( rGraphicHelper, rValue, nRefValue, bPixelX, bDefaultAsPixel ) + 180) / 360;
}
-// ============================================================================
-
-namespace {
-
-/** Converts a VML color attribute to a DrawingML color.
-
- @param orDmlColor (out-parameter) The destination DrawingML color.
-
- @param roVmlColor The VML string representation of the color. If existing,
- this can be a 6-digit hexadecimal RGB value with leading '#' character,
- a predefined color name (e.g. 'black', 'red', etc.), the index into an
- application defined color palette in brackets with leading color name
- (e.g. 'red [9]' or 'windowColor [64]'), or a color modifier used in
- one-color gradients (e.g. 'fill darken(128)' or 'fill lighten(0)'.
-
- @param roVmlOpacity The opacity of the color. If existing, this should be
- a floating-point value in the range [0.0;1.0].
-
- @param nDefaultRgb Deafult RGB color used if the parameter roVmlColor is
- empty.
-
- @param nPrimaryRgb If set to something else than API_RGB_TRANSPARENT,
- specifies the color to be used to resolve the color modifiers used in
- one-color gradients.
- */
-void lclGetColor( Color& orDmlColor, const GraphicHelper& rGraphicHelper,
+/*static*/ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper,
const OptValue< OUString >& roVmlColor, const OptValue< double >& roVmlOpacity,
- sal_Int32 nDefaultRgb, sal_Int32 nPrimaryRgb = API_RGB_TRANSPARENT )
+ sal_Int32 nDefaultRgb, sal_Int32 nPrimaryRgb )
{
+ Color aDmlColor;
+
// convert opacity
const sal_Int32 DML_FULL_OPAQUE = ::oox::drawingml::MAX_PERCENT;
double fOpacity = roVmlOpacity.get( 1.0 );
sal_Int32 nOpacity = getLimitedValue< sal_Int32, double >( fOpacity * DML_FULL_OPAQUE, 0, DML_FULL_OPAQUE );
if( nOpacity < DML_FULL_OPAQUE )
- orDmlColor.addTransformation( XML_alpha, nOpacity );
+ aDmlColor.addTransformation( XML_alpha, nOpacity );
// color attribute not present - set passed default color
if( !roVmlColor.has() )
{
- orDmlColor.setSrgbClr( nDefaultRgb );
- return;
+ aDmlColor.setSrgbClr( nDefaultRgb );
+ return aDmlColor;
}
// separate leading color name or RGB value from following palette index
OUString aColorName, aColorIndex;
- ConversionHelper::separatePair( aColorName, aColorIndex, roVmlColor.get(), ' ' );
+ separatePair( aColorName, aColorIndex, roVmlColor.get(), ' ' );
// RGB colors in the format '#RRGGBB'
if( (aColorName.getLength() == 7) && (aColorName[ 0 ] == '#') )
{
- orDmlColor.setSrgbClr( aColorName.copy( 1 ).toInt32( 16 ) );
- return;
+ aDmlColor.setSrgbClr( aColorName.copy( 1 ).toInt32( 16 ) );
+ return aDmlColor;
}
// RGB colors in the format '#RGB'
@@ -231,27 +212,27 @@ void lclGetColor( Color& orDmlColor, const GraphicHelper& rGraphicHelper,
sal_Int32 nR = aColorName.copy( 1, 1 ).toInt32( 16 ) * 0x11;
sal_Int32 nG = aColorName.copy( 2, 1 ).toInt32( 16 ) * 0x11;
sal_Int32 nB = aColorName.copy( 3, 1 ).toInt32( 16 ) * 0x11;
- orDmlColor.setSrgbClr( (nR << 16) | (nG << 8) | nB );
- return;
+ aDmlColor.setSrgbClr( (nR << 16) | (nG << 8) | nB );
+ return aDmlColor;
}
/* Predefined color names or system color names (resolve to RGB to detect
valid color name). */
- sal_Int32 nColorToken = StaticTokenMap::get().getTokenFromUnicode( aColorName );
+ sal_Int32 nColorToken = AttributeConversion::decodeToken( aColorName );
sal_Int32 nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
if( nRgbValue == API_RGB_TRANSPARENT )
nRgbValue = rGraphicHelper.getSystemColor( nColorToken, API_RGB_TRANSPARENT );
if( nRgbValue != API_RGB_TRANSPARENT )
{
- orDmlColor.setSrgbClr( nRgbValue );
- return;
+ aDmlColor.setSrgbClr( nRgbValue );
+ return aDmlColor;
}
// try palette colors enclosed in brackets
if( (aColorIndex.getLength() >= 3) && (aColorIndex[ 0 ] == '[') && (aColorIndex[ aColorIndex.getLength() - 1 ] == ']') )
{
- orDmlColor.setPaletteClr( aColorIndex.copy( 1, aColorIndex.getLength() - 2 ).toInt32() );
- return;
+ aDmlColor.setPaletteClr( aColorIndex.copy( 1, aColorIndex.getLength() - 2 ).toInt32() );
+ return aDmlColor;
}
// try fill gradient modificator 'fill <modifier>(<amount>)'
@@ -262,7 +243,7 @@ void lclGetColor( Color& orDmlColor, const GraphicHelper& rGraphicHelper,
if( (2 <= nOpenParen) && (nOpenParen + 1 < nCloseParen) && (nCloseParen + 1 == aColorIndex.getLength()) )
{
sal_Int32 nModToken = XML_TOKEN_INVALID;
- switch( StaticTokenMap::get().getTokenFromUnicode( aColorIndex.copy( 0, nOpenParen ) ) )
+ switch( AttributeConversion::decodeToken( aColorIndex.copy( 0, nOpenParen ) ) )
{
case XML_darken: nModToken = XML_shade;
case XML_lighten: nModToken = XML_tint;
@@ -273,18 +254,23 @@ void lclGetColor( Color& orDmlColor, const GraphicHelper& rGraphicHelper,
/* Simulate this modifier color by a color with related transformation.
The modifier amount has to be converted from the range [0;255] to
percentage [0;100000] used by DrawingML. */
- orDmlColor.setSrgbClr( nPrimaryRgb );
- orDmlColor.addTransformation( nModToken, static_cast< sal_Int32 >( nValue * ::oox::drawingml::MAX_PERCENT / 255 ) );
- return;
+ aDmlColor.setSrgbClr( nPrimaryRgb );
+ aDmlColor.addTransformation( nModToken, static_cast< sal_Int32 >( nValue * ::oox::drawingml::MAX_PERCENT / 255 ) );
+ return aDmlColor;
}
}
}
- OSL_ENSURE( false, OStringBuffer( "lclGetColor - invalid VML color name '" ).
+ OSL_ENSURE( false, OStringBuffer( "ConversionHelper::decodeColor - invalid VML color name '" ).
append( OUStringToOString( roVmlColor.get(), RTL_TEXTENCODING_ASCII_US ) ).append( '\'' ).getStr() );
- orDmlColor.setSrgbClr( nDefaultRgb );
+ aDmlColor.setSrgbClr( nDefaultRgb );
+ return aDmlColor;
}
+// ============================================================================
+
+namespace {
+
sal_Int32 lclGetEmu( const GraphicHelper& rGraphicHelper, const OptValue< OUString >& roValue, sal_Int32 nDefValue )
{
return roValue.has() ? ConversionHelper::decodeMeasureToEmu( rGraphicHelper, roValue.get(), 0, false, false ) : nDefValue;
@@ -295,7 +281,7 @@ void lclGetDmlLineDash( OptValue< sal_Int32 >& oroPresetDash, LineProperties::Da
if( roDashStyle.has() )
{
const OUString& rDashStyle = roDashStyle.get();
- switch( StaticTokenMap::get().getTokenFromUnicode( rDashStyle ) )
+ switch( AttributeConversion::decodeToken( rDashStyle ) )
{
case XML_solid: oroPresetDash = XML_solid; return;
case XML_shortdot: oroPresetDash = XML_sysDot; return;
@@ -441,7 +427,7 @@ void StrokeModel::pushToPropMap( PropertyMap& rPropMap,
aLineProps.maLineFill.moFillType = XML_solidFill;
lclConvertArrow( aLineProps.maStartArrow, maStartArrow );
lclConvertArrow( aLineProps.maEndArrow, maEndArrow );
- lclGetColor( aLineProps.maLineFill.maFillColor, rGraphicHelper, moColor, moOpacity, API_RGB_BLACK );
+ aLineProps.maLineFill.maFillColor = ConversionHelper::decodeColor( rGraphicHelper, moColor, moOpacity, API_RGB_BLACK );
aLineProps.moLineWidth = lclGetEmu( rGraphicHelper, moWeight, 1 );
lclGetDmlLineDash( aLineProps.moPresetDash, aLineProps.maCustomDash, moDashStyle );
aLineProps.moLineCompound = lclGetDmlLineCompound( moLineStyle );
@@ -494,9 +480,8 @@ void FillModel::pushToPropMap( PropertyMap& rPropMap,
double fFocus = moFocus.get( 0.0 );
// prepare colors
- Color aColor1, aColor2;
- lclGetColor( aColor1, rGraphicHelper, moColor, moOpacity, API_RGB_WHITE );
- lclGetColor( aColor2, rGraphicHelper, moColor2, moOpacity2, API_RGB_WHITE, aColor1.getColor( rGraphicHelper ) );
+ Color aColor1 = ConversionHelper::decodeColor( rGraphicHelper, moColor, moOpacity, API_RGB_WHITE );
+ Color aColor2 = ConversionHelper::decodeColor( rGraphicHelper, moColor2, moOpacity2, API_RGB_WHITE, aColor1.getColor( rGraphicHelper ) );
// type XML_gradient is linear or axial gradient
if( nFillType == XML_gradient )
@@ -584,7 +569,7 @@ void FillModel::pushToPropMap( PropertyMap& rPropMap,
{
aFillProps.moFillType = XML_solidFill;
// fill color (default is white)
- lclGetColor( aFillProps.maFillColor, rGraphicHelper, moColor, moOpacity, API_RGB_WHITE );
+ aFillProps.maFillColor = ConversionHelper::decodeColor( rGraphicHelper, moColor, moOpacity, API_RGB_WHITE );
}
}
}
@@ -600,4 +585,3 @@ void FillModel::pushToPropMap( PropertyMap& rPropMap,
} // namespace vml
} // namespace oox
-
diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx
index a6d50e193bc4..fb2443aba4c4 100644
--- a/oox/source/vml/vmlinputstream.cxx
+++ b/oox/source/vml/vmlinputstream.cxx
@@ -26,22 +26,25 @@
************************************************************************/
#include "oox/vml/vmlinputstream.hxx"
+
#include <map>
#include <rtl/strbuf.hxx>
#include <rtl/strbuf.hxx>
#include "oox/helper/helper.hxx"
-using ::rtl::OString;
-using ::rtl::OStringBuffer;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::io::XInputStream;
-
namespace oox {
namespace vml {
// ============================================================================
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
+
+// ============================================================================
+
namespace {
inline const sal_Char* lclFindCharacter( const sal_Char* pcBeg, const sal_Char* pcEnd, sal_Char cChar )
@@ -148,6 +151,48 @@ void lclProcessAttribs( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sal
lclAppendToBuffer( rBuffer, pcBeg, pcEnd );
}
+void lclProcessContents( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sal_Char* pcEnd )
+{
+ /* MSO has a very weird way to store and handle whitespaces. The stream
+ may contain lots of spaces, tabs, and newlines which have to be handled
+ as single space character. This will be done in this function.
+
+ If the element text contains a literal line break, it will be stored as
+ <br> tag (without matching closing </br> element).
+
+ A single space character following another character is stored
+ literally and must not be stipped away here. Example: The element
+ <font>abc </font>
+ contains the three letters a, b, and c, followed by a space character.
+
+ Consecutive space characters, or a leading single space character, are
+ stored in a <span> element. If there are N space characters (N > 1),
+ then the <span> element contains exactly (N-1) NBSP characters
+ (non-breaking space), followed by a regular space character. Example:
+ The element
+ <font><span style='mso-spacerun:yes'>\xA0\xA0\xA0 </span></font>
+ represents 4 consecutive space characters. Has to be handled by the
+ implementation.
+
+ A single space character for its own is stored in an empty element.
+ Example: The element
+ <font></font>
+ represents a single space character. Has to be handled by the
+ implementation.
+ */
+
+ // skip leading whitespace
+ const sal_Char* pcContentsBeg = lclFindNonWhiteSpace( pcBeg, pcEnd );
+ while( pcContentsBeg < pcEnd )
+ {
+ const sal_Char* pcWhitespaceBeg = lclFindWhiteSpace( pcContentsBeg + 1, pcEnd );
+ lclAppendToBuffer( rBuffer, pcContentsBeg, pcWhitespaceBeg );
+ if( pcWhitespaceBeg < pcEnd )
+ rBuffer.append( ' ' );
+ pcContentsBeg = lclFindNonWhiteSpace( pcWhitespaceBeg, pcEnd );
+ }
+}
+
} // namespace
// ============================================================================
@@ -176,8 +221,9 @@ StreamDataContainer::StreamDataContainer( const Reference< XInputStream >& rxInS
{
// look for the next opening angle bracket
const sal_Char* pcOpen = lclFindCharacter( pcCurr, pcEnd, '<' );
+
// copy all characters from current position to opening bracket
- lclAppendToBuffer( aBuffer, pcCurr, pcOpen );
+ lclProcessContents( aBuffer, pcCurr, pcOpen );
// nothing to do if no opening bracket has been found
if( pcOpen < pcEnd )
@@ -214,10 +260,10 @@ StreamDataContainer::StreamDataContainer( const Reference< XInputStream >& rxInS
// do nothing
}
- // replace '<br>' elements with '<br/>' elements
+ // replace '<br>' element with newline
else if( (nElementLen >= 4) && (pcOpen[ 1 ] == 'b') && (pcOpen[ 2 ] == 'r') && (lclFindNonWhiteSpace( pcOpen + 3, pcClose ) == pcClose) )
{
- aBuffer.append( RTL_CONSTASCII_STRINGPARAM( "<br/>" ) );
+ aBuffer.append( '\n' );
}
// check start elements and empty elements for repeated attributes
@@ -277,4 +323,3 @@ InputStream::~InputStream()
} // namespace vml
} // namespave oox
-
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d557a7f50354..db12f3d91e0b 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -26,52 +26,50 @@
************************************************************************/
#include "oox/vml/vmlshape.hxx"
-#include <rtl/math.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
-#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
-#include "properties.hxx"
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/graphichelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/xmlfilterbase.hxx"
#include "oox/ole/axcontrol.hxx"
#include "oox/ole/axcontrolfragment.hxx"
#include "oox/ole/oleobjecthelper.hxx"
#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-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::lang::XMultiServiceFactory;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::awt::XControlModel;
-using ::com::sun::star::graphic::XGraphic;
-using ::com::sun::star::drawing::PointSequenceSequence;
-using ::com::sun::star::drawing::XControlShape;
-using ::com::sun::star::drawing::XEnhancedCustomShapeDefaulter;
-using ::com::sun::star::drawing::XShape;
-using ::com::sun::star::drawing::XShapes;
-using ::oox::core::XmlFilterBase;
+#include "oox/vml/vmltextbox.hxx"
namespace oox {
namespace vml {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::graphic;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::XmlFilterBase;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
+const sal_Int32 VML_SHAPETYPE_PICTUREFRAME = 75;
+const sal_Int32 VML_SHAPETYPE_HOSTCONTROL = 201;
+
+// ----------------------------------------------------------------------------
+
Point lclGetAbsPoint( const Point& rRelPoint, const Rectangle& rShapeRect, const Rectangle& rCoordSys )
{
double fWidthRatio = static_cast< double >( rShapeRect.Width ) / rCoordSys.Width;
@@ -94,55 +92,6 @@ Rectangle lclGetAbsRect( const Rectangle& rRelRect, const Rectangle& rShapeRect,
return aAbsRect;
}
-Reference< XShape > lclCreateXShape( const XmlFilterBase& rFilter, const OUString& rService )
-{
- OSL_ENSURE( rService.getLength() > 0, "lclCreateXShape - missing UNO shape service name" );
- Reference< XShape > xShape;
- try
- {
- Reference< XMultiServiceFactory > xFactory( rFilter.getModelFactory(), UNO_SET_THROW );
- xShape.set( xFactory->createInstance( rService ), UNO_QUERY_THROW );
- }
- catch( Exception& )
- {
- }
- OSL_ENSURE( xShape.is(), "lclCreateXShape - cannot instanciate shape object" );
- return xShape;
-}
-
-void lclInsertXShape( const Reference< XShapes >& rxShapes, const Reference< XShape >& rxShape )
-{
- OSL_ENSURE( rxShapes.is(), "lclInsertXShape - missing XShapes container" );
- OSL_ENSURE( rxShape.is(), "lclInsertXShape - missing XShape" );
- if( rxShapes.is() && rxShape.is() ) try
- {
- // insert shape into passed shape collection (maybe drawpage or group shape)
- rxShapes->add( rxShape );
- }
- catch( Exception& )
- {
- }
-}
-
-void lclSetXShapeRect( const Reference< XShape >& rxShape, const Rectangle& rShapeRect )
-{
- OSL_ENSURE( rxShape.is(), "lclSetXShapeRect - missing XShape" );
- if( rxShape.is() )
- {
- rxShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) );
- rxShape->setSize( Size( rShapeRect.Width, rShapeRect.Height ) );
- }
-}
-
-Reference< XShape > lclCreateAndInsertXShape( const XmlFilterBase& rFilter,
- const Reference< XShapes >& rxShapes, const OUString& rService, const Rectangle& rShapeRect )
-{
- Reference< XShape > xShape = lclCreateXShape( rFilter, rService );
- lclInsertXShape( rxShapes, xShape );
- lclSetXShapeRect( xShape, rShapeRect );
- return xShape;
-}
-
} // namespace
// ============================================================================
@@ -175,6 +124,11 @@ ShapeType::~ShapeType()
{
}
+sal_Int32 ShapeType::getShapeType() const
+{
+ return maTypeModel.moShapeType.get( 0 );
+}
+
OUString ShapeType::getGraphicPath() const
{
return maTypeModel.moGraphicPath.get( OUString() );
@@ -215,12 +169,30 @@ Rectangle ShapeType::getRelRectangle() const
// ============================================================================
-ShapeClientData::ShapeClientData() :
+ClientData::ClientData() :
mnObjType( XML_TOKEN_INVALID ),
+ mnTextHAlign( XML_Left ),
+ mnTextVAlign( XML_Top ),
mnCol( -1 ),
mnRow( -1 ),
+ mnChecked( VML_CLIENTDATA_UNCHECKED ),
+ mnDropStyle( XML_Combo ),
+ mnDropLines( 1 ),
+ mnVal( 0 ),
+ mnMin( 0 ),
+ mnMax( 0 ),
+ mnInc( 0 ),
+ mnPage( 0 ),
+ mnSelType( XML_Single ),
+ mnVTEdit( VML_CLIENTDATA_TEXT ),
mbPrintObject( true ),
- mbVisible( false )
+ mbVisible( false ),
+ mbDde( false ),
+ mbNo3D( false ),
+ mbNo3D2( false ),
+ mbMultiLine( false ),
+ mbVScroll( false ),
+ mbSecretEdit( false )
{
}
@@ -230,9 +202,19 @@ ShapeModel::ShapeModel()
{
}
-ShapeClientData& ShapeModel::createClientData()
+ShapeModel::~ShapeModel()
+{
+}
+
+TextBox& ShapeModel::createTextBox()
+{
+ mxTextBox.reset( new TextBox );
+ return *mxTextBox;
+}
+
+ClientData& ShapeModel::createClientData()
{
- mxClientData.reset( new ShapeClientData );
+ mxClientData.reset( new ClientData );
return *mxClientData;
}
@@ -251,6 +233,22 @@ void ShapeBase::finalizeFragmentImport()
maTypeModel.assignUsed( pShapeType->getTypeModel() );
}
+OUString ShapeBase::getShapeName() const
+{
+ if( maTypeModel.maShapeName.getLength() > 0 )
+ return maTypeModel.maShapeName;
+
+ OUString aBaseName = mrDrawing.getShapeBaseName( *this );
+ if( aBaseName.getLength() > 0 )
+ {
+ sal_Int32 nShapeIdx = mrDrawing.getLocalShapeIndex( getShapeId() );
+ if( nShapeIdx > 0 )
+ return OUStringBuffer( aBaseName ).append( sal_Unicode( ' ' ) ).append( nShapeIdx ).makeStringAndClear();
+ }
+
+ return OUString();
+}
+
const ShapeType* ShapeBase::getChildTypeById( const OUString& ) const
{
return 0;
@@ -269,15 +267,23 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
/* Calculate shape rectangle. Applications may do something special
according to some imported shape client data (e.g. Excel cell anchor). */
Rectangle aShapeRect = calcShapeRectangle( pParentAnchor );
+
// convert the shape, if the calculated rectangle is not empty
if( ((aShapeRect.Width > 0) || (aShapeRect.Height > 0)) && rxShapes.is() )
{
xShape = implConvertAndInsert( rxShapes, aShapeRect );
- /* Notify the drawing that a new shape has been inserted (but not
- for children of group shapes). For convenience, pass the
- rectangle that contains position and size of the shape. */
- if( !pParentAnchor && xShape.is() )
- mrDrawing.notifyShapeInserted( xShape, aShapeRect );
+ if( xShape.is() )
+ {
+ // set shape name (imported or generated)
+ PropertySet aShapeProp( xShape );
+ aShapeProp.setProperty( PROP_Name, getShapeName() );
+
+ /* Notify the drawing that a new shape has been inserted. For
+ convenience, pass the rectangle that contains position and
+ size of the shape. */
+ bool bGroupChild = pParentAnchor != 0;
+ mrDrawing.notifyXShapeInserted( xShape, aShapeRect, *this, bGroupChild );
+ }
}
}
return xShape;
@@ -290,10 +296,12 @@ void ShapeBase::convertFormatting( const Reference< XShape >& rxShape, const Sha
/* Calculate shape rectangle. Applications may do something special
according to some imported shape client data (e.g. Excel cell anchor). */
Rectangle aShapeRect = calcShapeRectangle( pParentAnchor );
+
// convert the shape, if the calculated rectangle is not empty
if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) )
{
- lclSetXShapeRect( rxShape, aShapeRect );
+ rxShape->setPosition( Point( aShapeRect.X, aShapeRect.Y ) );
+ rxShape->setSize( Size( aShapeRect.Width, aShapeRect.Height ) );
convertShapeProperties( rxShape );
}
}
@@ -306,7 +314,8 @@ Rectangle ShapeBase::calcShapeRectangle( const ShapeParentAnchor* pParentAnchor
/* Calculate shape rectangle. Applications may do something special
according to some imported shape client data (e.g. Excel cell anchor). */
Rectangle aShapeRect;
- if( !maShapeModel.mxClientData.get() || !mrDrawing.convertShapeClientAnchor( aShapeRect, maShapeModel.mxClientData->maAnchor ) )
+ const ClientData* pClientData = getClientData();
+ if( !pClientData || !mrDrawing.convertClientAnchor( aShapeRect, pClientData->maAnchor ) )
aShapeRect = getRectangle( pParentAnchor );
return aShapeRect;
}
@@ -334,7 +343,7 @@ SimpleShape::SimpleShape( Drawing& rDrawing, const OUString& rService ) :
Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const
{
- Reference< XShape > xShape = lclCreateAndInsertXShape( mrDrawing.getFilter(), rxShapes, maService, rShapeRect );
+ Reference< XShape > xShape = mrDrawing.createAndInsertXShape( maService, rxShapes, rShapeRect );
convertShapeProperties( xShape );
return xShape;
}
@@ -393,7 +402,7 @@ Reference< XShape > CustomShape::implConvertAndInsert( const Reference< XShapes
{
// create the custom shape geometry
Reference< XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY_THROW );
- xDefaulter->createCustomShapeDefaults( OUString::valueOf( maTypeModel.moShapeType.get( 0 ) ) );
+ xDefaulter->createCustomShapeDefaults( OUString::valueOf( getShapeType() ) );
// convert common properties
convertShapeProperties( xShape );
}
@@ -413,11 +422,14 @@ ComplexShape::ComplexShape( Drawing& rDrawing ) :
Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const
{
XmlFilterBase& rFilter = mrDrawing.getFilter();
+ sal_Int32 nShapeType = getShapeType();
OUString aGraphicPath = getGraphicPath();
// try to find registered OLE object info
if( const OleObjectInfo* pOleObjectInfo = mrDrawing.getOleObjectInfo( maTypeModel.maShapeId ) )
{
+ OSL_ENSURE( nShapeType == VML_SHAPETYPE_PICTUREFRAME, "ComplexShape::implConvertAndInsert - unexpected shape type" );
+
// if OLE object is embedded into a DrawingML shape (PPTX), do not create it here
if( pOleObjectInfo->mbDmlShape )
return Reference< XShape >();
@@ -426,7 +438,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
Size aOleSize( rShapeRect.Width, rShapeRect.Height );
if( rFilter.getOleObjectHelper().importOleObject( aOleProps, *pOleObjectInfo, aOleSize ) )
{
- Reference< XShape > xShape = lclCreateAndInsertXShape( rFilter, rxShapes, CREATE_OUSTRING( "com.sun.star.drawing.OLE2Shape" ), rShapeRect );
+ Reference< XShape > xShape = mrDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.OLE2Shape" ), rxShapes, rShapeRect );
if( xShape.is() )
{
// set the replacement graphic
@@ -447,36 +459,40 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
// try to find registered form control info
const ControlInfo* pControlInfo = mrDrawing.getControlInfo( maTypeModel.maShapeId );
- if( pControlInfo && (pControlInfo->maFragmentPath.getLength() > 0) && (maTypeModel.maName.getLength() > 0) )
+ if( pControlInfo && (pControlInfo->maFragmentPath.getLength() > 0) )
{
- OSL_ENSURE( maTypeModel.maName == pControlInfo->maName, "ComplexShape::implConvertAndInsert - control name mismatch" );
- ::oox::ole::EmbeddedControl aControl( maTypeModel.maName );
- // load the control properties from fragment
- if( rFilter.importFragment( new ::oox::ole::AxControlFragment( rFilter, pControlInfo->maFragmentPath, aControl ) ) ) try
- {
- // create control model and insert it into the form of the draw page
- Reference< XControlModel > xCtrlModel( mrDrawing.getControlForm().convertAndInsert( aControl ), UNO_SET_THROW );
- if( maShapeModel.mxClientData.get() )
- mrDrawing.convertControlClientData( xCtrlModel, *maShapeModel.mxClientData );
-
- // create the control shape, set control model at the shape
- Reference< XShape > xShape = lclCreateAndInsertXShape(
- rFilter, rxShapes, CREATE_OUSTRING( "com.sun.star.drawing.ControlShape" ), rShapeRect );
- Reference< XControlShape > xCtrlShape( xShape, UNO_QUERY ); // do not throw, but always return the shape
- if( xCtrlShape.is() )
- xCtrlShape->setControl( xCtrlModel );
- return xShape;
- }
- catch( Exception& )
+ OSL_ENSURE( nShapeType == VML_SHAPETYPE_HOSTCONTROL, "ComplexShape::implConvertAndInsert - unexpected shape type" );
+ OUString aShapeName = getShapeName();
+ if( aShapeName.getLength() > 0 )
{
+ OSL_ENSURE( aShapeName == pControlInfo->maName, "ComplexShape::implConvertAndInsert - control name mismatch" );
+ // load the control properties from fragment
+ ::oox::ole::EmbeddedControl aControl( aShapeName );
+ if( rFilter.importFragment( new ::oox::ole::AxControlFragment( rFilter, pControlInfo->maFragmentPath, aControl ) ) )
+ {
+ // create and return the control shape (including control model)
+ sal_Int32 nCtrlIndex = -1;
+ Reference< XShape > xShape = mrDrawing.createAndInsertXControlShape( aControl, rxShapes, rShapeRect, nCtrlIndex );
+ // on error, proceed and try to create picture from replacement image
+ if( xShape.is() )
+ return xShape;
+ }
}
- // on error, proceed and try to create picture from replacement image
+ }
+
+ // host application wants to create the shape (do not try failed OLE controls again)
+ if( (nShapeType == VML_SHAPETYPE_HOSTCONTROL) && !pControlInfo )
+ {
+ OSL_ENSURE( getClientData(), "ComplexShape::implConvertAndInsert - missing client data" );
+ Reference< XShape > xShape = mrDrawing.createAndInsertClientXShape( *this, rxShapes, rShapeRect );
+ if( xShape.is() )
+ return xShape;
}
// try to create a picture object
if( aGraphicPath.getLength() > 0 )
{
- Reference< XShape > xShape = lclCreateAndInsertXShape( rFilter, rxShapes, CREATE_OUSTRING( "com.sun.star.drawing.GraphicObjectShape" ), rShapeRect );
+ Reference< XShape > xShape = mrDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.GraphicObjectShape" ), rxShapes, rShapeRect );
if( xShape.is() )
{
OUString aGraphicUrl = rFilter.getGraphicHelper().importEmbeddedGraphicObject( aGraphicPath );
@@ -532,7 +548,7 @@ Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >
aParentAnchor.maCoordSys = getCoordSystem();
if( !mxChildren->empty() && (aParentAnchor.maCoordSys.Width > 0) && (aParentAnchor.maCoordSys.Height > 0) ) try
{
- xGroupShape = lclCreateAndInsertXShape( mrDrawing.getFilter(), rxShapes, CREATE_OUSTRING( "com.sun.star.drawing.GroupShape" ), rShapeRect );
+ xGroupShape = mrDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.GroupShape" ), rxShapes, rShapeRect );
Reference< XShapes > xChildShapes( xGroupShape, UNO_QUERY_THROW );
mxChildren->convertAndInsert( xChildShapes, &aParentAnchor );
// no child shape has been created - delete the group shape
@@ -552,4 +568,3 @@ Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >
} // namespace vml
} // namespace oox
-
diff --git a/oox/source/vml/vmlshapecontainer.cxx b/oox/source/vml/vmlshapecontainer.cxx
index a3bdfdb217d7..9589549be0d9 100644
--- a/oox/source/vml/vmlshapecontainer.cxx
+++ b/oox/source/vml/vmlshapecontainer.cxx
@@ -26,19 +26,23 @@
************************************************************************/
#include "oox/vml/vmlshapecontainer.hxx"
+
#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmlshape.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::drawing::XShapes;
-
namespace oox {
namespace vml {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
template< typename ShapeType >
@@ -130,4 +134,3 @@ void ShapeContainer::convertAndInsert( const Reference< XShapes >& rxShapes, con
} // namespace vml
} // namespace oox
-
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 08115d4f8d25..54e0d1ac70bc 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -26,17 +26,23 @@
************************************************************************/
#include "oox/vml/vmlshapecontext.hxx"
+
+#include "oox/vml/vmldrawing.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
+#include "oox/vml/vmltextboxcontext.hxx"
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+using namespace ::com::sun::star::awt;
-using ::rtl::OUString;
-using ::com::sun::star::awt::Point;
using ::oox::core::ContextHandler2;
using ::oox::core::ContextHandler2Helper;
using ::oox::core::ContextHandlerRef;
-
-namespace oox {
-namespace vml {
+using ::rtl::OUString;
// ============================================================================
@@ -100,39 +106,101 @@ OptValue< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, sal_
bool lclDecodeVmlxBool( const OUString& rValue, bool bDefaultForEmpty )
{
if( rValue.getLength() == 0 ) return bDefaultForEmpty;
+ sal_Int32 nToken = AttributeConversion::decodeToken( rValue );
// anything else than 't' or 'True' is considered to be false, as specified
- return ((rValue.getLength() == 1) && (rValue[ 0 ] == 't')) || (rValue == CREATE_OUSTRING( "True" ));
+ return (nToken == XML_t) || (nToken == XML_True);
}
} // namespace
// ============================================================================
-ShapeClientDataContext::ShapeClientDataContext( ContextHandler2Helper& rParent,
- const AttributeList& rAttribs, ShapeClientData& rClientData ) :
+ShapeLayoutContext::ShapeLayoutContext( ContextHandler2Helper& rParent, Drawing& rDrawing ) :
+ ContextHandler2( rParent ),
+ mrDrawing( rDrawing )
+{
+}
+
+
+ContextHandlerRef ShapeLayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( nElement )
+ {
+ case O_TOKEN( idmap ):
+ {
+ OUString aBlockIds = rAttribs.getString( XML_data, OUString() );
+ sal_Int32 nIndex = 0;
+ while( nIndex >= 0 )
+ {
+ OUString aToken = aBlockIds.getToken( 0, ' ', nIndex ).trim();
+ if( aToken.getLength() > 0 )
+ mrDrawing.registerBlockId( aToken.toInt32() );
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
+// ============================================================================
+
+ClientDataContext::ClientDataContext( ContextHandler2Helper& rParent,
+ ClientData& rClientData, const AttributeList& rAttribs ) :
ContextHandler2( rParent ),
mrClientData( rClientData )
{
mrClientData.mnObjType = rAttribs.getToken( XML_ObjectType, XML_TOKEN_INVALID );
}
-ContextHandlerRef ShapeClientDataContext::onCreateContext( sal_Int32 /*nElement*/, const AttributeList& /*rAttribs*/ )
+ContextHandlerRef ClientDataContext::onCreateContext( sal_Int32 /*nElement*/, const AttributeList& /*rAttribs*/ )
{
- return isRootElement() ? this : 0;
+ if( isRootElement() )
+ {
+ maElementText = OUString();
+ return this;
+ }
+ return 0;
+}
+
+void ClientDataContext::onCharacters( const OUString& rChars )
+{
+ /* Empty but existing elements have special meaning, e.g. 'true'. Collect
+ existing text and convert it in onEndElement(). */
+ maElementText = rChars;
}
-void ShapeClientDataContext::onEndElement( const OUString& rChars )
+void ClientDataContext::onEndElement()
{
switch( getCurrentElement() )
{
- case VMLX_TOKEN( Anchor ): mrClientData.maAnchor = rChars; break;
- case VMLX_TOKEN( FmlaPict ): mrClientData.maPictureLink = rChars; break;
- case VMLX_TOKEN( FmlaLink ): mrClientData.maLinkedCell = rChars; break;
- case VMLX_TOKEN( FmlaRange ): mrClientData.maSourceRange = rChars; break;
- case VMLX_TOKEN( Column ): mrClientData.mnCol = rChars.toInt32(); break;
- case VMLX_TOKEN( Row ): mrClientData.mnRow = rChars.toInt32(); break;
- case VMLX_TOKEN( PrintObject ): mrClientData.mbPrintObject = lclDecodeVmlxBool( rChars, true ); break;
- case VMLX_TOKEN( Visible ): mrClientData.mbVisible = true; break;
+ case VMLX_TOKEN( Anchor ): mrClientData.maAnchor = maElementText; break;
+ case VMLX_TOKEN( FmlaMacro ): mrClientData.maFmlaMacro = maElementText; break;
+ case VMLX_TOKEN( FmlaPict ): mrClientData.maFmlaPict = maElementText; break;
+ case VMLX_TOKEN( FmlaLink ): mrClientData.maFmlaLink = maElementText; break;
+ case VMLX_TOKEN( FmlaRange ): mrClientData.maFmlaRange = maElementText; break;
+ case VMLX_TOKEN( FmlaGroup ): mrClientData.maFmlaGroup = maElementText; break;
+ case VMLX_TOKEN( TextHAlign ): mrClientData.mnTextHAlign = AttributeConversion::decodeToken( maElementText ); break;
+ case VMLX_TOKEN( TextVAlign ): mrClientData.mnTextVAlign = AttributeConversion::decodeToken( maElementText ); break;
+ case VMLX_TOKEN( Column ): mrClientData.mnCol = maElementText.toInt32(); break;
+ case VMLX_TOKEN( Row ): mrClientData.mnRow = maElementText.toInt32(); break;
+ case VMLX_TOKEN( Checked ): mrClientData.mnChecked = maElementText.toInt32(); break;
+ case VMLX_TOKEN( DropStyle ): mrClientData.mnDropStyle = AttributeConversion::decodeToken( maElementText ); break;
+ case VMLX_TOKEN( DropLines ): mrClientData.mnDropLines = maElementText.toInt32(); break;
+ case VMLX_TOKEN( Val ): mrClientData.mnVal = maElementText.toInt32(); break;
+ case VMLX_TOKEN( Min ): mrClientData.mnMin = maElementText.toInt32(); break;
+ case VMLX_TOKEN( Max ): mrClientData.mnMax = maElementText.toInt32(); break;
+ case VMLX_TOKEN( Inc ): mrClientData.mnInc = maElementText.toInt32(); break;
+ case VMLX_TOKEN( Page ): mrClientData.mnPage = maElementText.toInt32(); break;
+ case VMLX_TOKEN( SelType ): mrClientData.mnSelType = AttributeConversion::decodeToken( maElementText ); break;
+ case VMLX_TOKEN( VTEdit ): mrClientData.mnVTEdit = maElementText.toInt32(); break;
+ case VMLX_TOKEN( PrintObject ): mrClientData.mbPrintObject = lclDecodeVmlxBool( maElementText, true ); break;
+ case VMLX_TOKEN( Visible ): mrClientData.mbVisible = lclDecodeVmlxBool( maElementText, true ); break;
+ case VMLX_TOKEN( DDE ): mrClientData.mbDde = lclDecodeVmlxBool( maElementText, true ); break;
+ case VMLX_TOKEN( NoThreeD ): mrClientData.mbNo3D = lclDecodeVmlxBool( maElementText, true ); break;
+ case VMLX_TOKEN( NoThreeD2 ): mrClientData.mbNo3D2 = lclDecodeVmlxBool( maElementText, true ); break;
+ case VMLX_TOKEN( MultiLine ): mrClientData.mbMultiLine = lclDecodeVmlxBool( maElementText, true ); break;
+ case VMLX_TOKEN( VScroll ): mrClientData.mbVScroll = lclDecodeVmlxBool( maElementText, true ); break;
+ case VMLX_TOKEN( SecretEdit ): mrClientData.mbSecretEdit = lclDecodeVmlxBool( maElementText, true ); break;
}
}
@@ -144,23 +212,26 @@ ShapeContextBase::ShapeContextBase( ContextHandler2Helper& rParent ) :
}
/*static*/ ContextHandlerRef ShapeContextBase::createShapeContext( ContextHandler2Helper& rParent,
- sal_Int32 nElement, const AttributeList& rAttribs, ShapeContainer& rShapes )
+ ShapeContainer& rShapes, sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( nElement )
{
+ case O_TOKEN( shapelayout ):
+ return new ShapeLayoutContext( rParent, rShapes.getDrawing() );
+
case VML_TOKEN( shapetype ):
- return new ShapeTypeContext( rParent, rAttribs, rShapes.createShapeType() );
+ return new ShapeTypeContext( rParent, rShapes.createShapeType(), rAttribs );
case VML_TOKEN( group ):
- return new GroupShapeContext( rParent, rAttribs, rShapes.createShape< GroupShape >() );
+ return new GroupShapeContext( rParent, rShapes.createShape< GroupShape >(), rAttribs );
case VML_TOKEN( shape ):
- return new ShapeContext( rParent, rAttribs, rShapes.createShape< ComplexShape >() );
+ return new ShapeContext( rParent, rShapes.createShape< ComplexShape >(), rAttribs );
case VML_TOKEN( rect ):
case VML_TOKEN( roundrect ):
- return new ShapeContext( rParent, rAttribs, rShapes.createShape< RectangleShape >() );
+ return new ShapeContext( rParent, rShapes.createShape< RectangleShape >(), rAttribs );
case VML_TOKEN( oval ):
- return new ShapeContext( rParent, rAttribs, rShapes.createShape< EllipseShape >() );
+ return new ShapeContext( rParent, rShapes.createShape< EllipseShape >(), rAttribs );
case VML_TOKEN( polyline ):
- return new ShapeContext( rParent, rAttribs, rShapes.createShape< PolyLineShape >() );
+ return new ShapeContext( rParent, rShapes.createShape< PolyLineShape >(), rAttribs );
// TODO:
case VML_TOKEN( arc ):
@@ -168,14 +239,14 @@ ShapeContextBase::ShapeContextBase( ContextHandler2Helper& rParent ) :
case VML_TOKEN( line ):
case VML_TOKEN( diagram ):
case VML_TOKEN( image ):
- return new ShapeContext( rParent, rAttribs, rShapes.createShape< ComplexShape >() );
+ return new ShapeContext( rParent, rShapes.createShape< ComplexShape >(), rAttribs );
}
return 0;
}
// ============================================================================
-ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, ShapeType& rShapeType ) :
+ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& rShapeType, const AttributeList& rAttribs ) :
ShapeContextBase( rParent ),
mrTypeModel( rShapeType.getTypeModel() )
{
@@ -185,7 +256,7 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, const Attrib
OSL_ENSURE( mrTypeModel.maShapeId.getLength() > 0, "ShapeTypeContext::ShapeTypeContext - missing shape identifier" );
// if the o:spid attribute exists, the id attribute contains the user-defined shape name
if( bHasOspid )
- mrTypeModel.maName = rAttribs.getXString( XML_id, OUString() );
+ mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() );
// builtin shape type identifier
mrTypeModel.moShapeType = rAttribs.getInteger( O_TOKEN( spt ) );
@@ -276,8 +347,8 @@ void ShapeTypeContext::setStyle( const OUString& rStyle )
// ============================================================================
-ShapeContext::ShapeContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, ShapeBase& rShape ) :
- ShapeTypeContext( rParent, rAttribs, rShape ),
+ShapeContext::ShapeContext( ContextHandler2Helper& rParent, ShapeBase& rShape, const AttributeList& rAttribs ) :
+ ShapeTypeContext( rParent, rShape, rAttribs ),
mrShapeModel( rShape.getShapeModel() )
{
// collect shape specific attributes
@@ -289,8 +360,13 @@ ShapeContext::ShapeContext( ContextHandler2Helper& rParent, const AttributeList&
ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
// Excel specific shape client data
- if( isRootElement() && (nElement == VMLX_TOKEN( ClientData )) )
- return new ShapeClientDataContext( *this, rAttribs, mrShapeModel.createClientData() );
+ if( isRootElement() ) switch( nElement )
+ {
+ case VML_TOKEN( textbox ):
+ return new TextBoxContext( *this, mrShapeModel.createTextBox(), rAttribs );
+ case VMLX_TOKEN( ClientData ):
+ return new ClientDataContext( *this, mrShapeModel.createClientData(), rAttribs );
+ }
// handle remaining stuff in base class
return ShapeTypeContext::onCreateContext( nElement, rAttribs );
}
@@ -309,8 +385,8 @@ void ShapeContext::setPoints( const OUString& rPoints )
// ============================================================================
-GroupShapeContext::GroupShapeContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, GroupShape& rShape ) :
- ShapeContext( rParent, rAttribs, rShape ),
+GroupShapeContext::GroupShapeContext( ContextHandler2Helper& rParent, GroupShape& rShape, const AttributeList& rAttribs ) :
+ ShapeContext( rParent, rShape, rAttribs ),
mrShapes( rShape.getChildren() )
{
}
@@ -318,7 +394,7 @@ GroupShapeContext::GroupShapeContext( ContextHandler2Helper& rParent, const Attr
ContextHandlerRef GroupShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
// try to create a context of an embedded shape
- ContextHandlerRef xContext = createShapeContext( *this, nElement, rAttribs, mrShapes );
+ ContextHandlerRef xContext = createShapeContext( *this, mrShapes, nElement, rAttribs );
// handle remaining stuff of this shape in base class
return xContext.get() ? xContext : ShapeContext::onCreateContext( nElement, rAttribs );
}
diff --git a/oox/source/helper/recordinputstream.cxx b/oox/source/vml/vmltextbox.cxx
index 617e7f95876e..f56eb387d5b2 100644..100755
--- a/oox/source/helper/recordinputstream.cxx
+++ b/oox/source/vml/vmltextbox.cxx
@@ -25,47 +25,57 @@
*
************************************************************************/
-#include "oox/helper/recordinputstream.hxx"
-#include <vector>
-#include <string.h>
+#include "oox/vml/vmltextbox.hxx"
-using ::rtl::OUString;
+#include <rtl/ustrbuf.hxx>
namespace oox {
+namespace vml {
+
+// ============================================================================
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
// ============================================================================
-RecordInputStream::RecordInputStream( const StreamDataSequence& rData ) :
- SequenceInputStream( rData )
+TextFontModel::TextFontModel()
{
}
-OUString RecordInputStream::readString( bool b32BitLen )
+// ============================================================================
+
+TextPortionModel::TextPortionModel( const TextFontModel& rFont, const OUString& rText ) :
+ maFont( rFont ),
+ maText( rText )
{
- OUString aString;
- if( !isEof() )
- {
- sal_Int32 nCharCount = b32BitLen ? readValue< sal_Int32 >() : readValue< sal_Int16 >();
- // string length -1 is often used to indicate a missing string
- OSL_ENSURE( !isEof() && (nCharCount >= -1), "RecordInputStream::readString - invalid string length" );
- if( !isEof() && (nCharCount > 0) )
- {
- ::std::vector< sal_Unicode > aBuffer;
- aBuffer.reserve( getLimitedValue< size_t, sal_Int32 >( nCharCount + 1, 0, 0xFFFF ) );
- for( sal_Int32 nCharIdx = 0; !isEof() && (nCharIdx < nCharCount); ++nCharIdx )
- {
- sal_uInt16 nChar;
- readValue( nChar );
- aBuffer.push_back( static_cast< sal_Unicode >( nChar ) );
- }
- aBuffer.push_back( 0 );
- aString = OUString( &aBuffer.front() );
- }
- }
- return aString;
}
// ============================================================================
-} // namespace oox
+TextBox::TextBox()
+{
+}
+
+void TextBox::appendPortion( const TextFontModel& rFont, const OUString& rText )
+{
+ maPortions.push_back( TextPortionModel( rFont, rText ) );
+}
+
+const TextFontModel* TextBox::getFirstFont() const
+{
+ return maPortions.empty() ? 0 : &maPortions.front().maFont;
+}
+OUString TextBox::getText() const
+{
+ OUStringBuffer aBuffer;
+ for( PortionVector::const_iterator aIt = maPortions.begin(), aEnd = maPortions.end(); aIt != aEnd; ++aIt )
+ aBuffer.append( aIt->maText );
+ return aBuffer.makeStringAndClear();
+}
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx
new file mode 100755
index 000000000000..4b57656b4f78
--- /dev/null
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/vml/vmltextboxcontext.hxx"
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+using ::oox::core::ContextHandler2;
+using ::oox::core::ContextHandler2Helper;
+using ::oox::core::ContextHandlerRef;
+using ::rtl::OUString;
+
+// ============================================================================
+
+TextPortionContext::TextPortionContext( ContextHandler2Helper& rParent,
+ TextBox& rTextBox, const TextFontModel& rParentFont,
+ sal_Int32 nElement, const AttributeList& rAttribs ) :
+ ContextHandler2( rParent ),
+ mrTextBox( rTextBox ),
+ maFont( rParentFont ),
+ mnInitialPortions( rTextBox.getPortionCount() )
+{
+ switch( nElement )
+ {
+ case XML_font:
+ maFont.moName = rAttribs.getXString( XML_face );
+ maFont.moColor = rAttribs.getXString( XML_color );
+ maFont.monSize = rAttribs.getInteger( XML_size );
+ break;
+ case XML_u:
+ OSL_ENSURE( !maFont.monUnderline, "TextPortionContext::TextPortionContext - nested <u> elements" );
+ maFont.monUnderline = (rAttribs.getToken( XML_class, XML_TOKEN_INVALID ) == XML_font4) ? XML_double : XML_single;
+ break;
+ case XML_sub:
+ case XML_sup:
+ OSL_ENSURE( !maFont.monEscapement, "TextPortionContext::TextPortionContext - nested <sub> or <sup> elements" );
+ maFont.monEscapement = nElement;
+ break;
+ case XML_b:
+ OSL_ENSURE( !maFont.mobBold, "TextPortionContext::TextPortionContext - nested <b> elements" );
+ maFont.mobBold = true;
+ break;
+ case XML_i:
+ OSL_ENSURE( !maFont.mobItalic, "TextPortionContext::TextPortionContext - nested <i> elements" );
+ maFont.mobItalic = true;
+ break;
+ case XML_s:
+ OSL_ENSURE( !maFont.mobStrikeout, "TextPortionContext::TextPortionContext - nested <s> elements" );
+ maFont.mobStrikeout = true;
+ break;
+ default:
+ OSL_ENSURE( false, "TextPortionContext::TextPortionContext - unknown element" );
+ }
+}
+
+ContextHandlerRef TextPortionContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ OSL_ENSURE( nElement != XML_font, "TextPortionContext::onCreateContext - nested <font> elements" );
+ return new TextPortionContext( *this, mrTextBox, maFont, nElement, rAttribs );
+}
+
+void TextPortionContext::onCharacters( const OUString& rChars )
+{
+ switch( getCurrentElement() )
+ {
+ case XML_span:
+ // replace all NBSP characters with SP
+ mrTextBox.appendPortion( maFont, rChars.replace( 160, ' ' ) );
+ break;
+ default:
+ mrTextBox.appendPortion( maFont, rChars );
+ }
+}
+
+void TextPortionContext::onEndElement()
+{
+ /* An empty child element without own child elements represents a single
+ space character, for example:
+
+ <font>
+ <i>abc</i>
+ <font></font>
+ <b>def</b>
+ </font>
+
+ represents the italic text 'abc', an unformatted space character, and
+ the bold text 'def'.
+ */
+ if( (mnInitialPortions > 0) && (mrTextBox.getPortionCount() == mnInitialPortions) )
+ mrTextBox.appendPortion( maFont, OUString( sal_Unicode( ' ' ) ) );
+}
+
+// ============================================================================
+
+TextBoxContext::TextBoxContext( ContextHandler2Helper& rParent, TextBox& rTextBox, const AttributeList& /*rAttribs*/ ) :
+ ContextHandler2( rParent ),
+ mrTextBox( rTextBox )
+{
+}
+
+ContextHandlerRef TextBoxContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case VML_TOKEN( textbox ):
+ if( nElement == XML_div ) return this;
+ break;
+ case XML_div:
+ if( nElement == XML_font ) return new TextPortionContext( *this, mrTextBox, TextFontModel(), nElement, rAttribs );
+ break;
+ }
+ return 0;
+}
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
diff --git a/oox/source/xls/addressconverter.cxx b/oox/source/xls/addressconverter.cxx
index 5a379000fe9e..6d53be0c155b 100644
--- a/oox/source/xls/addressconverter.cxx
+++ b/oox/source/xls/addressconverter.cxx
@@ -26,37 +26,37 @@
************************************************************************/
#include "oox/xls/addressconverter.hxx"
-#include <osl/diagnose.h>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/strbuf.hxx>
+
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include "oox/helper/recordinputstream.hxx"
+#include <osl/diagnose.h>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/biffoutputstream.hxx"
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OStringBuffer;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::rtl::OStringBuffer;
using ::rtl::OUStringToOString;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::sheet::XCellRangeAddressable;
-
-namespace oox {
-namespace xls {
// ============================================================================
namespace {
-//! TODO: this limit may be changed
+//! TODO: this limit may change, is there a way to obtain it via API?
const sal_Int16 API_MAXTAB = 255;
const sal_Int32 OOX_MAXCOL = static_cast< sal_Int32 >( (1 << 14) - 1 );
@@ -122,7 +122,7 @@ CellAddress ApiCellRangeList::getBaseAddress() const
// ============================================================================
-void BinAddress::read( RecordInputStream& rStrm )
+void BinAddress::read( SequenceInputStream& rStrm )
{
rStrm >> mnRow >> mnCol;
}
@@ -153,7 +153,7 @@ bool BinRange::contains( const BinAddress& rAddr ) const
(maFirst.mnRow <= rAddr.mnRow) && (rAddr.mnRow <= maLast.mnRow);
}
-void BinRange::read( RecordInputStream& rStrm )
+void BinRange::read( SequenceInputStream& rStrm )
{
rStrm >> maFirst.mnRow >> maLast.mnRow >> maFirst.mnCol >> maLast.mnCol;
}
@@ -198,7 +198,7 @@ BinRange BinRangeList::getEnclosingRange() const
return aRange;
}
-void BinRangeList::read( RecordInputStream& rStrm )
+void BinRangeList::read( SequenceInputStream& rStrm )
{
sal_Int32 nCount = rStrm.readInt32();
resize( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / 16 ) );
@@ -242,7 +242,7 @@ AddressConverter::AddressConverter( const WorkbookHelper& rHelper ) :
maDConChars.set( 0xFFFF, '\x01', 0xFFFF, '\x02', 0xFFFF );
switch( getFilterType() )
{
- case FILTER_OOX:
+ case FILTER_OOXML:
initializeMaxPos( OOX_MAXTAB, OOX_MAXCOL, OOX_MAXROW );
break;
case FILTER_BIFF: switch( getBiff() )
@@ -781,4 +781,3 @@ void AddressConverter::initializeMaxPos(
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/autofilterbuffer.cxx b/oox/source/xls/autofilterbuffer.cxx
new file mode 100755
index 000000000000..7cf359f6d3c9
--- /dev/null
+++ b/oox/source/xls/autofilterbuffer.cxx
@@ -0,0 +1,853 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "oox/xls/autofilterbuffer.hxx"
+
+#include <com/sun/star/sheet/FilterConnection.hpp>
+#include <com/sun/star/sheet/FilterOperator2.hpp>
+#include <com/sun/star/sheet/TableFilterField2.hpp>
+#include <com/sun/star/sheet/XDatabaseRange.hpp>
+#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
+#include <com/sun/star/table/TableOrientation.hpp>
+#include <rtl/ustrbuf.hxx>
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/xls/addressconverter.hxx"
+#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/defnamesbuffer.hxx"
+
+namespace oox {
+namespace xls {
+
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt8 BIFF12_TOP10FILTER_TOP = 0x01;
+const sal_uInt8 BIFF12_TOP10FILTER_PERCENT = 0x02;
+
+const sal_uInt16 BIFF12_FILTERCOLUMN_HIDDENBUTTON = 0x0001;
+const sal_uInt16 BIFF12_FILTERCOLUMN_SHOWBUTTON = 0x0002;
+
+const sal_uInt16 BIFF_FILTERCOLUMN_OR = 0x0001;
+const sal_uInt16 BIFF_FILTERCOLUMN_TOP10FILTER = 0x0010;
+const sal_uInt16 BIFF_FILTERCOLUMN_TOP = 0x0020;
+const sal_uInt16 BIFF_FILTERCOLUMN_PERCENT = 0x0040;
+
+const sal_uInt8 BIFF_FILTER_DATATYPE_NONE = 0;
+const sal_uInt8 BIFF_FILTER_DATATYPE_RK = 2;
+const sal_uInt8 BIFF_FILTER_DATATYPE_DOUBLE = 4;
+const sal_uInt8 BIFF_FILTER_DATATYPE_STRING = 6;
+const sal_uInt8 BIFF_FILTER_DATATYPE_BOOLEAN = 8;
+const sal_uInt8 BIFF_FILTER_DATATYPE_EMPTY = 12;
+const sal_uInt8 BIFF_FILTER_DATATYPE_NOTEMPTY = 14;
+
+// ----------------------------------------------------------------------------
+
+bool lclGetApiOperatorFromToken( sal_Int32& rnApiOperator, sal_Int32 nToken )
+{
+ switch( nToken )
+ {
+ case XML_lessThan: rnApiOperator = FilterOperator2::NOT_EQUAL; return true;
+ case XML_equal: rnApiOperator = FilterOperator2::EQUAL; return true;
+ case XML_lessThanOrEqual: rnApiOperator = FilterOperator2::LESS_EQUAL; return true;
+ case XML_greaterThan: rnApiOperator = FilterOperator2::GREATER; return true;
+ case XML_notEqual: rnApiOperator = FilterOperator2::NOT_EQUAL; return true;
+ case XML_greaterThanOrEqual: rnApiOperator = FilterOperator2::GREATER_EQUAL; return true;
+ }
+ return false;
+}
+
+/** Removes leading asterisk characters from the passed string.
+ @return True = at least one asterisk character has been removed. */
+bool lclTrimLeadingAsterisks( OUString& rValue )
+{
+ sal_Int32 nLength = rValue.getLength();
+ sal_Int32 nPos = 0;
+ while( (nPos < nLength) && (rValue[ nPos ] == '*') )
+ ++nPos;
+ if( nPos > 0 )
+ {
+ rValue = rValue.copy( nPos );
+ return true;
+ }
+ return false;
+}
+
+/** Removes trailing asterisk characters from the passed string.
+ @return True = at least one asterisk character has been removed. */
+bool lclTrimTrailingAsterisks( OUString& rValue )
+{
+ sal_Int32 nLength = rValue.getLength();
+ sal_Int32 nPos = nLength;
+ while( (nPos > 0) && (rValue[ nPos - 1 ] == '*') )
+ --nPos;
+ if( nPos < nLength )
+ {
+ rValue = rValue.copy( 0, nPos );
+ return true;
+ }
+ return false;
+}
+
+/** Converts wildcard characters '*' and '?' to regular expressions and quotes
+ RE meta characters.
+ @return True = passed string has been changed (RE needs to be enabled). */
+bool lclConvertWildcardsToRegExp( OUString& rValue )
+{
+ // check existence of the wildcard characters '*' and '?'
+ if( (rValue.getLength() > 0) && ((rValue.indexOf( '*' ) >= 0) || (rValue.indexOf( '?' ) >= 0)) )
+ {
+ OUStringBuffer aBuffer;
+ aBuffer.ensureCapacity( rValue.getLength() + 5 );
+ const sal_Unicode* pcChar = rValue.getStr();
+ const sal_Unicode* pcEnd = pcChar + rValue.getLength();
+ for( ; pcChar < pcEnd; ++pcChar )
+ {
+ switch( *pcChar )
+ {
+ case '?':
+ aBuffer.append( sal_Unicode( '.' ) );
+ break;
+ case '*':
+ aBuffer.append( sal_Unicode( '.' ) ).append( sal_Unicode( '*' ) );
+ break;
+ case '\\': case '.': case '|': case '(': case ')': case '^': case '$':
+ // quote RE meta characters
+ aBuffer.append( sal_Unicode( '\\' ) ).append( *pcChar );
+ break;
+ default:
+ aBuffer.append( *pcChar );
+ }
+ }
+ rValue = aBuffer.makeStringAndClear();
+ return true;
+ }
+ return false;
+}
+
+} // namespace
+
+// ============================================================================
+
+ApiFilterSettings::ApiFilterSettings()
+{
+}
+
+void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, double fValue )
+{
+ maFilterFields.resize( maFilterFields.size() + 1 );
+ TableFilterField2& rFilterField = maFilterFields.back();
+ rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR;
+ rFilterField.Operator = nOperator;
+ rFilterField.IsNumeric = sal_True;
+ rFilterField.NumericValue = fValue;
+}
+
+void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, const OUString& rValue )
+{
+ maFilterFields.resize( maFilterFields.size() + 1 );
+ TableFilterField2& rFilterField = maFilterFields.back();
+ rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR;
+ rFilterField.Operator = nOperator;
+ rFilterField.IsNumeric = sal_False;
+ rFilterField.StringValue = rValue;
+}
+
+// ============================================================================
+
+FilterSettingsBase::FilterSettingsBase( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper )
+{
+}
+
+void FilterSettingsBase::importAttribs( sal_Int32 /*nElement*/, const AttributeList& /*rAttribs*/ )
+{
+}
+
+void FilterSettingsBase::importRecord( sal_Int32 /*nRecId*/, SequenceInputStream& /*rStrm*/ )
+{
+}
+
+void FilterSettingsBase::importBiffRecord( BiffInputStream& /*rStrm*/, sal_uInt16 /*nFlags*/ )
+{
+}
+
+ApiFilterSettings FilterSettingsBase::finalizeImport( sal_Int32 /*nMaxCount*/ )
+{
+ return ApiFilterSettings();
+}
+
+// ============================================================================
+
+DiscreteFilter::DiscreteFilter( const WorkbookHelper& rHelper ) :
+ FilterSettingsBase( rHelper ),
+ mnCalendarType( XML_none ),
+ mbShowBlank( false )
+{
+}
+
+void DiscreteFilter::importAttribs( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( nElement )
+ {
+ case XLS_TOKEN( filters ):
+ mnCalendarType = rAttribs.getToken( XML_calendarType, XML_none );
+ mbShowBlank = rAttribs.getBool( XML_blank, false );
+ break;
+
+ case XLS_TOKEN( filter ):
+ {
+ OUString aValue = rAttribs.getXString( XML_val, OUString() );
+ if( aValue.getLength() > 0 )
+ maValues.push_back( aValue );
+ }
+ break;
+ }
+}
+
+void DiscreteFilter::importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm )
+{
+ switch( nRecId )
+ {
+ case BIFF12_ID_DISCRETEFILTERS:
+ {
+ sal_Int32 nShowBlank, nCalendarType;
+ rStrm >> nShowBlank >> nCalendarType;
+
+ static const sal_Int32 spnCalendarTypes[] = {
+ XML_none, XML_gregorian, XML_gregorianUs, XML_japan, XML_taiwan, XML_korea, XML_hijri, XML_thai, XML_hebrew,
+ XML_gregorianMeFrench, XML_gregorianArabic, XML_gregorianXlitEnglish, XML_gregorianXlitFrench };
+ mnCalendarType = STATIC_ARRAY_SELECT( spnCalendarTypes, nCalendarType, XML_none );
+ mbShowBlank = nShowBlank != 0;
+ }
+ break;
+
+ case BIFF12_ID_DISCRETEFILTER:
+ {
+ OUString aValue = BiffHelper::readString( rStrm );
+ if( aValue.getLength() > 0 )
+ maValues.push_back( aValue );
+ }
+ break;
+ }
+}
+
+ApiFilterSettings DiscreteFilter::finalizeImport( sal_Int32 nMaxCount )
+{
+ ApiFilterSettings aSettings;
+ if( static_cast< sal_Int32 >( maValues.size() ) <= nMaxCount )
+ {
+ aSettings.maFilterFields.reserve( maValues.size() );
+
+ // insert all filter values
+ for( FilterValueVector::iterator aIt = maValues.begin(), aEnd = maValues.end(); aIt != aEnd; ++aIt )
+ aSettings.appendField( false, FilterOperator2::EQUAL, *aIt );
+
+ // extra field for 'show empty'
+ if( mbShowBlank )
+ aSettings.appendField( false, FilterOperator2::EMPTY, OUString() );
+
+ /* Require disabled regular expressions, filter entries may contain
+ any RE meta characters. */
+ if( !maValues.empty() )
+ aSettings.mobNeedsRegExp = false;
+ }
+ return aSettings;
+}
+
+// ============================================================================
+
+Top10Filter::Top10Filter( const WorkbookHelper& rHelper ) :
+ FilterSettingsBase( rHelper ),
+ mfValue( 0.0 ),
+ mbTop( true ),
+ mbPercent( false )
+{
+}
+
+void Top10Filter::importAttribs( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ if( nElement == XLS_TOKEN( top10 ) )
+ {
+ mfValue = rAttribs.getDouble( XML_val, 0.0 );
+ mbTop = rAttribs.getBool( XML_top, true );
+ mbPercent = rAttribs.getBool( XML_percent, false );
+ }
+}
+
+void Top10Filter::importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm )
+{
+ if( nRecId == BIFF12_ID_TOP10FILTER )
+ {
+ sal_uInt8 nFlags;
+ rStrm >> nFlags >> mfValue;
+ mbTop = getFlag( nFlags, BIFF12_TOP10FILTER_TOP );
+ mbPercent = getFlag( nFlags, BIFF12_TOP10FILTER_PERCENT );
+ }
+}
+
+void Top10Filter::importBiffRecord( BiffInputStream& /*rStrm*/, sal_uInt16 nFlags )
+{
+ mfValue = extractValue< sal_uInt16 >( nFlags, 7, 9 );
+ mbTop = getFlag( nFlags, BIFF_FILTERCOLUMN_TOP );
+ mbPercent = getFlag( nFlags, BIFF_FILTERCOLUMN_PERCENT );
+}
+
+ApiFilterSettings Top10Filter::finalizeImport( sal_Int32 /*nMaxCount*/ )
+{
+ sal_Int32 nOperator = mbTop ?
+ (mbPercent ? FilterOperator2::TOP_PERCENT : FilterOperator2::TOP_VALUES) :
+ (mbPercent ? FilterOperator2::BOTTOM_PERCENT : FilterOperator2::BOTTOM_VALUES);
+ ApiFilterSettings aSettings;
+ aSettings.appendField( true, nOperator, mfValue );
+ return aSettings;
+}
+
+// ============================================================================
+
+FilterCriterionModel::FilterCriterionModel() :
+ mnOperator( XML_equal ),
+ mnDataType( BIFF_FILTER_DATATYPE_NONE ),
+ mnStrLen( 0 )
+{
+}
+
+void FilterCriterionModel::setBiffOperator( sal_uInt8 nOperator )
+{
+ static const sal_Int32 spnOperators[] = { XML_TOKEN_INVALID,
+ XML_lessThan, XML_equal, XML_lessThanOrEqual, XML_greaterThan, XML_notEqual, XML_greaterThanOrEqual };
+ mnOperator = STATIC_ARRAY_SELECT( spnOperators, nOperator, XML_TOKEN_INVALID );
+}
+
+void FilterCriterionModel::readBiffData( SequenceInputStream& rStrm )
+{
+ sal_uInt8 nOperator;
+ rStrm >> mnDataType >> nOperator;
+ setBiffOperator( nOperator );
+
+ switch( mnDataType )
+ {
+ case BIFF_FILTER_DATATYPE_DOUBLE:
+ maValue <<= rStrm.readDouble();
+ break;
+ case BIFF_FILTER_DATATYPE_STRING:
+ {
+ rStrm.skip( 8 );
+ OUString aValue = BiffHelper::readString( rStrm ).trim();
+ if( aValue.getLength() > 0 )
+ maValue <<= aValue;
+ }
+ break;
+ case BIFF_FILTER_DATATYPE_BOOLEAN:
+ maValue <<= (rStrm.readuInt8() != 0);
+ rStrm.skip( 7 );
+ break;
+ case BIFF_FILTER_DATATYPE_EMPTY:
+ rStrm.skip( 8 );
+ if( mnOperator == XML_equal )
+ maValue <<= OUString();
+ break;
+ case BIFF_FILTER_DATATYPE_NOTEMPTY:
+ rStrm.skip( 8 );
+ if( mnOperator == XML_notEqual )
+ maValue <<= OUString();
+ break;
+ default:
+ OSL_ENSURE( false, "FilterCriterionModel::readBiffData - unexpected data type" );
+ rStrm.skip( 8 );
+ }
+}
+
+void FilterCriterionModel::readBiffData( BiffInputStream& rStrm )
+{
+ sal_uInt8 nOperator;
+ rStrm >> mnDataType >> nOperator;
+ setBiffOperator( nOperator );
+
+ switch( mnDataType )
+ {
+ case BIFF_FILTER_DATATYPE_NONE:
+ rStrm.skip( 8 );
+ break;
+ case BIFF_FILTER_DATATYPE_RK:
+ maValue <<= BiffHelper::calcDoubleFromRk( rStrm.readInt32() );
+ rStrm.skip( 4 );
+ break;
+ case BIFF_FILTER_DATATYPE_DOUBLE:
+ maValue <<= rStrm.readDouble();
+ break;
+ case BIFF_FILTER_DATATYPE_STRING:
+ rStrm.skip( 4 );
+ rStrm >> mnStrLen;
+ rStrm.skip( 3 );
+ break;
+ case BIFF_FILTER_DATATYPE_BOOLEAN:
+ {
+ sal_uInt8 nValue, nType;
+ rStrm >> nValue >> nType;
+ rStrm.skip( 6 );
+ switch( nType )
+ {
+ case BIFF_BOOLERR_BOOL: maValue <<= (nValue != 0); break;
+ case BIFF_BOOLERR_ERROR: maValue <<= BiffHelper::calcDoubleFromError( nValue ); break;
+ default: OSL_ENSURE( false, "FilterCriterionModel::readBiffData - unknown type" );
+ }
+ }
+ break;
+ case BIFF_FILTER_DATATYPE_EMPTY:
+ rStrm.skip( 8 );
+ if( mnOperator == XML_equal )
+ maValue <<= OUString();
+ break;
+ case BIFF_FILTER_DATATYPE_NOTEMPTY:
+ rStrm.skip( 8 );
+ if( mnOperator == XML_notEqual )
+ maValue <<= OUString();
+ break;
+ default:
+ OSL_ENSURE( false, "FilterCriterionModel::readBiffData - unexpected data type" );
+ rStrm.skip( 8 );
+ }
+}
+
+void FilterCriterionModel::readString( BiffInputStream& rStrm, BiffType eBiff, rtl_TextEncoding eTextEnc )
+{
+ if( (mnDataType == BIFF_FILTER_DATATYPE_STRING) && (mnStrLen > 0) )
+ {
+ OUString aValue = (eBiff == BIFF8) ?
+ rStrm.readUniStringBody( mnStrLen, true ) :
+ rStrm.readCharArrayUC( mnStrLen, eTextEnc, true );
+ aValue = aValue.trim();
+ if( aValue.getLength() > 0 )
+ maValue <<= aValue;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+CustomFilter::CustomFilter( const WorkbookHelper& rHelper ) :
+ FilterSettingsBase( rHelper ),
+ mbAnd( false )
+{
+}
+
+void CustomFilter::importAttribs( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( nElement )
+ {
+ case XLS_TOKEN( customFilters ):
+ mbAnd = rAttribs.getBool( XML_and, false );
+ break;
+
+ case XLS_TOKEN( customFilter ):
+ {
+ FilterCriterionModel aCriterion;
+ aCriterion.mnOperator = rAttribs.getToken( XML_operator, XML_equal );
+ OUString aValue = rAttribs.getXString( XML_val, OUString() ).trim();
+ if( (aCriterion.mnOperator == XML_equal) || (aCriterion.mnOperator == XML_notEqual) || (aValue.getLength() > 0) )
+ aCriterion.maValue <<= aValue;
+ appendCriterion( aCriterion );
+ }
+ break;
+ }
+}
+
+void CustomFilter::importRecord( sal_Int32 nRecId, SequenceInputStream& rStrm )
+{
+ switch( nRecId )
+ {
+ case BIFF12_ID_CUSTOMFILTERS:
+ mbAnd = rStrm.readInt32() == 0;
+ break;
+
+ case BIFF12_ID_CUSTOMFILTER:
+ {
+ FilterCriterionModel aCriterion;
+ aCriterion.readBiffData( rStrm );
+ appendCriterion( aCriterion );
+ }
+ break;
+ }
+}
+
+void CustomFilter::importBiffRecord( BiffInputStream& rStrm, sal_uInt16 nFlags )
+{
+ mbAnd = !getFlag( nFlags, BIFF_FILTERCOLUMN_OR );
+
+ FilterCriterionModel aCriterion1, aCriterion2;
+ aCriterion1.readBiffData( rStrm );
+ aCriterion2.readBiffData( rStrm );
+ aCriterion1.readString( rStrm, getBiff(), getTextEncoding() );
+ aCriterion2.readString( rStrm, getBiff(), getTextEncoding() );
+ appendCriterion( aCriterion1 );
+ appendCriterion( aCriterion2 );
+}
+
+ApiFilterSettings CustomFilter::finalizeImport( sal_Int32 /*nMaxCount*/ )
+{
+ ApiFilterSettings aSettings;
+ OSL_ENSURE( maCriteria.size() <= 2, "CustomFilter::finalizeImport - too many filter criteria" );
+ for( FilterCriterionVector::iterator aIt = maCriteria.begin(), aEnd = maCriteria.end(); aIt != aEnd; ++aIt )
+ {
+ // first extract the filter operator
+ sal_Int32 nOperator = 0;
+ bool bValidOperator = lclGetApiOperatorFromToken( nOperator, aIt->mnOperator );
+ if( bValidOperator )
+ {
+ if( aIt->maValue.has< OUString >() )
+ {
+ // string argument
+ OUString aValue;
+ aIt->maValue >>= aValue;
+ // check for 'empty', 'contains', 'begins with', or 'ends with' text filters
+ bool bEqual = nOperator == FilterOperator2::EQUAL;
+ bool bNotEqual = nOperator == FilterOperator2::NOT_EQUAL;
+ if( bEqual || bNotEqual )
+ {
+ if( aValue.getLength() == 0 )
+ {
+ // empty comparison string: create empty/not empty filters
+ nOperator = bNotEqual ? FilterOperator2::NOT_EMPTY : FilterOperator2::EMPTY;
+ }
+ else
+ {
+ // compare to something: try to find begins/ends/contains
+ bool bHasLeadingAsterisk = lclTrimLeadingAsterisks( aValue );
+ bool bHasTrailingAsterisk = lclTrimTrailingAsterisks( aValue );
+ // just '***' matches everything, do not create a filter field
+ bValidOperator = aValue.getLength() > 0;
+ if( bValidOperator )
+ {
+ if( bHasLeadingAsterisk && bHasTrailingAsterisk )
+ nOperator = bNotEqual ? FilterOperator2::DOES_NOT_CONTAIN : FilterOperator2::CONTAINS;
+ else if( bHasLeadingAsterisk )
+ nOperator = bNotEqual ? FilterOperator2::DOES_NOT_END_WITH : FilterOperator2::ENDS_WITH;
+ else if( bHasTrailingAsterisk )
+ nOperator = bNotEqual ? FilterOperator2::DOES_NOT_BEGIN_WITH : FilterOperator2::BEGINS_WITH;
+ // else: no asterisks, stick to equal/not equal
+ }
+ }
+ }
+
+ if( bValidOperator )
+ {
+ // if wildcards are present, require RE mode, otherwise keep don't care state
+ if( lclConvertWildcardsToRegExp( aValue ) )
+ aSettings.mobNeedsRegExp = true;
+ // create a new UNO API filter field
+ aSettings.appendField( mbAnd, nOperator, aValue );
+ }
+ }
+ else if( aIt->maValue.has< double >() )
+ {
+ // floating-point argument
+ double fValue = 0.0;
+ aIt->maValue >>= fValue;
+ aSettings.appendField( mbAnd, nOperator, fValue );
+ }
+ }
+ }
+ return aSettings;
+}
+
+void CustomFilter::appendCriterion( const FilterCriterionModel& rCriterion )
+{
+ if( (rCriterion.mnOperator != XML_TOKEN_INVALID) && rCriterion.maValue.hasValue() )
+ maCriteria.push_back( rCriterion );
+}
+
+// ============================================================================
+
+FilterColumn::FilterColumn( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper ),
+ mnColId( -1 ),
+ mbHiddenButton( false ),
+ mbShowButton( true )
+{
+}
+
+void FilterColumn::importFilterColumn( const AttributeList& rAttribs )
+{
+ mnColId = rAttribs.getInteger( XML_colId, -1 );
+ mbHiddenButton = rAttribs.getBool( XML_hiddenButton, false );
+ mbShowButton = rAttribs.getBool( XML_showButton, true );
+}
+
+void FilterColumn::importFilterColumn( SequenceInputStream& rStrm )
+{
+ sal_uInt16 nFlags;
+ rStrm >> mnColId >> nFlags;
+ mbHiddenButton = getFlag( nFlags, BIFF12_FILTERCOLUMN_HIDDENBUTTON );
+ mbShowButton = getFlag( nFlags, BIFF12_FILTERCOLUMN_SHOWBUTTON );
+}
+
+void FilterColumn::importFilterColumn( BiffInputStream& rStrm )
+{
+ sal_uInt16 nFlags;
+ mnColId = rStrm.readuInt16();
+ rStrm >> nFlags;
+
+ // BIFF5/BIFF8 support top-10 filters and custom filters
+ if( getFlag( nFlags, BIFF_FILTERCOLUMN_TOP10FILTER ) )
+ createFilterSettings< Top10Filter >().importBiffRecord( rStrm, nFlags );
+ else
+ createFilterSettings< CustomFilter >().importBiffRecord( rStrm, nFlags );
+}
+
+ApiFilterSettings FilterColumn::finalizeImport( sal_Int32 nMaxCount )
+{
+ ApiFilterSettings aSettings;
+ if( (0 <= mnColId) && mxSettings.get() )
+ {
+ // filter settings object creates a sequence of filter fields
+ aSettings = mxSettings->finalizeImport( nMaxCount );
+ // add column index to all filter fields
+ for( ApiFilterSettings::FilterFieldVector::iterator aIt = aSettings.maFilterFields.begin(), aEnd = aSettings.maFilterFields.end(); aIt != aEnd; ++aIt )
+ aIt->Field = mnColId;
+ }
+ return aSettings;
+}
+
+// ============================================================================
+
+AutoFilter::AutoFilter( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper )
+{
+}
+
+void AutoFilter::importAutoFilter( const AttributeList& rAttribs, sal_Int16 nSheet )
+{
+ OUString aRangeStr = rAttribs.getString( XML_ref, OUString() );
+ getAddressConverter().convertToCellRangeUnchecked( maRange, aRangeStr, nSheet );
+}
+
+void AutoFilter::importAutoFilter( SequenceInputStream& rStrm, sal_Int16 nSheet )
+{
+ BinRange aBinRange;
+ rStrm >> aBinRange;
+ getAddressConverter().convertToCellRangeUnchecked( maRange, aBinRange, nSheet );
+}
+
+FilterColumn& AutoFilter::createFilterColumn()
+{
+ FilterColumnVector::value_type xFilterColumn( new FilterColumn( *this ) );
+ maFilterColumns.push_back( xFilterColumn );
+ return *xFilterColumn;
+}
+
+void AutoFilter::finalizeImport( const Reference< XSheetFilterDescriptor2 >& rxFilterDesc )
+{
+ if( rxFilterDesc.is() )
+ {
+ // set some common properties for the auto filter range
+ PropertySet aDescProps( rxFilterDesc );
+ aDescProps.setProperty( PROP_IsCaseSensitive, false );
+ aDescProps.setProperty( PROP_SkipDuplicates, false );
+ aDescProps.setProperty( PROP_Orientation, TableOrientation_ROWS );
+ aDescProps.setProperty( PROP_ContainsHeader, true );
+ aDescProps.setProperty( PROP_CopyOutputData, false );
+
+ // maximum number of UNO API filter fields
+ sal_Int32 nMaxCount = 0;
+ aDescProps.getProperty( nMaxCount, PROP_MaxFieldCount );
+ OSL_ENSURE( nMaxCount > 0, "AutoFilter::finalizeImport - invalid maximum filter field count" );
+
+ // resulting list of all UNO API filter fields
+ ::std::vector< TableFilterField2 > aFilterFields;
+
+ // track if columns require to enable or disable regular expressions
+ OptValue< bool > obNeedsRegExp;
+
+ /* Track whether the filter fields of the first filter column are
+ connected with 'or'. In this case, other filter fields cannot be
+ inserted without altering the result of the entire filter, due to
+ Calc's precedence for the 'and' connection operator. Example:
+ Excel's filter conditions 'A1 and (B1 or B2) and C1' where B1 and
+ B2 belong to filter column B, will be evaluated by Calc as
+ '(A1 and B1) or (B2 and C1)'. */
+ bool bHasOrConnection = false;
+
+ // process all filter column objects, exit when 'or' connection exists
+ for( FilterColumnVector::iterator aIt = maFilterColumns.begin(), aEnd = maFilterColumns.end(); !bHasOrConnection && (aIt != aEnd); ++aIt )
+ {
+ // the filter settings object creates a list of filter fields
+ ApiFilterSettings aSettings = (*aIt)->finalizeImport( nMaxCount );
+ ApiFilterSettings::FilterFieldVector& rColumnFields = aSettings.maFilterFields;
+
+ // new total number of filter fields
+ sal_Int32 nNewCount = static_cast< sal_Int32 >( aFilterFields.size() + rColumnFields.size() );
+
+ /* Check whether mode for regular expressions is compatible with
+ the global mode in obNeedsRegExp. If either one is still in
+ don't-care state, all is fine. If both are set, they must be
+ equal. */
+ bool bRegExpCompatible = !obNeedsRegExp || !aSettings.mobNeedsRegExp || (obNeedsRegExp.get() == aSettings.mobNeedsRegExp.get());
+
+ // check whether fields are connected by 'or' (see comments above).
+ if( rColumnFields.size() >= 2 )
+ for( ApiFilterSettings::FilterFieldVector::iterator aSIt = rColumnFields.begin() + 1, aSEnd = rColumnFields.end(); !bHasOrConnection && (aSIt != aSEnd); ++aSIt )
+ bHasOrConnection = aSIt->Connection == FilterConnection_OR;
+
+ /* Skip the column filter, if no filter fields have been created,
+ if the number of new filter fields would exceed the total limit
+ of filter fields, or if the mode for regular expressions of the
+ filter column does not fit. */
+ if( !rColumnFields.empty() && (nNewCount <= nMaxCount) && bRegExpCompatible )
+ {
+ /* Add 'and' connection to the first filter field to connect
+ it to the existing filter fields of other columns. */
+ rColumnFields[ 0 ].Connection = FilterConnection_AND;
+
+ // insert the new filter fields
+ aFilterFields.insert( aFilterFields.end(), rColumnFields.begin(), rColumnFields.end() );
+
+ // update the regular expressions mode
+ obNeedsRegExp.assignIfUsed( aSettings.mobNeedsRegExp );
+ }
+ }
+
+ // insert all filter fields to the filter descriptor
+ if( !aFilterFields.empty() )
+ rxFilterDesc->setFilterFields2( ContainerHelper::vectorToSequence( aFilterFields ) );
+
+ // regular expressions
+ bool bUseRegExp = obNeedsRegExp.get( false );
+ aDescProps.setProperty( PROP_UseRegularExpressions, bUseRegExp );
+ }
+}
+
+// ============================================================================
+
+AutoFilterBuffer::AutoFilterBuffer( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper )
+{
+}
+
+AutoFilter& AutoFilterBuffer::createAutoFilter()
+{
+ AutoFilterVector::value_type xAutoFilter( new AutoFilter( *this ) );
+ maAutoFilters.push_back( xAutoFilter );
+ return *xAutoFilter;
+}
+
+void AutoFilterBuffer::finalizeImport( sal_Int16 nSheet )
+{
+ // rely on existence of the defined name '_FilterDatabase' containing the range address of the filtered area
+ if( const DefinedName* pFilterDBName = getDefinedNames().getByBuiltinId( BIFF_DEFNAME_FILTERDATABASE, nSheet ).get() )
+ {
+ CellRangeAddress aFilterRange;
+ if( pFilterDBName->getAbsoluteRange( aFilterRange ) && (aFilterRange.Sheet == nSheet) )
+ {
+ // use the same name for the database range as used for the defined name '_FilterDatabase'
+ OUString aDBRangeName = pFilterDBName->getCalcName();
+ Reference< XDatabaseRange > xDatabaseRange = createDatabaseRangeObject( aDBRangeName, aFilterRange );
+ // first, try to create an auto filter
+ bool bHasAutoFilter = finalizeImport( xDatabaseRange );
+ // no success: try to create an advanced filter
+ if( !bHasAutoFilter && xDatabaseRange.is() )
+ {
+ // the built-in defined name 'Criteria' must exist
+ if( const DefinedName* pCriteriaName = getDefinedNames().getByBuiltinId( BIFF_DEFNAME_CRITERIA, nSheet ).get() )
+ {
+ CellRangeAddress aCriteriaRange;
+ if( pCriteriaName->getAbsoluteRange( aCriteriaRange ) )
+ {
+ // set some common properties for the filter descriptor
+ PropertySet aDescProps( xDatabaseRange->getFilterDescriptor() );
+ aDescProps.setProperty( PROP_IsCaseSensitive, false );
+ aDescProps.setProperty( PROP_SkipDuplicates, false );
+ aDescProps.setProperty( PROP_Orientation, TableOrientation_ROWS );
+ aDescProps.setProperty( PROP_ContainsHeader, true );
+ // criteria range may contain wildcards, but these are incompatible with REs
+ aDescProps.setProperty( PROP_UseRegularExpressions, false );
+
+ // position of output data (if built-in defined name 'Extract' exists)
+ DefinedNameRef xExtractName = getDefinedNames().getByBuiltinId( BIFF_DEFNAME_EXTRACT, nSheet );
+ CellRangeAddress aOutputRange;
+ bool bHasOutputRange = xExtractName.get() && xExtractName->getAbsoluteRange( aOutputRange );
+ aDescProps.setProperty( PROP_CopyOutputData, bHasOutputRange );
+ if( bHasOutputRange )
+ {
+ aDescProps.setProperty( PROP_SaveOutputPosition, true );
+ aDescProps.setProperty( PROP_OutputPosition, CellAddress( aOutputRange.Sheet, aOutputRange.StartColumn, aOutputRange.StartRow ) );
+ }
+
+ /* Properties of the database range (must be set after
+ modifying properties of the filter descriptor,
+ otherwise the 'FilterCriteriaSource' property gets
+ deleted). */
+ PropertySet aRangeProps( xDatabaseRange );
+ aRangeProps.setProperty( PROP_AutoFilter, false );
+ aRangeProps.setProperty( PROP_FilterCriteriaSource, aCriteriaRange );
+ }
+ }
+ }
+ }
+ }
+}
+
+bool AutoFilterBuffer::finalizeImport( const Reference< XDatabaseRange >& rxDatabaseRange )
+{
+ AutoFilter* pAutoFilter = getActiveAutoFilter();
+ if( pAutoFilter && rxDatabaseRange.is() ) try
+ {
+ // the property 'AutoFilter' enables the drop-down buttons
+ PropertySet aRangeProps( rxDatabaseRange );
+ aRangeProps.setProperty( PROP_AutoFilter, true );
+ // convert filter settings using the filter descriptor of the database range
+ Reference< XSheetFilterDescriptor2 > xFilterDesc( rxDatabaseRange->getFilterDescriptor(), UNO_QUERY_THROW );
+ pAutoFilter->finalizeImport( xFilterDesc );
+ // return true to indicate enabled autofilter
+ return true;
+ }
+ catch( Exception& )
+ {
+ }
+ return false;
+}
+
+AutoFilter* AutoFilterBuffer::getActiveAutoFilter()
+{
+ // Excel expects not more than one auto filter per sheet or table
+ OSL_ENSURE( maAutoFilters.size() == 1, "AutoFilterBuffer::getActiveAutoFilter - too many auto filters" );
+ // stick to the last imported auto filter
+ return maAutoFilters.empty() ? 0 : maAutoFilters.back().get();
+}
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
diff --git a/oox/source/xls/autofiltercontext.cxx b/oox/source/xls/autofiltercontext.cxx
index 4ae31fc94c56..81327944fc05 100644
--- a/oox/source/xls/autofiltercontext.cxx
+++ b/oox/source/xls/autofiltercontext.cxx
@@ -26,750 +26,158 @@
************************************************************************/
#include "oox/xls/autofiltercontext.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/sheet/XDatabaseRange.hpp>
-#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp>
-#include <com/sun/star/sheet/FilterOperator.hpp>
-#include <com/sun/star/sheet/FilterConnection.hpp>
-#include <com/sun/star/i18n/XLocaleData.hpp>
-#include "properties.hxx"
-#include "oox/helper/attributelist.hxx"
-#include "oox/helper/propertyset.hxx"
-#include "oox/core/filterbase.hxx"
-#include "oox/xls/addressconverter.hxx"
-#define DEBUG_OOX_AUTOFILTER 0
-
-#if USE_SC_MULTI_STRING_FILTER_PATCH
-#include <com/sun/star/sheet/XExtendedSheetFilterDescriptor.hpp>
-#include <com/sun/star/sheet/TableFilterFieldNormal.hpp>
-#include <com/sun/star/sheet/TableFilterFieldMultiString.hpp>
-using ::com::sun::star::sheet::TableFilterFieldNormal;
-using ::com::sun::star::sheet::TableFilterFieldMultiString;
-using ::com::sun::star::sheet::XExtendedSheetFilterDescriptor;
-#else
-#include <com/sun/star/sheet/TableFilterField.hpp>
-using ::com::sun::star::sheet::TableFilterField;
-#endif
-
-#if DEBUG_OOX_AUTOFILTER
-#include <stdio.h>
-#endif
-
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNamed;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::sheet::XDatabaseRange;
-using ::com::sun::star::sheet::XDatabaseRanges;
-using ::com::sun::star::sheet::XSheetFilterDescriptor;
-using ::com::sun::star::i18n::LocaleDataItem;
-using ::com::sun::star::i18n::XLocaleData;
-using ::com::sun::star::lang::Locale;
-using ::oox::core::ContextHandlerRef;
+#include "oox/xls/autofilterbuffer.hxx"
+#include "oox/xls/biffinputstream.hxx"
namespace oox {
namespace xls {
-// ============================================================================
-
-FilterFieldItem::FilterFieldItem() :
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- mpField(new TableFilterFieldNormal),
-#else
- mpField(new TableFilterField),
-#endif
- meType(NORMAL)
-{
-}
-
-FilterFieldItem::FilterFieldItem(Type eType) :
- meType(eType)
-{
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- switch ( eType )
- {
- case MULTI_STRING:
- mpField.reset(new TableFilterFieldMultiString);
- break;
- case NORMAL:
- mpField.reset(new TableFilterFieldNormal);
- break;
- default:
- mpField.reset(new TableFilterFieldNormal);
- }
-#else
- mpField.reset(new TableFilterField);
- meType = NORMAL;
-#endif
-}
+using ::oox::core::ContextHandlerRef;
+using ::rtl::OUString;
// ============================================================================
-OoxAutoFilterContext::OoxAutoFilterContext( OoxWorksheetFragmentBase& rFragment ) :
- OoxWorksheetContextBase( rFragment ),
- mbValidAddress( false ),
- mbUseRegex( false ),
- mbShowBlank( false ),
- mbConnectionAnd( false )
+FilterSettingsContext::FilterSettingsContext( WorksheetContextBase& rParent, FilterSettingsBase& rFilterSettings ) :
+ WorksheetContextBase( rParent ),
+ mrFilterSettings( rFilterSettings )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxAutoFilterContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef FilterSettingsContext::onCreateContext( sal_Int32 nElement, const AttributeList& /*rAttribs*/ )
{
switch( getCurrentElement() )
{
- case XLS_TOKEN( autoFilter ):
- switch( nElement )
- {
- case XLS_TOKEN( filterColumn ): return this;
- }
- break;
-
- case XLS_TOKEN( filterColumn ):
- switch( nElement )
- {
- case XLS_TOKEN( filters ):
- case XLS_TOKEN( customFilters ):
- case XLS_TOKEN( top10 ):
- case XLS_TOKEN( dynamicFilter ): return this;
- }
- break;
-
case XLS_TOKEN( filters ):
- switch( nElement )
- {
- case XLS_TOKEN( filter ): return this;
- }
+ if( nElement == XLS_TOKEN( filter ) ) return this;
break;
-
case XLS_TOKEN( customFilters ):
- switch( nElement )
- {
- case XLS_TOKEN( customFilter ): return this;
- }
+ if( nElement == XLS_TOKEN( customFilter ) ) return this;
break;
}
return 0;
}
-void OoxAutoFilterContext::onStartElement( const AttributeList& rAttribs )
+void FilterSettingsContext::onStartElement( const AttributeList& rAttribs )
{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( autoFilter ):
- importAutoFilter( rAttribs );
- break;
- case XLS_TOKEN( filterColumn ):
- if ( mbValidAddress )
- importFilterColumn( rAttribs );
- break;
- case XLS_TOKEN( filters ):
- if ( mbValidAddress )
- importFilters( rAttribs );
- break;
- case XLS_TOKEN( filter ):
- if ( mbValidAddress )
- importFilter( rAttribs );
- break;
- case XLS_TOKEN( customFilters ):
- if ( mbValidAddress )
- importCustomFilters( rAttribs );
- break;
- case XLS_TOKEN( customFilter ):
- if ( mbValidAddress )
- importCustomFilter( rAttribs );
- break;
- case XLS_TOKEN( top10 ):
- if ( mbValidAddress )
- importTop10( rAttribs );
- break;
- case XLS_TOKEN( dynamicFilter ):
- if ( mbValidAddress )
- importDynamicFilter( rAttribs );
- break;
- }
+ mrFilterSettings.importAttribs( getCurrentElement(), rAttribs );
}
-void OoxAutoFilterContext::onEndElement( const OUString& /*rChars*/ )
+ContextHandlerRef FilterSettingsContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& /*rStrm*/ )
{
switch( getCurrentElement() )
{
- case XLS_TOKEN( autoFilter ):
- maybeShowBlank();
- setAutoFilter();
+ case BIFF12_ID_DISCRETEFILTERS:
+ if( nRecId == BIFF12_ID_DISCRETEFILTER ) return this;
break;
- case XLS_TOKEN( filters ):
- setFilterNames();
+ case BIFF12_ID_CUSTOMFILTERS:
+ if( nRecId == BIFF12_ID_CUSTOMFILTER ) return this;
break;
}
+ return 0;
}
-#if DEBUG_OOX_AUTOFILTER
-static void lclPrintNormalField(
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- TableFilterFieldNormal* pField
-#else
- TableFilterField* pField
-#endif
-)
+void FilterSettingsContext::onStartRecord( SequenceInputStream& rStrm )
{
- using namespace ::com::sun::star::sheet;
-
- printf(" Operator: ");
- switch ( pField->Operator )
- {
- case FilterOperator_EQUAL:
- printf("EQUAL");
- break;
- case FilterOperator_NOT_EQUAL:
- printf("NOT_EQUAL");
- break;
- case com::sun::star::sheet::FilterOperator_GREATER:
- printf("GREATER");
- break;
- case com::sun::star::sheet::FilterOperator_GREATER_EQUAL:
- printf("GREATER_EQUAL");
- break;
- case FilterOperator_LESS:
- printf("LESS");
- break;
- case FilterOperator_LESS_EQUAL:
- printf("LESS_EQUAL");
- break;
- case FilterOperator_NOT_EMPTY:
- printf("NOT_EMPTY");
- break;
- case FilterOperator_EMPTY:
- printf("EMPTY");
- break;
- case FilterOperator_BOTTOM_PERCENT:
- printf("BOTTOM_PERCENT");
- break;
- case FilterOperator_BOTTOM_VALUES:
- printf("BOTTOM_VALUES");
- break;
- case FilterOperator_TOP_PERCENT:
- printf("TOP_PERCENT");
- break;
- case FilterOperator_TOP_VALUES:
- printf("TOP_VALUES");
- break;
- default:
- printf("other");
- }
- printf("\n");
-
- printf(" StringValue: %s\n",
- OUStringToOString(pField->StringValue, RTL_TEXTENCODING_UTF8).getStr());
-
- printf(" NumericValue: %g\n", pField->NumericValue);
-
- printf(" IsNumeric: ");
- if (pField->IsNumeric)
- printf("yes\n");
- else
- printf("no\n");
+ mrFilterSettings.importRecord( getCurrentElement(), rStrm );
}
-static void lclPrintFieldConnection( ::com::sun::star::sheet::FilterConnection eConn )
-{
- using namespace ::com::sun::star::sheet;
+// ============================================================================
- printf(" Connection: ");
- switch ( eConn )
- {
- case FilterConnection_AND:
- printf("AND");
- break;
- case FilterConnection_OR:
- printf("OR");
- break;
- case FilterConnection_MAKE_FIXED_SIZE:
- printf("MAKE_FIXED_SIZE");
- break;
- default:
- printf("other");
- }
- printf("\n");
+FilterColumnContext::FilterColumnContext( WorksheetContextBase& rParent, FilterColumn& rFilterColumn ) :
+ WorksheetContextBase( rParent ),
+ mrFilterColumn( rFilterColumn )
+{
}
-static void lclPrintFilterField( const FilterFieldItem& aItem )
+ContextHandlerRef FilterColumnContext::onCreateContext( sal_Int32 nElement, const AttributeList& /*rAttribs*/ )
{
- using namespace ::com::sun::star::sheet;
-
- printf("----------------------------------------\n");
-#if USE_SC_MULTI_STRING_FILTER_PATCH
+ if( getCurrentElement() == XLS_TOKEN( filterColumn ) ) switch( nElement )
{
- // Print common fields first.
-
- TableFilterFieldBase* pField = aItem.mpField.get();
- printf(" Field: %ld\n", pField->Field);
- lclPrintFieldConnection(pField->Connection);
- }
- switch ( aItem.meType )
- {
- case FilterFieldItem::NORMAL:
- {
- TableFilterFieldNormal* pField = static_cast<TableFilterFieldNormal*>(aItem.mpField.get());
- lclPrintNormalField(pField);
- }
- break;
- case FilterFieldItem::MULTI_STRING:
- {
- TableFilterFieldMultiString* pMultiStrField = static_cast<TableFilterFieldMultiString*>(aItem.mpField.get());
- sal_Int32 nSize = pMultiStrField->StringSet.getLength();
- printf(" StringSet:\n");
- for ( sal_Int32 i = 0; i < nSize; ++i )
- {
- printf(" * %s\n",
- OUStringToOString(pMultiStrField->StringSet[i], RTL_TEXTENCODING_UTF8).getStr());
- }
- }
- break;
+ case XLS_TOKEN( filters ):
+ return new FilterSettingsContext( *this, mrFilterColumn.createFilterSettings< DiscreteFilter >() );
+ case XLS_TOKEN( top10 ):
+ return new FilterSettingsContext( *this, mrFilterColumn.createFilterSettings< Top10Filter >() );
+ case XLS_TOKEN( customFilters ):
+ return new FilterSettingsContext( *this, mrFilterColumn.createFilterSettings< CustomFilter >() );
}
-#else
- TableFilterField* pField = aItem.mpField.get();
- printf(" Field: %ld\n", pField->Field);
- lclPrintFieldConnection(pField->Connection);
- lclPrintNormalField(pField);
-
-#endif
- fflush(stdout);
+ return 0;
}
-#endif
-void OoxAutoFilterContext::initialize()
+void FilterColumnContext::onStartElement( const AttributeList& rAttribs )
{
- maFields.clear();
- maFilterNames.clear();
- mbValidAddress = mbShowBlank = mbUseRegex = mbConnectionAnd = false;
+ mrFilterColumn.importFilterColumn( rAttribs );
}
-void OoxAutoFilterContext::setAutoFilter()
+ContextHandlerRef FilterColumnContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& /*rStrm*/ )
{
- using namespace ::com::sun::star::sheet;
-
- // Name this built-in database.
- OUStringBuffer sDataAreaNameBuf( CREATE_OUSTRING("Excel_BuiltIn__FilterDatabase_ ") );
- sDataAreaNameBuf.append( static_cast<sal_Int32>(getSheetIndex()+1) );
-
- OUString sDataAreaName = sDataAreaNameBuf.makeStringAndClear();
- Reference< XCellRange > xCellRange = getCellRange( maAutoFilterRange );
-
- // Create a new database range, add filters to it and refresh the database
- // for that to take effect.
-
- Reference< XDatabaseRanges > xDBRanges = getDatabaseRanges();
- if ( !xDBRanges.is() )
+ if( getCurrentElement() == BIFF12_ID_FILTERCOLUMN ) switch( nRecId )
{
- OSL_ENSURE( false, "OoxAutoFilterContext::setAutoFilter: DBRange empty" );
- return;
+ case BIFF12_ID_DISCRETEFILTERS:
+ return new FilterSettingsContext( *this, mrFilterColumn.createFilterSettings< DiscreteFilter >() );
+ case BIFF12_ID_TOP10FILTER:
+ return new FilterSettingsContext( *this, mrFilterColumn.createFilterSettings< Top10Filter >() );
+ case BIFF12_ID_CUSTOMFILTERS:
+ return new FilterSettingsContext( *this, mrFilterColumn.createFilterSettings< CustomFilter >() );
}
-
- Reference< XNameAccess > xNA( xDBRanges, UNO_QUERY_THROW );
- if ( !xNA->hasByName( sDataAreaName ) )
- xDBRanges->addNewByName( sDataAreaName, maAutoFilterRange );
-
- Reference< XDatabaseRange > xDB( xNA->getByName( sDataAreaName ), UNO_QUERY );
- if ( xDB.is() )
- {
- PropertySet aProp( xDB );
- aProp.setProperty( PROP_AutoFilter, true );
- }
-
- sal_Int32 nSize = maFields.size();
- sal_Int32 nMaxFieldCount = nSize;
- Reference< XSheetFilterDescriptor > xDescriptor = xDB->getFilterDescriptor();
- if ( xDescriptor.is() )
- {
- PropertySet aProp( xDescriptor );
- aProp.setProperty( PROP_ContainsHeader, true );
- aProp.setProperty( PROP_UseRegularExpressions, mbUseRegex );
- aProp.getProperty( nMaxFieldCount, PROP_MaxFieldCount );
- }
- else
- {
- OSL_ENSURE(false, "OoxAutoFilterContext::setAutoFilter: descriptor is empty");
- return;
- }
-
- // Unpack all column field items into a sequence.
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- Reference< XExtendedSheetFilterDescriptor > xExtDescriptor( xDescriptor, UNO_QUERY );
- if ( !xExtDescriptor.is() )
- {
- OSL_ENSURE(false, "OoxAutoFilterContext::setAutoFilter: extended descriptor is empty");
- return;
- }
-
- xExtDescriptor->begin();
-
- ::std::list< FilterFieldItem >::const_iterator itr = maFields.begin(), itrEnd = maFields.end();
- for (sal_Int32 i = 0; itr != itrEnd && i < nMaxFieldCount; ++itr, ++i)
- {
-#if DEBUG_OOX_AUTOFILTER
- lclPrintFilterField(*itr);
-#endif
- switch ( itr->meType )
- {
- case oox::xls::FilterFieldItem::MULTI_STRING:
- {
- // multi-string filter type
- TableFilterFieldMultiString* pField = static_cast<TableFilterFieldMultiString*>( itr->mpField.get() );
- xExtDescriptor->addFilterFieldMultiString( *pField );
- }
- break;
- case oox::xls::FilterFieldItem::NORMAL:
- default:
- // normal filter type
- TableFilterFieldNormal* pField = static_cast<TableFilterFieldNormal*>( itr->mpField.get() );
- xExtDescriptor->addFilterFieldNormal( *pField );
- }
- }
- xExtDescriptor->commit();
-
-#else
- Sequence< TableFilterField > aFields(nSize);
- ::std::list< FilterFieldItem >::const_iterator itr = maFields.begin(), itrEnd = maFields.end();
- for (sal_Int32 i = 0; itr != itrEnd && i < nMaxFieldCount; ++itr, ++i)
- {
-#if DEBUG_OOX_AUTOFILTER
- lclPrintFilterField( *itr );
-#endif
- aFields[i] = *itr->mpField;
- }
- xDescriptor->setFilterFields( aFields );
-#endif
- xDB->refresh();
+ return 0;
}
-void OoxAutoFilterContext::maybeShowBlank()
+void FilterColumnContext::onStartRecord( SequenceInputStream& rStrm )
{
- using namespace ::com::sun::star::sheet;
-
- if ( !mbShowBlank )
- return;
-
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- FilterFieldItem aItem(FilterFieldItem::NORMAL);
- TableFilterFieldNormal* pField = static_cast<TableFilterFieldNormal*>(aItem.mpField.get());
- pField->Field = mnCurColID;
- pField->Operator = FilterOperator_EMPTY;
- pField->Connection = FilterConnection_AND;
- pField->IsNumeric = false;
-#else
- FilterFieldItem aItem;
- aItem.mpField->Field = mnCurColID;
- aItem.mpField->Operator = FilterOperator_EMPTY;
- aItem.mpField->Connection = FilterConnection_AND;
- aItem.mpField->IsNumeric = false;
-#endif
- maFields.push_back(aItem);
+ mrFilterColumn.importFilterColumn( rStrm );
}
-void OoxAutoFilterContext::setFilterNames()
-{
- using namespace ::com::sun::star::sheet;
-
-
- sal_Int32 size = maFilterNames.size();
- if ( !size )
- return;
-
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- Sequence< OUString > aStrList(size);
- ::std::list< OUString >::const_iterator itr = maFilterNames.begin(), itrEnd = maFilterNames.end();
- for (sal_Int32 i = 0; itr != itrEnd; ++itr, ++i)
- aStrList[i] = *itr;
-
- FilterFieldItem aItem(FilterFieldItem::MULTI_STRING);
- TableFilterFieldMultiString* pField = static_cast<TableFilterFieldMultiString*>( aItem.mpField.get() );
- pField->Field = mnCurColID;
- pField->Connection = FilterConnection_AND;
- pField->StringSet = aStrList;
-
- maFields.push_back(aItem);
-#else
- static const OUString sSep = CREATE_OUSTRING("|");
-
- OUStringBuffer buf;
- if ( size > 1 )
- {
- buf.append( CREATE_OUSTRING("^(") );
- mbUseRegex = true;
- }
-
- ::std::list< OUString >::const_iterator itr = maFilterNames.begin(), itrEnd = maFilterNames.end();
- bool bFirst = true;
- for (; itr != itrEnd; ++itr)
- {
- if (bFirst)
- bFirst = false;
- else
- buf.append( sSep );
- buf.append( *itr );
- }
- if ( size > 1 )
- buf.append( CREATE_OUSTRING(")$") );
-
- FilterFieldItem aItem;
- aItem.mpField->Field = mnCurColID;
- aItem.mpField->StringValue = buf.makeStringAndClear();
- aItem.mpField->Operator = FilterOperator_EQUAL;
- aItem.mpField->Connection = FilterConnection_AND;
- aItem.mpField->IsNumeric = false;
- maFields.push_back(aItem);
-#endif
-}
+// ============================================================================
-void OoxAutoFilterContext::importAutoFilter( const AttributeList& rAttribs )
+AutoFilterContext::AutoFilterContext( WorksheetFragmentBase& rFragment, AutoFilter& rAutoFilter ) :
+ WorksheetContextBase( rFragment ),
+ mrAutoFilter( rAutoFilter )
{
- initialize();
-
- mbValidAddress = getAddressConverter().convertToCellRange(
- maAutoFilterRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true );
}
-void OoxAutoFilterContext::importFilterColumn( const AttributeList& rAttribs )
+ContextHandlerRef AutoFilterContext::onCreateContext( sal_Int32 nElement, const AttributeList& /*rAttribs*/ )
{
- // hiddenButton and showButton attributes are not used for now.
- mnCurColID = rAttribs.getInteger( XML_colId, -1 );
+ if( (getCurrentElement() == XLS_TOKEN( autoFilter )) && (nElement == XLS_TOKEN( filterColumn )) )
+ return new FilterColumnContext( *this, mrAutoFilter.createFilterColumn() );
+ return 0;
}
-void OoxAutoFilterContext::importTop10( const AttributeList& rAttribs )
+void AutoFilterContext::onStartElement( const AttributeList& rAttribs )
{
- using namespace ::com::sun::star::sheet;
-
- // filterVal attribute is not necessarily, since Calc also supports top 10
- // and top 10% filter type.
- FilterFieldItem aItem;
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- TableFilterFieldNormal* pField = static_cast<TableFilterFieldNormal*>(aItem.mpField.get());
-#else
- TableFilterField* pField = aItem.mpField.get();
-#endif
- pField->Field = mnCurColID;
-
- bool bPercent = rAttribs.getBool( XML_percent, false );
- bool bTop = rAttribs.getBool( XML_top, true );
- pField->NumericValue = rAttribs.getDouble( XML_val, 0.0 );
- pField->IsNumeric = true;
-
- // When top10 filter item is present, that's the only filter item for that column.
- if ( bTop )
- if ( bPercent )
- pField->Operator = FilterOperator_TOP_PERCENT;
- else
- pField->Operator = FilterOperator_TOP_VALUES;
- else
- if ( bPercent )
- pField->Operator = FilterOperator_BOTTOM_PERCENT;
- else
- pField->Operator = FilterOperator_BOTTOM_VALUES;
-
- maFields.push_back(aItem);
+ mrAutoFilter.importAutoFilter( rAttribs, getSheetIndex() );
}
-void OoxAutoFilterContext::importCustomFilters( const AttributeList& rAttribs )
+ContextHandlerRef AutoFilterContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& /*rStrm*/ )
{
- // OR is default when the 'and' attribute is absent.
- mbConnectionAnd = rAttribs.getBool( XML_and, false );
+ if( (getCurrentElement() == BIFF12_ID_AUTOFILTER) && (nRecId == BIFF12_ID_FILTERCOLUMN) )
+ return new FilterColumnContext( *this, mrAutoFilter.createFilterColumn() );
+ return 0;
}
-/** Do a best-effort guess of whether or not the given string is numerical. */
-static bool lclIsNumeric( const OUString& _str, const LocaleDataItem& aLocaleItem )
+void AutoFilterContext::onStartRecord( SequenceInputStream& rStrm )
{
- OUString str = _str.trim();
- sal_Int32 size = str.getLength();
-
- if ( !size )
- // Empty string. This can't be a number.
- return false;
-
- // Get the decimal separator for the current locale.
- const OUString& sep = aLocaleItem.decimalSeparator;
-
- bool bDecimalSep = false;
- for (sal_Int32 i = 0; i < size; ++i)
- {
- OUString c = str.copy(i, 1);
- if ( !c.compareTo(sep) )
- {
- if ( bDecimalSep )
- return false;
- else
- {
- bDecimalSep = true;
- continue;
- }
- }
- if ( (0 > c.compareToAscii("0") || 0 < c.compareToAscii("9")) )
- return false;
- }
-
- return true;
+ mrAutoFilter.importAutoFilter( rStrm, getSheetIndex() );
}
-/** Convert wildcard characters to regex equivalent. Returns true if any
- wildcard character is found. */
-static bool lclWildcard2Regex( OUString& str )
-{
- bool bWCFound = false;
- OUStringBuffer buf;
- sal_Int32 size = str.getLength();
- buf.ensureCapacity(size + 6); // pure heuristics.
-
- sal_Unicode dot = '.', star = '*', hat = '^', dollar = '$';
- buf.append(hat);
- for (sal_Int32 i = 0; i < size; ++i)
- {
- OUString c = str.copy(i, 1);
- if ( !c.compareToAscii("?") )
- {
- buf.append(dot);
- bWCFound = true;
- }
- else if ( !c.compareToAscii("*") )
- {
- buf.append(dot);
- buf.append(star);
- bWCFound = true;
- }
- else
- buf.append(c);
- }
- buf.append(dollar);
-
- if (bWCFound)
- str = buf.makeStringAndClear();
-
- return bWCFound;
-}
+// ============================================================================
-/** Translate Excel's filter operator to Calc's. */
-static ::com::sun::star::sheet::FilterOperator lclTranslateFilterOp( sal_Int32 nToken )
+BiffAutoFilterContext::BiffAutoFilterContext( const WorksheetHelper& rHelper, AutoFilter& rAutoFilter ) :
+ BiffWorksheetContextBase( rHelper ),
+ mrAutoFilter( rAutoFilter )
{
- using namespace ::com::sun::star::sheet;
-
- switch ( nToken )
- {
- case XML_equal:
- return FilterOperator_EQUAL;
- case XML_notEqual:
- return FilterOperator_NOT_EQUAL;
- case XML_greaterThan:
- return FilterOperator_GREATER;
- case XML_greaterThanOrEqual:
- return FilterOperator_GREATER_EQUAL;
- case XML_lessThan:
- return FilterOperator_LESS;
- case XML_lessThanOrEqual:
- return FilterOperator_LESS_EQUAL;
- }
- return FilterOperator_EQUAL;
}
-void OoxAutoFilterContext::importCustomFilter( const AttributeList& rAttribs )
+void BiffAutoFilterContext::importRecord( BiffInputStream& rStrm )
{
- using namespace ::com::sun::star::sheet;
-
- sal_Int32 nToken = rAttribs.getToken( XML_operator, XML_equal );
-#if USE_SC_MULTI_STRING_FILTER_PATCH
- FilterFieldItem aItem(FilterFieldItem::NORMAL);
- TableFilterFieldNormal* pField = static_cast<TableFilterFieldNormal*>(aItem.mpField.get());
-#else
- FilterFieldItem aItem;
- TableFilterField* pField = aItem.mpField.get();
-#endif
- pField->Field = mnCurColID;
- pField->StringValue = rAttribs.getString( XML_val, OUString() );
- pField->NumericValue = pField->StringValue.toDouble();
- pField->Operator = lclTranslateFilterOp( nToken );
-
- if ( nToken == XML_notEqual && !pField->StringValue.compareToAscii(" ") )
+ switch( rStrm.getRecId() )
{
- // Special case for hiding blanks. Excel translates "hide blanks" to
- // (filter if notEqual " "). So, we need to translate it back.
- pField->Operator = FilterOperator_NOT_EMPTY;
- pField->IsNumeric = false;
- maFields.push_back(aItem);
- return;
+ // nothing to read for BIFF_ID_AUTOFILTER
+ case BIFF_ID_FILTERCOLUMN: mrAutoFilter.createFilterColumn().importFilterColumn( rStrm ); break;
}
-
- switch ( nToken )
- {
- case XML_equal:
- case XML_notEqual:
- {
- Reference< XLocaleData > xLocale( getGlobalFactory()->createInstance(
- CREATE_OUSTRING("com.sun.star.i18n.LocaleData") ), UNO_QUERY );
-
- if ( !xLocale.is() )
- return;
-
- LocaleDataItem aLocaleItem = xLocale->getLocaleItem( ::com::sun::star::lang::Locale() );
- pField->IsNumeric = lclIsNumeric(pField->StringValue, aLocaleItem);
-
- if ( !pField->IsNumeric && lclWildcard2Regex(pField->StringValue) )
- mbUseRegex = true;
-
- maFields.push_back(aItem);
- }
- break;
-
- case XML_greaterThan:
- case XML_greaterThanOrEqual:
- case XML_lessThan:
- case XML_lessThanOrEqual:
- {
- pField->IsNumeric = true;
- maFields.push_back(aItem);
- }
- break;
- default:
- OSL_ENSURE( false, "OoxAutoFilterContext::importCustomFilter: unhandled case" );
- }
-}
-
-void OoxAutoFilterContext::importFilters( const AttributeList& rAttribs )
-{
- // blank (boolean) and calendarType attributes can be present, but not used for now.
-
- mbShowBlank = rAttribs.getBool( XML_blank, false );
- maFilterNames.clear();
-}
-
-void OoxAutoFilterContext::importFilter( const AttributeList& rAttribs )
-{
- if (mnCurColID == -1)
- return;
-
- OUString value = rAttribs.getString( XML_val, OUString() );
- if ( value.getLength() )
- maFilterNames.push_back(value);
-}
-
-void OoxAutoFilterContext::importDynamicFilter( const AttributeList& /*rAttribs*/ )
-{
- // not implemented yet - Calc doesn't support this.
}
// ============================================================================
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/biffcodec.cxx b/oox/source/xls/biffcodec.cxx
index 0872dcc654df..cb4829973fcc 100644
--- a/oox/source/xls/biffcodec.cxx
+++ b/oox/source/xls/biffcodec.cxx
@@ -26,20 +26,24 @@
************************************************************************/
#include "oox/xls/biffcodec.hxx"
+
#include <osl/thread.h>
#include <string.h>
#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::FilterBase;
using ::rtl::OString;
using ::rtl::OUString;
using ::rtl::OStringToOUString;
-using ::oox::core::FilterBase;
-
-using namespace ::com::sun::star;
-
-namespace oox {
-namespace xls {
// ============================================================================
@@ -52,14 +56,14 @@ BiffDecoderBase::~BiffDecoderBase()
{
}
-::comphelper::DocPasswordVerifierResult BiffDecoderBase::verifyPassword( const ::rtl::OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData )
+::comphelper::DocPasswordVerifierResult BiffDecoderBase::verifyPassword( const OUString& rPassword, Sequence< NamedValue >& o_rEncryptionData )
{
o_rEncryptionData = implVerifyPassword( rPassword );
- mbValid = ( o_rEncryptionData.getLength() > 0 );
+ mbValid = o_rEncryptionData.hasElements();
return mbValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
}
-::comphelper::DocPasswordVerifierResult BiffDecoderBase::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData )
+::comphelper::DocPasswordVerifierResult BiffDecoderBase::verifyEncryptionData( const Sequence< NamedValue >& rEncryptionData )
{
mbValid = implVerifyEncryptionData( rEncryptionData );
return mbValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
@@ -101,7 +105,7 @@ BiffDecoder_XOR* BiffDecoder_XOR::implClone()
return new BiffDecoder_XOR( *this );
}
-uno::Sequence< beans::NamedValue > BiffDecoder_XOR::implVerifyPassword( const ::rtl::OUString& rPassword )
+Sequence< NamedValue > BiffDecoder_XOR::implVerifyPassword( const OUString& rPassword )
{
maEncryptionData.realloc( 0 );
@@ -112,29 +116,29 @@ uno::Sequence< beans::NamedValue > BiffDecoder_XOR::implVerifyPassword( const ::
if( (0 < nLen) && (nLen < 16) )
{
// init codec
- maCodec.initKey( (sal_uInt8*)aBytePassword.getStr() );
+ maCodec.initKey( reinterpret_cast< const sal_uInt8* >( aBytePassword.getStr() ) );
- if ( maCodec.verifyKey( mnKey, mnHash ) )
+ if( maCodec.verifyKey( mnKey, mnHash ) )
maEncryptionData = maCodec.getEncryptionData();
}
return maEncryptionData;
}
-bool BiffDecoder_XOR::implVerifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData )
+bool BiffDecoder_XOR::implVerifyEncryptionData( const Sequence< NamedValue >& rEncryptionData )
{
maEncryptionData.realloc( 0 );
- if( rEncryptionData.getLength() )
+ if( rEncryptionData.hasElements() )
{
// init codec
maCodec.initCodec( rEncryptionData );
- if ( maCodec.verifyKey( mnKey, mnHash ) )
+ if( maCodec.verifyKey( mnKey, mnHash ) )
maEncryptionData = rEncryptionData;
}
- return maEncryptionData.getLength();
+ return maEncryptionData.hasElements();
}
void BiffDecoder_XOR::implDecode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcData, sal_Int64 nStreamPos, sal_uInt16 nBytes )
@@ -187,7 +191,7 @@ BiffDecoder_RCF* BiffDecoder_RCF::implClone()
return new BiffDecoder_RCF( *this );
}
-uno::Sequence< beans::NamedValue > BiffDecoder_RCF::implVerifyPassword( const ::rtl::OUString& rPassword )
+Sequence< NamedValue > BiffDecoder_RCF::implVerifyPassword( const OUString& rPassword )
{
maEncryptionData.realloc( 0 );
@@ -204,31 +208,29 @@ uno::Sequence< beans::NamedValue > BiffDecoder_RCF::implVerifyPassword( const ::
// init codec
maCodec.initKey( &aPassVect.front(), &maSalt.front() );
- if ( maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ) )
+ if( maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ) )
maEncryptionData = maCodec.getEncryptionData();
}
return maEncryptionData;
}
-bool BiffDecoder_RCF::implVerifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData )
+bool BiffDecoder_RCF::implVerifyEncryptionData( const Sequence< NamedValue >& rEncryptionData )
{
maEncryptionData.realloc( 0 );
- if( rEncryptionData.getLength() )
+ if( rEncryptionData.hasElements() )
{
// init codec
maCodec.initCodec( rEncryptionData );
- if ( maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ) )
+ if( maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ) )
maEncryptionData = rEncryptionData;
}
- return maEncryptionData.getLength();
+ return maEncryptionData.hasElements();
}
-
-
void BiffDecoder_RCF::implDecode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcData, sal_Int64 nStreamPos, sal_uInt16 nBytes )
{
sal_uInt8* pnCurrDest = pnDestData;
@@ -375,4 +377,3 @@ void BiffCodecHelper::cloneDecoder( BiffInputStream& rStrm )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/biffdetector.cxx b/oox/source/xls/biffdetector.cxx
index fc3e1e710bcb..038d7d732425 100644
--- a/oox/source/xls/biffdetector.cxx
+++ b/oox/source/xls/biffdetector.cxx
@@ -26,31 +26,31 @@
************************************************************************/
#include "oox/xls/biffdetector.hxx"
+
#include <algorithm>
-#include <rtl/strbuf.hxx>
#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <comphelper/mediadescriptor.hxx>
+#include <rtl/strbuf.hxx>
#include "oox/helper/binaryinputstream.hxx"
#include "oox/ole/olestorage.hxx"
-using ::rtl::OUString;
-using ::rtl::OStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::io::XInputStream;
-using ::comphelper::MediaDescriptor;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::comphelper::MediaDescriptor;
+using ::rtl::OStringBuffer;
+using ::rtl::OUString;
+
+// ============================================================================
+
Sequence< OUString > BiffDetector_getSupportedServiceNames()
{
Sequence< OUString > aServiceNames( 1 );
@@ -60,18 +60,18 @@ Sequence< OUString > BiffDetector_getSupportedServiceNames()
OUString BiffDetector_getImplementationName()
{
- return CREATE_OUSTRING( "com.sun.star.comp.oox.BiffDetector" );
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.xls.BiffDetector" );
}
-Reference< XInterface > SAL_CALL BiffDetector_createInstance( const Reference< XMultiServiceFactory >& rxFactory ) throw( Exception )
+Reference< XInterface > SAL_CALL BiffDetector_createInstance( const Reference< XComponentContext >& rxContext ) throw( Exception )
{
- return static_cast< ::cppu::OWeakObject* >( new BiffDetector( rxFactory ) );
+ return static_cast< ::cppu::OWeakObject* >( new BiffDetector( rxContext ) );
}
// ============================================================================
-BiffDetector::BiffDetector( const Reference< XMultiServiceFactory >& rxFactory ) :
- mxFactory( rxFactory )
+BiffDetector::BiffDetector( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ mxContext( rxContext, UNO_SET_THROW )
{
}
@@ -79,7 +79,7 @@ BiffDetector::~BiffDetector()
{
}
-BiffType BiffDetector::detectStreamBiffVersion( BinaryInputStream& rInStream )
+/*static*/ BiffType BiffDetector::detectStreamBiffVersion( BinaryInputStream& rInStream )
{
BiffType eBiff = BIFF_UNKNOWN;
if( !rInStream.isEof() && rInStream.isSeekable() && (rInStream.getLength() > 4) )
@@ -132,36 +132,36 @@ BiffType BiffDetector::detectStreamBiffVersion( BinaryInputStream& rInStream )
return eBiff;
}
-BiffType BiffDetector::detectStorageBiffVersion( OUString& orWorkbookStreamName, StorageRef xStorage )
+/*static*/ BiffType BiffDetector::detectStorageBiffVersion( OUString& orWorkbookStreamName, const StorageRef& rxStorage )
{
static const OUString saBookName = CREATE_OUSTRING( "Book" );
static const OUString saWorkbookName = CREATE_OUSTRING( "Workbook" );
BiffType eBiff = BIFF_UNKNOWN;
- if( xStorage.get() )
+ if( rxStorage.get() )
{
- if( xStorage->isStorage() )
+ if( rxStorage->isStorage() )
{
// try to open the "Book" stream
- BinaryXInputStream aBookStrm5( xStorage->openInputStream( saBookName ), true );
+ BinaryXInputStream aBookStrm5( rxStorage->openInputStream( saBookName ), true );
BiffType eBookStrm5Biff = detectStreamBiffVersion( aBookStrm5 );
// try to open the "Workbook" stream
- BinaryXInputStream aBookStrm8( xStorage->openInputStream( saWorkbookName ), true );
+ BinaryXInputStream aBookStrm8( rxStorage->openInputStream( saWorkbookName ), true );
BiffType eBookStrm8Biff = detectStreamBiffVersion( aBookStrm8 );
// decide which stream to use
if( (eBookStrm8Biff != BIFF_UNKNOWN) && ((eBookStrm5Biff == BIFF_UNKNOWN) || (eBookStrm8Biff > eBookStrm5Biff)) )
{
- /* Only "Workbook" stream exists; or both streams exist,
- and "Workbook" has higher BIFF version than "Book" stream. */
+ /* Only "Workbook" stream exists; or both streams exist, and
+ "Workbook" has higher BIFF version than "Book" stream. */
eBiff = eBookStrm8Biff;
orWorkbookStreamName = saWorkbookName;
}
else if( eBookStrm5Biff != BIFF_UNKNOWN )
{
- /* Only "Book" stream exists; or both streams exist,
- and "Book" has higher BIFF version than "Workbook" stream. */
+ /* Only "Book" stream exists; or both streams exist, and
+ "Book" has higher BIFF version than "Workbook" stream. */
eBiff = eBookStrm5Biff;
orWorkbookStreamName = saBookName;
}
@@ -169,7 +169,7 @@ BiffType BiffDetector::detectStorageBiffVersion( OUString& orWorkbookStreamName,
else
{
// no storage, try plain input stream from medium (even for BIFF5+)
- BinaryXInputStream aStrm( xStorage->openInputStream( OUString() ), false );
+ BinaryXInputStream aStrm( rxStorage->openInputStream( OUString() ), false );
eBiff = detectStreamBiffVersion( aStrm );
orWorkbookStreamName = OUString();
}
@@ -187,7 +187,7 @@ OUString SAL_CALL BiffDetector::getImplementationName() throw( RuntimeException
sal_Bool SAL_CALL BiffDetector::supportsService( const OUString& rService ) throw( RuntimeException )
{
- const Sequence< OUString > aServices( BiffDetector_getSupportedServiceNames() );
+ const Sequence< OUString > aServices = BiffDetector_getSupportedServiceNames();
const OUString* pArray = aServices.getConstArray();
const OUString* pArrayEnd = pArray + aServices.getLength();
return ::std::find( pArray, pArrayEnd, rService ) != pArrayEnd;
@@ -207,20 +207,19 @@ OUString SAL_CALL BiffDetector::detect( Sequence< PropertyValue >& rDescriptor )
MediaDescriptor aDescriptor( rDescriptor );
aDescriptor.addInputStream();
- Reference< XInputStream > xInStrm( aDescriptor[ MediaDescriptor::PROP_INPUTSTREAM() ], UNO_QUERY );
- if( xInStrm.is() )
+ Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW );
+ Reference< XInputStream > xInStrm( aDescriptor[ MediaDescriptor::PROP_INPUTSTREAM() ], UNO_QUERY_THROW );
+ StorageRef xStorage( new ::oox::ole::OleStorage( xFactory, xInStrm, true ) );
+
+ OUString aWorkbookName;
+ switch( detectStorageBiffVersion( aWorkbookName, xStorage ) )
{
- OUString aWorkbookName;
- StorageRef xStorage( new ::oox::ole::OleStorage( mxFactory, xInStrm, true ) );
- switch( detectStorageBiffVersion( aWorkbookName, xStorage ) )
- {
- case BIFF2:
- case BIFF3:
- case BIFF4: aTypeName = CREATE_OUSTRING( "calc_MS_Excel_40" ); break;
- case BIFF5: aTypeName = CREATE_OUSTRING( "calc_MS_Excel_95" ); break;
- case BIFF8: aTypeName = CREATE_OUSTRING( "calc_MS_Excel_97" ); break;
- default:;
- }
+ case BIFF2:
+ case BIFF3:
+ case BIFF4: aTypeName = CREATE_OUSTRING( "calc_MS_Excel_40" ); break;
+ case BIFF5: aTypeName = CREATE_OUSTRING( "calc_MS_Excel_95" ); break;
+ case BIFF8: aTypeName = CREATE_OUSTRING( "calc_MS_Excel_97" ); break;
+ default:;
}
return aTypeName;
@@ -230,4 +229,3 @@ OUString SAL_CALL BiffDetector::detect( Sequence< PropertyValue >& rDescriptor )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/biffhelper.cxx b/oox/source/xls/biffhelper.cxx
index afd7e04e6a08..55839043865e 100644
--- a/oox/source/xls/biffhelper.cxx
+++ b/oox/source/xls/biffhelper.cxx
@@ -26,20 +26,23 @@
************************************************************************/
#include "oox/xls/biffhelper.hxx"
+
#include <rtl/math.hxx>
#include <rtl/tencinfo.h>
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/biffoutputstream.hxx"
#include "oox/xls/worksheethelper.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-
namespace oox {
namespace xls {
// ============================================================================
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
const sal_Int32 BIFF_RK_100FLAG = 0x00000001;
@@ -186,6 +189,8 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm,
// ============================================================================
+// conversion -----------------------------------------------------------------
+
/*static*/ double BiffHelper::calcDoubleFromRk( sal_Int32 nRkValue )
{
DecodedDouble aDecDbl( 0.0 );
@@ -262,6 +267,53 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm,
return static_cast< sal_uInt16 >( (nCodePage == 0) ? 1252 : nCodePage );
}
+// BIFF12 import --------------------------------------------------------------
+
+/*static*/ OUString BiffHelper::readString( SequenceInputStream& rStrm, bool b32BitLen )
+{
+ OUString aString;
+ if( !rStrm.isEof() )
+ {
+ sal_Int32 nCharCount = b32BitLen ? rStrm.readValue< sal_Int32 >() : rStrm.readValue< sal_Int16 >();
+ // string length -1 is often used to indicate a missing string
+ OSL_ENSURE( !rStrm.isEof() && (nCharCount >= -1), "BiffHelper::readString - invalid string length" );
+ if( !rStrm.isEof() && (nCharCount > 0) )
+ {
+ ::std::vector< sal_Unicode > aBuffer;
+ aBuffer.reserve( getLimitedValue< size_t, sal_Int32 >( nCharCount + 1, 0, 0xFFFF ) );
+ for( sal_Int32 nCharIdx = 0; !rStrm.isEof() && (nCharIdx < nCharCount); ++nCharIdx )
+ {
+ sal_uInt16 nChar;
+ rStrm.readValue( nChar );
+ aBuffer.push_back( static_cast< sal_Unicode >( nChar ) );
+ }
+ aBuffer.push_back( 0 );
+ aString = OUString( &aBuffer.front() );
+ }
+ }
+ return aString;
+}
+
+// BIFF2-BIFF8 import ---------------------------------------------------------
+
+/*static*/ bool BiffHelper::isBofRecord( BiffInputStream& rStrm )
+{
+ return
+ (rStrm.getRecId() == BIFF2_ID_BOF) ||
+ (rStrm.getRecId() == BIFF3_ID_BOF) ||
+ (rStrm.getRecId() == BIFF4_ID_BOF) ||
+ (rStrm.getRecId() == BIFF5_ID_BOF);
+}
+
+/*static*/ bool BiffHelper::skipRecordBlock( BiffInputStream& rStrm, sal_uInt16 nEndRecId )
+{
+ sal_uInt16 nStartRecId = rStrm.getRecId();
+ while( rStrm.startNextRecord() && (rStrm.getRecId() != nEndRecId) )
+ if( rStrm.getRecId() == nStartRecId )
+ skipRecordBlock( rStrm, nEndRecId );
+ return !rStrm.isEof() && (rStrm.getRecId() == nEndRecId);
+}
+
/*static*/ void BiffHelper::importImgData( StreamDataSequence& orDataSeq, BiffInputStream& rStrm, BiffType eBiff )
{
sal_uInt16 nFormat, nEnv;
@@ -284,4 +336,3 @@ void lclImportImgDataDib( StreamDataSequence& orDataSeq, BiffInputStream& rStrm,
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/biffinputstream.cxx b/oox/source/xls/biffinputstream.cxx
index fec36d4fa54d..6dfa8f755c25 100644
--- a/oox/source/xls/biffinputstream.cxx
+++ b/oox/source/xls/biffinputstream.cxx
@@ -26,17 +26,20 @@
************************************************************************/
#include "oox/xls/biffinputstream.hxx"
+
#include <algorithm>
#include <rtl/ustrbuf.hxx>
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
using ::rtl::OString;
using ::rtl::OStringToOUString;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-namespace oox {
-namespace xls {
-
// ============================================================================
namespace prv {
@@ -628,4 +631,3 @@ BiffInputStreamPosGuard::~BiffInputStreamPosGuard()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/biffoutputstream.cxx b/oox/source/xls/biffoutputstream.cxx
index 5ec8834c5336..ba59f50bea4d 100644
--- a/oox/source/xls/biffoutputstream.cxx
+++ b/oox/source/xls/biffoutputstream.cxx
@@ -205,4 +205,3 @@ sal_uInt16 BiffOutputStream::prepareRawBlock( sal_Int32 nTotalSize )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/chartsheetfragment.cxx b/oox/source/xls/chartsheetfragment.cxx
index 287518584cc3..c67768ef2f22 100644
--- a/oox/source/xls/chartsheetfragment.cxx
+++ b/oox/source/xls/chartsheetfragment.cxx
@@ -26,32 +26,32 @@
************************************************************************/
#include "oox/xls/chartsheetfragment.hxx"
+
#include "oox/helper/attributelist.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/pagesettings.hxx"
#include "oox/xls/viewsettings.hxx"
#include "oox/xls/workbooksettings.hxx"
#include "oox/xls/worksheetsettings.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
-
namespace oox {
namespace xls {
// ============================================================================
-OoxChartsheetFragment::OoxChartsheetFragment( const WorkbookHelper& rHelper,
- const OUString& rFragmentPath, ISegmentProgressBarRef xProgressBar, sal_Int16 nSheet ) :
- OoxWorksheetFragmentBase( rHelper, rFragmentPath, xProgressBar, SHEETTYPE_CHARTSHEET, nSheet )
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+ChartsheetFragment::ChartsheetFragment( const WorkbookHelper& rHelper,
+ const OUString& rFragmentPath, const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ) :
+ WorksheetFragmentBase( rHelper, rFragmentPath, rxProgressBar, SHEETTYPE_CHARTSHEET, nSheet )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxChartsheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ChartsheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -86,14 +86,14 @@ ContextHandlerRef OoxChartsheetFragment::onCreateContext( sal_Int32 nElement, co
case XLS_TOKEN( oddHeader ):
case XLS_TOKEN( oddFooter ):
case XLS_TOKEN( evenHeader ):
- case XLS_TOKEN( evenFooter ): return this; // collect contents in onEndElement()
+ case XLS_TOKEN( evenFooter ): return this; // collect contents in onCharacters()
}
break;
}
return 0;
}
-void OoxChartsheetFragment::onEndElement( const OUString& rChars )
+void ChartsheetFragment::onCharacters( const OUString& rChars )
{
switch( getCurrentElement() )
{
@@ -108,60 +108,58 @@ void OoxChartsheetFragment::onEndElement( const OUString& rChars )
}
}
-ContextHandlerRef OoxChartsheetFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef ChartsheetFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_WORKSHEET ) return this;
+ if( nRecId == BIFF12_ID_WORKSHEET ) return this;
break;
- case OOBIN_ID_WORKSHEET:
+ case BIFF12_ID_WORKSHEET:
switch( nRecId )
{
- case OOBIN_ID_CHARTSHEETVIEWS: return this;
-
- case OOBIN_ID_CHARTSHEETPR: getWorksheetSettings().importChartSheetPr( rStrm ); break;
- case OOBIN_ID_CHARTPROTECTION: getWorksheetSettings().importChartProtection( rStrm ); break;
- case OOBIN_ID_PAGEMARGINS: getPageSettings().importPageMargins( rStrm ); break;
- case OOBIN_ID_CHARTPAGESETUP: getPageSettings().importChartPageSetup( getRelations(), rStrm ); break;
- case OOBIN_ID_HEADERFOOTER: getPageSettings().importHeaderFooter( rStrm ); break;
- case OOBIN_ID_PICTURE: getPageSettings().importPicture( getRelations(), rStrm ); break;
- case OOBIN_ID_DRAWING: importDrawing( rStrm ); break;
+ case BIFF12_ID_CHARTSHEETVIEWS: return this;
+
+ case BIFF12_ID_CHARTSHEETPR: getWorksheetSettings().importChartSheetPr( rStrm ); break;
+ case BIFF12_ID_CHARTPROTECTION: getWorksheetSettings().importChartProtection( rStrm ); break;
+ case BIFF12_ID_PAGEMARGINS: getPageSettings().importPageMargins( rStrm ); break;
+ case BIFF12_ID_CHARTPAGESETUP: getPageSettings().importChartPageSetup( getRelations(), rStrm ); break;
+ case BIFF12_ID_HEADERFOOTER: getPageSettings().importHeaderFooter( rStrm ); break;
+ case BIFF12_ID_PICTURE: getPageSettings().importPicture( getRelations(), rStrm ); break;
+ case BIFF12_ID_DRAWING: importDrawing( rStrm ); break;
}
break;
- case OOBIN_ID_CHARTSHEETVIEWS:
- if( nRecId == OOBIN_ID_CHARTSHEETVIEW ) getSheetViewSettings().importChartSheetView( rStrm );
+ case BIFF12_ID_CHARTSHEETVIEWS:
+ if( nRecId == BIFF12_ID_CHARTSHEETVIEW ) getSheetViewSettings().importChartSheetView( rStrm );
break;
}
return 0;
}
-// oox.core.FragmentHandler2 interface ----------------------------------------
-
-const RecordInfo* OoxChartsheetFragment::getRecordInfos() const
+const RecordInfo* ChartsheetFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_CHARTSHEETVIEW, OOBIN_ID_CHARTSHEETVIEW + 1 },
- { OOBIN_ID_CHARTSHEETVIEWS, OOBIN_ID_CHARTSHEETVIEWS + 1 },
- { OOBIN_ID_CUSTOMCHARTVIEW, OOBIN_ID_CUSTOMCHARTVIEW + 1 },
- { OOBIN_ID_CUSTOMCHARTVIEWS, OOBIN_ID_CUSTOMCHARTVIEWS + 1 },
- { OOBIN_ID_HEADERFOOTER, OOBIN_ID_HEADERFOOTER + 1 },
- { OOBIN_ID_WORKSHEET, OOBIN_ID_WORKSHEET + 1 },
+ { BIFF12_ID_CHARTSHEETVIEW, BIFF12_ID_CHARTSHEETVIEW + 1 },
+ { BIFF12_ID_CHARTSHEETVIEWS, BIFF12_ID_CHARTSHEETVIEWS + 1 },
+ { BIFF12_ID_CUSTOMCHARTVIEW, BIFF12_ID_CUSTOMCHARTVIEW + 1 },
+ { BIFF12_ID_CUSTOMCHARTVIEWS, BIFF12_ID_CUSTOMCHARTVIEWS + 1 },
+ { BIFF12_ID_HEADERFOOTER, BIFF12_ID_HEADERFOOTER + 1 },
+ { BIFF12_ID_WORKSHEET, BIFF12_ID_WORKSHEET + 1 },
{ -1, -1 }
};
return spRecInfos;
}
-void OoxChartsheetFragment::initializeImport()
+void ChartsheetFragment::initializeImport()
{
// initial processing in base class WorksheetHelper
initializeWorksheetImport();
}
-void OoxChartsheetFragment::finalizeImport()
+void ChartsheetFragment::finalizeImport()
{
// final processing in base class WorksheetHelper
finalizeWorksheetImport();
@@ -169,21 +167,21 @@ void OoxChartsheetFragment::finalizeImport()
// private --------------------------------------------------------------------
-void OoxChartsheetFragment::importDrawing( const AttributeList& rAttribs )
+void ChartsheetFragment::importDrawing( const AttributeList& rAttribs )
{
setDrawingPath( getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ) );
}
-void OoxChartsheetFragment::importDrawing( RecordInputStream& rStrm )
+void ChartsheetFragment::importDrawing( SequenceInputStream& rStrm )
{
- setDrawingPath( getFragmentPathFromRelId( rStrm.readString() ) );
+ setDrawingPath( getFragmentPathFromRelId( BiffHelper::readString( rStrm ) ) );
}
// ============================================================================
BiffChartsheetFragment::BiffChartsheetFragment( const BiffWorkbookFragmentBase& rParent,
- ISegmentProgressBarRef xProgressBar, sal_Int16 nSheet ) :
- BiffWorksheetFragmentBase( rParent, xProgressBar, SHEETTYPE_CHARTSHEET, nSheet )
+ const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ) :
+ BiffWorksheetFragmentBase( rParent, rxProgressBar, SHEETTYPE_CHARTSHEET, nSheet )
{
}
@@ -197,80 +195,82 @@ bool BiffChartsheetFragment::importFragment()
PageSettings& rPageSett = getPageSettings();
// process all record in this sheet fragment
- while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
+ BiffInputStream& rStrm = getInputStream();
+ while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
{
- if( isBofRecord() )
+ if( BiffHelper::isBofRecord( rStrm ) )
{
// skip unknown embedded fragments (BOF/EOF blocks)
skipFragment();
}
else
{
- sal_uInt16 nRecId = mrStrm.getRecId();
+ sal_uInt16 nRecId = rStrm.getRecId();
switch( nRecId )
{
// records in all BIFF versions
- case BIFF_ID_BOTTOMMARGIN: rPageSett.importBottomMargin( mrStrm ); break;
- case BIFF_ID_CHBEGIN: skipRecordBlock( BIFF_ID_CHEND ); break;
- case BIFF_ID_FOOTER: rPageSett.importFooter( mrStrm ); break;
- case BIFF_ID_HEADER: rPageSett.importHeader( mrStrm ); break;
- case BIFF_ID_LEFTMARGIN: rPageSett.importLeftMargin( mrStrm ); break;
- case BIFF_ID_PASSWORD: rWorksheetSett.importPassword( mrStrm ); break;
- case BIFF_ID_PROTECT: rWorksheetSett.importProtect( mrStrm ); break;
- case BIFF_ID_RIGHTMARGIN: rPageSett.importRightMargin( mrStrm ); break;
- case BIFF_ID_TOPMARGIN: rPageSett.importTopMargin( mrStrm ); break;
+ case BIFF_ID_BOTTOMMARGIN: rPageSett.importBottomMargin( rStrm ); break;
+ case BIFF_ID_CHBEGIN: BiffHelper::skipRecordBlock( rStrm, BIFF_ID_CHEND ); break;
+ case BIFF_ID_FOOTER: rPageSett.importFooter( rStrm ); break;
+ case BIFF_ID_HEADER: rPageSett.importHeader( rStrm ); break;
+ case BIFF_ID_LEFTMARGIN: rPageSett.importLeftMargin( rStrm ); break;
+ case BIFF_ID_PASSWORD: rWorksheetSett.importPassword( rStrm ); break;
+ case BIFF_ID_PROTECT: rWorksheetSett.importProtect( rStrm ); break;
+ case BIFF_ID_RIGHTMARGIN: rPageSett.importRightMargin( rStrm ); break;
+ case BIFF_ID_TOPMARGIN: rPageSett.importTopMargin( rStrm ); break;
// BIFF specific records
default: switch( getBiff() )
{
case BIFF2: switch( nRecId )
{
- case BIFF2_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF2_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
case BIFF3: switch( nRecId )
{
- case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break;
- case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
- case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
- case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_HCENTER: rPageSett.importHorCenter( rStrm ); break;
+ case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm ); break;
+ case BIFF_ID_VCENTER: rPageSett.importVerCenter( rStrm ); break;
+ case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
case BIFF4: switch( nRecId )
{
- case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break;
- case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
- case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
- case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
- case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_HCENTER: rPageSett.importHorCenter( rStrm ); break;
+ case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm ); break;
+ case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( rStrm ); break;
+ case BIFF_ID_VCENTER: rPageSett.importVerCenter( rStrm ); break;
+ case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
case BIFF5: switch( nRecId )
{
- case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break;
- case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
- case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
- case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( mrStrm ); break;
- case BIFF_ID_SCL: rSheetViewSett.importScl( mrStrm ); break;
- case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
- case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_HCENTER: rPageSett.importHorCenter( rStrm ); break;
+ case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm ); break;
+ case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( rStrm ); break;
+ case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( rStrm ); break;
+ case BIFF_ID_SCL: rSheetViewSett.importScl( rStrm ); break;
+ case BIFF_ID_VCENTER: rPageSett.importVerCenter( rStrm ); break;
+ case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
case BIFF8: switch( nRecId )
{
- case BIFF_ID_CODENAME: rWorksheetSett.importCodeName( mrStrm ); break;
- case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break;
- case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
- case BIFF_ID_PICTURE: rPageSett.importPicture( mrStrm ); break;
- case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
- case BIFF_ID_SCL: rSheetViewSett.importScl( mrStrm ); break;
- case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
- case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_CODENAME: rWorksheetSett.importCodeName( rStrm ); break;
+ case BIFF_ID_HCENTER: rPageSett.importHorCenter( rStrm ); break;
+ case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm ); break;
+ case BIFF_ID_PICTURE: rPageSett.importPicture( rStrm ); break;
+ case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( rStrm ); break;
+ case BIFF_ID_SCL: rSheetViewSett.importScl( rStrm ); break;
+ case BIFF_ID_SHEETEXT: rWorksheetSett.importSheetExt( rStrm ); break;
+ case BIFF_ID_VCENTER: rPageSett.importVerCenter( rStrm ); break;
+ case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
@@ -282,11 +282,10 @@ bool BiffChartsheetFragment::importFragment()
// final processing in base class WorksheetHelper
finalizeWorksheetImport();
- return mrStrm.getRecId() == BIFF_ID_EOF;
+ return rStrm.getRecId() == BIFF_ID_EOF;
}
// ============================================================================
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx
index 190309649789..78d5fe044fe8 100644
--- a/oox/source/xls/commentsbuffer.cxx
+++ b/oox/source/xls/commentsbuffer.cxx
@@ -26,34 +26,30 @@
************************************************************************/
#include "oox/xls/commentsbuffer.hxx"
+
#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
#include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
#include <com/sun/star/sheet/XSheetAnnotations.hpp>
#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
#include "oox/helper/attributelist.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/drawingfragment.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::drawing::XShape;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::sheet::XSheetAnnotation;
-using ::com::sun::star::sheet::XSheetAnnotationAnchor;
-using ::com::sun::star::sheet::XSheetAnnotationShapeSupplier;
-using ::com::sun::star::sheet::XSheetAnnotations;
-using ::com::sun::star::sheet::XSheetAnnotationsSupplier;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
CommentModel::CommentModel() :
mnAuthorId( -1 )
{
@@ -73,7 +69,7 @@ void Comment::importComment( const AttributeList& rAttribs )
getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex() );
}
-void Comment::importComment( RecordInputStream& rStrm )
+void Comment::importComment( SequenceInputStream& rStrm )
{
BinRange aBinRange;
rStrm >> maModel.mnAuthorId >> aBinRange;
@@ -89,7 +85,7 @@ RichStringRef Comment::createText()
void Comment::finalizeImport()
{
- // OOBIN format stores cell range instead of cell address, use first cell of this range
+ // BIFF12 stores cell range instead of cell address, use first cell of this range
OSL_ENSURE( (maModel.maRange.StartColumn == maModel.maRange.EndColumn) &&
(maModel.maRange.StartRow == maModel.maRange.EndRow),
"Comment::finalizeImport - comment anchor should be a single cell" );
@@ -115,9 +111,8 @@ void Comment::finalizeImport()
// position and formatting
pNoteShape->convertFormatting( xAnnoShape );
// visibility
- const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = pNoteShape->getShapeModel().mxClientData;
- bool bVisible = rxClientData.get() && rxClientData->mbVisible;
- xAnno->setIsVisible( bVisible );
+ const ::oox::vml::ClientData* pClientData = pNoteShape->getClientData();
+ xAnno->setIsVisible( pClientData && pClientData->mbVisible );
}
}
}
@@ -154,4 +149,3 @@ void CommentsBuffer::finalizeImport()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/commentsfragment.cxx b/oox/source/xls/commentsfragment.cxx
index c87d3028b7cb..b37860c4553e 100644
--- a/oox/source/xls/commentsfragment.cxx
+++ b/oox/source/xls/commentsfragment.cxx
@@ -26,25 +26,26 @@
************************************************************************/
#include "oox/xls/commentsfragment.hxx"
-#include "oox/xls/richstringcontext.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
+#include "oox/xls/richstringcontext.hxx"
namespace oox {
namespace xls {
// ============================================================================
-OoxCommentsFragment::OoxCommentsFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorksheetFragmentBase( rHelper, rFragmentPath )
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+CommentsFragment::CommentsFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
+ WorksheetFragmentBase( rHelper, rFragmentPath )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxCommentsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef CommentsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -56,91 +57,84 @@ ContextHandlerRef OoxCommentsFragment::onCreateContext( sal_Int32 nElement, cons
if( nElement == XLS_TOKEN( commentList ) ) return this;
break;
case XLS_TOKEN( authors ):
- if( nElement == XLS_TOKEN( author ) ) return this; // collect author in onEndElement()
+ if( nElement == XLS_TOKEN( author ) ) return this; // collect author in onCharacters()
break;
case XLS_TOKEN( commentList ):
if( nElement == XLS_TOKEN( comment ) ) { importComment( rAttribs ); return this; }
break;
case XLS_TOKEN( comment ):
if( (nElement == XLS_TOKEN( text )) && mxComment.get() )
- return new OoxRichStringContext( *this, mxComment->createText() );
+ return new RichStringContext( *this, mxComment->createText() );
break;
}
return 0;
}
-void OoxCommentsFragment::onEndElement( const OUString& rChars )
+void CommentsFragment::onCharacters( const OUString& rChars )
{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( author ):
- getComments().appendAuthor( rChars );
- break;
- case XLS_TOKEN( comment ):
- mxComment.reset();
- break;
- }
+ if( isCurrentElement( XLS_TOKEN( author ) ) )
+ getComments().appendAuthor( rChars );
+}
+
+void CommentsFragment::onEndElement()
+{
+ if( isCurrentElement( XLS_TOKEN( comment ) ) )
+ mxComment.reset();
}
-ContextHandlerRef OoxCommentsFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef CommentsFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_COMMENTS ) return this;
+ if( nRecId == BIFF12_ID_COMMENTS ) return this;
break;
- case OOBIN_ID_COMMENTS:
- if( nRecId == OOBIN_ID_COMMENTAUTHORS ) return this;
- if( nRecId == OOBIN_ID_COMMENTLIST ) return this;
+ case BIFF12_ID_COMMENTS:
+ if( nRecId == BIFF12_ID_COMMENTAUTHORS ) return this;
+ if( nRecId == BIFF12_ID_COMMENTLIST ) return this;
break;
- case OOBIN_ID_COMMENTAUTHORS:
- if( nRecId == OOBIN_ID_COMMENTAUTHOR ) getComments().appendAuthor( rStrm.readString() );
+ case BIFF12_ID_COMMENTAUTHORS:
+ if( nRecId == BIFF12_ID_COMMENTAUTHOR ) getComments().appendAuthor( BiffHelper::readString( rStrm ) );
break;
- case OOBIN_ID_COMMENTLIST:
- if( nRecId == OOBIN_ID_COMMENT ) { importComment( rStrm ); return this; }
+ case BIFF12_ID_COMMENTLIST:
+ if( nRecId == BIFF12_ID_COMMENT ) { importComment( rStrm ); return this; }
break;
- case OOBIN_ID_COMMENT:
- if( (nRecId == OOBIN_ID_COMMENTTEXT) && mxComment.get() )
+ case BIFF12_ID_COMMENT:
+ if( (nRecId == BIFF12_ID_COMMENTTEXT) && mxComment.get() )
mxComment->createText()->importString( rStrm, true );
break;
}
return 0;
}
-void OoxCommentsFragment::onEndRecord()
+void CommentsFragment::onEndRecord()
{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_COMMENT:
- mxComment.reset();
- break;
- }
+ if( isCurrentElement( BIFF12_ID_COMMENT ) )
+ mxComment.reset();
}
-// oox.core.FragmentHandler2 interface ----------------------------------------
-
-const RecordInfo* OoxCommentsFragment::getRecordInfos() const
+const RecordInfo* CommentsFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_COMMENT, OOBIN_ID_COMMENT + 1 },
- { OOBIN_ID_COMMENTAUTHORS, OOBIN_ID_COMMENTAUTHORS + 1 },
- { OOBIN_ID_COMMENTLIST, OOBIN_ID_COMMENTLIST + 1 },
- { OOBIN_ID_COMMENTS, OOBIN_ID_COMMENTS + 1 },
- { -1, -1 }
+ { BIFF12_ID_COMMENT, BIFF12_ID_COMMENT + 1 },
+ { BIFF12_ID_COMMENTAUTHORS, BIFF12_ID_COMMENTAUTHORS + 1 },
+ { BIFF12_ID_COMMENTLIST, BIFF12_ID_COMMENTLIST + 1 },
+ { BIFF12_ID_COMMENTS, BIFF12_ID_COMMENTS + 1 },
+ { -1, -1 }
};
return spRecInfos;
}
// private --------------------------------------------------------------------
-void OoxCommentsFragment::importComment( const AttributeList& rAttribs )
+void CommentsFragment::importComment( const AttributeList& rAttribs )
{
mxComment = getComments().createComment();
mxComment->importComment( rAttribs );
}
-void OoxCommentsFragment::importComment( RecordInputStream& rStrm )
+void CommentsFragment::importComment( SequenceInputStream& rStrm )
{
mxComment = getComments().createComment();
mxComment->importComment( rStrm );
@@ -150,4 +144,3 @@ void OoxCommentsFragment::importComment( RecordInputStream& rStrm )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/condformatbuffer.cxx b/oox/source/xls/condformatbuffer.cxx
index 317476f25635..51d9170e1794 100644
--- a/oox/source/xls/condformatbuffer.cxx
+++ b/oox/source/xls/condformatbuffer.cxx
@@ -26,109 +26,98 @@
************************************************************************/
#include "oox/xls/condformatbuffer.hxx"
-#include <rtl/ustrbuf.hxx>
+
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
#include <com/sun/star/sheet/ConditionOperator.hpp>
+#include <com/sun/star/sheet/XSheetCellRanges.hpp>
#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheets.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-#include "properties.hxx"
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <rtl/ustrbuf.hxx>
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/stylesbuffer.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::style::XStyleFamiliesSupplier;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::sheet::ConditionOperator;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::sheet::XSheetCellRanges;
-using ::com::sun::star::sheet::XSheetConditionalEntries;
-using ::com::sun::star::sheet::XSpreadsheetDocument;
-using ::com::sun::star::sheet::XSpreadsheets;
-using ::com::sun::star::sheet::XSpreadsheet;
-using ::com::sun::star::style::XStyle;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
-const sal_Int32 OOBIN_CFRULE_TYPE_CELLIS = 1;
-const sal_Int32 OOBIN_CFRULE_TYPE_EXPRESSION = 2;
-const sal_Int32 OOBIN_CFRULE_TYPE_COLORSCALE = 3;
-const sal_Int32 OOBIN_CFRULE_TYPE_DATABAR = 4;
-const sal_Int32 OOBIN_CFRULE_TYPE_TOPTEN = 5;
-const sal_Int32 OOBIN_CFRULE_TYPE_ICONSET = 6;
-
-const sal_Int32 OOBIN_CFRULE_SUB_CELLIS = 0;
-const sal_Int32 OOBIN_CFRULE_SUB_EXPRESSION = 1;
-const sal_Int32 OOBIN_CFRULE_SUB_COLORSCALE = 2;
-const sal_Int32 OOBIN_CFRULE_SUB_DATABAR = 3;
-const sal_Int32 OOBIN_CFRULE_SUB_ICONSET = 4;
-const sal_Int32 OOBIN_CFRULE_SUB_TOPTEN = 5;
-const sal_Int32 OOBIN_CFRULE_SUB_UNIQUE = 7;
-const sal_Int32 OOBIN_CFRULE_SUB_TEXT = 8;
-const sal_Int32 OOBIN_CFRULE_SUB_BLANK = 9;
-const sal_Int32 OOBIN_CFRULE_SUB_NOTBLANK = 10;
-const sal_Int32 OOBIN_CFRULE_SUB_ERROR = 11;
-const sal_Int32 OOBIN_CFRULE_SUB_NOTERROR = 12;
-const sal_Int32 OOBIN_CFRULE_SUB_TODAY = 15;
-const sal_Int32 OOBIN_CFRULE_SUB_TOMORROW = 16;
-const sal_Int32 OOBIN_CFRULE_SUB_YESTERDAY = 17;
-const sal_Int32 OOBIN_CFRULE_SUB_LAST7DAYS = 18;
-const sal_Int32 OOBIN_CFRULE_SUB_LASTMONTH = 19;
-const sal_Int32 OOBIN_CFRULE_SUB_NEXTMONTH = 20;
-const sal_Int32 OOBIN_CFRULE_SUB_THISWEEK = 21;
-const sal_Int32 OOBIN_CFRULE_SUB_NEXTWEEK = 22;
-const sal_Int32 OOBIN_CFRULE_SUB_LASTWEEK = 23;
-const sal_Int32 OOBIN_CFRULE_SUB_THISMONTH = 24;
-const sal_Int32 OOBIN_CFRULE_SUB_ABOVEAVERAGE = 25;
-const sal_Int32 OOBIN_CFRULE_SUB_BELOWAVERAGE = 26;
-const sal_Int32 OOBIN_CFRULE_SUB_DUPLICATE = 27;
-const sal_Int32 OOBIN_CFRULE_SUB_EQABOVEAVERAGE = 29;
-const sal_Int32 OOBIN_CFRULE_SUB_EQBELOWAVERAGE = 30;
-
-const sal_Int32 OOBIN_CFRULE_TIMEOP_TODAY = 0;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_YESTERDAY = 1;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_LAST7DAYS = 2;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_THISWEEK = 3;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_LASTWEEK = 4;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_LASTMONTH = 5;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_TOMORROW = 6;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_NEXTWEEK = 7;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_NEXTMONTH = 8;
-const sal_Int32 OOBIN_CFRULE_TIMEOP_THISMONTH = 9;
-
-const sal_uInt16 OOBIN_CFRULE_STOPIFTRUE = 0x0002;
-const sal_uInt16 OOBIN_CFRULE_ABOVEAVERAGE = 0x0004;
-const sal_uInt16 OOBIN_CFRULE_BOTTOM = 0x0008;
-const sal_uInt16 OOBIN_CFRULE_PERCENT = 0x0010;
+const sal_Int32 BIFF12_CFRULE_TYPE_CELLIS = 1;
+const sal_Int32 BIFF12_CFRULE_TYPE_EXPRESSION = 2;
+const sal_Int32 BIFF12_CFRULE_TYPE_COLORSCALE = 3;
+const sal_Int32 BIFF12_CFRULE_TYPE_DATABAR = 4;
+const sal_Int32 BIFF12_CFRULE_TYPE_TOPTEN = 5;
+const sal_Int32 BIFF12_CFRULE_TYPE_ICONSET = 6;
+
+const sal_Int32 BIFF12_CFRULE_SUB_CELLIS = 0;
+const sal_Int32 BIFF12_CFRULE_SUB_EXPRESSION = 1;
+const sal_Int32 BIFF12_CFRULE_SUB_COLORSCALE = 2;
+const sal_Int32 BIFF12_CFRULE_SUB_DATABAR = 3;
+const sal_Int32 BIFF12_CFRULE_SUB_ICONSET = 4;
+const sal_Int32 BIFF12_CFRULE_SUB_TOPTEN = 5;
+const sal_Int32 BIFF12_CFRULE_SUB_UNIQUE = 7;
+const sal_Int32 BIFF12_CFRULE_SUB_TEXT = 8;
+const sal_Int32 BIFF12_CFRULE_SUB_BLANK = 9;
+const sal_Int32 BIFF12_CFRULE_SUB_NOTBLANK = 10;
+const sal_Int32 BIFF12_CFRULE_SUB_ERROR = 11;
+const sal_Int32 BIFF12_CFRULE_SUB_NOTERROR = 12;
+const sal_Int32 BIFF12_CFRULE_SUB_TODAY = 15;
+const sal_Int32 BIFF12_CFRULE_SUB_TOMORROW = 16;
+const sal_Int32 BIFF12_CFRULE_SUB_YESTERDAY = 17;
+const sal_Int32 BIFF12_CFRULE_SUB_LAST7DAYS = 18;
+const sal_Int32 BIFF12_CFRULE_SUB_LASTMONTH = 19;
+const sal_Int32 BIFF12_CFRULE_SUB_NEXTMONTH = 20;
+const sal_Int32 BIFF12_CFRULE_SUB_THISWEEK = 21;
+const sal_Int32 BIFF12_CFRULE_SUB_NEXTWEEK = 22;
+const sal_Int32 BIFF12_CFRULE_SUB_LASTWEEK = 23;
+const sal_Int32 BIFF12_CFRULE_SUB_THISMONTH = 24;
+const sal_Int32 BIFF12_CFRULE_SUB_ABOVEAVERAGE = 25;
+const sal_Int32 BIFF12_CFRULE_SUB_BELOWAVERAGE = 26;
+const sal_Int32 BIFF12_CFRULE_SUB_DUPLICATE = 27;
+const sal_Int32 BIFF12_CFRULE_SUB_EQABOVEAVERAGE = 29;
+const sal_Int32 BIFF12_CFRULE_SUB_EQBELOWAVERAGE = 30;
+
+const sal_Int32 BIFF12_CFRULE_TIMEOP_TODAY = 0;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_YESTERDAY = 1;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_LAST7DAYS = 2;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_THISWEEK = 3;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_LASTWEEK = 4;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_LASTMONTH = 5;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_TOMORROW = 6;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_NEXTWEEK = 7;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_NEXTMONTH = 8;
+const sal_Int32 BIFF12_CFRULE_TIMEOP_THISMONTH = 9;
+
+const sal_uInt16 BIFF12_CFRULE_STOPIFTRUE = 0x0002;
+const sal_uInt16 BIFF12_CFRULE_ABOVEAVERAGE = 0x0004;
+const sal_uInt16 BIFF12_CFRULE_BOTTOM = 0x0008;
+const sal_uInt16 BIFF12_CFRULE_PERCENT = 0x0010;
// ----------------------------------------------------------------------------
@@ -160,7 +149,7 @@ CondFormatRuleModel::CondFormatRuleModel() :
{
}
-void CondFormatRuleModel::setBinOperator( sal_Int32 nOperator )
+void CondFormatRuleModel::setBiffOperator( sal_Int32 nOperator )
{
static const sal_Int32 spnOperators[] = {
XML_TOKEN_INVALID, XML_between, XML_notBetween, XML_equal, XML_notEqual,
@@ -168,7 +157,7 @@ void CondFormatRuleModel::setBinOperator( sal_Int32 nOperator )
mnOperator = STATIC_ARRAY_SELECT( spnOperators, nOperator, XML_TOKEN_INVALID );
}
-void CondFormatRuleModel::setOobTextType( sal_Int32 nOperator )
+void CondFormatRuleModel::setBiff12TextType( sal_Int32 nOperator )
{
// note: type XML_notContainsText vs. operator XML_notContains
static const sal_Int32 spnTypes[] = { XML_containsText, XML_notContainsText, XML_beginsWith, XML_endsWith };
@@ -210,7 +199,7 @@ void CondFormatRule::appendFormula( const OUString& rFormula )
maModel.maFormulas.push_back( aContext );
}
-void CondFormatRule::importCfRule( RecordInputStream& rStrm )
+void CondFormatRule::importCfRule( SequenceInputStream& rStrm )
{
sal_Int32 nType, nSubType, nOperator, nFmla1Size, nFmla2Size, nFmla3Size;
sal_uInt16 nFlags;
@@ -251,129 +240,129 @@ void CondFormatRule::importCfRule( RecordInputStream& rStrm )
}
// flags
- maModel.mbStopIfTrue = getFlag( nFlags, OOBIN_CFRULE_STOPIFTRUE );
- maModel.mbBottom = getFlag( nFlags, OOBIN_CFRULE_BOTTOM );
- maModel.mbPercent = getFlag( nFlags, OOBIN_CFRULE_PERCENT );
- maModel.mbAboveAverage = getFlag( nFlags, OOBIN_CFRULE_ABOVEAVERAGE );
+ maModel.mbStopIfTrue = getFlag( nFlags, BIFF12_CFRULE_STOPIFTRUE );
+ maModel.mbBottom = getFlag( nFlags, BIFF12_CFRULE_BOTTOM );
+ maModel.mbPercent = getFlag( nFlags, BIFF12_CFRULE_PERCENT );
+ maModel.mbAboveAverage = getFlag( nFlags, BIFF12_CFRULE_ABOVEAVERAGE );
// no flag for equalAverage, must be determined from subtype below...
// Convert the type/operator settings. This is a real mess...
switch( nType )
{
- case OOBIN_CFRULE_TYPE_CELLIS:
- OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_CELLIS, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+ case BIFF12_CFRULE_TYPE_CELLIS:
+ OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_CELLIS, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
maModel.mnType = XML_cellIs;
- maModel.setBinOperator( nOperator );
+ maModel.setBiffOperator( nOperator );
OSL_ENSURE( maModel.mnOperator != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unknown operator" );
break;
- case OOBIN_CFRULE_TYPE_EXPRESSION:
+ case BIFF12_CFRULE_TYPE_EXPRESSION:
// here we have to look at the subtype to find the real type...
switch( nSubType )
{
- case OOBIN_CFRULE_SUB_EXPRESSION:
+ case BIFF12_CFRULE_SUB_EXPRESSION:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_expression;
break;
- case OOBIN_CFRULE_SUB_UNIQUE:
+ case BIFF12_CFRULE_SUB_UNIQUE:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_uniqueValues;
break;
- case OOBIN_CFRULE_SUB_TEXT:
- maModel.setOobTextType( nOperator );
+ case BIFF12_CFRULE_SUB_TEXT:
+ maModel.setBiff12TextType( nOperator );
OSL_ENSURE( maModel.mnType != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unexpected operator value" );
break;
- case OOBIN_CFRULE_SUB_BLANK:
+ case BIFF12_CFRULE_SUB_BLANK:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_containsBlanks;
break;
- case OOBIN_CFRULE_SUB_NOTBLANK:
+ case BIFF12_CFRULE_SUB_NOTBLANK:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_notContainsBlanks;
break;
- case OOBIN_CFRULE_SUB_ERROR:
+ case BIFF12_CFRULE_SUB_ERROR:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_containsErrors;
break;
- case OOBIN_CFRULE_SUB_NOTERROR:
+ case BIFF12_CFRULE_SUB_NOTERROR:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_notContainsErrors;
break;
- case OOBIN_CFRULE_SUB_TODAY:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_TODAY, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_TODAY:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_TODAY, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_today;
break;
- case OOBIN_CFRULE_SUB_TOMORROW:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_TOMORROW, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_TOMORROW:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_TOMORROW, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_tomorrow;
break;
- case OOBIN_CFRULE_SUB_YESTERDAY:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_YESTERDAY, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_YESTERDAY:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_YESTERDAY, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_yesterday;
break;
- case OOBIN_CFRULE_SUB_LAST7DAYS:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LAST7DAYS, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_LAST7DAYS:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LAST7DAYS, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_last7Days;
break;
- case OOBIN_CFRULE_SUB_LASTMONTH:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LASTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_LASTMONTH:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LASTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_lastMonth;
break;
- case OOBIN_CFRULE_SUB_NEXTMONTH:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_NEXTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_NEXTMONTH:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_NEXTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_nextMonth;
break;
- case OOBIN_CFRULE_SUB_THISWEEK:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_THISWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_THISWEEK:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_THISWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_thisWeek;
break;
- case OOBIN_CFRULE_SUB_NEXTWEEK:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_NEXTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_NEXTWEEK:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_NEXTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_nextWeek;
break;
- case OOBIN_CFRULE_SUB_LASTWEEK:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LASTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_LASTWEEK:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LASTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_lastWeek;
break;
- case OOBIN_CFRULE_SUB_THISMONTH:
- OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_THISMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
+ case BIFF12_CFRULE_SUB_THISMONTH:
+ OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_THISMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
maModel.mnType = XML_timePeriod;
maModel.mnTimePeriod = XML_thisMonth;
break;
- case OOBIN_CFRULE_SUB_ABOVEAVERAGE:
+ case BIFF12_CFRULE_SUB_ABOVEAVERAGE:
OSL_ENSURE( maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
maModel.mnType = XML_aboveAverage;
maModel.mnStdDev = nOperator; // operator field used for standard deviation
maModel.mbAboveAverage = true;
maModel.mbEqualAverage = false; // does not exist as real flag...
break;
- case OOBIN_CFRULE_SUB_BELOWAVERAGE:
+ case BIFF12_CFRULE_SUB_BELOWAVERAGE:
OSL_ENSURE( !maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
maModel.mnType = XML_aboveAverage;
maModel.mnStdDev = nOperator; // operator field used for standard deviation
maModel.mbAboveAverage = false;
maModel.mbEqualAverage = false; // does not exist as real flag...
break;
- case OOBIN_CFRULE_SUB_DUPLICATE:
+ case BIFF12_CFRULE_SUB_DUPLICATE:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_duplicateValues;
break;
- case OOBIN_CFRULE_SUB_EQABOVEAVERAGE:
+ case BIFF12_CFRULE_SUB_EQABOVEAVERAGE:
OSL_ENSURE( maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
maModel.mnType = XML_aboveAverage;
maModel.mnStdDev = nOperator; // operator field used for standard deviation
maModel.mbAboveAverage = true;
maModel.mbEqualAverage = true; // does not exist as real flag...
break;
- case OOBIN_CFRULE_SUB_EQBELOWAVERAGE:
+ case BIFF12_CFRULE_SUB_EQBELOWAVERAGE:
OSL_ENSURE( !maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
maModel.mnType = XML_aboveAverage;
maModel.mnStdDev = nOperator; // operator field used for standard deviation
@@ -382,23 +371,23 @@ void CondFormatRule::importCfRule( RecordInputStream& rStrm )
break;
}
break;
- case OOBIN_CFRULE_TYPE_COLORSCALE:
- OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_COLORSCALE, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+ case BIFF12_CFRULE_TYPE_COLORSCALE:
+ OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_COLORSCALE, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_colorScale;
break;
- case OOBIN_CFRULE_TYPE_DATABAR:
- OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_DATABAR, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+ case BIFF12_CFRULE_TYPE_DATABAR:
+ OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_DATABAR, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_dataBar;
break;
- case OOBIN_CFRULE_TYPE_TOPTEN:
- OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_TOPTEN, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+ case BIFF12_CFRULE_TYPE_TOPTEN:
+ OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_TOPTEN, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
maModel.mnType = XML_top10;
maModel.mnRank = nOperator; // operator field used for rank value
break;
- case OOBIN_CFRULE_TYPE_ICONSET:
- OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_ICONSET, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+ case BIFF12_CFRULE_TYPE_ICONSET:
+ OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_ICONSET, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
maModel.mnType = XML_iconSet;
break;
@@ -418,7 +407,7 @@ void CondFormatRule::importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority )
static const sal_Int32 spnTypeIds[] = { XML_TOKEN_INVALID, XML_cellIs, XML_expression };
maModel.mnType = STATIC_ARRAY_SELECT( spnTypeIds, nType, XML_TOKEN_INVALID );
- maModel.setBinOperator( nOperator );
+ maModel.setBiffOperator( nOperator );
maModel.mnPriority = nPriority;
maModel.mbStopIfTrue = true;
@@ -658,7 +647,7 @@ CondFormatRuleRef CondFormat::importCfRule( const AttributeList& rAttribs )
return xRule;
}
-void CondFormat::importCondFormatting( RecordInputStream& rStrm )
+void CondFormat::importCondFormatting( SequenceInputStream& rStrm )
{
BinRangeList aRanges;
rStrm.skip( 8 );
@@ -666,7 +655,7 @@ void CondFormat::importCondFormatting( RecordInputStream& rStrm )
getAddressConverter().convertToCellRangeList( maModel.maRanges, aRanges, getSheetIndex(), true );
}
-void CondFormat::importCfRule( RecordInputStream& rStrm )
+void CondFormat::importCfRule( SequenceInputStream& rStrm )
{
CondFormatRuleRef xRule = createRule();
xRule->importCfRule( rStrm );
@@ -694,18 +683,17 @@ void CondFormat::importCfHeader( BiffInputStream& rStrm )
void CondFormat::finalizeImport()
{
- Reference< XSheetCellRanges > xRanges = getCellRangeList( maModel.maRanges );
- if( xRanges.is() )
+ try
{
+ Reference< XSheetCellRanges > xRanges( getCellRangeList( maModel.maRanges ), UNO_SET_THROW );
PropertySet aPropSet( xRanges );
- Reference< XSheetConditionalEntries > xEntries;
- aPropSet.getProperty( xEntries, PROP_ConditionalFormat );
- if( xEntries.is() )
- {
- // maRules is sorted by rule priority
- maRules.forEachMem( &CondFormatRule::finalizeImport, ::boost::cref( xEntries ) );
- aPropSet.setProperty( PROP_ConditionalFormat, xEntries );
- }
+ Reference< XSheetConditionalEntries > xEntries( aPropSet.getAnyProperty( PROP_ConditionalFormat ), UNO_QUERY_THROW );
+ // maRules is sorted by rule priority
+ maRules.forEachMem( &CondFormatRule::finalizeImport, ::boost::cref( xEntries ) );
+ aPropSet.setProperty( PROP_ConditionalFormat, xEntries );
+ }
+ catch( Exception& )
+ {
}
}
@@ -737,7 +725,7 @@ CondFormatRef CondFormatBuffer::importConditionalFormatting( const AttributeList
return xCondFmt;
}
-CondFormatRef CondFormatBuffer::importCondFormatting( RecordInputStream& rStrm )
+CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm )
{
CondFormatRef xCondFmt = createCondFormat();
xCondFmt->importCondFormatting( rStrm );
@@ -784,4 +772,3 @@ CondFormatRef CondFormatBuffer::createCondFormat()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/condformatcontext.cxx b/oox/source/xls/condformatcontext.cxx
index 8cd3a33615fc..091dc11fb614 100644
--- a/oox/source/xls/condformatcontext.cxx
+++ b/oox/source/xls/condformatcontext.cxx
@@ -27,22 +27,22 @@
#include "oox/xls/condformatcontext.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-
namespace oox {
namespace xls {
// ============================================================================
-OoxCondFormatContext::OoxCondFormatContext( OoxWorksheetFragmentBase& rFragment ) :
- OoxWorksheetContextBase( rFragment )
+using ::oox::core::ContextHandlerRef;
+using ::rtl::OUString;
+
+// ============================================================================
+
+CondFormatContext::CondFormatContext( WorksheetFragmentBase& rFragment ) :
+ WorksheetContextBase( rFragment )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxCondFormatContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef CondFormatContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
@@ -54,7 +54,7 @@ ContextHandlerRef OoxCondFormatContext::onCreateContext( sal_Int32 nElement, con
return 0;
}
-void OoxCondFormatContext::onStartElement( const AttributeList& rAttribs )
+void CondFormatContext::onStartElement( const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -67,34 +67,30 @@ void OoxCondFormatContext::onStartElement( const AttributeList& rAttribs )
}
}
-void OoxCondFormatContext::onEndElement( const OUString& rChars )
+void CondFormatContext::onCharacters( const OUString& rChars )
{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( formula ):
- if( mxCondFmt.get() && mxRule.get() ) mxRule->appendFormula( rChars );
- break;
- }
+ if( isCurrentElement( XLS_TOKEN( formula ) ) && mxCondFmt.get() && mxRule.get() )
+ mxRule->appendFormula( rChars );
}
-ContextHandlerRef OoxCondFormatContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef CondFormatContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_CONDFORMATTING:
- return (nRecId == OOBIN_ID_CFRULE) ? this : 0;
+ case BIFF12_ID_CONDFORMATTING:
+ return (nRecId == BIFF12_ID_CFRULE) ? this : 0;
}
return 0;
}
-void OoxCondFormatContext::onStartRecord( RecordInputStream& rStrm )
+void CondFormatContext::onStartRecord( SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_CONDFORMATTING:
+ case BIFF12_ID_CONDFORMATTING:
mxCondFmt = getCondFormats().importCondFormatting( rStrm );
break;
- case OOBIN_ID_CFRULE:
+ case BIFF12_ID_CFRULE:
if( mxCondFmt.get() ) mxCondFmt->importCfRule( rStrm );
break;
}
@@ -104,4 +100,3 @@ void OoxCondFormatContext::onStartRecord( RecordInputStream& rStrm )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/connectionsbuffer.cxx b/oox/source/xls/connectionsbuffer.cxx
new file mode 100755
index 000000000000..6d0fcd65122f
--- /dev/null
+++ b/oox/source/xls/connectionsbuffer.cxx
@@ -0,0 +1,501 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "oox/xls/connectionsbuffer.hxx"
+
+#include "oox/helper/attributelist.hxx"
+#include "oox/xls/biffinputstream.hxx"
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
+namespace {
+
+const sal_Int32 BIFF12_RECONNECT_AS_REQUIRED = 1;
+const sal_Int32 BIFF12_RECONNECT_ALWAYS = 2;
+const sal_Int32 BIFF12_RECONNECT_NEVER = 3;
+
+const sal_uInt8 BIFF12_CONNECTION_SAVEPASSWORD_ON = 1;
+const sal_uInt8 BIFF12_CONNECTION_SAVEPASSWORD_OFF = 2;
+
+const sal_uInt16 BIFF12_CONNECTION_KEEPALIVE = 0x0001;
+const sal_uInt16 BIFF12_CONNECTION_NEW = 0x0002;
+const sal_uInt16 BIFF12_CONNECTION_DELETED = 0x0004;
+const sal_uInt16 BIFF12_CONNECTION_ONLYUSECONNFILE = 0x0008;
+const sal_uInt16 BIFF12_CONNECTION_BACKGROUND = 0x0010;
+const sal_uInt16 BIFF12_CONNECTION_REFRESHONLOAD = 0x0020;
+const sal_uInt16 BIFF12_CONNECTION_SAVEDATA = 0x0040;
+
+const sal_uInt16 BIFF12_CONNECTION_HAS_SOURCEFILE = 0x0001;
+const sal_uInt16 BIFF12_CONNECTION_HAS_SOURCECONNFILE = 0x0002;
+const sal_uInt16 BIFF12_CONNECTION_HAS_DESCRIPTION = 0x0004;
+const sal_uInt16 BIFF12_CONNECTION_HAS_NAME = 0x0008;
+const sal_uInt16 BIFF12_CONNECTION_HAS_SSOID = 0x0010;
+
+const sal_uInt32 BIFF12_WEBPR_XML = 0x00000100;
+const sal_uInt32 BIFF12_WEBPR_SOURCEDATA = 0x00000200;
+const sal_uInt32 BIFF12_WEBPR_PARSEPRE = 0x00000400;
+const sal_uInt32 BIFF12_WEBPR_CONSECUTIVE = 0x00000800;
+const sal_uInt32 BIFF12_WEBPR_FIRSTROW = 0x00001000;
+const sal_uInt32 BIFF12_WEBPR_XL97CREATED = 0x00002000;
+const sal_uInt32 BIFF12_WEBPR_TEXTDATES = 0x00004000;
+const sal_uInt32 BIFF12_WEBPR_XL2000REFRESHED = 0x00008000;
+const sal_uInt32 BIFF12_WEBPR_HTMLTABLES = 0x00010000;
+
+const sal_uInt8 BIFF12_WEBPR_HAS_POSTMETHOD = 0x01;
+const sal_uInt8 BIFF12_WEBPR_HAS_EDITPAGE = 0x02;
+const sal_uInt8 BIFF12_WEBPR_HAS_URL = 0x04;
+
+const sal_uInt16 BIFF_DBQUERY_ODBC = 0x0008;
+const sal_uInt16 BIFF_DBQUERY_SQLQUERY = 0x0010;
+const sal_uInt16 BIFF_DBQUERY_SERVERBASEDSQL = 0x0020;
+const sal_uInt16 BIFF_DBQUERY_HTML = 0x0040;
+const sal_uInt16 BIFF_DBQUERY_SAVEPASSWORD = 0x0080;
+const sal_uInt16 BIFF_DBQUERY_HTMLTABLES = 0x0100;
+
+const sal_uInt16 BIFF_QTSETTINGS_KEEPALIVE = 0x0001;
+const sal_uInt16 BIFF_QTSETTINGS_NEW = 0x0002;
+const sal_uInt16 BIFF_QTSETTINGS_SOURCEDATA = 0x0004;
+const sal_uInt16 BIFF_QTSETTINGS_WEBBASEDPROV = 0x0008;
+const sal_uInt16 BIFF_QTSETTINGS_REINITLIST = 0x0010;
+const sal_uInt16 BIFF_QTSETTINGS_XML = 0x0080;
+
+const sal_uInt16 BIFF_QTSETTINGS_PARSEPRE = 0x0001;
+const sal_uInt16 BIFF_QTSETTINGS_CONSECUTIVE = 0x0002;
+const sal_uInt16 BIFF_QTSETTINGS_FIRSTROW = 0x0004;
+const sal_uInt16 BIFF_QTSETTINGS_XL97CREATED = 0x0008;
+const sal_uInt16 BIFF_QTSETTINGS_TEXTDATES = 0x0010;
+const sal_uInt16 BIFF_QTSETTINGS_XL2000REFRESHED = 0x0020;
+
+const sal_uInt16 BIFF_QTSETTINGS_TEXTQUERY = 0x0001;
+const sal_uInt16 BIFF_QTSETTINGS_TABLENAMES = 0x0002;
+
+// ----------------------------------------------------------------------------
+
+OUString lclReadQueryString( BiffInputStream& rStrm, sal_uInt16 nCount )
+{
+ bool bValidRec = true;
+ OUStringBuffer aBuffer;
+ for( sal_uInt16 nIndex = 0; bValidRec && (nIndex < nCount); ++nIndex )
+ {
+ bValidRec = (rStrm.getNextRecId() == BIFF_ID_PCITEM_STRING) && rStrm.startNextRecord();
+ if( bValidRec )
+ aBuffer.append( rStrm.readUniString() );
+ }
+ OSL_ENSURE( bValidRec, "lclReadQueryString - missing PCITEM_STRING records" );
+ return aBuffer.makeStringAndClear();
+}
+
+void lclParseTables( WebPrModel::TablesVector& rTables, const OUString& rTableNames )
+{
+ rTables.clear();
+ OUString aTableNames = rTableNames.trim();
+ while( aTableNames.getLength() > 0 )
+ {
+ sal_Int32 nSep = -1;
+ // table names are enclosed in double quotes
+ if( aTableNames[ 0 ] == '"' )
+ {
+ // search closing quote character
+ sal_Int32 nEndQuote = aTableNames.indexOf( '"', 1 );
+ OSL_ENSURE( nEndQuote >= 1, "lclParseTables - invalid syntax" );
+ if( nEndQuote < 0 )
+ nEndQuote = aTableNames.getLength();
+ else
+ nSep = aTableNames.indexOf( ',', nEndQuote + 1 );
+ // extract text between quote characters
+ OUString aTableName = aTableNames.copy( 1, nEndQuote - 1 ).trim();
+ if( aTableName.getLength() > 0 )
+ rTables.push_back( Any( aTableName ) );
+ else
+ rTables.push_back( Any() );
+ }
+ else
+ {
+ nSep = aTableNames.indexOf( ',' );
+ if( nSep < 0 )
+ nSep = aTableNames.getLength();
+ OUString aTableIndex = aTableNames.copy( 0, nSep ).trim();
+ if( (aTableIndex.getLength() > 0) && (aTableIndex[ 0 ] >= '1') && (aTableIndex[ 0 ] <= '9') )
+ rTables.push_back( Any( aTableIndex.toInt32() ) );
+ else
+ rTables.push_back( Any() );
+ }
+
+ // remove processed item from aTableNames
+ if( (nSep < 0) || (nSep >= aTableNames.getLength()) )
+ aTableNames = OUString();
+ else
+ aTableNames = aTableNames.copy( nSep + 1 ).trim();
+ }
+}
+
+} // namespace
+
+// ============================================================================
+
+WebPrModel::WebPrModel() :
+ mnHtmlFormat( XML_none ),
+ mbXml( false ),
+ mbSourceData( false ),
+ mbParsePre( false ),
+ mbConsecutive( false ),
+ mbFirstRow( false ),
+ mbXl97Created( false ),
+ mbTextDates( false ),
+ mbXl2000Refreshed( false ),
+ mbHtmlTables( false )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+ConnectionModel::ConnectionModel() :
+ mnId( -1 ),
+ mnType( BIFF12_CONNECTION_UNKNOWN ),
+ mnReconnectMethod( BIFF12_RECONNECT_AS_REQUIRED ),
+ mnCredentials( XML_integrated ),
+ mnInterval( 0 ),
+ mbKeepAlive( false ),
+ mbNew( false ),
+ mbDeleted( false ),
+ mbOnlyUseConnFile( false ),
+ mbBackground( false ),
+ mbRefreshOnLoad( false ),
+ mbSaveData( false ),
+ mbSavePassword( false )
+{
+}
+
+WebPrModel& ConnectionModel::createWebPr()
+{
+ OSL_ENSURE( !mxWebPr.get(), "ConnectionModel::createWebPr - multiple call" );
+ mxWebPr.reset( new WebPrModel );
+ return *mxWebPr;
+}
+
+// ----------------------------------------------------------------------------
+
+Connection::Connection( const WorkbookHelper& rHelper, sal_Int32 nConnId ) :
+ WorkbookHelper( rHelper )
+{
+ maModel.mnId = nConnId;
+}
+
+void Connection::importConnection( const AttributeList& rAttribs )
+{
+ maModel.maName = rAttribs.getXString( XML_name, OUString() );
+ maModel.maDescription = rAttribs.getXString( XML_description, OUString() );
+ maModel.maSourceFile = rAttribs.getXString( XML_sourceFile, OUString() );
+ maModel.maSourceConnFile = rAttribs.getXString( XML_odcFile, OUString() );
+ maModel.maSsoId = rAttribs.getXString( XML_singleSignOnId, OUString() );
+ maModel.mnId = rAttribs.getInteger( XML_id, -1 );
+ // type and reconnectionMethod are using the BIFF12 constants instead of XML tokens
+ maModel.mnType = rAttribs.getInteger( XML_type, BIFF12_CONNECTION_UNKNOWN );
+ maModel.mnReconnectMethod = rAttribs.getInteger( XML_reconnectionMethod, BIFF12_RECONNECT_AS_REQUIRED );
+ maModel.mnCredentials = rAttribs.getToken( XML_credentials, XML_integrated );
+ maModel.mnInterval = rAttribs.getInteger( XML_interval, 0 );
+ maModel.mbKeepAlive = rAttribs.getBool( XML_keepAlive, false );
+ maModel.mbNew = rAttribs.getBool( XML_new, false );
+ maModel.mbDeleted = rAttribs.getBool( XML_deleted, false );
+ maModel.mbOnlyUseConnFile = rAttribs.getBool( XML_onlyUseConnectionFile, false );
+ maModel.mbBackground = rAttribs.getBool( XML_background, false );
+ maModel.mbRefreshOnLoad = rAttribs.getBool( XML_refreshOnLoad, false );
+ maModel.mbSaveData = rAttribs.getBool( XML_saveData, false );
+ maModel.mbSavePassword = rAttribs.getBool( XML_savePassword, false );
+}
+
+void Connection::importWebPr( const AttributeList& rAttribs )
+{
+ WebPrModel& rWebPr = maModel.createWebPr();
+
+ rWebPr.maUrl = rAttribs.getXString( XML_url, OUString() );
+ rWebPr.maPostMethod = rAttribs.getXString( XML_post, OUString() );
+ rWebPr.maEditPage = rAttribs.getXString( XML_editPage, OUString() );
+ rWebPr.mnHtmlFormat = rAttribs.getToken( XML_htmlFormat, XML_none );
+ rWebPr.mbXml = rAttribs.getBool( XML_xml, false );
+ rWebPr.mbSourceData = rAttribs.getBool( XML_sourceData, false );
+ rWebPr.mbParsePre = rAttribs.getBool( XML_parsePre, false );
+ rWebPr.mbConsecutive = rAttribs.getBool( XML_consecutive, false );
+ rWebPr.mbFirstRow = rAttribs.getBool( XML_firstRow, false );
+ rWebPr.mbXl97Created = rAttribs.getBool( XML_xl97, false );
+ rWebPr.mbTextDates = rAttribs.getBool( XML_textDates, false );
+ rWebPr.mbXl2000Refreshed = rAttribs.getBool( XML_xl2000, false );
+ rWebPr.mbHtmlTables = rAttribs.getBool( XML_htmlTables, false );
+}
+
+void Connection::importTables( const AttributeList& /*rAttribs*/ )
+{
+ if( maModel.mxWebPr.get() )
+ {
+ OSL_ENSURE( maModel.mxWebPr->maTables.empty(), "Connection::importTables - multiple calls" );
+ maModel.mxWebPr->maTables.clear();
+ }
+}
+
+void Connection::importTable( const AttributeList& rAttribs, sal_Int32 nElement )
+{
+ if( maModel.mxWebPr.get() )
+ {
+ Any aTableAny;
+ switch( nElement )
+ {
+ case XLS_TOKEN( m ): break;
+ case XLS_TOKEN( s ): aTableAny <<= rAttribs.getXString( XML_v, OUString() ); break;
+ case XLS_TOKEN( x ): aTableAny <<= rAttribs.getInteger( XML_v, -1 ); break;
+ default:
+ OSL_ENSURE( false, "Connection::importTable - unexpected element" );
+ return;
+ }
+ maModel.mxWebPr->maTables.push_back( aTableAny );
+ }
+}
+
+void Connection::importConnection( SequenceInputStream& rStrm )
+{
+ sal_uInt16 nFlags, nStrFlags;
+ sal_uInt8 nSavePassword, nCredentials;
+ rStrm.skip( 2 );
+ rStrm >> nSavePassword;
+ rStrm.skip( 1 );
+ maModel.mnInterval = rStrm.readuInt16();
+ rStrm >> nFlags >> nStrFlags >> maModel.mnType >> maModel.mnReconnectMethod >> maModel.mnId >> nCredentials;
+
+ if( getFlag( nStrFlags, BIFF12_CONNECTION_HAS_SOURCEFILE ) )
+ rStrm >> maModel.maSourceFile;
+ if( getFlag( nStrFlags, BIFF12_CONNECTION_HAS_SOURCECONNFILE ) )
+ rStrm >> maModel.maSourceConnFile;
+ if( getFlag( nStrFlags, BIFF12_CONNECTION_HAS_DESCRIPTION ) )
+ rStrm >> maModel.maDescription;
+ if( getFlag( nStrFlags, BIFF12_CONNECTION_HAS_NAME ) )
+ rStrm >> maModel.maName;
+ if( getFlag( nStrFlags, BIFF12_CONNECTION_HAS_SSOID ) )
+ rStrm >> maModel.maSsoId;
+
+ static const sal_Int32 spnCredentials[] = { XML_integrated, XML_none, XML_stored, XML_prompt };
+ maModel.mnCredentials = STATIC_ARRAY_SELECT( spnCredentials, nCredentials, XML_integrated );
+
+ maModel.mbKeepAlive = getFlag( nFlags, BIFF12_CONNECTION_KEEPALIVE );
+ maModel.mbNew = getFlag( nFlags, BIFF12_CONNECTION_NEW );
+ maModel.mbDeleted = getFlag( nFlags, BIFF12_CONNECTION_DELETED );
+ maModel.mbOnlyUseConnFile = getFlag( nFlags, BIFF12_CONNECTION_ONLYUSECONNFILE );
+ maModel.mbBackground = getFlag( nFlags, BIFF12_CONNECTION_BACKGROUND );
+ maModel.mbRefreshOnLoad = getFlag( nFlags, BIFF12_CONNECTION_REFRESHONLOAD );
+ maModel.mbSaveData = getFlag( nFlags, BIFF12_CONNECTION_SAVEDATA );
+ maModel.mbSavePassword = nSavePassword == BIFF12_CONNECTION_SAVEPASSWORD_ON;
+}
+
+void Connection::importWebPr( SequenceInputStream& rStrm )
+{
+ WebPrModel& rWebPr = maModel.createWebPr();
+
+ sal_uInt32 nFlags;
+ sal_uInt8 nStrFlags;
+ rStrm >> nFlags >> nStrFlags;
+
+ if( getFlag( nStrFlags, BIFF12_WEBPR_HAS_URL ) )
+ rStrm >> rWebPr.maUrl;
+ if( getFlag( nStrFlags, BIFF12_WEBPR_HAS_POSTMETHOD ) )
+ rStrm >> rWebPr.maPostMethod;
+ if( getFlag( nStrFlags, BIFF12_WEBPR_HAS_EDITPAGE ) )
+ rStrm >> rWebPr.maEditPage;
+
+ static const sal_Int32 spnHmlFormats[] = { XML_none, XML_rtf, XML_all };
+ rWebPr.mnHtmlFormat = STATIC_ARRAY_SELECT( spnHmlFormats, extractValue< sal_uInt8 >( nFlags, 0, 8 ), XML_none );
+
+ rWebPr.mbXml = getFlag( nFlags, BIFF12_WEBPR_XML );
+ rWebPr.mbSourceData = getFlag( nFlags, BIFF12_WEBPR_SOURCEDATA );
+ rWebPr.mbParsePre = getFlag( nFlags, BIFF12_WEBPR_PARSEPRE );
+ rWebPr.mbConsecutive = getFlag( nFlags, BIFF12_WEBPR_CONSECUTIVE );
+ rWebPr.mbFirstRow = getFlag( nFlags, BIFF12_WEBPR_FIRSTROW );
+ rWebPr.mbXl97Created = getFlag( nFlags, BIFF12_WEBPR_XL97CREATED );
+ rWebPr.mbTextDates = getFlag( nFlags, BIFF12_WEBPR_TEXTDATES );
+ rWebPr.mbXl2000Refreshed = getFlag( nFlags, BIFF12_WEBPR_XL2000REFRESHED );
+ rWebPr.mbHtmlTables = getFlag( nFlags, BIFF12_WEBPR_HTMLTABLES );
+}
+
+void Connection::importWebPrTables( SequenceInputStream& /*rStrm*/ )
+{
+ if( maModel.mxWebPr.get() )
+ {
+ OSL_ENSURE( maModel.mxWebPr->maTables.empty(), "Connection::importWebPrTables - multiple calls" );
+ maModel.mxWebPr->maTables.clear();
+ }
+}
+
+void Connection::importWebPrTable( SequenceInputStream& rStrm, sal_Int32 nRecId )
+{
+ if( maModel.mxWebPr.get() )
+ {
+ Any aTableAny;
+ switch( nRecId )
+ {
+ case BIFF12_ID_PCITEM_MISSING: break;
+ case BIFF12_ID_PCITEM_STRING: aTableAny <<= BiffHelper::readString( rStrm ); break;
+ case BIFF12_ID_PCITEM_INDEX: aTableAny <<= rStrm.readInt32(); break;
+ default:
+ OSL_ENSURE( false, "Connection::importWebPrTable - unexpected record" );
+ return;
+ }
+ maModel.mxWebPr->maTables.push_back( aTableAny );
+ }
+}
+
+void Connection::importDbQuery( BiffInputStream& rStrm )
+{
+ sal_uInt16 nFlags, nSqlParamCount, nCommandCount, nPostMethodCount, nServerSqlCount, nOdbcConnCount;
+ rStrm >> nFlags >> nSqlParamCount >> nCommandCount >> nPostMethodCount >> nServerSqlCount >> nOdbcConnCount;
+
+ // same type constants in all BIFF versions
+ maModel.mnType = extractValue< sal_Int32 >( nFlags, 0, 3 );
+ maModel.mbSavePassword = getFlag( nFlags, BIFF_DBQUERY_SAVEPASSWORD );
+
+ OSL_ENSURE( getFlag( nFlags, BIFF_DBQUERY_ODBC ) == (maModel.mnType == BIFF12_CONNECTION_ODBC), "Connection::importDbQuery - wrong ODBC flag" );
+ OSL_ENSURE( getFlag( nFlags, BIFF_DBQUERY_SQLQUERY ) != (maModel.mnType == BIFF12_CONNECTION_HTML), "Connection::importDbQuery - wrong SQL query flag" );
+ OSL_ENSURE( getFlag( nFlags, BIFF_DBQUERY_HTML ) == (maModel.mnType == BIFF12_CONNECTION_HTML), "Connection::importDbQuery - wrong HTML flag" );
+
+ if( (maModel.mnType == BIFF12_CONNECTION_HTML) && getFlag( nFlags, BIFF_DBQUERY_HTML ) )
+ {
+ WebPrModel& rWebPr = maModel.createWebPr();
+ rWebPr.mbHtmlTables = getFlag( nFlags, BIFF_DBQUERY_HTMLTABLES );
+
+ // read HTML query URL and post method
+ rWebPr.maUrl = lclReadQueryString( rStrm, nCommandCount );
+ rWebPr.maPostMethod = lclReadQueryString( rStrm, nPostMethodCount );
+ }
+}
+
+void Connection::importQueryTableSettings( BiffInputStream& rStrm )
+{
+ rStrm.skip( 4 );
+ // source data type, again
+ sal_uInt16 nType = rStrm.readuInt16();
+ OSL_ENSURE( nType == maModel.mnType, "Connection::importQueryTableSettings - source data type mismatch" );
+ if( nType == maModel.mnType )
+ {
+ sal_uInt16 nFlags1, nFlags2, nFlags3, nHtmlFormat;
+ rStrm >> nFlags1 >> nFlags2 >> nFlags3;
+ rStrm.skip( 10 );
+ maModel.mnInterval = rStrm.readuInt16();
+ rStrm >> nHtmlFormat;
+
+ // first flags field: generic connection flags
+ maModel.mbKeepAlive = getFlag( nFlags1, BIFF_QTSETTINGS_KEEPALIVE );
+ maModel.mbNew = getFlag( nFlags1, BIFF_QTSETTINGS_NEW );
+
+ // meaning of second flags field is dependent on source data type
+ if( (maModel.mnType == BIFF12_CONNECTION_HTML) && maModel.mxWebPr.get() )
+ {
+ WebPrModel& rWebPr = *maModel.mxWebPr;
+
+ // HTML format is one-based in BIFF8 (but zero-based in BIFF12)
+ static const sal_Int32 spnHmlFormats[] = { XML_none, XML_none, XML_rtf, XML_all };
+ rWebPr.mnHtmlFormat = STATIC_ARRAY_SELECT( spnHmlFormats, nHtmlFormat, XML_none );
+
+ rWebPr.mbXml = getFlag( nFlags1, BIFF_QTSETTINGS_XML );
+ rWebPr.mbSourceData = getFlag( nFlags1, BIFF_QTSETTINGS_SOURCEDATA );
+ rWebPr.mbParsePre = getFlag( nFlags2, BIFF_QTSETTINGS_PARSEPRE );
+ rWebPr.mbConsecutive = getFlag( nFlags2, BIFF_QTSETTINGS_CONSECUTIVE );
+ rWebPr.mbFirstRow = getFlag( nFlags2, BIFF_QTSETTINGS_FIRSTROW );
+ rWebPr.mbXl97Created = getFlag( nFlags2, BIFF_QTSETTINGS_XL97CREATED );
+ rWebPr.mbTextDates = getFlag( nFlags2, BIFF_QTSETTINGS_TEXTDATES );
+ rWebPr.mbXl2000Refreshed = getFlag( nFlags2, BIFF_QTSETTINGS_XL2000REFRESHED );
+
+ // list of HTML table names or indexes
+ if( getFlag( nFlags3, BIFF_QTSETTINGS_TABLENAMES ) )
+ {
+ // a QUERYTABLESTRING record containing the table names must follow
+ bool bHasQTString = (rStrm.getNextRecId() == BIFF_ID_QUERYTABLESTRING) && rStrm.startNextRecord();
+ OSL_ENSURE( bHasQTString, "Connection::importQueryTableSettings - missing QUERYTABLESTRING record" );
+ if( bHasQTString )
+ {
+ rStrm.skip( 4 );
+ lclParseTables( rWebPr.maTables, rStrm.readUniString() );
+ }
+ }
+ }
+ }
+}
+
+// ============================================================================
+
+ConnectionsBuffer::ConnectionsBuffer( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper ),
+ mnUnusedId( 1 )
+{
+}
+
+Connection& ConnectionsBuffer::createConnection()
+{
+ ConnectionRef xConnection( new Connection( *this ) );
+ maConnections.push_back( xConnection );
+ return *xConnection;
+}
+
+Connection& ConnectionsBuffer::createConnectionWithId()
+{
+ ConnectionRef xConnection( new Connection( *this, mnUnusedId ) );
+ maConnections.push_back( xConnection );
+ insertConnectionToMap( xConnection );
+ return *xConnection;
+}
+
+void ConnectionsBuffer::finalizeImport()
+{
+ for( ConnectionVector::iterator aIt = maConnections.begin(), aEnd = maConnections.end(); aIt != aEnd; ++aIt )
+ insertConnectionToMap( *aIt );
+}
+
+ConnectionRef ConnectionsBuffer::getConnection( sal_Int32 nConnId ) const
+{
+ return maConnectionsById.get( nConnId );
+}
+
+void ConnectionsBuffer::insertConnectionToMap( const ConnectionRef& rxConnection )
+{
+ sal_Int32 nConnId = rxConnection->getConnectionId();
+ if( nConnId > 0 )
+ {
+ OSL_ENSURE( !maConnectionsById.has( nConnId ), "ConnectionsBuffer::insertConnectionToMap - multiple connection identifier" );
+ maConnectionsById[ nConnId ] = rxConnection;
+ mnUnusedId = ::std::max< sal_Int32 >( mnUnusedId, nConnId + 1 );
+ }
+}
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
diff --git a/oox/source/xls/connectionsfragment.cxx b/oox/source/xls/connectionsfragment.cxx
index f19204306d1b..7aafcd84cd7e 100644
--- a/oox/source/xls/connectionsfragment.cxx
+++ b/oox/source/xls/connectionsfragment.cxx
@@ -26,88 +26,154 @@
************************************************************************/
#include "oox/xls/connectionsfragment.hxx"
-#include "oox/helper/attributelist.hxx"
-#include "oox/xls/webquerybuffer.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
+#include "oox/helper/attributelist.hxx"
+#include "oox/xls/biffhelper.hxx"
+#include "oox/xls/connectionsbuffer.hxx"
namespace oox {
namespace xls {
-OoxConnectionsFragment::OoxConnectionsFragment( const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath )
+// ============================================================================
+
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+ConnectionContext::ConnectionContext( WorkbookFragmentBase& rParent, Connection& rConnection ) :
+ WorkbookContextBase( rParent ),
+ mrConnection( rConnection )
{
}
-ContextHandlerRef OoxConnectionsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ConnectionContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
- case XML_ROOT_CONTEXT:
- if( nElement == XLS_TOKEN( connections ) ) return this;
- break;
-
- case XLS_TOKEN( connections ):
- switch( nElement )
+ case XLS_TOKEN( connection ):
+ if( nElement == XLS_TOKEN( webPr ) )
{
- case XLS_TOKEN( connection ): importConnection( rAttribs ); return this;
+ mrConnection.importWebPr( rAttribs );
+ return this;
}
break;
- case XLS_TOKEN( connection ):
- switch( nElement )
+ case XLS_TOKEN( webPr ):
+ if( nElement == XLS_TOKEN( tables ) )
{
- case XLS_TOKEN( webPr ): importWebPr( rAttribs ); return this;
+ mrConnection.importTables( rAttribs );
+ return this;
}
break;
- case XLS_TOKEN( webPr ):
- switch( nElement )
+ case XLS_TOKEN( tables ):
+ mrConnection.importTable( rAttribs, nElement );
+ break;
+ }
+ return 0;
+}
+
+void ConnectionContext::onStartElement( const AttributeList& rAttribs )
+{
+ if( getCurrentElement() == XLS_TOKEN( connection ) )
+ mrConnection.importConnection( rAttribs );
+}
+
+ContextHandlerRef ConnectionContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
+{
+ switch( getCurrentElement() )
+ {
+ case BIFF12_ID_CONNECTION:
+ if( nRecId == BIFF12_ID_WEBPR )
{
- case XLS_TOKEN( tables ): importTables( rAttribs ); return this;
+ mrConnection.importWebPr( rStrm );
+ return this;
}
break;
- case XLS_TOKEN( tables ):
- switch( nElement )
+ case BIFF12_ID_WEBPR:
+ if( nRecId == BIFF12_ID_WEBPRTABLES )
{
- case XLS_TOKEN( s ): importS( rAttribs ); break;
- case XLS_TOKEN( x ): importX( rAttribs ); break;
+ mrConnection.importWebPrTables( rStrm );
+ return this;
}
break;
+
+ case BIFF12_ID_WEBPRTABLES:
+ mrConnection.importWebPrTable( rStrm, nRecId );
+ break;
}
return 0;
}
-void OoxConnectionsFragment::importConnection( const AttributeList& rAttribs )
+void ConnectionContext::onStartRecord( SequenceInputStream& rStrm )
+{
+ if( getCurrentElement() == BIFF12_ID_CONNECTION )
+ mrConnection.importConnection( rStrm );
+}
+
+// ============================================================================
+
+ConnectionsFragment::ConnectionsFragment( const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
+ WorkbookFragmentBase( rHelper, rFragmentPath )
{
- if ( rAttribs.getInteger( XML_type, 0 ) == Connection::CONNECTION_WEBQUERY )
- {
- getWebQueries().importConnection( rAttribs );
- }
}
-void OoxConnectionsFragment::importWebPr( const AttributeList& rAttribs )
+ContextHandlerRef ConnectionsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& /*rAttribs*/ )
{
- getWebQueries().importWebPr( rAttribs );
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nElement == XLS_TOKEN( connections ) )
+ return this;
+ break;
+
+ case XLS_TOKEN( connections ):
+ if( nElement == XLS_TOKEN( connection ) )
+ return new ConnectionContext( *this, getConnections().createConnection() );
+ break;
+ }
+ return 0;
}
-void OoxConnectionsFragment::importTables( const AttributeList& /*rAttribs*/ )
+ContextHandlerRef ConnectionsFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& /*rStrm*/ )
{
-// sal_Int32 nCount = rAttribs.getInteger( XML_count, 0 );
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nRecId == BIFF12_ID_CONNECTIONS )
+ return this;
+ break;
+
+ case BIFF12_ID_CONNECTIONS:
+ if( nRecId == BIFF12_ID_CONNECTION )
+ return new ConnectionContext( *this, getConnections().createConnection() );
+ break;
+ }
+ return 0;
}
-void OoxConnectionsFragment::importS( const AttributeList& /*rAttribs*/ )
+const RecordInfo* ConnectionsFragment::getRecordInfos() const
{
-// OUString aName = rAttribs.getString( XML_v );
+ static const RecordInfo spRecInfos[] =
+ {
+ { BIFF12_ID_CONNECTIONS, BIFF12_ID_CONNECTIONS + 1 },
+ { BIFF12_ID_CONNECTION, BIFF12_ID_CONNECTION + 1 },
+ { BIFF12_ID_WEBPR, BIFF12_ID_WEBPR + 1 },
+ { BIFF12_ID_WEBPRTABLES, BIFF12_ID_WEBPRTABLES + 1 },
+ { -1, -1 }
+ };
+ return spRecInfos;
}
-void OoxConnectionsFragment::importX( const AttributeList& /*rAttribs*/ )
+void ConnectionsFragment::finalizeImport()
{
-// sal_Int32 nSharedId = rAttribs.getInteger( XML_v, 0 );
+ getConnections().finalizeImport();
}
+// ============================================================================
+
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/defnamesbuffer.cxx b/oox/source/xls/defnamesbuffer.cxx
index a02375e2b869..96fcec0042f5 100644
--- a/oox/source/xls/defnamesbuffer.cxx
+++ b/oox/source/xls/defnamesbuffer.cxx
@@ -26,7 +26,7 @@
************************************************************************/
#include "oox/xls/defnamesbuffer.hxx"
-#include <rtl/ustrbuf.hxx>
+
#include <com/sun/star/sheet/ComplexReference.hpp>
#include <com/sun/star/sheet/ExternalReference.hpp>
#include <com/sun/star/sheet/NamedRangeFlag.hpp>
@@ -34,8 +34,9 @@
#include <com/sun/star/sheet/SingleReference.hpp>
#include <com/sun/star/sheet/XFormulaTokens.hpp>
#include <com/sun/star/sheet/XPrintAreas.hpp>
-#include "properties.hxx"
+#include <rtl/ustrbuf.hxx>
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
@@ -43,34 +44,30 @@
#include "oox/xls/formulaparser.hxx"
#include "oox/xls/worksheetbuffer.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::sheet::ComplexReference;
-using ::com::sun::star::sheet::ExternalReference;
-using ::com::sun::star::sheet::SingleReference;
-using ::com::sun::star::sheet::XFormulaTokens;
-using ::com::sun::star::sheet::XPrintAreas;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
-const sal_uInt32 OOBIN_DEFNAME_HIDDEN = 0x00000001;
-const sal_uInt32 OOBIN_DEFNAME_FUNC = 0x00000002;
-const sal_uInt32 OOBIN_DEFNAME_VBNAME = 0x00000004;
-const sal_uInt32 OOBIN_DEFNAME_MACRO = 0x00000008;
-const sal_uInt32 OOBIN_DEFNAME_CALCEXP = 0x00000010;
-const sal_uInt32 OOBIN_DEFNAME_BUILTIN = 0x00000020;
-const sal_uInt32 OOBIN_DEFNAME_PUBLISHED = 0x00008000;
-const sal_uInt32 OOBIN_DEFNAME_WBPARAM = 0x00010000;
+const sal_uInt32 BIFF12_DEFNAME_HIDDEN = 0x00000001;
+const sal_uInt32 BIFF12_DEFNAME_FUNC = 0x00000002;
+const sal_uInt32 BIFF12_DEFNAME_VBNAME = 0x00000004;
+const sal_uInt32 BIFF12_DEFNAME_MACRO = 0x00000008;
+const sal_uInt32 BIFF12_DEFNAME_CALCEXP = 0x00000010;
+const sal_uInt32 BIFF12_DEFNAME_BUILTIN = 0x00000020;
+const sal_uInt32 BIFF12_DEFNAME_PUBLISHED = 0x00008000;
+const sal_uInt32 BIFF12_DEFNAME_WBPARAM = 0x00010000;
const sal_uInt16 BIFF_DEFNAME_HIDDEN = 0x0001;
const sal_uInt16 BIFF_DEFNAME_FUNC = 0x0002;
@@ -84,6 +81,11 @@ const sal_uInt8 BIFF2_DEFNAME_FUNC = 0x02; /// BIFF2 function/comma
const sal_uInt16 BIFF_DEFNAME_GLOBAL = 0; /// 0 = Globally defined name.
+const sal_uInt16 BIFF_REFFLAG_COL1REL = 0x0001;
+const sal_uInt16 BIFF_REFFLAG_ROW1REL = 0x0002;
+const sal_uInt16 BIFF_REFFLAG_COL2REL = 0x0004;
+const sal_uInt16 BIFF_REFFLAG_ROW2REL = 0x0008;
+
// ----------------------------------------------------------------------------
const sal_Char* const spcLegacyPrefix = "Excel_BuiltIn_";
@@ -91,20 +93,20 @@ const sal_Char* const spcOoxPrefix = "_xlnm.";
const sal_Char* const sppcBaseNames[] =
{
- "Consolidate_Area", /* OOX */
+ "Consolidate_Area",
"Auto_Open",
"Auto_Close",
- "Extract", /* OOX */
- "Database", /* OOX */
- "Criteria", /* OOX */
- "Print_Area", /* OOX */
- "Print_Titles", /* OOX */
+ "Extract",
+ "Database",
+ "Criteria",
+ "Print_Area",
+ "Print_Titles",
"Recorder",
"Data_Form",
"Auto_Activate",
"Auto_Deactivate",
- "Sheet_Title", /* OOX */
- "_FilterDatabase" /* OOX */
+ "Sheet_Title",
+ "_FilterDatabase"
};
/** Localized names for _xlnm._FilterDatabase as used in BIFF5. */
@@ -116,7 +118,7 @@ const sal_Char* const sppcFilterDbNames[] =
OUString lclGetBaseName( sal_Unicode cBuiltinId )
{
- OSL_ENSURE( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ), "lclGetBaseName - unknown builtin name" );
+ OSL_ENSURE( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ), "lclGetBaseName - unsupported built-in identifier" );
OUStringBuffer aBuffer;
if( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ) )
aBuffer.appendAscii( sppcBaseNames[ cBuiltinId ] );
@@ -125,67 +127,52 @@ OUString lclGetBaseName( sal_Unicode cBuiltinId )
return aBuffer.makeStringAndClear();
}
-OUString lclGetBuiltinName( sal_Unicode cBuiltinId )
+OUString lclGetPrefixedName( sal_Unicode cBuiltinId )
{
return OUStringBuffer().appendAscii( spcOoxPrefix ).append( lclGetBaseName( cBuiltinId ) ).makeStringAndClear();
}
-sal_Unicode lclGetBuiltinIdFromOox( const OUString& rOoxName )
+/** returns the built-in name identifier from a perfixed built-in name, e.g. '_xlnm.Print_Area'. */
+sal_Unicode lclGetBuiltinIdFromPrefixedName( const OUString& rModelName )
{
OUString aPrefix = OUString::createFromAscii( spcOoxPrefix );
sal_Int32 nPrefixLen = aPrefix.getLength();
- if( rOoxName.matchIgnoreAsciiCase( aPrefix ) )
+ if( rModelName.matchIgnoreAsciiCase( aPrefix ) )
{
for( sal_Unicode cBuiltinId = 0; cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ); ++cBuiltinId )
{
OUString aBaseName = lclGetBaseName( cBuiltinId );
sal_Int32 nBaseNameLen = aBaseName.getLength();
- if( (rOoxName.getLength() == nPrefixLen + nBaseNameLen) && rOoxName.matchIgnoreAsciiCase( aBaseName, nPrefixLen ) )
+ if( (rModelName.getLength() == nPrefixLen + nBaseNameLen) && rModelName.matchIgnoreAsciiCase( aBaseName, nPrefixLen ) )
return cBuiltinId;
}
}
- return OOX_DEFNAME_UNKNOWN;
+ return BIFF_DEFNAME_UNKNOWN;
}
-sal_Unicode lclGetBuiltinIdFromOob( const OUString& rOobName )
+/** returns the built-in name identifier from a built-in base name, e.g. 'Print_Area'. */
+sal_Unicode lclGetBuiltinIdFromBaseName( const OUString& rModelName )
{
for( sal_Unicode cBuiltinId = 0; cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ); ++cBuiltinId )
- if( rOobName.equalsIgnoreAsciiCaseAscii( sppcBaseNames[ cBuiltinId ] ) )
+ if( rModelName.equalsIgnoreAsciiCaseAscii( sppcBaseNames[ cBuiltinId ] ) )
return cBuiltinId;
- return OOX_DEFNAME_UNKNOWN;
+ return BIFF_DEFNAME_UNKNOWN;
}
-bool lclIsFilterDatabaseName( const OUString& rName )
+bool lclIsFilterDatabaseName( const OUString& rModelName )
{
for( const sal_Char* const* ppcName = sppcFilterDbNames; ppcName < STATIC_ARRAY_END( sppcFilterDbNames ); ++ppcName )
- if( rName.equalsIgnoreAsciiCaseAscii( *ppcName ) )
+ if( rModelName.equalsIgnoreAsciiCaseAscii( *ppcName ) )
return true;
return false;
}
-} // namespace
-
-// ============================================================================
-
-DefinedNameModel::DefinedNameModel() :
- mnSheet( -1 ),
- mnFuncGroupId( -1 ),
- mbMacro( false ),
- mbFunction( false ),
- mbVBName( false ),
- mbHidden( false )
+OUString lclGetUpcaseModelName( const OUString& rModelName )
{
+ // TODO: i18n?
+ return rModelName.toAsciiUpperCase();
}
-// ============================================================================
-
-namespace {
-
-const sal_uInt16 BIFF_REFFLAG_COL1REL = 0x0001;
-const sal_uInt16 BIFF_REFFLAG_ROW1REL = 0x0002;
-const sal_uInt16 BIFF_REFFLAG_COL2REL = 0x0004;
-const sal_uInt16 BIFF_REFFLAG_ROW2REL = 0x0008;
-
void lclConvertRefFlags( sal_Int32& ornFlags, sal_Int32& ornAbsPos, sal_Int32& ornRelPos, sal_Int32 nBasePos, sal_Int32 nApiRelFlag, bool bRel )
{
if( getFlag( ornFlags, nApiRelFlag ) && !bRel )
@@ -235,7 +222,19 @@ Any lclConvertReference( const Any& rRefAny, const CellAddress& rBaseAddress, sa
} // namespace
-// ----------------------------------------------------------------------------
+// ============================================================================
+
+DefinedNameModel::DefinedNameModel() :
+ mnSheet( -1 ),
+ mnFuncGroupId( -1 ),
+ mbMacro( false ),
+ mbFunction( false ),
+ mbVBName( false ),
+ mbHidden( false )
+{
+}
+
+// ============================================================================
DefinedNameBase::DefinedNameBase( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper )
@@ -245,7 +244,7 @@ DefinedNameBase::DefinedNameBase( const WorkbookHelper& rHelper ) :
const OUString& DefinedNameBase::getUpcaseModelName() const
{
if( maUpModelName.getLength() == 0 )
- maUpModelName = maModel.maName.toAsciiUpperCase();
+ maUpModelName = lclGetUpcaseModelName( maModel.maName );
return maUpModelName;
}
@@ -288,7 +287,7 @@ void DefinedNameBase::importOoxFormula( FormulaContext& rContext, sal_Int16 nBas
getFormulaParser().convertErrorToFormula( rContext, BIFF_ERR_NAME );
}
-void DefinedNameBase::importOobFormula( FormulaContext& rContext, sal_Int16 nBaseSheet, RecordInputStream& rStrm )
+void DefinedNameBase::importBiff12Formula( FormulaContext& rContext, sal_Int16 nBaseSheet, SequenceInputStream& rStrm )
{
rContext.setBaseAddress( CellAddress( nBaseSheet, 0, 0 ) );
getFormulaParser().importFormula( rContext, rStrm );
@@ -314,7 +313,7 @@ void DefinedNameBase::extractReference( const ApiTokenSequence& rTokens )
DefinedName::DefinedName( const WorkbookHelper& rHelper ) :
DefinedNameBase( rHelper ),
mnTokenIndex( -1 ),
- mcBuiltinId( OOX_DEFNAME_UNKNOWN ),
+ mcBuiltinId( BIFF_DEFNAME_UNKNOWN ),
mnFmlaSize( 0 )
{
}
@@ -328,8 +327,11 @@ void DefinedName::importDefinedName( const AttributeList& rAttribs )
maModel.mbFunction = rAttribs.getBool( XML_function, false );
maModel.mbVBName = rAttribs.getBool( XML_vbProcedure, false );
maModel.mbHidden = rAttribs.getBool( XML_hidden, false );
- mcBuiltinId = lclGetBuiltinIdFromOox( maModel.maName );
mnCalcSheet = (maModel.mnSheet >= 0) ? getWorksheets().getCalcSheetIndex( maModel.mnSheet ) : -1;
+
+ /* Detect built-in state from name itself, there is no built-in flag.
+ Built-in names are prexixed with '_xlnm.' instead. */
+ mcBuiltinId = lclGetBuiltinIdFromPrefixedName( maModel.maName );
}
void DefinedName::setFormula( const OUString& rFormula )
@@ -337,7 +339,7 @@ void DefinedName::setFormula( const OUString& rFormula )
maModel.maFormula = rFormula;
}
-void DefinedName::importDefinedName( RecordInputStream& rStrm )
+void DefinedName::importDefinedName( SequenceInputStream& rStrm )
{
sal_uInt32 nFlags;
rStrm >> nFlags;
@@ -347,17 +349,14 @@ void DefinedName::importDefinedName( RecordInputStream& rStrm )
// macro function/command, hidden flag
maModel.mnFuncGroupId = extractValue< sal_Int32 >( nFlags, 6, 9 );
- maModel.mbMacro = getFlag( nFlags, OOBIN_DEFNAME_MACRO );
- maModel.mbFunction = getFlag( nFlags, OOBIN_DEFNAME_FUNC );
- maModel.mbVBName = getFlag( nFlags, OOBIN_DEFNAME_VBNAME );
- maModel.mbHidden = getFlag( nFlags, OOBIN_DEFNAME_HIDDEN );
-
- // get builtin name index from name
- if( getFlag( nFlags, OOBIN_DEFNAME_BUILTIN ) )
- mcBuiltinId = lclGetBuiltinIdFromOob( maModel.maName );
- // unhide built-in names (_xlnm._FilterDatabase is always hidden)
- if( isBuiltinName() )
- maModel.mbHidden = false;
+ maModel.mbMacro = getFlag( nFlags, BIFF12_DEFNAME_MACRO );
+ maModel.mbFunction = getFlag( nFlags, BIFF12_DEFNAME_FUNC );
+ maModel.mbVBName = getFlag( nFlags, BIFF12_DEFNAME_VBNAME );
+ maModel.mbHidden = getFlag( nFlags, BIFF12_DEFNAME_HIDDEN );
+
+ // get built-in name index from name
+ if( getFlag( nFlags, BIFF12_DEFNAME_BUILTIN ) )
+ mcBuiltinId = lclGetBuiltinIdFromBaseName( maModel.maName );
// store token array data
sal_Int64 nRecPos = rStrm.tell();
@@ -419,24 +418,22 @@ void DefinedName::importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcShee
maModel.mbVBName = getFlag( nFlags, BIFF_DEFNAME_VBNAME );
maModel.mbHidden = getFlag( nFlags, BIFF_DEFNAME_HIDDEN );
- // get builtin name index from name
+ // get built-in name index from name
if( getFlag( nFlags, BIFF_DEFNAME_BUILTIN ) )
{
- OSL_ENSURE( maModel.maName.getLength() == 1, "DefinedName::importDefinedName - wrong builtin name" );
- if( maModel.maName.getLength() > 0 )
+ // name may be the built-in identifier or the built-in base name
+ if( maModel.maName.getLength() == 1 )
mcBuiltinId = maModel.maName[ 0 ];
+ else
+ mcBuiltinId = lclGetBuiltinIdFromBaseName( maModel.maName );
}
- /* In BIFF5, _xlnm._FilterDatabase appears as hidden user name without
+ /* In BIFF5, '_FilterDatabase' appears as hidden user name without
built-in flag, and even worse, localized. */
else if( (eBiff == BIFF5) && lclIsFilterDatabaseName( maModel.maName ) )
{
- mcBuiltinId = OOX_DEFNAME_FILTERDATABASE;
+ mcBuiltinId = BIFF_DEFNAME_FILTERDATABASE;
}
- // unhide built-in names (_xlnm._FilterDatabase is always hidden)
- if( isBuiltinName() )
- maModel.mbHidden = false;
-
// get sheet index for sheet-local names in BIFF5-BIFF8
switch( getBiff() )
{
@@ -486,18 +483,13 @@ void DefinedName::importDefinedName( BiffInputStream& rStrm, sal_Int16 nCalcShee
void DefinedName::createNameObject()
{
- // do not create names for (macro) functions
+ // do not create names for (macro) functions or VBA procedures
// #163146# do not ignore hidden names (may be regular names created by VBA scripts)
- if( /*maModel.mbHidden ||*/ maModel.mbFunction )
+ if( /*maModel.mbHidden ||*/ maModel.mbFunction || maModel.mbVBName )
return;
- // convert original name to final Calc name
- if( maModel.mbVBName )
- maCalcName = maModel.maName;
- else if( isBuiltinName() )
- maCalcName = lclGetBuiltinName( mcBuiltinId );
- else
- maCalcName = maModel.maName; //! TODO convert to valid name
+ // convert original name to final Calc name (TODO: filter invalid characters from model name)
+ maCalcName = isBuiltinName() ? lclGetPrefixedName( mcBuiltinId ) : maModel.maName;
// #163146# do not rename sheet-local names by default, this breaks VBA scripts
#if 0
@@ -512,9 +504,9 @@ void DefinedName::createNameObject()
using namespace ::com::sun::star::sheet::NamedRangeFlag;
if( !isGlobalName() ) switch( mcBuiltinId )
{
- case OOX_DEFNAME_CRITERIA: nNameFlags = FILTER_CRITERIA; break;
- case OOX_DEFNAME_PRINTAREA: nNameFlags = PRINT_AREA; break;
- case OOX_DEFNAME_PRINTTITLES: nNameFlags = COLUMN_HEADER | ROW_HEADER; break;
+ case BIFF_DEFNAME_CRITERIA: nNameFlags = FILTER_CRITERIA; break;
+ case BIFF_DEFNAME_PRINTAREA: nNameFlags = PRINT_AREA; break;
+ case BIFF_DEFNAME_PRINTTITLES: nNameFlags = COLUMN_HEADER | ROW_HEADER; break;
}
// create the name and insert it into the document, maCalcName will be changed to the resulting name
@@ -532,7 +524,7 @@ void DefinedName::convertFormula()
// convert and set formula of the defined name
switch( getFilterType() )
{
- case FILTER_OOX:
+ case FILTER_OOXML:
{
SimpleFormulaContext aContext( xTokens, true, false );
implImportOoxFormula( aContext );
@@ -547,10 +539,10 @@ void DefinedName::convertFormula()
case FILTER_UNKNOWN: break;
}
- // set builtin names (print ranges, repeated titles, filter ranges)
+ // set built-in names (print ranges, repeated titles, filter ranges)
if( !isGlobalName() ) switch( mcBuiltinId )
{
- case OOX_DEFNAME_PRINTAREA:
+ case BIFF_DEFNAME_PRINTAREA:
{
Reference< XPrintAreas > xPrintAreas( getSheetFromDoc( mnCalcSheet ), UNO_QUERY );
ApiCellRangeList aPrintRanges;
@@ -559,7 +551,7 @@ void DefinedName::convertFormula()
xPrintAreas->setPrintAreas( ContainerHelper::vectorToSequence( aPrintRanges ) );
}
break;
- case OOX_DEFNAME_PRINTTITLES:
+ case BIFF_DEFNAME_PRINTTITLES:
{
Reference< XPrintAreas > xPrintAreas( getSheetFromDoc( mnCalcSheet ), UNO_QUERY );
ApiCellRangeList aTitleRanges;
@@ -605,8 +597,8 @@ void DefinedName::implImportOoxFormula( FormulaContext& rContext )
{
if( mxFormula.get() )
{
- RecordInputStream aStrm( *mxFormula );
- importOobFormula( rContext, mnCalcSheet, aStrm );
+ SequenceInputStream aStrm( *mxFormula );
+ importBiff12Formula( rContext, mnCalcSheet, aStrm );
}
else
importOoxFormula( rContext, mnCalcSheet );
@@ -643,7 +635,7 @@ DefinedNameRef DefinedNamesBuffer::importDefinedName( const AttributeList& rAttr
return xDefName;
}
-void DefinedNamesBuffer::importDefinedName( RecordInputStream& rStrm )
+void DefinedNamesBuffer::importDefinedName( SequenceInputStream& rStrm )
{
createDefinedName()->importDefinedName( rStrm );
}
@@ -655,14 +647,20 @@ void DefinedNamesBuffer::importDefinedName( BiffInputStream& rStrm )
void DefinedNamesBuffer::finalizeImport()
{
- // first insert all names without formula definition into the document
+ // first insert all names without formula definition into the document, and insert them into the maps
for( DefNameVector::iterator aIt = maDefNames.begin(), aEnd = maDefNames.end(); aIt != aEnd; ++aIt )
{
DefinedNameRef xDefName = *aIt;
xDefName->createNameObject();
+ // map by sheet index and original model name
+ maModelNameMap[ SheetNameKey( xDefName->getLocalCalcSheet(), xDefName->getUpcaseModelName() ) ] = xDefName;
+ // map by sheet index and built-in identifier
+ if( !xDefName->isGlobalName() && xDefName->isBuiltinName() )
+ maBuiltinMap[ BuiltinKey( xDefName->getLocalCalcSheet(), xDefName->getBuiltinId() ) ] = xDefName;
+ // map by API formula token identifier
sal_Int32 nTokenIndex = xDefName->getTokenIndex();
if( nTokenIndex >= 0 )
- maDefNameMap[ nTokenIndex ] = xDefName;
+ maTokenIdMap[ nTokenIndex ] = xDefName;
}
/* Now convert all name formulas, so that the formula parser can find all
@@ -677,25 +675,22 @@ DefinedNameRef DefinedNamesBuffer::getByIndex( sal_Int32 nIndex ) const
DefinedNameRef DefinedNamesBuffer::getByTokenIndex( sal_Int32 nIndex ) const
{
- return maDefNameMap.get( nIndex );
+ return maTokenIdMap.get( nIndex );
}
DefinedNameRef DefinedNamesBuffer::getByModelName( const OUString& rModelName, sal_Int16 nCalcSheet ) const
{
- DefinedNameRef xGlobalName; // a found global name
- DefinedNameRef xLocalName; // a found local name
- for( DefNameVector::const_iterator aIt = maDefNames.begin(), aEnd = maDefNames.end(); (aIt != aEnd) && !xLocalName; ++aIt )
- {
- DefinedNameRef xCurrName = *aIt;
- if( xCurrName->getModelName() == rModelName )
- {
- if( xCurrName->getLocalCalcSheet() == nCalcSheet )
- xLocalName = xCurrName;
- else if( xCurrName->isGlobalName() )
- xGlobalName = xCurrName;
- }
- }
- return xLocalName.get() ? xLocalName : xGlobalName;
+ OUString aUpcaseName = lclGetUpcaseModelName( rModelName );
+ DefinedNameRef xDefName = maModelNameMap.get( SheetNameKey( nCalcSheet, aUpcaseName ) );
+ // lookup global name, if no local name exists
+ if( !xDefName && (nCalcSheet >= 0) )
+ xDefName = maModelNameMap.get( SheetNameKey( -1, aUpcaseName ) );
+ return xDefName;
+}
+
+DefinedNameRef DefinedNamesBuffer::getByBuiltinId( sal_Unicode cBuiltinId, sal_Int16 nCalcSheet ) const
+{
+ return maBuiltinMap.get( BuiltinKey( nCalcSheet, cBuiltinId ) );
}
DefinedNameRef DefinedNamesBuffer::createDefinedName()
@@ -709,4 +704,3 @@ DefinedNameRef DefinedNamesBuffer::createDefinedName()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx
index 172530692923..e28608f728c6 100644
--- a/oox/source/xls/drawingfragment.cxx
+++ b/oox/source/xls/drawingfragment.cxx
@@ -26,19 +26,18 @@
************************************************************************/
#include "oox/xls/drawingfragment.hxx"
-#include <com/sun/star/awt/Point.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/form/binding/XBindableValue.hpp>
-#include <com/sun/star/form/binding/XListEntrySink.hpp>
-#include <com/sun/star/form/binding/XListEntrySource.hpp>
-#include <com/sun/star/form/binding/XValueBinding.hpp>
-#include "properties.hxx"
-#include "oox/helper/attributelist.hxx"
-#include "oox/helper/propertyset.hxx"
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <rtl/strbuf.hxx>
#include "oox/drawingml/connectorshapecontext.hxx"
#include "oox/drawingml/graphicshapecontext.hxx"
-#include "oox/drawingml/shapecontext.hxx"
-#include "oox/drawingml/shapegroupcontext.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/propertyset.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/vml/vmlshapecontainer.hxx"
#include "oox/xls/formulaparser.hxx"
@@ -46,40 +45,33 @@
#include "oox/xls/themebuffer.hxx"
#include "oox/xls/unitconverter.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::beans::NamedValue;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::awt::XControlModel;
-using ::com::sun::star::form::binding::XBindableValue;
-using ::com::sun::star::form::binding::XListEntrySink;
-using ::com::sun::star::form::binding::XListEntrySource;
-using ::com::sun::star::form::binding::XValueBinding;
-using ::com::sun::star::drawing::XShape;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::oox::core::ContextHandlerRef;
-using ::oox::drawingml::ConnectorShapeContext;
-using ::oox::drawingml::GraphicalObjectFrameContext;
-using ::oox::drawingml::GraphicShapeContext;
-using ::oox::drawingml::Shape;
-using ::oox::drawingml::ShapePtr;
-using ::oox::drawingml::ShapeContext;
-using ::oox::drawingml::ShapeGroupContext;
-// no using's for ::oox::vml, that may clash with ::oox::drawingml types
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::oox::core;
+using namespace ::oox::drawingml;
+using namespace ::oox::ole;
+
+using ::rtl::OStringBuffer;
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
+// no using's for ::oox::vml, that may clash with ::oox::drawingml types
+
+// ============================================================================
+// DrawingML
+// ============================================================================
+
namespace {
/** Converts the passed 64-bit integer value from the passed unit to EMUs. */
@@ -418,19 +410,120 @@ Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) c
// ============================================================================
-OoxDrawingFragment::OoxDrawingFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorksheetFragmentBase( rHelper, rFragmentPath ),
+ShapeMacroAttacher::ShapeMacroAttacher( const OUString& rMacroName, const Reference< XShape >& rxShape ) :
+ VbaMacroAttacherBase( rMacroName ),
+ mxShape( rxShape )
+{
+}
+
+void ShapeMacroAttacher::attachMacro( const OUString& rMacroUrl )
+{
+ try
+ {
+ Reference< XEventsSupplier > xSupplier( mxShape, UNO_QUERY_THROW );
+ Reference< XNameReplace > xEvents( xSupplier->getEvents(), UNO_SET_THROW );
+ Sequence< PropertyValue > aEventProps( 2 );
+ aEventProps[ 0 ].Name = CREATE_OUSTRING( "EventType" );
+ aEventProps[ 0 ].Value <<= CREATE_OUSTRING( "Script" );
+ aEventProps[ 1 ].Name = CREATE_OUSTRING( "Script" );
+ aEventProps[ 1 ].Value <<= rMacroUrl;
+ xEvents->replaceByName( CREATE_OUSTRING( "OnClick" ), Any( aEventProps ) );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// ============================================================================
+
+Shape::Shape( const WorksheetHelper& rHelper, const AttributeList& rAttribs, const sal_Char* pcServiceName ) :
+ ::oox::drawingml::Shape( pcServiceName ),
+ WorksheetHelper( rHelper )
+{
+ OUString aMacro = rAttribs.getXString( XML_macro, OUString() );
+ if( aMacro.getLength() > 0 )
+ maMacroName = getFormulaParser().importMacroName( aMacro );
+}
+
+void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& rxShapes )
+{
+ if( (maMacroName.getLength() > 0) && mxShape.is() )
+ {
+ VbaMacroAttacherRef xAttacher( new ShapeMacroAttacher( maMacroName, mxShape ) );
+ getBaseFilter().getVbaProject().registerMacroAttacher( xAttacher );
+ }
+ ::oox::drawingml::Shape::finalizeXShape( rFilter, rxShapes );
+}
+
+// ============================================================================
+
+GroupShapeContext::GroupShapeContext( ContextHandler& rParent,
+ const WorksheetHelper& rHelper, const ShapePtr& rxParentShape, const ShapePtr& rxShape ) :
+ ShapeGroupContext( rParent, rxParentShape, rxShape ),
+ WorksheetHelper( rHelper )
+{
+}
+
+/*static*/ ContextHandlerRef GroupShapeContext::createShapeContext( ContextHandler& rParent,
+ const WorksheetHelper& rHelper, sal_Int32 nElement, const AttributeList& rAttribs,
+ const ShapePtr& rxParentShape, ShapePtr* pxShape )
+{
+ switch( nElement )
+ {
+ case XDR_TOKEN( sp ):
+ {
+ ShapePtr xShape( new Shape( rHelper, rAttribs, "com.sun.star.drawing.CustomShape" ) );
+ if( pxShape ) *pxShape = xShape;
+ return new ShapeContext( rParent, rxParentShape, xShape );
+ }
+ case XDR_TOKEN( cxnSp ):
+ {
+ ShapePtr xShape( new Shape( rHelper, rAttribs, "com.sun.star.drawing.ConnectorShape" ) );
+ if( pxShape ) *pxShape = xShape;
+ return new ConnectorShapeContext( rParent, rxParentShape, xShape );
+ }
+ case XDR_TOKEN( pic ):
+ {
+ ShapePtr xShape( new Shape( rHelper, rAttribs, "com.sun.star.drawing.GraphicObjectShape" ) );
+ if( pxShape ) *pxShape = xShape;
+ return new GraphicShapeContext( rParent, rxParentShape, xShape );
+ }
+ case XDR_TOKEN( graphicFrame ):
+ {
+ ShapePtr xShape( new Shape( rHelper, rAttribs, "com.sun.star.drawing.GraphicObjectShape" ) );
+ if( pxShape ) *pxShape = xShape;
+ return new GraphicalObjectFrameContext( rParent, rxParentShape, xShape, rHelper.getSheetType() != SHEETTYPE_CHARTSHEET );
+ }
+ case XDR_TOKEN( grpSp ):
+ {
+ ShapePtr xShape( new Shape( rHelper, rAttribs, "com.sun.star.drawing.GroupShape" ) );
+ if( pxShape ) *pxShape = xShape;
+ return new GroupShapeContext( rParent, rHelper, rxParentShape, xShape );
+ }
+ }
+ return 0;
+}
+
+Reference< XFastContextHandler > SAL_CALL GroupShapeContext::createFastChildContext(
+ sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) throw (SAXException, RuntimeException)
+{
+ ContextHandlerRef xContext = createShapeContext( *this, *this, nElement, AttributeList( rxAttribs ), mpGroupShapePtr );
+ return xContext.get() ? xContext.get() : ShapeGroupContext::createFastChildContext( nElement, rxAttribs );
+}
+
+// ============================================================================
+
+DrawingFragment::DrawingFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
+ WorksheetFragmentBase( rHelper, rFragmentPath ),
mxDrawPage( rHelper.getDrawPage(), UNO_QUERY )
{
- OSL_ENSURE( mxDrawPage.is(), "OoxDrawingFragment::OoxDrawingFragment - missing drawing page" );
+ OSL_ENSURE( mxDrawPage.is(), "DrawingFragment::DrawingFragment - missing drawing page" );
maApiSheetSize = getDrawPageSize();
maEmuSheetSize.Width = static_cast< sal_Int64 >( getUnitConverter().scaleFromMm100( maApiSheetSize.Width, UNIT_EMU ) );
maEmuSheetSize.Height = static_cast< sal_Int64 >( getUnitConverter().scaleFromMm100( maApiSheetSize.Height, UNIT_EMU ) );
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxDrawingFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -453,31 +546,19 @@ ContextHandlerRef OoxDrawingFragment::onCreateContext( sal_Int32 nElement, const
case XDR_TOKEN( absoluteAnchor ):
case XDR_TOKEN( oneCellAnchor ):
case XDR_TOKEN( twoCellAnchor ):
+ {
switch( nElement )
{
- case XDR_TOKEN( sp ):
- mxShape.reset( new Shape( "com.sun.star.drawing.CustomShape" ) );
- return new ShapeContext( *this, ShapePtr(), mxShape );
- case XDR_TOKEN( cxnSp ):
- mxShape.reset( new Shape( "com.sun.star.drawing.ConnectorShape" ) );
- return new ConnectorShapeContext( *this, ShapePtr(), mxShape );
- case XDR_TOKEN( pic ):
- mxShape.reset( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) );
- return new GraphicShapeContext( *this, ShapePtr(), mxShape );
- case XDR_TOKEN( graphicFrame ):
- mxShape.reset( new Shape( "com.sun.star.drawing.OLE2Shape" ) );
- return new GraphicalObjectFrameContext( *this, ShapePtr(), mxShape, getSheetType() != SHEETTYPE_CHARTSHEET );
- case XDR_TOKEN( grpSp ):
- mxShape.reset( new Shape( "com.sun.star.drawing.GroupShape" ) );
- return new ShapeGroupContext( *this, ShapePtr(), mxShape );
-
case XDR_TOKEN( from ):
case XDR_TOKEN( to ): return this;
case XDR_TOKEN( pos ): if( mxAnchor.get() ) mxAnchor->importPos( rAttribs ); break;
case XDR_TOKEN( ext ): if( mxAnchor.get() ) mxAnchor->importExt( rAttribs ); break;
case XDR_TOKEN( clientData ): if( mxAnchor.get() ) mxAnchor->importClientData( rAttribs ); break;
+
+ default: return GroupShapeContext::createShapeContext( *this, *this, nElement, rAttribs, ShapePtr(), &mxShape );
}
+ }
break;
case XDR_TOKEN( from ):
@@ -487,14 +568,14 @@ ContextHandlerRef OoxDrawingFragment::onCreateContext( sal_Int32 nElement, const
case XDR_TOKEN( col ):
case XDR_TOKEN( row ):
case XDR_TOKEN( colOff ):
- case XDR_TOKEN( rowOff ): return this; // collect index in onEndElement()
+ case XDR_TOKEN( rowOff ): return this; // collect index in onCharacters()
}
break;
}
return 0;
}
-void OoxDrawingFragment::onEndElement( const OUString& rChars )
+void DrawingFragment::onCharacters( const OUString& rChars )
{
switch( getCurrentElement() )
{
@@ -502,8 +583,15 @@ void OoxDrawingFragment::onEndElement( const OUString& rChars )
case XDR_TOKEN( row ):
case XDR_TOKEN( colOff ):
case XDR_TOKEN( rowOff ):
- if( mxAnchor.get() ) mxAnchor->setCellPos( getCurrentElement(), getPreviousElement(), rChars );
+ if( mxAnchor.get() ) mxAnchor->setCellPos( getCurrentElement(), getParentElement(), rChars );
break;
+ }
+}
+
+void DrawingFragment::onEndElement()
+{
+ switch( getCurrentElement() )
+ {
case XDR_TOKEN( absoluteAnchor ):
case XDR_TOKEN( oneCellAnchor ):
case XDR_TOKEN( twoCellAnchor ):
@@ -513,8 +601,15 @@ void OoxDrawingFragment::onEndElement( const OUString& rChars )
if( (aShapeRect.X >= 0) && (aShapeRect.Y >= 0) && (aShapeRect.Width >= 0) && (aShapeRect.Height >= 0) )
{
mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, &aShapeRect );
- // collect all shape positions in the WorksheetHelper base class
- extendShapeBoundingBox( aShapeRect );
+ /* Collect all shape positions in the WorksheetHelper base
+ class. But first, scale EMUs to 1/100 mm. */
+ const UnitConverter& rUnitConv = getUnitConverter();
+ Rectangle aShapeRectHmm(
+ rUnitConv.scaleToMm100( aShapeRect.X, UNIT_EMU ),
+ rUnitConv.scaleToMm100( aShapeRect.Y, UNIT_EMU ),
+ rUnitConv.scaleToMm100( aShapeRect.Width, UNIT_EMU ),
+ rUnitConv.scaleToMm100( aShapeRect.Height, UNIT_EMU ) );
+ extendShapeBoundingBox( aShapeRectHmm );
}
}
mxShape.reset();
@@ -524,6 +619,8 @@ void OoxDrawingFragment::onEndElement( const OUString& rChars )
}
// ============================================================================
+// VML
+// ============================================================================
namespace {
@@ -538,6 +635,8 @@ private:
sal_Int32 mnRow;
};
+// ----------------------------------------------------------------------------
+
VmlFindNoteFunc::VmlFindNoteFunc( const CellAddress& rPos ) :
mnCol( rPos.Column ),
mnRow( rPos.Row )
@@ -546,18 +645,88 @@ VmlFindNoteFunc::VmlFindNoteFunc( const CellAddress& rPos ) :
bool VmlFindNoteFunc::operator()( const ::oox::vml::ShapeBase& rShape ) const
{
- const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = rShape.getShapeModel().mxClientData;
- return rxClientData.get() && (rxClientData->mnCol == mnCol) && (rxClientData->mnRow == mnRow);
+ const ::oox::vml::ClientData* pClientData = rShape.getClientData();
+ return pClientData && (pClientData->mnCol == mnCol) && (pClientData->mnRow == mnRow);
}
} // namespace
-// ----------------------------------------------------------------------------
+// ============================================================================
+
+VmlControlMacroAttacher::VmlControlMacroAttacher( const OUString& rMacroName,
+ const Reference< XIndexContainer >& rxCtrlFormIC, sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle ) :
+ VbaMacroAttacherBase( rMacroName ),
+ mxCtrlFormIC( rxCtrlFormIC ),
+ mnCtrlIndex( nCtrlIndex ),
+ mnCtrlType( nCtrlType ),
+ mnDropStyle( nDropStyle )
+{
+}
+
+void VmlControlMacroAttacher::attachMacro( const OUString& rMacroUrl )
+{
+ ScriptEventDescriptor aEventDesc;
+ aEventDesc.ScriptType = CREATE_OUSTRING( "Script" );
+ aEventDesc.ScriptCode = rMacroUrl;
+
+ // editable drop downs are treated like edit boxes
+ bool bEditDropDown = (mnCtrlType == XML_Drop) && (mnDropStyle == XML_ComboEdit);
+ sal_Int32 nCtrlType = bEditDropDown ? XML_Edit : mnCtrlType;
+
+ switch( nCtrlType )
+ {
+ case XML_Button:
+ case XML_Checkbox:
+ case XML_Radio:
+ aEventDesc.ListenerType = CREATE_OUSTRING( "XActionListener" );
+ aEventDesc.EventMethod = CREATE_OUSTRING( "actionPerformed" );
+ break;
+ case XML_Label:
+ case XML_GBox:
+ case XML_Dialog:
+ aEventDesc.ListenerType = CREATE_OUSTRING( "XMouseListener" );
+ aEventDesc.EventMethod = CREATE_OUSTRING( "mouseReleased" );
+ break;
+ case XML_Edit:
+ aEventDesc.ListenerType = CREATE_OUSTRING( "XTextListener" );
+ aEventDesc.EventMethod = CREATE_OUSTRING( "textChanged" );
+ break;
+ case XML_Spin:
+ case XML_Scroll:
+ aEventDesc.ListenerType = CREATE_OUSTRING( "XAdjustmentListener" );
+ aEventDesc.EventMethod = CREATE_OUSTRING( "adjustmentValueChanged" );
+ break;
+ case XML_List:
+ case XML_Drop:
+ aEventDesc.ListenerType = CREATE_OUSTRING( "XChangeListener" );
+ aEventDesc.EventMethod = CREATE_OUSTRING( "changed" );
+ break;
+ default:
+ OSL_ENSURE( false, "VmlControlMacroAttacher::attachMacro - unexpected object type" );
+ return;
+ }
+
+ try
+ {
+ Reference< XEventAttacherManager > xEventMgr( mxCtrlFormIC, UNO_QUERY_THROW );
+ xEventMgr->registerScriptEvent( mnCtrlIndex, aEventDesc );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// ============================================================================
VmlDrawing::VmlDrawing( const WorksheetHelper& rHelper ) :
::oox::vml::Drawing( rHelper.getOoxFilter(), rHelper.getDrawPage(), ::oox::vml::VMLDRAWING_EXCEL ),
- WorksheetHelper( rHelper )
+ WorksheetHelper( rHelper ),
+ maControlConv( rHelper.getBaseFilter().getModel(), rHelper.getBaseFilter().getGraphicHelper() )
{
+ // default font for legacy listboxes and dropdowns: Tahoma, 8pt
+ maListBoxFont.moName = CREATE_OUSTRING( "Tahoma" );
+ maListBoxFont.moColor = CREATE_OUSTRING( "auto" );
+ maListBoxFont.monSize = 160;
}
const ::oox::vml::ShapeBase* VmlDrawing::getNoteShape( const CellAddress& rPos ) const
@@ -567,11 +736,35 @@ const ::oox::vml::ShapeBase* VmlDrawing::getNoteShape( const CellAddress& rPos )
bool VmlDrawing::isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const
{
- const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = rShape.getShapeModel().mxClientData;
- return !rxClientData.get() || (rxClientData->mnObjType != XML_Note);
+ const ::oox::vml::ClientData* pClientData = rShape.getClientData();
+ return !pClientData || (pClientData->mnObjType != XML_Note);
+}
+
+OUString VmlDrawing::getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) const
+{
+ if( const ::oox::vml::ClientData* pClientData = rShape.getClientData() )
+ {
+ switch( pClientData->mnObjType )
+ {
+ case XML_Button: return CREATE_OUSTRING( "Button" );
+ case XML_Checkbox: return CREATE_OUSTRING( "Check Box" );
+ case XML_Dialog: return CREATE_OUSTRING( "Dialog Frame" );
+ case XML_Drop: return CREATE_OUSTRING( "Drop Down" );
+ case XML_Edit: return CREATE_OUSTRING( "Edit Box" );
+ case XML_GBox: return CREATE_OUSTRING( "Group Box" );
+ case XML_Label: return CREATE_OUSTRING( "Label" );
+ case XML_List: return CREATE_OUSTRING( "List Box" );
+ case XML_Note: return CREATE_OUSTRING( "Comment" );
+ case XML_Pict: return (pClientData->mbDde || getOleObjectInfo( rShape.getShapeId() )) ? CREATE_OUSTRING( "Object" ) : CREATE_OUSTRING( "Picture" );
+ case XML_Radio: return CREATE_OUSTRING( "Option Button" );
+ case XML_Scroll: return CREATE_OUSTRING( "Scroll Bar" );
+ case XML_Spin: return CREATE_OUSTRING( "Spinner" );
+ }
+ }
+ return ::oox::vml::Drawing::getShapeBaseName( rShape );
}
-bool VmlDrawing::convertShapeClientAnchor( Rectangle& orShapeRect, const OUString& rShapeAnchor ) const
+bool VmlDrawing::convertClientAnchor( Rectangle& orShapeRect, const OUString& rShapeAnchor ) const
{
if( rShapeAnchor.getLength() == 0 )
return false;
@@ -581,71 +774,206 @@ bool VmlDrawing::convertShapeClientAnchor( Rectangle& orShapeRect, const OUStrin
return (orShapeRect.Width >= 0) && (orShapeRect.Height >= 0);
}
-void VmlDrawing::convertControlClientData( const Reference< XControlModel >& rxCtrlModel,
- const ::oox::vml::ShapeClientData& rClientData ) const
+Reference< XShape > VmlDrawing::createAndInsertClientXShape( const ::oox::vml::ShapeBase& rShape,
+ const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const
{
- if( rxCtrlModel.is() )
+ // simulate the legacy drawing controls with OLE form controls
+ OUString aShapeName = rShape.getShapeName();
+ const ::oox::vml::ClientData* pClientData = rShape.getClientData();
+ if( (aShapeName.getLength() > 0) && pClientData )
{
- PropertySet aPropSet( rxCtrlModel );
+ Rectangle aShapeRect = rShapeRect;
+ const ::oox::vml::TextBox* pTextBox = rShape.getTextBox();
+ EmbeddedControl aControl( aShapeName );
+ switch( pClientData->mnObjType )
+ {
+ case XML_Button:
+ {
+ AxCommandButtonModel& rAxModel = aControl.createModel< AxCommandButtonModel >();
+ convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maCaption, pTextBox, pClientData->mnTextHAlign );
+ rAxModel.mnFlags = AX_FLAGS_ENABLED | AX_FLAGS_OPAQUE | AX_FLAGS_WORDWRAP;
+ rAxModel.mnVerticalAlign = pClientData->mnTextVAlign;
+ }
+ break;
- // printable
- aPropSet.setProperty( PROP_Printable, rClientData.mbPrintObject );
+ case XML_Label:
+ {
+ AxLabelModel& rAxModel = aControl.createModel< AxLabelModel >();
+ convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maCaption, pTextBox, pClientData->mnTextHAlign );
+ rAxModel.mnFlags = AX_FLAGS_ENABLED | AX_FLAGS_WORDWRAP;
+ rAxModel.mnBorderStyle = AX_BORDERSTYLE_NONE;
+ rAxModel.mnSpecialEffect = AX_SPECIALEFFECT_FLAT;
+ rAxModel.mnVerticalAlign = pClientData->mnTextVAlign;
+ }
+ break;
- // linked cell
- if( rClientData.maLinkedCell.getLength() > 0 ) try
- {
- Reference< XBindableValue > xBindable( rxCtrlModel, UNO_QUERY_THROW );
-
- // convert formula string to cell address
- FormulaParser& rParser = getFormulaParser();
- TokensFormulaContext aContext( true, false );
- aContext.setBaseAddress( CellAddress( getSheetIndex(), 0, 0 ) );
- rParser.importFormula( aContext, rClientData.maLinkedCell );
- CellAddress aAddress;
- if( rParser.extractCellAddress( aAddress, aContext.getTokens(), true ) )
+ case XML_Edit:
{
- // create argument sequence for createInstanceWithArguments()
- NamedValue aValue;
- aValue.Name = CREATE_OUSTRING( "BoundCell" );
- aValue.Value <<= aAddress;
- Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= aValue;
-
- // create the CellValueBinding instance and set at the control model
- Reference< XValueBinding > xBinding( getDocumentFactory()->createInstanceWithArguments(
- CREATE_OUSTRING( "com.sun.star.table.CellValueBinding" ), aArgs ), UNO_QUERY_THROW );
- xBindable->setValueBinding( xBinding );
+ bool bNumeric = (pClientData->mnVTEdit == ::oox::vml::VML_CLIENTDATA_INTEGER) || (pClientData->mnVTEdit == ::oox::vml::VML_CLIENTDATA_NUMBER);
+ AxMorphDataModelBase& rAxModel = bNumeric ?
+ static_cast< AxMorphDataModelBase& >( aControl.createModel< AxNumericFieldModel >() ) :
+ static_cast< AxMorphDataModelBase& >( aControl.createModel< AxTextBoxModel >() );
+ convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maValue, pTextBox, pClientData->mnTextHAlign );
+ setFlag( rAxModel.mnFlags, AX_FLAGS_MULTILINE, pClientData->mbMultiLine );
+ setFlag( rAxModel.mnScrollBars, AX_SCROLLBAR_VERTICAL, pClientData->mbVScroll );
+ if( pClientData->mbSecretEdit )
+ rAxModel.mnPasswordChar = '*';
}
- }
- catch( Exception& )
- {
+ break;
+
+ case XML_GBox:
+ {
+ AxFrameModel& rAxModel = aControl.createModel< AxFrameModel >();
+ convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maCaption, pTextBox, pClientData->mnTextHAlign );
+ rAxModel.mnBorderStyle = pClientData->mbNo3D ? AX_BORDERSTYLE_SINGLE : AX_BORDERSTYLE_NONE;
+ rAxModel.mnSpecialEffect = pClientData->mbNo3D ? AX_SPECIALEFFECT_FLAT : AX_SPECIALEFFECT_BUMPED;
+
+ /* Move top border of groupbox up by half font height, because
+ Excel specifies Y position of the groupbox border line
+ instead the top border of the caption text. */
+ if( const ::oox::vml::TextFontModel* pFontModel = pTextBox ? pTextBox->getFirstFont() : 0 )
+ {
+ sal_Int32 nFontHeightHmm = getUnitConverter().scaleToMm100( pFontModel->monSize.get( 160 ), UNIT_TWIP );
+ sal_Int32 nYDiff = ::std::min< sal_Int32 >( nFontHeightHmm / 2, aShapeRect.Y );
+ aShapeRect.Y -= nYDiff;
+ aShapeRect.Height += nYDiff;
+ }
+ }
+ break;
+
+ case XML_Checkbox:
+ {
+ AxCheckBoxModel& rAxModel = aControl.createModel< AxCheckBoxModel >();
+ convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maCaption, pTextBox, pClientData->mnTextHAlign );
+ convertControlBackground( rAxModel, rShape );
+ rAxModel.maValue = OUString::valueOf( pClientData->mnChecked );
+ rAxModel.mnSpecialEffect = pClientData->mbNo3D ? AX_SPECIALEFFECT_FLAT : AX_SPECIALEFFECT_SUNKEN;
+ rAxModel.mnVerticalAlign = pClientData->mnTextVAlign;
+ bool bTriState = (pClientData->mnChecked != ::oox::vml::VML_CLIENTDATA_UNCHECKED) && (pClientData->mnChecked != ::oox::vml::VML_CLIENTDATA_CHECKED);
+ rAxModel.mnMultiSelect = bTriState ? AX_SELCTION_MULTI : AX_SELCTION_SINGLE;
+ }
+ break;
+
+ case XML_Radio:
+ {
+ AxOptionButtonModel& rAxModel = aControl.createModel< AxOptionButtonModel >();
+ convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maCaption, pTextBox, pClientData->mnTextHAlign );
+ convertControlBackground( rAxModel, rShape );
+ rAxModel.maValue = OUString::valueOf( pClientData->mnChecked );
+ rAxModel.mnSpecialEffect = pClientData->mbNo3D ? AX_SPECIALEFFECT_FLAT : AX_SPECIALEFFECT_SUNKEN;
+ rAxModel.mnVerticalAlign = pClientData->mnTextVAlign;
+ }
+ break;
+
+ case XML_List:
+ {
+ AxListBoxModel& rAxModel = aControl.createModel< AxListBoxModel >();
+ convertControlFontData( rAxModel.maFontData, rAxModel.mnTextColor, maListBoxFont );
+ rAxModel.mnBorderStyle = pClientData->mbNo3D2 ? AX_BORDERSTYLE_SINGLE : AX_BORDERSTYLE_NONE;
+ rAxModel.mnSpecialEffect = pClientData->mbNo3D2 ? AX_SPECIALEFFECT_FLAT : AX_SPECIALEFFECT_SUNKEN;
+ switch( pClientData->mnSelType )
+ {
+ case XML_Single: rAxModel.mnMultiSelect = AX_SELCTION_SINGLE; break;
+ case XML_Multi: rAxModel.mnMultiSelect = AX_SELCTION_MULTI; break;
+ case XML_Extend: rAxModel.mnMultiSelect = AX_SELCTION_EXTENDED; break;
+ }
+ }
+ break;
+
+ case XML_Drop:
+ {
+ AxComboBoxModel& rAxModel = aControl.createModel< AxComboBoxModel >();
+ convertControlFontData( rAxModel.maFontData, rAxModel.mnTextColor, maListBoxFont );
+ rAxModel.mnDisplayStyle = AX_DISPLAYSTYLE_DROPDOWN;
+ rAxModel.mnShowDropButton = AX_SHOWDROPBUTTON_ALWAYS;
+ rAxModel.mnBorderStyle = pClientData->mbNo3D2 ? AX_BORDERSTYLE_SINGLE : AX_BORDERSTYLE_NONE;
+ rAxModel.mnSpecialEffect = pClientData->mbNo3D2 ? AX_SPECIALEFFECT_FLAT : AX_SPECIALEFFECT_SUNKEN;
+ rAxModel.mnListRows = pClientData->mnDropLines;
+ }
+ break;
+
+ case XML_Spin:
+ {
+ AxSpinButtonModel& rAxModel = aControl.createModel< AxSpinButtonModel >();
+ rAxModel.mnMin = pClientData->mnMin;
+ rAxModel.mnMax = pClientData->mnMax;
+ rAxModel.mnPosition = pClientData->mnVal;
+ rAxModel.mnSmallChange = pClientData->mnInc;
+ }
+ break;
+
+ case XML_Scroll:
+ {
+ AxScrollBarModel& rAxModel = aControl.createModel< AxScrollBarModel >();
+ rAxModel.mnMin = pClientData->mnMin;
+ rAxModel.mnMax = pClientData->mnMax;
+ rAxModel.mnPosition = pClientData->mnVal;
+ rAxModel.mnSmallChange = pClientData->mnInc;
+ rAxModel.mnLargeChange = pClientData->mnPage;
+ }
+ break;
+
+ case XML_Dialog:
+ {
+ // fake with a group box
+ AxFrameModel& rAxModel = aControl.createModel< AxFrameModel >();
+ convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, rAxModel.maCaption, pTextBox, XML_Left );
+ rAxModel.mnBorderStyle = AX_BORDERSTYLE_SINGLE;
+ rAxModel.mnSpecialEffect = AX_SPECIALEFFECT_FLAT;
+ }
+ break;
}
- // source range
- if( rClientData.maSourceRange.getLength() > 0 ) try
+ if( ControlModelBase* pAxModel = aControl.getModel() )
{
- Reference< XListEntrySink > xEntrySink( rxCtrlModel, UNO_QUERY_THROW );
-
- // convert formula string to cell range
- FormulaParser& rParser = getFormulaParser();
- TokensFormulaContext aContext( true, false );
- aContext.setBaseAddress( CellAddress( getSheetIndex(), 0, 0 ) );
- rParser.importFormula( aContext, rClientData.maSourceRange );
- CellRangeAddress aRange;
- if( rParser.extractCellRange( aRange, aContext.getTokens(), true ) )
+ // create the control shape
+ pAxModel->maSize.first = aShapeRect.Width;
+ pAxModel->maSize.second = aShapeRect.Height;
+ sal_Int32 nCtrlIndex = -1;
+ Reference< XShape > xShape = createAndInsertXControlShape( aControl, rxShapes, aShapeRect, nCtrlIndex );
+
+ // control shape macro
+ if( xShape.is() && (nCtrlIndex >= 0) && (pClientData->maFmlaMacro.getLength() > 0) )
{
- // create argument sequence for createInstanceWithArguments()
- NamedValue aValue;
- aValue.Name = CREATE_OUSTRING( "CellRange" );
- aValue.Value <<= aRange;
- Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= aValue;
-
- // create the EntrySource instance and set at the control model
- Reference< XListEntrySource > xEntrySource( getDocumentFactory()->createInstanceWithArguments(
- CREATE_OUSTRING( "com.sun.star.table.CellRangeListSource" ), aArgs ), UNO_QUERY_THROW );
- xEntrySink->setListEntrySource( xEntrySource );
+ OUString aMacroName = getFormulaParser().importMacroName( pClientData->maFmlaMacro );
+ if( aMacroName.getLength() > 0 )
+ {
+ Reference< XIndexContainer > xFormIC = getControlForm().getXForm();
+ VbaMacroAttacherRef xAttacher( new VmlControlMacroAttacher( aMacroName, xFormIC, nCtrlIndex, pClientData->mnObjType, pClientData->mnDropStyle ) );
+ getBaseFilter().getVbaProject().registerMacroAttacher( xAttacher );
+ }
}
+
+ return xShape;
+ }
+ }
+
+ return Reference< XShape >();
+}
+
+void VmlDrawing::notifyXShapeInserted( const Reference< XShape >& rxShape,
+ const Rectangle& rShapeRect, const ::oox::vml::ShapeBase& rShape, bool bGroupChild )
+{
+ // collect all shape positions in the WorksheetHelper base class (but not children of group shapes)
+ if( !bGroupChild )
+ extendShapeBoundingBox( rShapeRect );
+
+ // convert settings from VML client data
+ if( const ::oox::vml::ClientData* pClientData = rShape.getClientData() )
+ {
+ // specific settings for embedded form controls
+ try
+ {
+ Reference< XControlShape > xCtrlShape( rxShape, UNO_QUERY_THROW );
+ Reference< XControlModel > xCtrlModel( xCtrlShape->getControl(), UNO_SET_THROW );
+ PropertySet aPropSet( xCtrlModel );
+
+ // printable
+ aPropSet.setProperty( PROP_Printable, pClientData->mbPrintObject );
+
+ // control source links
+ if( (pClientData->maFmlaLink.getLength() > 0) || (pClientData->maFmlaRange.getLength() > 0) )
+ maControlConv.bindToSources( xCtrlModel, pClientData->maFmlaLink, pClientData->maFmlaRange, getSheetIndex() );
}
catch( Exception& )
{
@@ -653,21 +981,113 @@ void VmlDrawing::convertControlClientData( const Reference< XControlModel >& rxC
}
}
-void VmlDrawing::notifyShapeInserted( const Reference< XShape >& /*rxShape*/, const Rectangle& rShapeRect )
+// private --------------------------------------------------------------------
+
+sal_uInt32 VmlDrawing::convertControlTextColor( const OUString& rTextColor ) const
{
- // collect all shape positions in the WorksheetHelper base class
- extendShapeBoundingBox( rShapeRect );
+ // color attribute not present or 'auto' - use passed default color
+ if( (rTextColor.getLength() == 0) || rTextColor.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "auto" ) ) )
+ return AX_SYSCOLOR_WINDOWTEXT;
+
+ if( rTextColor[ 0 ] == '#' )
+ {
+ // RGB colors in the format '#RRGGBB'
+ if( rTextColor.getLength() == 7 )
+ return OleHelper::encodeOleColor( rTextColor.copy( 1 ).toInt32( 16 ) );
+
+ // RGB colors in the format '#RGB'
+ if( rTextColor.getLength() == 4 )
+ {
+ sal_Int32 nR = rTextColor.copy( 1, 1 ).toInt32( 16 ) * 0x11;
+ sal_Int32 nG = rTextColor.copy( 2, 1 ).toInt32( 16 ) * 0x11;
+ sal_Int32 nB = rTextColor.copy( 3, 1 ).toInt32( 16 ) * 0x11;
+ return OleHelper::encodeOleColor( (nR << 16) | (nG << 8) | nB );
+ }
+
+ OSL_ENSURE( false, OStringBuffer( "VmlDrawing::convertControlTextColor - invalid color name '" ).
+ append( OUStringToOString( rTextColor, RTL_TEXTENCODING_ASCII_US ) ).append( '\'' ).getStr() );
+ return AX_SYSCOLOR_WINDOWTEXT;
+ }
+
+ const GraphicHelper& rGraphicHelper = getBaseFilter().getGraphicHelper();
+
+ /* Predefined color names or system color names (resolve to RGB to detect
+ valid color name). */
+ sal_Int32 nColorToken = AttributeConversion::decodeToken( rTextColor );
+ sal_Int32 nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
+ if( nRgbValue == API_RGB_TRANSPARENT )
+ nRgbValue = rGraphicHelper.getSystemColor( nColorToken, API_RGB_TRANSPARENT );
+ if( nRgbValue != API_RGB_TRANSPARENT )
+ return OleHelper::encodeOleColor( nRgbValue );
+
+ // try palette color
+ return OleHelper::encodeOleColor( rGraphicHelper.getPaletteColor( rTextColor.toInt32() ) );
+}
+
+void VmlDrawing::convertControlFontData( AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, const ::oox::vml::TextFontModel& rFontModel ) const
+{
+ if( rFontModel.moName.has() )
+ rAxFontData.maFontName = rFontModel.moName.get();
+
+ // font height: convert from twips to points, then to internal representation of AX controls
+ rAxFontData.setHeightPoints( static_cast< sal_Int16 >( (rFontModel.monSize.get( 200 ) + 10) / 20 ) );
+
+ // font effects
+ rAxFontData.mnFontEffects = 0;
+ setFlag( rAxFontData.mnFontEffects, AX_FONTDATA_BOLD, rFontModel.mobBold.get( false ) );
+ setFlag( rAxFontData.mnFontEffects, AX_FONTDATA_ITALIC, rFontModel.mobItalic.get( false ) );
+ setFlag( rAxFontData.mnFontEffects, AX_FONTDATA_STRIKEOUT, rFontModel.mobStrikeout.get( false ) );
+ sal_Int32 nUnderline = rFontModel.monUnderline.get( XML_none );
+ setFlag( rAxFontData.mnFontEffects, AX_FONTDATA_UNDERLINE, nUnderline != XML_none );
+ rAxFontData.mbDblUnderline = nUnderline == XML_double;
+
+ // font color
+ rnOleTextColor = convertControlTextColor( rFontModel.moColor.get( OUString() ) );
+}
+
+void VmlDrawing::convertControlText( AxFontData& rAxFontData, sal_uInt32& rnOleTextColor,
+ OUString& rCaption, const ::oox::vml::TextBox* pTextBox, sal_Int32 nTextHAlign ) const
+{
+ if( pTextBox )
+ {
+ rCaption = pTextBox->getText();
+ if( const ::oox::vml::TextFontModel* pFontModel = pTextBox->getFirstFont() )
+ convertControlFontData( rAxFontData, rnOleTextColor, *pFontModel );
+ }
+
+ switch( nTextHAlign )
+ {
+ case XML_Left: rAxFontData.mnHorAlign = AX_FONTDATA_LEFT; break;
+ case XML_Center: rAxFontData.mnHorAlign = AX_FONTDATA_CENTER; break;
+ case XML_Right: rAxFontData.mnHorAlign = AX_FONTDATA_RIGHT; break;
+ default: rAxFontData.mnHorAlign = AX_FONTDATA_LEFT;
+ }
+}
+
+void VmlDrawing::convertControlBackground( AxMorphDataModelBase& rAxModel, const ::oox::vml::ShapeBase& rShape ) const
+{
+ const ::oox::vml::FillModel& rFillModel = rShape.getTypeModel().maFillModel;
+ bool bHasFill = rFillModel.moFilled.get( true );
+ setFlag( rAxModel.mnFlags, AX_FLAGS_OPAQUE, bHasFill );
+ if( bHasFill )
+ {
+ const GraphicHelper& rGraphicHelper = getBaseFilter().getGraphicHelper();
+ sal_Int32 nSysWindowColor = rGraphicHelper.getSystemColor( XML_window, API_RGB_WHITE );
+ ::oox::drawingml::Color aColor = ::oox::vml::ConversionHelper::decodeColor( rGraphicHelper, rFillModel.moColor, rFillModel.moOpacity, nSysWindowColor );
+ sal_Int32 nRgbValue = aColor.getColor( rGraphicHelper );
+ rAxModel.mnBackColor = OleHelper::encodeOleColor( nRgbValue );
+ }
}
// ============================================================================
-OoxVmlDrawingFragment::OoxVmlDrawingFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
+VmlDrawingFragment::VmlDrawingFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
::oox::vml::DrawingFragment( rHelper.getOoxFilter(), rFragmentPath, rHelper.getVmlDrawing() ),
WorksheetHelper( rHelper )
{
}
-void OoxVmlDrawingFragment::finalizeImport()
+void VmlDrawingFragment::finalizeImport()
{
::oox::vml::DrawingFragment::finalizeImport();
getVmlDrawing().convertAndInsert();
@@ -677,4 +1097,3 @@ void OoxVmlDrawingFragment::finalizeImport()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/excelchartconverter.cxx b/oox/source/xls/excelchartconverter.cxx
index bde3dd65d723..53c0a3b83bf2 100644
--- a/oox/source/xls/excelchartconverter.cxx
+++ b/oox/source/xls/excelchartconverter.cxx
@@ -26,30 +26,30 @@
************************************************************************/
#include "oox/xls/excelchartconverter.hxx"
+
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include "oox/drawingml/chart/datasourcemodel.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/xls/formulaparser.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::chart2::XChartDocument;
-using ::com::sun::star::chart2::data::XDataProvider;
-using ::com::sun::star::chart2::data::XDataReceiver;
-using ::com::sun::star::chart2::data::XDataSequence;
-using ::oox::drawingml::chart::DataSequenceModel;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star::chart2::data;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::oox::drawingml::chart::DataSequenceModel;
+using ::rtl::OUString;
+
+// ============================================================================
+
ExcelChartConverter::ExcelChartConverter( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper )
{
@@ -122,4 +122,3 @@ Reference< XDataSequence > ExcelChartConverter::createDataSequence(
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/excelfilter.cxx b/oox/source/xls/excelfilter.cxx
index 5affbfff44a7..aeac1494c338 100644
--- a/oox/source/xls/excelfilter.cxx
+++ b/oox/source/xls/excelfilter.cxx
@@ -26,36 +26,35 @@
************************************************************************/
#include "oox/xls/excelfilter.hxx"
+
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include "oox/dump/biffdumper.hxx"
+#include "oox/dump/xlsbdumper.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/xls/biffdetector.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/excelchartconverter.hxx"
+#include "oox/xls/excelvbaproject.hxx"
#include "oox/xls/stylesbuffer.hxx"
#include "oox/xls/themebuffer.hxx"
#include "oox/xls/workbookfragment.hxx"
-#include "oox/dump/biffdumper.hxx"
-#include "oox/dump/xlsbdumper.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::xml::sax::XFastDocumentHandler;
-using ::oox::core::BinaryFilterBase;
-using ::oox::core::FragmentHandlerRef;
-using ::oox::core::Relation;
-using ::oox::core::Relations;
-using ::oox::core::XmlFilterBase;
-using ::oox::drawingml::table::TableStyleListPtr;
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+using ::oox::drawingml::table::TableStyleListPtr;
+
+// ============================================================================
+
ExcelFilterBase::ExcelFilterBase() :
mpData( 0 )
{
@@ -86,26 +85,27 @@ void ExcelFilterBase::unregisterWorkbookData()
OUString SAL_CALL ExcelFilter_getImplementationName() throw()
{
- return CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelFilter" );
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.xls.ExcelFilter" );
}
Sequence< OUString > SAL_CALL ExcelFilter_getSupportedServiceNames() throw()
{
- OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelFilter" );
- Sequence< OUString > aSeq( &aServiceName, 1 );
+ Sequence< OUString > aSeq( 2 );
+ aSeq[ 0 ] = CREATE_OUSTRING( "com.sun.star.document.ImportFilter" );
+ aSeq[ 1 ] = CREATE_OUSTRING( "com.sun.star.document.ExportFilter" );
return aSeq;
}
Reference< XInterface > SAL_CALL ExcelFilter_createInstance(
- const Reference< XMultiServiceFactory >& rxGlobalFactory ) throw( Exception )
+ const Reference< XComponentContext >& rxContext ) throw( Exception )
{
- return static_cast< ::cppu::OWeakObject* >( new ExcelFilter( rxGlobalFactory ) );
+ return static_cast< ::cppu::OWeakObject* >( new ExcelFilter( rxContext ) );
}
// ----------------------------------------------------------------------------
-ExcelFilter::ExcelFilter( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
- XmlFilterBase( rxGlobalFactory )
+ExcelFilter::ExcelFilter( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ XmlFilterBase( rxContext )
{
}
@@ -121,12 +121,12 @@ bool ExcelFilter::importDocument() throw()
this variable (nonpro only). */
OOX_DUMP_FILE( ::oox::dump::xlsb::Dumper );
- OUString aWorkbookPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "officeDocument" ) );
+ OUString aWorkbookPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "officeDocument" ) );
if( aWorkbookPath.getLength() == 0 )
return false;
WorkbookHelperRoot aHelper( *this );
- return aHelper.isValid() && importFragment( new OoxWorkbookFragment( aHelper, aWorkbookPath ) );
+ return aHelper.isValid() && importFragment( new WorkbookFragment( aHelper, aWorkbookPath ) );
}
bool ExcelFilter::exportDocument() throw()
@@ -159,6 +159,11 @@ GraphicHelper* ExcelFilter::implCreateGraphicHelper() const
return new ExcelGraphicHelper( getWorkbookData() );
}
+::oox::ole::VbaProject* ExcelFilter::implCreateVbaProject() const
+{
+ return new ExcelVbaProject( getComponentContext(), Reference< XSpreadsheetDocument >( getModel(), UNO_QUERY ) );
+}
+
OUString ExcelFilter::implGetImplementationName() const
{
return ExcelFilter_getImplementationName();
@@ -168,26 +173,27 @@ OUString ExcelFilter::implGetImplementationName() const
OUString SAL_CALL ExcelBiffFilter_getImplementationName() throw()
{
- return CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" );
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.xls.ExcelBiffFilter" );
}
Sequence< OUString > SAL_CALL ExcelBiffFilter_getSupportedServiceNames() throw()
{
- OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" );
- Sequence< OUString > aSeq( &aServiceName, 1 );
+ Sequence< OUString > aSeq( 2 );
+ aSeq[ 0 ] = CREATE_OUSTRING( "com.sun.star.document.ImportFilter" );
+ aSeq[ 1 ] = CREATE_OUSTRING( "com.sun.star.document.ExportFilter" );
return aSeq;
}
Reference< XInterface > SAL_CALL ExcelBiffFilter_createInstance(
- const Reference< XMultiServiceFactory >& rxGlobalFactory ) throw( Exception )
+ const Reference< XComponentContext >& rxContext ) throw( Exception )
{
- return static_cast< ::cppu::OWeakObject* >( new ExcelBiffFilter( rxGlobalFactory ) );
+ return static_cast< ::cppu::OWeakObject* >( new ExcelBiffFilter( rxContext ) );
}
// ----------------------------------------------------------------------------
-ExcelBiffFilter::ExcelBiffFilter( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
- BinaryFilterBase( rxGlobalFactory )
+ExcelBiffFilter::ExcelBiffFilter( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ BinaryFilterBase( rxContext )
{
}
@@ -233,6 +239,11 @@ GraphicHelper* ExcelBiffFilter::implCreateGraphicHelper() const
return new ExcelGraphicHelper( getWorkbookData() );
}
+::oox::ole::VbaProject* ExcelBiffFilter::implCreateVbaProject() const
+{
+ return new ExcelVbaProject( getComponentContext(), Reference< XSpreadsheetDocument >( getModel(), UNO_QUERY ) );
+}
+
OUString ExcelBiffFilter::implGetImplementationName() const
{
return ExcelBiffFilter_getImplementationName();
@@ -240,5 +251,64 @@ OUString ExcelBiffFilter::implGetImplementationName() const
// ============================================================================
+OUString SAL_CALL ExcelVbaProjectFilter_getImplementationName() throw()
+{
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.xls.ExcelVbaProjectFilter" );
+}
+
+Sequence< OUString > SAL_CALL ExcelVbaProjectFilter_getSupportedServiceNames() throw()
+{
+ Sequence< OUString > aSeq( 1 );
+ aSeq[ 0 ] = CREATE_OUSTRING( "com.sun.star.document.ImportFilter" );
+ return aSeq;
+}
+
+Reference< XInterface > SAL_CALL ExcelVbaProjectFilter_createInstance(
+ const Reference< XComponentContext >& rxContext ) throw( Exception )
+{
+ return static_cast< ::cppu::OWeakObject* >( new ExcelVbaProjectFilter( rxContext ) );
+}
+
+// ----------------------------------------------------------------------------
+
+ExcelVbaProjectFilter::ExcelVbaProjectFilter( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
+ ExcelBiffFilter( rxContext )
+{
+}
+
+bool ExcelVbaProjectFilter::importDocument() throw()
+{
+ // detect BIFF version and workbook stream name
+ OUString aWorkbookName;
+ BiffType eBiff = BiffDetector::detectStorageBiffVersion( aWorkbookName, getStorage() );
+ OSL_ENSURE( eBiff == BIFF8, "ExcelVbaProjectFilter::ExcelVbaProjectFilter - invalid file format" );
+ if( eBiff != BIFF8 )
+ return false;
+
+ StorageRef xVbaPrjStrg = openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false );
+ if( !xVbaPrjStrg || !xVbaPrjStrg->isStorage() )
+ return false;
+
+ WorkbookHelperRoot aHelper( *this, eBiff );
+ // set palette colors passed in service constructor
+ Any aPalette = getArgument( CREATE_OUSTRING( "ColorPalette" ) );
+ aHelper.getStyles().importPalette( aPalette );
+ // import the VBA project
+ getVbaProject().importVbaProject( *xVbaPrjStrg, getGraphicHelper() );
+ return true;
+}
+
+bool ExcelVbaProjectFilter::exportDocument() throw()
+{
+ return false;
+}
+
+OUString ExcelVbaProjectFilter::implGetImplementationName() const
+{
+ return ExcelVbaProjectFilter_getImplementationName();
+}
+
+// ============================================================================
+
} // namespace xls
} // namespace oox
diff --git a/oox/source/xls/excelhandlers.cxx b/oox/source/xls/excelhandlers.cxx
index aaf551424483..1ffad94d52f1 100644
--- a/oox/source/xls/excelhandlers.cxx
+++ b/oox/source/xls/excelhandlers.cxx
@@ -26,20 +26,23 @@
************************************************************************/
#include "oox/xls/excelhandlers.hxx"
+
#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
-using ::rtl::OUString;
-using ::oox::core::FilterBase;
-using ::oox::core::FragmentHandler2;
-
namespace oox {
namespace xls {
// ============================================================================
+
+using ::oox::core::FilterBase;
+using ::oox::core::FragmentHandler2;
+using ::rtl::OUString;
+
+// ============================================================================
// ============================================================================
-OoxWorkbookFragmentBase::OoxWorkbookFragmentBase(
+WorkbookFragmentBase::WorkbookFragmentBase(
const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
WorkbookHelper( rHelper )
@@ -48,14 +51,14 @@ OoxWorkbookFragmentBase::OoxWorkbookFragmentBase(
// ============================================================================
-OoxWorksheetFragmentBase::OoxWorksheetFragmentBase( const WorkbookHelper& rHelper,
- const OUString& rFragmentPath, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+WorksheetFragmentBase::WorksheetFragmentBase( const WorkbookHelper& rHelper,
+ const OUString& rFragmentPath, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
- WorksheetHelperRoot( rHelper, xProgressBar, eSheetType, nSheet )
+ WorksheetHelperRoot( rHelper, rxProgressBar, eSheetType, nSheet )
{
}
-OoxWorksheetFragmentBase::OoxWorksheetFragmentBase(
+WorksheetFragmentBase::WorksheetFragmentBase(
const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
WorksheetHelperRoot( rHelper )
@@ -65,108 +68,52 @@ OoxWorksheetFragmentBase::OoxWorksheetFragmentBase(
// ============================================================================
// ============================================================================
-namespace {
-
-const sal_uInt16 BIFF_BOF_GLOBALS = 0x0005; /// BIFF5-BIFF8 workbook globals.
-const sal_uInt16 BIFF_BOF_MODULE = 0x0006; /// BIFF5-BIFF8 Visual Basic module.
-const sal_uInt16 BIFF_BOF_SHEET = 0x0010; /// BIFF2-BIFF8 worksheet/dialog sheet.
-const sal_uInt16 BIFF_BOF_CHART = 0x0020; /// BIFF2-BIFF8 chart sheet.
-const sal_uInt16 BIFF_BOF_MACRO = 0x0040; /// BIFF4-BIFF8 macro sheet.
-const sal_uInt16 BIFF_BOF_WORKSPACE = 0x0100; /// BIFF3-BIFF8 workspace.
-
-} // namespace
-
-// ============================================================================
-
-BiffHandlerBase::~BiffHandlerBase()
-{
-}
-
-bool BiffHandlerBase::skipRecordBlock( sal_uInt16 nEndRecId )
-{
- sal_uInt16 nStartRecId = mrStrm.getRecId();
- while( mrStrm.startNextRecord() && (mrStrm.getRecId() != nEndRecId) )
- if( mrStrm.getRecId() == nStartRecId )
- skipRecordBlock( nEndRecId );
- return !mrStrm.isEof() && (mrStrm.getRecId() == nEndRecId);
-}
-
-bool BiffHandlerBase::isBofRecord() const
-{
- return
- (mrStrm.getRecId() == BIFF2_ID_BOF) ||
- (mrStrm.getRecId() == BIFF3_ID_BOF) ||
- (mrStrm.getRecId() == BIFF4_ID_BOF) ||
- (mrStrm.getRecId() == BIFF5_ID_BOF);
-}
-
-// ============================================================================
-
-BiffContextHandler::BiffContextHandler( const BiffHandlerBase& rParent ) :
- BiffHandlerBase( rParent )
+BiffContextHandler::~BiffContextHandler()
{
}
-// ============================================================================
-
-namespace prv {
-
-BiffFragmentStreamOwner::BiffFragmentStreamOwner( const FilterBase& rFilter, const OUString& rStrmName )
-{
- // do not automatically close the root stream (indicated by empty stream name)
- mxXInStrm.reset( new BinaryXInputStream( rFilter.openInputStream( rStrmName ), rStrmName.getLength() > 0 ) );
- mxBiffStrm.reset( new BiffInputStream( *mxXInStrm ) );
-}
+// ----------------------------------------------------------------------------
-BiffFragmentStreamOwner::~BiffFragmentStreamOwner()
+BiffWorkbookContextBase::BiffWorkbookContextBase( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper )
{
}
-} // namespace prv
-
// ----------------------------------------------------------------------------
-BiffFragmentHandler::BiffFragmentHandler( const FilterBase& rFilter, const OUString& rStrmName ) :
- prv::BiffFragmentStreamOwner( rFilter, rStrmName ),
- BiffHandlerBase( *mxBiffStrm )
+BiffWorksheetContextBase::BiffWorksheetContextBase( const WorkbookHelper& rHelper,
+ const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+ WorksheetHelperRoot( rHelper, rxProgressBar, eSheetType, nSheet )
{
}
-BiffFragmentHandler::BiffFragmentHandler( const BiffFragmentHandler& rHandler ) :
- prv::BiffFragmentStreamOwner( rHandler ),
- BiffHandlerBase( rHandler )
+BiffWorksheetContextBase::BiffWorksheetContextBase( const WorksheetHelper& rHelper ) :
+ WorksheetHelperRoot( rHelper )
{
}
-BiffFragmentType BiffFragmentHandler::startFragment( BiffType eBiff )
-{
- return mrStrm.startNextRecord() ? implStartFragment( eBiff ) : BIFF_FRAGMENT_UNKNOWN;
-}
+// ============================================================================
-BiffFragmentType BiffFragmentHandler::startFragment( BiffType eBiff, sal_Int64 nRecHandle )
-{
- return mrStrm.startRecordByHandle( nRecHandle ) ? implStartFragment( eBiff ) : BIFF_FRAGMENT_UNKNOWN;
-}
+namespace {
-bool BiffFragmentHandler::skipFragment()
-{
- while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
- if( isBofRecord() )
- skipFragment();
- return !mrStrm.isEof() && (mrStrm.getRecId() == BIFF_ID_EOF);
-}
+const sal_uInt16 BIFF_BOF_GLOBALS = 0x0005; /// BIFF5-BIFF8 workbook globals.
+const sal_uInt16 BIFF_BOF_MODULE = 0x0006; /// BIFF5-BIFF8 Visual Basic module.
+const sal_uInt16 BIFF_BOF_SHEET = 0x0010; /// BIFF2-BIFF8 worksheet/dialog sheet.
+const sal_uInt16 BIFF_BOF_CHART = 0x0020; /// BIFF2-BIFF8 chart sheet.
+const sal_uInt16 BIFF_BOF_MACRO = 0x0040; /// BIFF4-BIFF8 macro sheet.
+const sal_uInt16 BIFF_BOF_WORKSPACE = 0x0100; /// BIFF3-BIFF8 workspace.
-BiffFragmentType BiffFragmentHandler::implStartFragment( BiffType eBiff )
+BiffFragmentType lclStartFragment( BiffInputStream& rStrm, BiffType eBiff )
{
BiffFragmentType eFragment = BIFF_FRAGMENT_UNKNOWN;
/* #i23425# Don't rely on BOF record ID to read BOF contents, but on
the detected BIFF version. */
- if( isBofRecord() )
+ if( BiffHelper::isBofRecord( rStrm ) )
{
// BOF is always written unencrypted
- mrStrm.enableDecoder( false );
- mrStrm.skip( 2 );
- sal_uInt16 nType = mrStrm.readuInt16();
+ rStrm.enableDecoder( false );
+ rStrm.skip( 2 );
+ sal_uInt16 nType = rStrm.readuInt16();
// decide which fragment types are valid for current BIFF version
switch( eBiff )
@@ -219,30 +166,64 @@ BiffFragmentType BiffFragmentHandler::implStartFragment( BiffType eBiff )
return eFragment;
}
-// ============================================================================
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+BiffFragmentHandler::BiffFragmentHandler( const FilterBase& rFilter, const OUString& rStrmName )
+{
+ // do not automatically close the root stream (indicated by empty stream name)
+ bool bRootStrm = rStrmName.getLength() == 0;
+ mxXInStrm.reset( new BinaryXInputStream( rFilter.openInputStream( rStrmName ), !bRootStrm ) );
+ mxBiffStrm.reset( new BiffInputStream( *mxXInStrm ) );
+}
+
+BiffFragmentHandler::~BiffFragmentHandler()
+{
+}
+
+BiffFragmentType BiffFragmentHandler::startFragment( BiffType eBiff )
+{
+ return mxBiffStrm->startNextRecord() ? lclStartFragment( *mxBiffStrm, eBiff ) : BIFF_FRAGMENT_UNKNOWN;
+}
+
+BiffFragmentType BiffFragmentHandler::startFragment( BiffType eBiff, sal_Int64 nRecHandle )
+{
+ return mxBiffStrm->startRecordByHandle( nRecHandle ) ? lclStartFragment( *mxBiffStrm, eBiff ) : BIFF_FRAGMENT_UNKNOWN;
+}
+
+bool BiffFragmentHandler::skipFragment()
+{
+ while( mxBiffStrm->startNextRecord() && (mxBiffStrm->getRecId() != BIFF_ID_EOF) )
+ if( BiffHelper::isBofRecord( *mxBiffStrm ) )
+ skipFragment();
+ return !mxBiffStrm->isEof() && (mxBiffStrm->getRecId() == BIFF_ID_EOF);
+}
+
+// ----------------------------------------------------------------------------
BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, const OUString& rStrmName, bool bCloneDecoder ) :
BiffFragmentHandler( rHelper.getBaseFilter(), rStrmName ),
WorkbookHelper( rHelper )
{
if( bCloneDecoder )
- getCodecHelper().cloneDecoder( mrStrm );
+ getCodecHelper().cloneDecoder( getInputStream() );
}
-// ============================================================================
+// ----------------------------------------------------------------------------
BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const BiffWorkbookFragmentBase& rParent,
- ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+ const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
BiffFragmentHandler( rParent ),
- WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
+ WorksheetHelperRoot( rParent, rxProgressBar, eSheetType, nSheet )
{
}
-// ============================================================================
+// ----------------------------------------------------------------------------
-BiffSkipWorksheetFragment::BiffSkipWorksheetFragment(
- const BiffWorkbookFragmentBase& rParent, ISegmentProgressBarRef xProgressBar, sal_Int16 nSheet ) :
- BiffWorksheetFragmentBase( rParent, xProgressBar, SHEETTYPE_EMPTYSHEET, nSheet )
+BiffSkipWorksheetFragment::BiffSkipWorksheetFragment( const BiffWorkbookFragmentBase& rParent,
+ const ISegmentProgressBarRef& rxProgressBar, sal_Int16 nSheet ) :
+ BiffWorksheetFragmentBase( rParent, rxProgressBar, SHEETTYPE_EMPTYSHEET, nSheet )
{
}
@@ -256,4 +237,3 @@ bool BiffSkipWorksheetFragment::importFragment()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/excelvbaproject.cxx b/oox/source/xls/excelvbaproject.cxx
index ee22dc8398ba..7fc8115cc680 100755
--- a/oox/source/xls/excelvbaproject.cxx
+++ b/oox/source/xls/excelvbaproject.cxx
@@ -38,7 +38,6 @@
#include <rtl/ustrbuf.hxx>
#include "oox/helper/helper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "properties.hxx"
namespace oox {
namespace xls {
@@ -58,25 +57,12 @@ using ::rtl::OUStringBuffer;
// ============================================================================
-ExcelVbaProject::ExcelVbaProject( const Reference< XMultiServiceFactory >& rxGlobalFactory, const Reference< XSpreadsheetDocument >& rxDocument ) :
- ::oox::ole::VbaProject( rxGlobalFactory, Reference< XModel >( rxDocument, UNO_QUERY ), CREATE_OUSTRING( "Calc" ) ),
+ExcelVbaProject::ExcelVbaProject( const Reference< XComponentContext >& rxContext, const Reference< XSpreadsheetDocument >& rxDocument ) :
+ ::oox::ole::VbaProject( rxContext, Reference< XModel >( rxDocument, UNO_QUERY ), CREATE_OUSTRING( "Calc" ) ),
mxDocument( rxDocument )
{
}
-void ExcelVbaProject::createMissingModules()
-{
- /* !! HACK !! This function is called from old XLS filter only, must be
- removed when this filter uses the OOX VBA import instead of the old SVX
- VBA import.
- */
-
- // collect and register all sheets without codenames
- prepareImport();
- // manually create the registered dummy modules
- createDummyModules();
-}
-
// protected ------------------------------------------------------------------
namespace {
diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx
index 04fcd2f84648..683ac3582071 100644
--- a/oox/source/xls/externallinkbuffer.cxx
+++ b/oox/source/xls/externallinkbuffer.cxx
@@ -26,7 +26,7 @@
************************************************************************/
#include "oox/xls/externallinkbuffer.hxx"
-#include <rtl/strbuf.hxx>
+
#include <com/sun/star/sheet/ComplexReference.hpp>
#include <com/sun/star/sheet/DDELinkInfo.hpp>
#include <com/sun/star/sheet/ExternalLinkType.hpp>
@@ -38,53 +38,44 @@
#include <com/sun/star/sheet/XDDELinkResults.hpp>
#include <com/sun/star/sheet/XExternalDocLink.hpp>
#include <com/sun/star/sheet/XExternalDocLinks.hpp>
-#include "oox/helper/attributelist.hxx"
+#include <rtl/strbuf.hxx>
#include "oox/core/filterbase.hxx"
+#include "oox/helper/attributelist.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/excelhandlers.hxx"
#include "oox/xls/formulaparser.hxx"
#include "oox/xls/worksheetbuffer.hxx"
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::Relation;
+using ::oox::core::Relations;
using ::rtl::OString;
using ::rtl::OStringBuffer;
using ::rtl::OStringToOUString;
using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::sheet::ComplexReference;
-using ::com::sun::star::sheet::DDEItemInfo;
-using ::com::sun::star::sheet::DDELinkInfo;
-using ::com::sun::star::sheet::ExternalLinkInfo;
-using ::com::sun::star::sheet::ExternalReference;
-using ::com::sun::star::sheet::SingleReference;
-using ::com::sun::star::sheet::XDDELinks;
-using ::com::sun::star::sheet::XDDELinkResults;
-using ::com::sun::star::sheet::XExternalDocLinks;
-using ::com::sun::star::sheet::XExternalSheetCache;
-using ::oox::core::Relation;
-using ::oox::core::Relations;
-
-namespace oox {
-namespace xls {
// ============================================================================
namespace {
-const sal_uInt16 OOBIN_EXTERNALBOOK_BOOK = 0;
-const sal_uInt16 OOBIN_EXTERNALBOOK_DDE = 1;
-const sal_uInt16 OOBIN_EXTERNALBOOK_OLE = 2;
+const sal_uInt16 BIFF12_EXTERNALBOOK_BOOK = 0;
+const sal_uInt16 BIFF12_EXTERNALBOOK_DDE = 1;
+const sal_uInt16 BIFF12_EXTERNALBOOK_OLE = 2;
-const sal_uInt16 OOBIN_EXTNAME_AUTOMATIC = 0x0002;
-const sal_uInt16 OOBIN_EXTNAME_PREFERPIC = 0x0004;
-const sal_uInt16 OOBIN_EXTNAME_STDDOCNAME = 0x0008;
-const sal_uInt16 OOBIN_EXTNAME_OLEOBJECT = 0x0010;
-const sal_uInt16 OOBIN_EXTNAME_ICONIFIED = 0x0020;
+const sal_uInt16 BIFF12_EXTNAME_AUTOMATIC = 0x0002;
+const sal_uInt16 BIFF12_EXTNAME_PREFERPIC = 0x0004;
+const sal_uInt16 BIFF12_EXTNAME_STDDOCNAME = 0x0008;
+const sal_uInt16 BIFF12_EXTNAME_OLEOBJECT = 0x0010;
+const sal_uInt16 BIFF12_EXTNAME_ICONIFIED = 0x0020;
const sal_uInt16 BIFF_EXTNAME_BUILTIN = 0x0001;
const sal_uInt16 BIFF_EXTNAME_AUTOMATIC = 0x0002;
@@ -150,54 +141,54 @@ void ExternalName::importOleItem( const AttributeList& rAttribs )
maExtNameModel.mbIconified = rAttribs.getBool( XML_icon, false );
}
-void ExternalName::importExternalName( RecordInputStream& rStrm )
+void ExternalName::importExternalName( SequenceInputStream& rStrm )
{
rStrm >> maModel.maName;
OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importExternalName - empty name" );
}
-void ExternalName::importExternalNameFlags( RecordInputStream& rStrm )
+void ExternalName::importExternalNameFlags( SequenceInputStream& rStrm )
{
sal_uInt16 nFlags;
sal_Int32 nSheetId;
rStrm >> nFlags >> nSheetId;
- // index into sheet list of EXTSHEETNAMES (one-based in OOBIN)
+ // index into sheet list of EXTSHEETNAMES (one-based in BIFF12)
maModel.mnSheet = nSheetId - 1;
- // no flag for built-in names, as in OOX...
- maExtNameModel.mbNotify = getFlag( nFlags, OOBIN_EXTNAME_AUTOMATIC );
- maExtNameModel.mbPreferPic = getFlag( nFlags, OOBIN_EXTNAME_PREFERPIC );
- maExtNameModel.mbStdDocName = getFlag( nFlags, OOBIN_EXTNAME_STDDOCNAME );
- maExtNameModel.mbOleObj = getFlag( nFlags, OOBIN_EXTNAME_OLEOBJECT );
- maExtNameModel.mbIconified = getFlag( nFlags, OOBIN_EXTNAME_ICONIFIED );
+ // no flag for built-in names, as in OOXML...
+ maExtNameModel.mbNotify = getFlag( nFlags, BIFF12_EXTNAME_AUTOMATIC );
+ maExtNameModel.mbPreferPic = getFlag( nFlags, BIFF12_EXTNAME_PREFERPIC );
+ maExtNameModel.mbStdDocName = getFlag( nFlags, BIFF12_EXTNAME_STDDOCNAME );
+ maExtNameModel.mbOleObj = getFlag( nFlags, BIFF12_EXTNAME_OLEOBJECT );
+ maExtNameModel.mbIconified = getFlag( nFlags, BIFF12_EXTNAME_ICONIFIED );
OSL_ENSURE( (mrParentLink.getLinkType() == LINKTYPE_OLE) == maExtNameModel.mbOleObj,
"ExternalName::importExternalNameFlags - wrong OLE flag in external name" );
}
-void ExternalName::importDdeItemValues( RecordInputStream& rStrm )
+void ExternalName::importDdeItemValues( SequenceInputStream& rStrm )
{
sal_Int32 nRows, nCols;
rStrm >> nRows >> nCols;
setResultSize( nCols, nRows );
}
-void ExternalName::importDdeItemBool( RecordInputStream& rStrm )
+void ExternalName::importDdeItemBool( SequenceInputStream& rStrm )
{
appendResultValue< double >( (rStrm.readuInt8() == 0) ? 0.0 : 1.0 );
}
-void ExternalName::importDdeItemDouble( RecordInputStream& rStrm )
+void ExternalName::importDdeItemDouble( SequenceInputStream& rStrm )
{
appendResultValue( rStrm.readDouble() );
}
-void ExternalName::importDdeItemError( RecordInputStream& rStrm )
+void ExternalName::importDdeItemError( SequenceInputStream& rStrm )
{
appendResultValue( BiffHelper::calcDoubleFromError( rStrm.readuInt8() ) );
}
-void ExternalName::importDdeItemString( RecordInputStream& rStrm )
+void ExternalName::importDdeItemString( SequenceInputStream& rStrm )
{
- appendResultValue( rStrm.readString() );
+ appendResultValue( BiffHelper::readString( rStrm ) );
}
void ExternalName::importExternalName( BiffInputStream& rStrm )
@@ -322,8 +313,8 @@ sal_Int32 ExternalName::getSheetCacheIndex() const
sal_Int32 nCacheIdx = -1;
switch( getFilterType() )
{
- case FILTER_OOX:
- // OOXML/OOBIN: zero-based index into sheet list, -1 means global name
+ case FILTER_OOXML:
+ // OOXML/BIFF12: zero-based index into sheet list, -1 means global name
if( maModel.mnSheet >= 0 )
nCacheIdx = mrParentLink.getSheetIndex( maModel.mnSheet );
break;
@@ -373,14 +364,15 @@ bool ExternalName::getDdeLinkData( OUString& orDdeServer, OUString& orDdeTopic,
// try to create a DDE link and to set the imported link results
if( !mbDdeLinkCreated ) try
{
- Reference< XDDELinks > xDdeLinks( getDdeLinks(), UNO_QUERY_THROW );
+ PropertySet aDocProps( getDocument() );
+ Reference< XDDELinks > xDdeLinks( aDocProps.getAnyProperty( PROP_DDELinks ), UNO_QUERY_THROW );
mxDdeLink = xDdeLinks->addDDELink( mrParentLink.getClassName(), mrParentLink.getTargetUrl(), maModel.maName, ::com::sun::star::sheet::DDELinkMode_DEFAULT );
+ mbDdeLinkCreated = true; // ignore if setting results fails
if( !maResults.empty() )
{
Reference< XDDELinkResults > xResults( mxDdeLink, UNO_QUERY_THROW );
xResults->setResults( ContainerHelper::matrixToSequenceSequence( maResults ) );
}
- mbDdeLinkCreated = true;
}
catch( Exception& )
{
@@ -551,44 +543,44 @@ ExternalNameRef ExternalLink::importOleItem( const AttributeList& rAttribs )
return xExtName;
}
-void ExternalLink::importExternalRef( RecordInputStream& rStrm )
+void ExternalLink::importExternalRef( SequenceInputStream& rStrm )
{
rStrm >> maRelId;
}
-void ExternalLink::importExternalSelf( RecordInputStream& )
+void ExternalLink::importExternalSelf( SequenceInputStream& )
{
meLinkType = LINKTYPE_SELF;
}
-void ExternalLink::importExternalSame( RecordInputStream& )
+void ExternalLink::importExternalSame( SequenceInputStream& )
{
meLinkType = LINKTYPE_SAME;
}
-void ExternalLink::importExternalAddin( RecordInputStream& )
+void ExternalLink::importExternalAddin( SequenceInputStream& )
{
meLinkType = LINKTYPE_UNKNOWN;
}
-void ExternalLink::importExternalBook( const Relations& rRelations, RecordInputStream& rStrm )
+void ExternalLink::importExternalBook( const Relations& rRelations, SequenceInputStream& rStrm )
{
switch( rStrm.readuInt16() )
{
- case OOBIN_EXTERNALBOOK_BOOK:
- parseExternalReference( rRelations, rStrm.readString() );
+ case BIFF12_EXTERNALBOOK_BOOK:
+ parseExternalReference( rRelations, BiffHelper::readString( rStrm ) );
break;
- case OOBIN_EXTERNALBOOK_DDE:
+ case BIFF12_EXTERNALBOOK_DDE:
{
OUString aDdeService, aDdeTopic;
rStrm >> aDdeService >> aDdeTopic;
setDdeOleTargetUrl( aDdeService, aDdeTopic, LINKTYPE_DDE );
}
break;
- case OOBIN_EXTERNALBOOK_OLE:
+ case BIFF12_EXTERNALBOOK_OLE:
{
- OUString aTargetUrl = rRelations.getExternalTargetFromRelId( rStrm.readString() );
- OUString aProgId = rStrm.readString();
+ OUString aTargetUrl = rRelations.getExternalTargetFromRelId( BiffHelper::readString( rStrm ) );
+ OUString aProgId = BiffHelper::readString( rStrm );
setDdeOleTargetUrl( aProgId, aTargetUrl, LINKTYPE_OLE );
}
break;
@@ -597,17 +589,17 @@ void ExternalLink::importExternalBook( const Relations& rRelations, RecordInputS
}
}
-void ExternalLink::importExtSheetNames( RecordInputStream& rStrm )
+void ExternalLink::importExtSheetNames( SequenceInputStream& rStrm )
{
// load external sheet names and create the sheet caches in the Calc document
OSL_ENSURE( (meLinkType == LINKTYPE_EXTERNAL) || (meLinkType == LINKTYPE_LIBRARY),
"ExternalLink::importExtSheetNames - invalid link type" );
if( meLinkType == LINKTYPE_EXTERNAL ) // ignore sheets of external libraries
for( sal_Int32 nSheet = 0, nCount = rStrm.readInt32(); !rStrm.isEof() && (nSheet < nCount); ++nSheet )
- insertExternalSheet( rStrm.readString() );
+ insertExternalSheet( BiffHelper::readString( rStrm ) );
}
-ExternalNameRef ExternalLink::importExternalName( RecordInputStream& rStrm )
+ExternalNameRef ExternalLink::importExternalName( SequenceInputStream& rStrm )
{
ExternalNameRef xExtName = createExternalName();
xExtName->importExternalName( rStrm );
@@ -724,9 +716,9 @@ FunctionLibraryType ExternalLink::getFuncLibraryType() const
sal_Int16 ExternalLink::getCalcSheetIndex( sal_Int32 nTabId ) const
{
OSL_ENSURE( meLinkType == LINKTYPE_INTERNAL, "ExternalLink::getCalcSheetIndex - invalid link type" );
- OSL_ENSURE( (nTabId == 0) || (getFilterType() == FILTER_OOX) || (getBiff() == BIFF8),
+ OSL_ENSURE( (nTabId == 0) || (getFilterType() == FILTER_OOXML) || (getBiff() == BIFF8),
"ExternalLink::getCalcSheetIndex - invalid sheet index" );
- return ContainerHelper::getVectorElement< sal_Int16 >( maCalcSheets, nTabId, -1 );
+ return ContainerHelper::getVectorElement( maCalcSheets, nTabId, -1 );
}
sal_Int32 ExternalLink::getDocumentLinkIndex() const
@@ -738,9 +730,9 @@ sal_Int32 ExternalLink::getDocumentLinkIndex() const
sal_Int32 ExternalLink::getSheetCacheIndex( sal_Int32 nTabId ) const
{
OSL_ENSURE( meLinkType == LINKTYPE_EXTERNAL, "ExternalLink::getSheetCacheIndex - invalid link type" );
- OSL_ENSURE( (nTabId == 0) || (getFilterType() == FILTER_OOX) || (getBiff() == BIFF8),
+ OSL_ENSURE( (nTabId == 0) || (getFilterType() == FILTER_OOXML) || (getBiff() == BIFF8),
"ExternalLink::getSheetCacheIndex - invalid sheet index" );
- return ContainerHelper::getVectorElement< sal_Int32 >( maSheetCaches, nTabId, -1 );
+ return ContainerHelper::getVectorElement( maSheetCaches, nTabId, -1 );
}
Reference< XExternalSheetCache > ExternalLink::getSheetCache( sal_Int32 nTabId ) const
@@ -776,8 +768,8 @@ void ExternalLink::getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId
sal_Int32 nDocLinkIdx = getDocumentLinkIndex();
switch( getFilterType() )
{
- case FILTER_OOX:
- // OOBIN: passed indexes point into sheet list of EXTSHEETLIST
+ case FILTER_OOXML:
+ // BIFF12: passed indexes point into sheet list of EXTSHEETLIST
orSheetRange.setExternalRange( nDocLinkIdx, getSheetCacheIndex( nTabId1 ), getSheetCacheIndex( nTabId2 ) );
break;
case FILTER_BIFF:
@@ -819,8 +811,8 @@ ExternalNameRef ExternalLink::getNameByIndex( sal_Int32 nIndex ) const
// private --------------------------------------------------------------------
-#define OOX_TARGETTYPE_EXTLINK CREATE_OFFICEDOC_RELATIONSTYPE( "externalLinkPath" )
-#define OOX_TARGETTYPE_LIBRARY CREATE_MSOFFICE_RELATIONSTYPE( "xlExternalLinkPath/xlLibrary" )
+#define OOX_TARGETTYPE_EXTLINK CREATE_OFFICEDOC_RELATION_TYPE( "externalLinkPath" )
+#define OOX_TARGETTYPE_LIBRARY CREATE_MSOFFICE_RELATION_TYPE( "xlExternalLinkPath/xlLibrary" )
void ExternalLink::setExternalTargetUrl( const OUString& rTargetUrl, const OUString& rTargetType )
{
@@ -839,11 +831,14 @@ void ExternalLink::setExternalTargetUrl( const OUString& rTargetUrl, const OUStr
OSL_ENSURE( meLinkType != LINKTYPE_UNKNOWN, "ExternalLink::setExternalTargetUrl - empty target URL or unknown target type" );
// create the external document link API object that will contain the sheet caches
- if( meLinkType == LINKTYPE_EXTERNAL )
+ if( meLinkType == LINKTYPE_EXTERNAL ) try
+ {
+ PropertySet aDocProps( getDocument() );
+ Reference< XExternalDocLinks > xDocLinks( aDocProps.getAnyProperty( PROP_ExternalDocLinks ), UNO_QUERY_THROW );
+ mxDocLink = xDocLinks->addDocLink( maTargetUrl );
+ }
+ catch( Exception& )
{
- Reference< XExternalDocLinks > xDocLinks = getExternalDocLinks();
- if( xDocLinks.is() )
- mxDocLink = xDocLinks->addDocLink( maTargetUrl );
}
}
@@ -931,7 +926,7 @@ RefSheetsModel::RefSheetsModel() :
{
}
-void RefSheetsModel::readOobData( RecordInputStream& rStrm )
+void RefSheetsModel::readBiff12Data( SequenceInputStream& rStrm )
{
rStrm >> mnExtRefId >> mnTabId1 >> mnTabId2;
}
@@ -947,8 +942,10 @@ void RefSheetsModel::readBiff8Data( BiffInputStream& rStrm )
ExternalLinkBuffer::ExternalLinkBuffer( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
+ mxSelfRef( new ExternalLink( rHelper ) ),
mbUseRefSheets( false )
{
+ mxSelfRef->setSelfLinkType();
}
ExternalLinkRef ExternalLinkBuffer::importExternalReference( const AttributeList& rAttribs )
@@ -959,7 +956,7 @@ ExternalLinkRef ExternalLinkBuffer::importExternalReference( const AttributeList
return xExtLink;
}
-ExternalLinkRef ExternalLinkBuffer::importExternalRef( RecordInputStream& rStrm )
+ExternalLinkRef ExternalLinkBuffer::importExternalRef( SequenceInputStream& rStrm )
{
mbUseRefSheets = true;
ExternalLinkRef xExtLink = createExternalLink();
@@ -968,25 +965,25 @@ ExternalLinkRef ExternalLinkBuffer::importExternalRef( RecordInputStream& rStrm
return xExtLink;
}
-void ExternalLinkBuffer::importExternalSelf( RecordInputStream& rStrm )
+void ExternalLinkBuffer::importExternalSelf( SequenceInputStream& rStrm )
{
mbUseRefSheets = true;
createExternalLink()->importExternalSelf( rStrm );
}
-void ExternalLinkBuffer::importExternalSame( RecordInputStream& rStrm )
+void ExternalLinkBuffer::importExternalSame( SequenceInputStream& rStrm )
{
mbUseRefSheets = true;
createExternalLink()->importExternalSame( rStrm );
}
-void ExternalLinkBuffer::importExternalAddin( RecordInputStream& rStrm )
+void ExternalLinkBuffer::importExternalAddin( SequenceInputStream& rStrm )
{
mbUseRefSheets = true;
createExternalLink()->importExternalAddin( rStrm );
}
-void ExternalLinkBuffer::importExternalSheets( RecordInputStream& rStrm )
+void ExternalLinkBuffer::importExternalSheets( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbUseRefSheets, "ExternalLinkBuffer::importExternalSheets - missing EXTERNALREFS records" );
mbUseRefSheets = true;
@@ -999,7 +996,7 @@ void ExternalLinkBuffer::importExternalSheets( RecordInputStream& rStrm )
for( size_t nRefId = 0; !rStrm.isEof() && (nRefId < nMaxCount); ++nRefId )
{
RefSheetsModel aRefSheets;
- aRefSheets.readOobData( rStrm );
+ aRefSheets.readBiff12Data( rStrm );
maRefSheets.push_back( aRefSheets );
}
}
@@ -1039,30 +1036,32 @@ void ExternalLinkBuffer::importExternSheet8( BiffInputStream& rStrm )
insert the entries of the second record before the entries of the first
record. */
maRefSheets.insert( maRefSheets.begin(), nRefCount, RefSheetsModel() );
- for( RefSheetsModelVec::iterator aIt = maRefSheets.begin(); !rStrm.isEof() && (nRefCount > 0); --nRefCount )
+ for( RefSheetsModelVec::iterator aIt = maRefSheets.begin(), aEnd = aIt + nRefCount; !rStrm.isEof() && (aIt != aEnd); ++aIt )
aIt->readBiff8Data( rStrm );
}
Sequence< ExternalLinkInfo > ExternalLinkBuffer::getLinkInfos() const
{
::std::vector< ExternalLinkInfo > aLinkInfos;
- // dummy entry for index 0
- aLinkInfos.push_back( ExternalLinkInfo( ::com::sun::star::sheet::ExternalLinkType::UNKNOWN, Any() ) );
+ // should not be used for BIFF12 documents
+ OSL_ENSURE( (getFilterType() == FILTER_OOXML) && !mbUseRefSheets, "ExternalLinkBuffer::getLinkInfos - unexpected file format" );
+ // add entry for implicit index 0 (self reference to this document)
+ aLinkInfos.push_back( mxSelfRef->getLinkInfo() );
for( ExternalLinkVec::const_iterator aIt = maExtLinks.begin(), aEnd = maExtLinks.end(); aIt != aEnd; ++aIt )
aLinkInfos.push_back( (*aIt)->getLinkInfo() );
return ContainerHelper::vectorToSequence( aLinkInfos );
}
-ExternalLinkRef ExternalLinkBuffer::getExternalLink( sal_Int32 nRefId ) const
+ExternalLinkRef ExternalLinkBuffer::getExternalLink( sal_Int32 nRefId, bool bUseRefSheets ) const
{
ExternalLinkRef xExtLink;
switch( getFilterType() )
{
- case FILTER_OOX:
- // OOXML: one-based index
- if( !mbUseRefSheets )
- xExtLink = maLinks.get( nRefId - 1 );
- // OOBIN: zero-based index into ref-sheets list
+ case FILTER_OOXML:
+ // OOXML: 0 = this document, otherwise one-based index into link list
+ if( !bUseRefSheets || !mbUseRefSheets )
+ xExtLink = (nRefId == 0) ? mxSelfRef : maLinks.get( nRefId - 1 );
+ // BIFF12: zero-based index into ref-sheets list
else if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
xExtLink = maLinks.get( pRefSheets->mnExtRefId );
break;
@@ -1113,7 +1112,7 @@ LinkSheetRange ExternalLinkBuffer::getSheetRange( sal_Int32 nRefId, sal_Int16 nT
LinkSheetRange ExternalLinkBuffer::getSheetRange( sal_Int32 nRefId ) const
{
- OSL_ENSURE( ((getFilterType() == FILTER_OOX) && mbUseRefSheets) || (getBiff() == BIFF8), "ExternalLinkBuffer::getSheetRange - wrong BIFF version" );
+ OSL_ENSURE( ((getFilterType() == FILTER_OOXML) && mbUseRefSheets) || (getBiff() == BIFF8), "ExternalLinkBuffer::getSheetRange - wrong BIFF version" );
LinkSheetRange aSheetRange;
if( const ExternalLink* pExtLink = getExternalLink( nRefId ).get() )
if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
@@ -1140,4 +1139,3 @@ const RefSheetsModel* ExternalLinkBuffer::getRefSheets( sal_Int32 nRefId ) const
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/externallinkfragment.cxx b/oox/source/xls/externallinkfragment.cxx
index e1bff95ff724..094b192b817c 100644
--- a/oox/source/xls/externallinkfragment.cxx
+++ b/oox/source/xls/externallinkfragment.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/xls/externallinkfragment.hxx"
+
#include <com/sun/star/sheet/XExternalSheetCache.hpp>
#include "oox/helper/attributelist.hxx"
#include "oox/xls/biffinputstream.hxx"
@@ -33,32 +34,30 @@
#include "oox/xls/sheetdatacontext.hxx"
#include "oox/xls/unitconverter.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::sheet::XExternalSheetCache;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
-using ::oox::core::Relation;
-
namespace oox {
namespace xls {
// ============================================================================
-OoxExternalSheetDataContext::OoxExternalSheetDataContext(
- OoxWorkbookFragmentBase& rFragment, const Reference< XExternalSheetCache >& rxSheetCache ) :
- OoxWorkbookContextBase( rFragment ),
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+// ============================================================================
+
+ExternalSheetDataContext::ExternalSheetDataContext(
+ WorkbookFragmentBase& rFragment, const Reference< XExternalSheetCache >& rxSheetCache ) :
+ WorkbookContextBase( rFragment ),
mxSheetCache( rxSheetCache )
{
- OSL_ENSURE( mxSheetCache.is(), "OoxExternalSheetDataContext::OoxExternalSheetDataContext - missing sheet cache" );
+ OSL_ENSURE( mxSheetCache.is(), "ExternalSheetDataContext::ExternalSheetDataContext - missing sheet cache" );
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxExternalSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ExternalSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -69,50 +68,48 @@ ContextHandlerRef OoxExternalSheetDataContext::onCreateContext( sal_Int32 nEleme
if( nElement == XLS_TOKEN( cell ) ) { importCell( rAttribs ); return this; }
break;
case XLS_TOKEN( cell ):
- if( nElement == XLS_TOKEN( v ) ) return this; // collect characters in onEndElement()
+ if( nElement == XLS_TOKEN( v ) ) return this; // collect characters in onCharacters()
break;
}
return 0;
}
-void OoxExternalSheetDataContext::onEndElement( const OUString& rChars )
+void ExternalSheetDataContext::onCharacters( const OUString& rChars )
{
- switch( getCurrentElement() )
+ if( isCurrentElement( XLS_TOKEN( v ) ) )
{
- case XLS_TOKEN( v ):
- switch( mnCurrType )
- {
- case XML_b:
- case XML_n:
- setCellValue( Any( rChars.toDouble() ) );
- break;
- case XML_e:
- setCellValue( Any( BiffHelper::calcDoubleFromError( getUnitConverter().calcBiffErrorCode( rChars ) ) ) );
- break;
- case XML_str:
- setCellValue( Any( rChars ) );
- break;
- }
- mnCurrType = XML_TOKEN_INVALID;
- break;
+ switch( mnCurrType )
+ {
+ case XML_b:
+ case XML_n:
+ setCellValue( Any( rChars.toDouble() ) );
+ break;
+ case XML_e:
+ setCellValue( Any( BiffHelper::calcDoubleFromError( getUnitConverter().calcBiffErrorCode( rChars ) ) ) );
+ break;
+ case XML_str:
+ setCellValue( Any( rChars ) );
+ break;
+ }
+ mnCurrType = XML_TOKEN_INVALID;
}
}
-ContextHandlerRef OoxExternalSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef ExternalSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_EXTSHEETDATA:
- if( nRecId == OOBIN_ID_EXTROW ) { maCurrPos.Row = rStrm.readInt32(); return this; }
+ case BIFF12_ID_EXTSHEETDATA:
+ if( nRecId == BIFF12_ID_EXTROW ) { maCurrPos.Row = rStrm.readInt32(); return this; }
break;
- case OOBIN_ID_EXTROW:
+ case BIFF12_ID_EXTROW:
switch( nRecId )
{
- case OOBIN_ID_EXTCELL_BLANK: importExtCellBlank( rStrm ); break;
- case OOBIN_ID_EXTCELL_BOOL: importExtCellBool( rStrm ); break;
- case OOBIN_ID_EXTCELL_DOUBLE: importExtCellDouble( rStrm ); break;
- case OOBIN_ID_EXTCELL_ERROR: importExtCellError( rStrm ); break;
- case OOBIN_ID_EXTCELL_STRING: importExtCellString( rStrm ); break;
+ case BIFF12_ID_EXTCELL_BLANK: importExtCellBlank( rStrm ); break;
+ case BIFF12_ID_EXTCELL_BOOL: importExtCellBool( rStrm ); break;
+ case BIFF12_ID_EXTCELL_DOUBLE: importExtCellDouble( rStrm ); break;
+ case BIFF12_ID_EXTCELL_ERROR: importExtCellError( rStrm ); break;
+ case BIFF12_ID_EXTCELL_STRING: importExtCellString( rStrm ); break;
}
break;
}
@@ -121,7 +118,7 @@ ContextHandlerRef OoxExternalSheetDataContext::onCreateRecordContext( sal_Int32
// private --------------------------------------------------------------------
-void OoxExternalSheetDataContext::importCell( const AttributeList& rAttribs )
+void ExternalSheetDataContext::importCell( const AttributeList& rAttribs )
{
if( getAddressConverter().convertToCellAddress( maCurrPos, rAttribs.getString( XML_r, OUString() ), 0, false ) )
mnCurrType = rAttribs.getToken( XML_t, XML_n );
@@ -129,38 +126,38 @@ void OoxExternalSheetDataContext::importCell( const AttributeList& rAttribs )
mnCurrType = XML_TOKEN_INVALID;
}
-void OoxExternalSheetDataContext::importExtCellBlank( RecordInputStream& rStrm )
+void ExternalSheetDataContext::importExtCellBlank( SequenceInputStream& rStrm )
{
maCurrPos.Column = rStrm.readInt32();
setCellValue( Any( OUString() ) );
}
-void OoxExternalSheetDataContext::importExtCellBool( RecordInputStream& rStrm )
+void ExternalSheetDataContext::importExtCellBool( SequenceInputStream& rStrm )
{
maCurrPos.Column = rStrm.readInt32();
double fValue = (rStrm.readuInt8() == 0) ? 0.0 : 1.0;
setCellValue( Any( fValue ) );
}
-void OoxExternalSheetDataContext::importExtCellDouble( RecordInputStream& rStrm )
+void ExternalSheetDataContext::importExtCellDouble( SequenceInputStream& rStrm )
{
maCurrPos.Column = rStrm.readInt32();
setCellValue( Any( rStrm.readDouble() ) );
}
-void OoxExternalSheetDataContext::importExtCellError( RecordInputStream& rStrm )
+void ExternalSheetDataContext::importExtCellError( SequenceInputStream& rStrm )
{
maCurrPos.Column = rStrm.readInt32();
setCellValue( Any( BiffHelper::calcDoubleFromError( rStrm.readuInt8() ) ) );
}
-void OoxExternalSheetDataContext::importExtCellString( RecordInputStream& rStrm )
+void ExternalSheetDataContext::importExtCellString( SequenceInputStream& rStrm )
{
maCurrPos.Column = rStrm.readInt32();
- setCellValue( Any( rStrm.readString() ) );
+ setCellValue( Any( BiffHelper::readString( rStrm ) ) );
}
-void OoxExternalSheetDataContext::setCellValue( const Any& rValue )
+void ExternalSheetDataContext::setCellValue( const Any& rValue )
{
if( mxSheetCache.is() && getAddressConverter().checkCellAddress( maCurrPos, false ) ) try
{
@@ -173,17 +170,15 @@ void OoxExternalSheetDataContext::setCellValue( const Any& rValue )
// ============================================================================
-OoxExternalLinkFragment::OoxExternalLinkFragment( const WorkbookHelper& rHelper,
+ExternalLinkFragment::ExternalLinkFragment( const WorkbookHelper& rHelper,
const OUString& rFragmentPath, ExternalLink& rExtLink ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath ),
+ WorkbookFragmentBase( rHelper, rFragmentPath ),
mrExtLink( rExtLink ),
mnResultType( XML_TOKEN_INVALID )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxExternalLinkFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ExternalLinkFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -245,7 +240,7 @@ ContextHandlerRef OoxExternalLinkFragment::onCreateContext( sal_Int32 nElement,
}
break;
case XLS_TOKEN( value ):
- if( nElement == XLS_TOKEN( val ) ) return this; // collect value in onEndElement()
+ if( nElement == XLS_TOKEN( val ) ) return this; // collect value in onCharacters()
break;
case XLS_TOKEN( oleLink ):
@@ -258,209 +253,188 @@ ContextHandlerRef OoxExternalLinkFragment::onCreateContext( sal_Int32 nElement,
return 0;
}
-void OoxExternalLinkFragment::onEndElement( const OUString& rChars )
+void ExternalLinkFragment::onCharacters( const OUString& rChars )
{
- switch( getCurrentElement() )
+ if( isCurrentElement( XLS_TOKEN( val ) ) )
+ maResultValue = rChars;
+}
+
+void ExternalLinkFragment::onEndElement()
+{
+ if( isCurrentElement( XLS_TOKEN( value ) ) && mxExtName.get() ) switch( mnResultType )
{
- case XLS_TOKEN( val ):
- maResultValue = rChars;
+ case XML_b:
+ mxExtName->appendResultValue( maResultValue.toDouble() );
break;
- case XLS_TOKEN( value ):
- if( mxExtName.get() ) switch( mnResultType )
- {
- case XML_b:
- mxExtName->appendResultValue( maResultValue.toDouble() );
- break;
- case XML_e:
- mxExtName->appendResultValue( BiffHelper::calcDoubleFromError( getUnitConverter().calcBiffErrorCode( maResultValue ) ) );
- break;
- case XML_n:
- mxExtName->appendResultValue( maResultValue.toDouble() );
- break;
- case XML_str:
- mxExtName->appendResultValue( maResultValue );
- break;
- default:
- mxExtName->appendResultValue( BiffHelper::calcDoubleFromError( BIFF_ERR_NA ) );
- }
+ case XML_e:
+ mxExtName->appendResultValue( BiffHelper::calcDoubleFromError( getUnitConverter().calcBiffErrorCode( maResultValue ) ) );
+ break;
+ case XML_n:
+ mxExtName->appendResultValue( maResultValue.toDouble() );
+ break;
+ case XML_str:
+ mxExtName->appendResultValue( maResultValue );
break;
+ default:
+ mxExtName->appendResultValue( BiffHelper::calcDoubleFromError( BIFF_ERR_NA ) );
}
}
-ContextHandlerRef OoxExternalLinkFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef ExternalLinkFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_EXTERNALBOOK )
+ if( nRecId == BIFF12_ID_EXTERNALBOOK )
{
mrExtLink.importExternalBook( getRelations(), rStrm );
return this;
}
break;
- case OOBIN_ID_EXTERNALBOOK:
+ case BIFF12_ID_EXTERNALBOOK:
switch( nRecId )
{
- case OOBIN_ID_EXTSHEETDATA:
+ case BIFF12_ID_EXTSHEETDATA:
if( mrExtLink.getLinkType() == LINKTYPE_EXTERNAL )
return createSheetDataContext( rStrm.readInt32() );
break;
- case OOBIN_ID_EXTSHEETNAMES: mrExtLink.importExtSheetNames( rStrm ); break;
- case OOBIN_ID_EXTERNALNAME: mxExtName = mrExtLink.importExternalName( rStrm ); return this;
+ case BIFF12_ID_EXTSHEETNAMES: mrExtLink.importExtSheetNames( rStrm ); break;
+ case BIFF12_ID_EXTERNALNAME: mxExtName = mrExtLink.importExternalName( rStrm ); return this;
}
break;
- case OOBIN_ID_EXTERNALNAME:
+ case BIFF12_ID_EXTERNALNAME:
switch( nRecId )
{
- case OOBIN_ID_EXTERNALNAMEFLAGS: if( mxExtName.get() ) mxExtName->importExternalNameFlags( rStrm ); break;
- case OOBIN_ID_DDEITEMVALUES: if( mxExtName.get() ) mxExtName->importDdeItemValues( rStrm ); return this;
+ case BIFF12_ID_EXTERNALNAMEFLAGS: if( mxExtName.get() ) mxExtName->importExternalNameFlags( rStrm ); break;
+ case BIFF12_ID_DDEITEMVALUES: if( mxExtName.get() ) mxExtName->importDdeItemValues( rStrm ); return this;
}
break;
- case OOBIN_ID_DDEITEMVALUES:
+ case BIFF12_ID_DDEITEMVALUES:
switch( nRecId )
{
- case OOBIN_ID_DDEITEM_BOOL: if( mxExtName.get() ) mxExtName->importDdeItemBool( rStrm ); break;
- case OOBIN_ID_DDEITEM_DOUBLE: if( mxExtName.get() ) mxExtName->importDdeItemDouble( rStrm ); break;
- case OOBIN_ID_DDEITEM_ERROR: if( mxExtName.get() ) mxExtName->importDdeItemError( rStrm ); break;
- case OOBIN_ID_DDEITEM_STRING: if( mxExtName.get() ) mxExtName->importDdeItemString( rStrm ); break;
+ case BIFF12_ID_DDEITEM_BOOL: if( mxExtName.get() ) mxExtName->importDdeItemBool( rStrm ); break;
+ case BIFF12_ID_DDEITEM_DOUBLE: if( mxExtName.get() ) mxExtName->importDdeItemDouble( rStrm ); break;
+ case BIFF12_ID_DDEITEM_ERROR: if( mxExtName.get() ) mxExtName->importDdeItemError( rStrm ); break;
+ case BIFF12_ID_DDEITEM_STRING: if( mxExtName.get() ) mxExtName->importDdeItemString( rStrm ); break;
}
break;
}
return 0;
}
-ContextHandlerRef OoxExternalLinkFragment::createSheetDataContext( sal_Int32 nSheetId )
+ContextHandlerRef ExternalLinkFragment::createSheetDataContext( sal_Int32 nSheetId )
{
- return new OoxExternalSheetDataContext( *this, mrExtLink.getSheetCache( nSheetId ) );
+ return new ExternalSheetDataContext( *this, mrExtLink.getSheetCache( nSheetId ) );
}
-// oox.core.FragmentHandler2 interface ----------------------------------------
-
-const RecordInfo* OoxExternalLinkFragment::getRecordInfos() const
+const RecordInfo* ExternalLinkFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_DDEITEMVALUES, OOBIN_ID_DDEITEMVALUES + 1 },
- { OOBIN_ID_EXTERNALBOOK, OOBIN_ID_EXTERNALBOOK + 228 },
- { OOBIN_ID_EXTERNALNAME, OOBIN_ID_EXTERNALNAME + 10 },
- { OOBIN_ID_EXTROW, -1 },
- { OOBIN_ID_EXTSHEETDATA, OOBIN_ID_EXTSHEETDATA + 1 },
- { -1, -1 }
+ { BIFF12_ID_DDEITEMVALUES, BIFF12_ID_DDEITEMVALUES + 1 },
+ { BIFF12_ID_EXTERNALBOOK, BIFF12_ID_EXTERNALBOOK + 228 },
+ { BIFF12_ID_EXTERNALNAME, BIFF12_ID_EXTERNALNAME + 10 },
+ { BIFF12_ID_EXTROW, -1 },
+ { BIFF12_ID_EXTSHEETDATA, BIFF12_ID_EXTSHEETDATA + 1 },
+ { -1, -1 }
};
return spRecInfos;
}
// ============================================================================
+// ============================================================================
-BiffExternalLinkFragment::BiffExternalLinkFragment( const BiffWorkbookFragmentBase& rParent, bool bImportDefNames ) :
- BiffWorkbookFragmentBase( rParent ),
+BiffExternalSheetDataContext::BiffExternalSheetDataContext( const WorkbookHelper& rHelper, bool bImportDefNames ) :
+ BiffWorkbookContextBase( rHelper ),
mbImportDefNames( bImportDefNames )
{
}
-BiffExternalLinkFragment::~BiffExternalLinkFragment()
+BiffExternalSheetDataContext::~BiffExternalSheetDataContext()
{
}
-bool BiffExternalLinkFragment::importFragment()
+void BiffExternalSheetDataContext::importRecord( BiffInputStream& rStrm )
{
- // process all record in this sheet fragment
- while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
- {
- if( isBofRecord() )
- skipFragment(); // skip unknown embedded fragments
- else
- importRecord();
- }
- return !mrStrm.isEof() && (mrStrm.getRecId() == BIFF_ID_EOF);
-}
-
-void BiffExternalLinkFragment::importRecord()
-{
- sal_uInt16 nRecId = mrStrm.getRecId();
+ sal_uInt16 nRecId = rStrm.getRecId();
switch( getBiff() )
{
case BIFF2: switch( nRecId )
{
- case BIFF2_ID_EXTERNALNAME: importExternalName(); break;
- case BIFF_ID_EXTERNSHEET: importExternSheet(); break;
- case BIFF2_ID_DEFINEDNAME: importDefinedName(); break;
+ case BIFF2_ID_EXTERNALNAME: importExternalName( rStrm ); break;
+ case BIFF_ID_EXTERNSHEET: importExternSheet( rStrm ); break;
+ case BIFF2_ID_DEFINEDNAME: importDefinedName( rStrm ); break;
}
break;
case BIFF3: switch( nRecId )
{
- case BIFF_ID_CRN: importCrn(); break;
- case BIFF3_ID_EXTERNALNAME: importExternalName(); break;
- case BIFF_ID_EXTERNSHEET: importExternSheet(); break;
- case BIFF3_ID_DEFINEDNAME: importDefinedName(); break;
- case BIFF_ID_XCT: importXct(); break;
+ case BIFF_ID_CRN: importCrn( rStrm ); break;
+ case BIFF3_ID_EXTERNALNAME: importExternalName( rStrm ); break;
+ case BIFF_ID_EXTERNSHEET: importExternSheet( rStrm ); break;
+ case BIFF3_ID_DEFINEDNAME: importDefinedName( rStrm ); break;
+ case BIFF_ID_XCT: importXct( rStrm ); break;
}
break;
case BIFF4: switch( nRecId )
{
- case BIFF_ID_CRN: importCrn(); break;
- case BIFF3_ID_EXTERNALNAME: importExternalName(); break;
- case BIFF_ID_EXTERNSHEET: importExternSheet(); break;
- case BIFF3_ID_DEFINEDNAME: importDefinedName(); break;
- case BIFF_ID_XCT: importXct(); break;
+ case BIFF_ID_CRN: importCrn( rStrm ); break;
+ case BIFF3_ID_EXTERNALNAME: importExternalName( rStrm ); break;
+ case BIFF_ID_EXTERNSHEET: importExternSheet( rStrm ); break;
+ case BIFF3_ID_DEFINEDNAME: importDefinedName( rStrm ); break;
+ case BIFF_ID_XCT: importXct( rStrm ); break;
}
break;
case BIFF5: switch( nRecId )
{
- case BIFF_ID_CRN: importCrn(); break;
- case BIFF5_ID_EXTERNALNAME: importExternalName(); break;
- case BIFF_ID_EXTERNSHEET: importExternSheet(); break;
- case BIFF5_ID_DEFINEDNAME: importDefinedName(); break;
- case BIFF_ID_XCT: importXct(); break;
+ case BIFF_ID_CRN: importCrn( rStrm ); break;
+ case BIFF5_ID_EXTERNALNAME: importExternalName( rStrm ); break;
+ case BIFF_ID_EXTERNSHEET: importExternSheet( rStrm ); break;
+ case BIFF5_ID_DEFINEDNAME: importDefinedName( rStrm ); break;
+ case BIFF_ID_XCT: importXct( rStrm ); break;
}
break;
case BIFF8: switch( nRecId )
{
- case BIFF_ID_CRN: importCrn(); break;
- case BIFF_ID_EXTERNALBOOK: importExternalBook(); break;
- case BIFF5_ID_EXTERNALNAME: importExternalName(); break;
- case BIFF_ID_EXTERNSHEET: importExternSheet(); break;
- case BIFF5_ID_DEFINEDNAME: importDefinedName(); break;
- case BIFF_ID_XCT: importXct(); break;
+ case BIFF_ID_CRN: importCrn( rStrm ); break;
+ case BIFF_ID_EXTERNALBOOK: importExternalBook( rStrm ); break;
+ case BIFF5_ID_EXTERNALNAME: importExternalName( rStrm ); break;
+ case BIFF_ID_EXTERNSHEET: importExternSheet( rStrm ); break;
+ case BIFF5_ID_DEFINEDNAME: importDefinedName( rStrm ); break;
+ case BIFF_ID_XCT: importXct( rStrm ); break;
}
break;
case BIFF_UNKNOWN: break;
}
}
-void BiffExternalLinkFragment::finalizeImport()
-{
- getDefinedNames().finalizeImport();
-}
-
// private --------------------------------------------------------------------
-void BiffExternalLinkFragment::importExternSheet()
+void BiffExternalSheetDataContext::importExternSheet( BiffInputStream& rStrm )
{
mxSheetCache.clear();
if( getBiff() == BIFF8 )
- getExternalLinks().importExternSheet8( mrStrm );
+ getExternalLinks().importExternSheet8( rStrm );
else
- mxExtLink = getExternalLinks().importExternSheet( mrStrm );
+ mxExtLink = getExternalLinks().importExternSheet( rStrm );
}
-void BiffExternalLinkFragment::importExternalBook()
+void BiffExternalSheetDataContext::importExternalBook( BiffInputStream& rStrm )
{
mxSheetCache.clear();
- mxExtLink = getExternalLinks().importExternalBook( mrStrm );
+ mxExtLink = getExternalLinks().importExternalBook( rStrm );
}
-void BiffExternalLinkFragment::importExternalName()
+void BiffExternalSheetDataContext::importExternalName( BiffInputStream& rStrm )
{
if( mxExtLink.get() )
- mxExtLink->importExternalName( mrStrm );
+ mxExtLink->importExternalName( rStrm );
}
-void BiffExternalLinkFragment::importXct()
+void BiffExternalSheetDataContext::importXct( BiffInputStream& rStrm )
{
mxSheetCache.clear();
if( mxExtLink.get() && (mxExtLink->getLinkType() == LINKTYPE_EXTERNAL) )
@@ -475,64 +449,65 @@ void BiffExternalLinkFragment::importXct()
mxSheetCache = mxExtLink->getSheetCache( 0 );
break;
case BIFF8:
- mrStrm.skip( 2 );
- mxSheetCache = mxExtLink->getSheetCache( mrStrm.readInt16() );
+ rStrm.skip( 2 );
+ mxSheetCache = mxExtLink->getSheetCache( rStrm.readInt16() );
+ break;
+ case BIFF_UNKNOWN:
break;
- case BIFF_UNKNOWN: break;
}
}
}
-void BiffExternalLinkFragment::importCrn()
+void BiffExternalSheetDataContext::importCrn( BiffInputStream& rStrm )
{
if( !mxSheetCache.is() ) return;
sal_uInt8 nCol2, nCol1;
sal_uInt16 nRow;
- mrStrm >> nCol2 >> nCol1 >> nRow;
+ rStrm >> nCol2 >> nCol1 >> nRow;
bool bLoop = true;
- for( BinAddress aBinAddr( nCol1, nRow ); bLoop && !mrStrm.isEof() && (aBinAddr.mnCol <= nCol2); ++aBinAddr.mnCol )
+ for( BinAddress aBinAddr( nCol1, nRow ); bLoop && !rStrm.isEof() && (aBinAddr.mnCol <= nCol2); ++aBinAddr.mnCol )
{
- switch( mrStrm.readuInt8() )
+ switch( rStrm.readuInt8() )
{
case BIFF_DATATYPE_EMPTY:
- mrStrm.skip( 8 );
+ rStrm.skip( 8 );
setCellValue( aBinAddr, Any( OUString() ) );
break;
case BIFF_DATATYPE_DOUBLE:
- setCellValue( aBinAddr, Any( mrStrm.readDouble() ) );
+ setCellValue( aBinAddr, Any( rStrm.readDouble() ) );
break;
case BIFF_DATATYPE_STRING:
{
- OUString aText = (getBiff() == BIFF8) ? mrStrm.readUniString() : mrStrm.readByteStringUC( false, getTextEncoding() );
+ OUString aText = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteStringUC( false, getTextEncoding() );
setCellValue( aBinAddr, Any( aText ) );
}
break;
case BIFF_DATATYPE_BOOL:
{
- double fValue = (mrStrm.readuInt8() == 0) ? 0.0 : 1.0;
+ double fValue = (rStrm.readuInt8() == 0) ? 0.0 : 1.0;
setCellValue( aBinAddr, Any( fValue ) );
- mrStrm.skip( 7 );
+ rStrm.skip( 7 );
}
break;
case BIFF_DATATYPE_ERROR:
- setCellValue( aBinAddr, Any( BiffHelper::calcDoubleFromError( mrStrm.readuInt8() ) ) );
- mrStrm.skip( 7 );
+ setCellValue( aBinAddr, Any( BiffHelper::calcDoubleFromError( rStrm.readuInt8() ) ) );
+ rStrm.skip( 7 );
break;
default:
- OSL_ENSURE( false, "BiffExternalLinkFragment::importCrn - unknown data type" );
+ OSL_ENSURE( false, "BiffExternalSheetDataContext::importCrn - unknown data type" );
bLoop = false;
}
}
}
-void BiffExternalLinkFragment::importDefinedName()
+void BiffExternalSheetDataContext::importDefinedName( BiffInputStream& rStrm )
{
if( mbImportDefNames )
- getDefinedNames().importDefinedName( mrStrm );
+ getDefinedNames().importDefinedName( rStrm );
}
-void BiffExternalLinkFragment::setCellValue( const BinAddress& rBinAddr, const Any& rValue )
+void BiffExternalSheetDataContext::setCellValue( const BinAddress& rBinAddr, const Any& rValue )
{
CellAddress aCellPos;
if( mxSheetCache.is() && getAddressConverter().convertToCellAddress( aCellPos, rBinAddr, 0, false ) ) try
@@ -546,6 +521,28 @@ void BiffExternalLinkFragment::setCellValue( const BinAddress& rBinAddr, const A
// ============================================================================
+BiffExternalLinkFragment::BiffExternalLinkFragment( const BiffWorkbookFragmentBase& rParent ) :
+ BiffWorkbookFragmentBase( rParent )
+{
+}
+
+bool BiffExternalLinkFragment::importFragment()
+{
+ // process all record in this sheet fragment
+ BiffExternalSheetDataContext aSheetContext( *this, false );
+ BiffInputStream& rStrm = getInputStream();
+ while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
+ {
+ if( BiffHelper::isBofRecord( rStrm ) )
+ skipFragment(); // skip unknown embedded fragments
+ else
+ aSheetContext.importRecord( rStrm );
+ }
+ return !rStrm.isEof() && (rStrm.getRecId() == BIFF_ID_EOF);
+}
+
+// ============================================================================
+// ============================================================================
+
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx
index ea353bb48558..ba8485d1f42b 100644..100755
--- a/oox/source/xls/formulabase.cxx
+++ b/oox/source/xls/formulabase.cxx
@@ -26,9 +26,8 @@
************************************************************************/
#include "oox/xls/formulabase.hxx"
+
#include <map>
-#include <rtl/strbuf.hxx>
-#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/table/XCellRange.hpp>
#include <com/sun/star/sheet/AddressConvention.hpp>
@@ -41,37 +40,28 @@
#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
#include <com/sun/star/sheet/XFormulaParser.hpp>
#include <com/sun/star/sheet/XFormulaTokens.hpp>
-#include "properties.hxx"
-#include "oox/helper/recordinputstream.hxx"
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
#include "oox/core/filterbase.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/xls/biffinputstream.hxx"
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
using ::rtl::OString;
using ::rtl::OStringBuffer;
+using ::rtl::OStringToOUString;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::rtl::OStringToOUString;
using ::rtl::OUStringToOString;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::sheet::SingleReference;
-using ::com::sun::star::sheet::ComplexReference;
-using ::com::sun::star::sheet::FormulaToken;
-using ::com::sun::star::sheet::FormulaOpCodeMapEntry;
-using ::com::sun::star::sheet::XSpreadsheetDocument;
-using ::com::sun::star::sheet::XFormulaOpCodeMapper;
-using ::com::sun::star::sheet::XFormulaTokens;
-
-namespace oox {
-namespace xls {
// reference helpers ==========================================================
@@ -83,16 +73,16 @@ BinSingleRef2d::BinSingleRef2d() :
{
}
-void BinSingleRef2d::setOobData( sal_uInt16 nCol, sal_Int32 nRow, bool bRelativeAsOffset )
+void BinSingleRef2d::setBiff12Data( sal_uInt16 nCol, sal_Int32 nRow, bool bRelativeAsOffset )
{
- mnCol = nCol & OOBIN_TOK_REF_COLMASK;
- mnRow = nRow & OOBIN_TOK_REF_ROWMASK;
- mbColRel = getFlag( nCol, OOBIN_TOK_REF_COLREL );
- mbRowRel = getFlag( nCol, OOBIN_TOK_REF_ROWREL );
- if( bRelativeAsOffset && mbColRel && (mnCol > (OOBIN_TOK_REF_COLMASK >> 1)) )
- mnCol -= (OOBIN_TOK_REF_COLMASK + 1);
- if( bRelativeAsOffset && mbRowRel && (mnRow > (OOBIN_TOK_REF_ROWMASK >> 1)) )
- mnRow -= (OOBIN_TOK_REF_ROWMASK + 1);
+ mnCol = nCol & BIFF12_TOK_REF_COLMASK;
+ mnRow = nRow & BIFF12_TOK_REF_ROWMASK;
+ mbColRel = getFlag( nCol, BIFF12_TOK_REF_COLREL );
+ mbRowRel = getFlag( nCol, BIFF12_TOK_REF_ROWREL );
+ if( bRelativeAsOffset && mbColRel && (mnCol > (BIFF12_TOK_REF_COLMASK >> 1)) )
+ mnCol -= (BIFF12_TOK_REF_COLMASK + 1);
+ if( bRelativeAsOffset && mbRowRel && (mnRow > (BIFF12_TOK_REF_ROWMASK >> 1)) )
+ mnRow -= (BIFF12_TOK_REF_ROWMASK + 1);
}
void BinSingleRef2d::setBiff2Data( sal_uInt8 nCol, sal_uInt16 nRow, bool bRelativeAsOffset )
@@ -119,12 +109,12 @@ void BinSingleRef2d::setBiff8Data( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelat
mnRow -= 0x10000;
}
-void BinSingleRef2d::readOobData( RecordInputStream& rStrm, bool bRelativeAsOffset )
+void BinSingleRef2d::readBiff12Data( SequenceInputStream& rStrm, bool bRelativeAsOffset )
{
sal_Int32 nRow;
sal_uInt16 nCol;
rStrm >> nRow >> nCol;
- setOobData( nCol, nRow, bRelativeAsOffset );
+ setBiff12Data( nCol, nRow, bRelativeAsOffset );
}
void BinSingleRef2d::readBiff2Data( BiffInputStream& rStrm, bool bRelativeAsOffset )
@@ -144,13 +134,13 @@ void BinSingleRef2d::readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffs
// ----------------------------------------------------------------------------
-void BinComplexRef2d::readOobData( RecordInputStream& rStrm, bool bRelativeAsOffset )
+void BinComplexRef2d::readBiff12Data( SequenceInputStream& rStrm, bool bRelativeAsOffset )
{
sal_Int32 nRow1, nRow2;
sal_uInt16 nCol1, nCol2;
rStrm >> nRow1 >> nRow2 >> nCol1 >> nCol2;
- maRef1.setOobData( nCol1, nRow1, bRelativeAsOffset );
- maRef2.setOobData( nCol2, nRow2, bRelativeAsOffset );
+ maRef1.setBiff12Data( nCol1, nRow1, bRelativeAsOffset );
+ maRef2.setBiff12Data( nCol2, nRow2, bRelativeAsOffset );
}
void BinComplexRef2d::readBiff2Data( BiffInputStream& rStrm, bool bRelativeAsOffset )
@@ -246,8 +236,8 @@ struct FunctionData
{
const sal_Char* mpcOdfFuncName; /// ODF function name.
const sal_Char* mpcOoxFuncName; /// OOXML function name.
- sal_uInt16 mnOobFuncId; /// OOBIN function identifier.
- sal_uInt16 mnBiffFuncId; /// BIFF function identifier.
+ sal_uInt16 mnBiff12FuncId; /// BIFF12 function identifier.
+ sal_uInt16 mnBiffFuncId; /// BIFF2-BIFF8 function identifier.
sal_uInt8 mnMinParamCount; /// Minimum number of parameters.
sal_uInt8 mnMaxParamCount; /// Maximum number of parameters.
sal_uInt8 mnRetClass; /// BIFF token class of the return value.
@@ -264,7 +254,7 @@ inline bool FunctionData::isSupported( bool bImportFilter ) const
return !getFlag( mnFlags, bImportFilter ? FUNCFLAG_EXPORTONLY : FUNCFLAG_IMPORTONLY );
}
-const sal_uInt16 NOID = SAL_MAX_UINT16; /// No BIFF/OOBIN function identifier available.
+const sal_uInt16 NOID = SAL_MAX_UINT16; /// No BIFF function identifier available.
const sal_uInt8 MX = SAL_MAX_UINT8; /// Maximum parameter count.
// abbreviations for function return token class
@@ -678,8 +668,8 @@ static const FunctionData saFuncTableBiff5[] =
{ "COUNTBLANK", "COUNTBLANK", 347, 347, 1, 1, V, { RO }, 0 },
{ "ISPMT", "ISPMT", 350, 350, 4, 4, V, { VR }, 0 },
{ 0, "DATEDIF", 351, 351, 3, 3, V, { VR }, FUNCFLAG_IMPORTONLY }, // not supported in Calc
- { 0, "DATESTRING", 352, 352, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY }, // not supported in Calc, missing in OOX spec
- { 0, "NUMBERSTRING", 353, 353, 2, 2, V, { VR }, FUNCFLAG_IMPORTONLY }, // not supported in Calc, missing in OOX spec
+ { 0, "DATESTRING", 352, 352, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY }, // not supported in Calc, missing in OOXML spec
+ { 0, "NUMBERSTRING", 353, 353, 2, 2, V, { VR }, FUNCFLAG_IMPORTONLY }, // not supported in Calc, missing in OOXML spec
{ "ROMAN", "ROMAN", 354, 354, 1, 2, V, { VR }, 0 },
// *** EuroTool add-in ***
@@ -722,7 +712,7 @@ static const FunctionData saFuncTableBiff8[] =
{ 0, "RTD", 379, 379, 3, 3, A, { VR, VR, RO }, 0 }
};
-/** Functions new in OOX. */
+/** Functions new in OOXML. */
static const FunctionData saFuncTableOox[] =
{
{ 0, "CUBEVALUE", 380, NOID, 1, MX, V, { VR, RX }, 0 },
@@ -769,7 +759,7 @@ static const FunctionData saFuncTableOdf[] =
{ "PERMUTATIONA", 0, NOID, NOID, 2, 2, V, { VR }, FUNCFLAG_MACROCALLODF },
{ "PHI", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF },
{ "RRI", 0, NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALLODF },
- { "SHEET", 0, NOID, NOID, 1, 1, V, { RO }, FUNCFLAG_MACROCALLODF },
+ { "SHEET", 0, NOID, NOID, 0, 1, V, { RO }, FUNCFLAG_MACROCALLODF },
{ "SHEETS", 0, NOID, NOID, 0, 1, V, { RO }, FUNCFLAG_MACROCALLODF },
{ "SKEWP", 0, NOID, NOID, 1, MX, V, { RX }, FUNCFLAG_MACROCALLODF },
{ "UNICHAR", 0, NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALLODF },
@@ -845,8 +835,8 @@ struct FunctionProviderImpl
FunctionInfoVector maFuncs; /// All function infos in one list.
FuncNameMap maOdfFuncs; /// Maps ODF function names to function data.
FuncNameMap maOoxFuncs; /// Maps OOXML function names to function data.
- FuncIdMap maOobFuncs; /// Maps OOBIN function indexes to function data.
- FuncIdMap maBiffFuncs; /// Maps BIFF function indexes to function data.
+ FuncIdMap maBiff12Funcs; /// Maps BIFF12 function indexes to function data.
+ FuncIdMap maBiffFuncs; /// Maps BIFF2-BIFF8 function indexes to function data.
FuncNameMap maMacroFuncs; /// Maps macro function names to function data.
explicit FunctionProviderImpl( FilterType eFilter, BiffType eBiff, bool bImportFilter );
@@ -869,9 +859,9 @@ FunctionProviderImpl::FunctionProviderImpl( FilterType eFilter, BiffType eBiff,
sal_uInt8 nMaxParam = 0;
switch( eFilter )
{
- case FILTER_OOX:
+ case FILTER_OOXML:
nMaxParam = OOX_MAX_PARAMCOUNT;
- eBiff = BIFF8; // insert all BIFF function tables, then the OOX table
+ eBiff = BIFF8; // insert all BIFF function tables, then the OOXML table
break;
case FILTER_BIFF:
nMaxParam = BIFF_MAX_PARAMCOUNT;
@@ -895,7 +885,7 @@ FunctionProviderImpl::FunctionProviderImpl( FilterType eFilter, BiffType eBiff,
initFuncs( saFuncTableBiff5, STATIC_ARRAY_END( saFuncTableBiff5 ), nMaxParam, bImportFilter );
if( eBiff >= BIFF8 )
initFuncs( saFuncTableBiff8, STATIC_ARRAY_END( saFuncTableBiff8 ), nMaxParam, bImportFilter );
- if( eFilter == FILTER_OOX )
+ if( eFilter == FILTER_OOXML )
initFuncs( saFuncTableOox, STATIC_ARRAY_END( saFuncTableOox ), nMaxParam, bImportFilter );
initFuncs( saFuncTableOdf, STATIC_ARRAY_END( saFuncTableOdf ), nMaxParam, bImportFilter );
}
@@ -928,7 +918,7 @@ void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nM
}
xFuncInfo->mnApiOpCode = -1;
- xFuncInfo->mnOobFuncId = rFuncData.mnOobFuncId;
+ xFuncInfo->mnBiff12FuncId = rFuncData.mnBiff12FuncId;
xFuncInfo->mnBiffFuncId = rFuncData.mnBiffFuncId;
xFuncInfo->mnMinParamCount = rFuncData.mnMinParamCount;
xFuncInfo->mnMaxParamCount = (rFuncData.mnMaxParamCount == MX) ? nMaxParam : rFuncData.mnMaxParamCount;
@@ -941,7 +931,7 @@ void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nM
xFuncInfo->mbMacroFunc = bMacroCmd || getFlag( rFuncData.mnFlags, FUNCFLAG_MACROFUNC );
xFuncInfo->mbVarParam = bMacroCmd || (rFuncData.mnMinParamCount != rFuncData.mnMaxParamCount) || getFlag( rFuncData.mnFlags, FUNCFLAG_ALWAYSVAR );
- setFlag( xFuncInfo->mnOobFuncId, BIFF_TOK_FUNCVAR_CMD, bMacroCmd );
+ setFlag( xFuncInfo->mnBiff12FuncId, BIFF_TOK_FUNCVAR_CMD, bMacroCmd );
setFlag( xFuncInfo->mnBiffFuncId, BIFF_TOK_FUNCVAR_CMD, bMacroCmd );
// insert the function info into the member maps
@@ -950,8 +940,8 @@ void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nM
maOdfFuncs[ xFuncInfo->maOdfFuncName ] = xFuncInfo;
if( xFuncInfo->maOoxFuncName.getLength() > 0 )
maOoxFuncs[ xFuncInfo->maOoxFuncName ] = xFuncInfo;
- if( xFuncInfo->mnOobFuncId != NOID )
- maOobFuncs[ xFuncInfo->mnOobFuncId ] = xFuncInfo;
+ if( xFuncInfo->mnBiff12FuncId != NOID )
+ maBiff12Funcs[ xFuncInfo->mnBiff12FuncId ] = xFuncInfo;
if( xFuncInfo->mnBiffFuncId != NOID )
maBiffFuncs[ xFuncInfo->mnBiffFuncId ] = xFuncInfo;
if( xFuncInfo->maBiffMacroName.getLength() > 0 )
@@ -986,9 +976,9 @@ const FunctionInfo* FunctionProvider::getFuncInfoFromOoxFuncName( const OUString
return mxFuncImpl->maOoxFuncs.get( rFuncName ).get();
}
-const FunctionInfo* FunctionProvider::getFuncInfoFromOobFuncId( sal_uInt16 nFuncId ) const
+const FunctionInfo* FunctionProvider::getFuncInfoFromBiff12FuncId( sal_uInt16 nFuncId ) const
{
- return mxFuncImpl->maOobFuncs.get( nFuncId ).get();
+ return mxFuncImpl->maBiff12Funcs.get( nFuncId ).get();
}
const FunctionInfo* FunctionProvider::getFuncInfoFromBiffFuncId( sal_uInt16 nFuncId ) const
@@ -1252,7 +1242,7 @@ bool OpCodeProviderImpl::initFuncOpCode( FunctionInfo& orFuncInfo, const ApiToke
append( '"' ).getStr() );
}
- // add to parser map, if OOX function name exists
+ // add to parser map, if OOXML function name exists
if( bIsValid && (orFuncInfo.maOoxFuncName.getLength() > 0) )
{
// create the parser map entry
@@ -1747,4 +1737,3 @@ void FormulaProcessorBase::convertStringToStringList(
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx
index 12deadecd695..8b1f1b809d88 100644
--- a/oox/source/xls/formulaparser.cxx
+++ b/oox/source/xls/formulaparser.cxx
@@ -26,14 +26,13 @@
************************************************************************/
#include "oox/xls/formulaparser.hxx"
+
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sheet/ComplexReference.hpp>
#include <com/sun/star/sheet/ExternalReference.hpp>
#include <com/sun/star/sheet/FormulaToken.hpp>
#include <com/sun/star/sheet/ReferenceFlags.hpp>
#include <com/sun/star/sheet/SingleReference.hpp>
-#include "properties.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/core/filterbase.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
@@ -42,26 +41,20 @@
#include "oox/xls/tablebuffer.hxx"
#include "oox/xls/worksheethelper.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::sheet::ComplexReference;
-using ::com::sun::star::sheet::ExternalReference;
-using ::com::sun::star::sheet::SingleReference;
-using ::com::sun::star::sheet::XFormulaParser;
-using namespace ::com::sun::star::sheet::ReferenceFlags;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::sheet::ReferenceFlags;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
sal_uInt16 lclReadFmlaSize( BiffInputStream& rStrm, BiffType eBiff, const sal_uInt16* pnFmlaSize )
@@ -249,7 +242,7 @@ const ApiToken* FormulaFinalizer::processParameters(
if( !aParamInfoIt.isExcelOnlyParam() )
{
// replace empty second and third parameter in IF function with zeros
- if( (pRealFuncInfo->mnOobFuncId == OOBIN_FUNC_IF) && ((nParam == 1) || (nParam == 2)) && bIsEmpty )
+ if( (pRealFuncInfo->mnBiff12FuncId == BIFF_FUNC_IF) && ((nParam == 1) || (nParam == 2)) && bIsEmpty )
{
maTokens.append< double >( OPCODE_PUSH, 0.0 );
bIsEmpty = false;
@@ -368,10 +361,10 @@ const ApiToken* FormulaFinalizer::findParameters( ParameterPosVector& rParams,
void FormulaFinalizer::appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam )
{
(void)nParam; // prevent 'unused' warning
- switch( rFuncInfo.mnOobFuncId )
+ switch( rFuncInfo.mnBiff12FuncId )
{
- case OOBIN_FUNC_FLOOR:
- case OOBIN_FUNC_CEILING:
+ case BIFF_FUNC_FLOOR:
+ case BIFF_FUNC_CEILING:
OSL_ENSURE( nParam == 2, "FormulaFinalizer::appendCalcOnlyParameter - unexpected parameter index" );
maTokens.append< double >( OPCODE_PUSH, 1.0 );
maTokens.append( OPCODE_SEP );
@@ -381,9 +374,9 @@ void FormulaFinalizer::appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, s
void FormulaFinalizer::appendRequiredParameters( const FunctionInfo& rFuncInfo, size_t nParamCount )
{
- switch( rFuncInfo.mnOobFuncId )
+ switch( rFuncInfo.mnBiff12FuncId )
{
- case OOBIN_FUNC_WEEKNUM:
+ case BIFF_FUNC_WEEKNUM:
if( nParamCount == 1 )
{
maTokens.append< double >( OPCODE_PUSH, 1.0 );
@@ -422,12 +415,12 @@ public:
FormulaContext& rContext,
const OUString& rFormulaString );
- /** Imports and converts a OOBIN token array from the passed stream. */
- virtual void importOobFormula(
+ /** Imports and converts a BIFF12 token array from the passed stream. */
+ virtual void importBiff12Formula(
FormulaContext& rContext,
- RecordInputStream& rStrm );
+ SequenceInputStream& rStrm );
- /** Imports and converts a BIFF token array from the passed stream. */
+ /** Imports and converts a BIFF2-BIFF8 token array from the passed stream. */
virtual void importBiffFormula(
FormulaContext& rContext,
BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize );
@@ -439,7 +432,7 @@ public:
const ApiTokenSequence& rTokens );
/** Tries to resolve the passed ref-id to an OLE target URL. */
- OUString resolveOleTarget( sal_Int32 nRefId ) const;
+ OUString resolveOleTarget( sal_Int32 nRefId, bool bUseRefSheets ) const;
protected:
typedef ::std::pair< sal_Int32, bool > WhiteSpace;
@@ -589,9 +582,9 @@ void FormulaParserImpl::importOoxFormula( FormulaContext&, const OUString& )
OSL_ENSURE( false, "FormulaParserImpl::importOoxFormula - not implemented" );
}
-void FormulaParserImpl::importOobFormula( FormulaContext&, RecordInputStream& )
+void FormulaParserImpl::importBiff12Formula( FormulaContext&, SequenceInputStream& )
{
- OSL_ENSURE( false, "FormulaParserImpl::importOobFormula - not implemented" );
+ OSL_ENSURE( false, "FormulaParserImpl::importBiff12Formula - not implemented" );
}
void FormulaParserImpl::importBiffFormula( FormulaContext&, BiffInputStream&, const sal_uInt16* )
@@ -605,9 +598,9 @@ void FormulaParserImpl::setFormula( FormulaContext& rContext, const ApiTokenSequ
finalizeImport( rTokens );
}
-OUString FormulaParserImpl::resolveOleTarget( sal_Int32 nRefId ) const
+OUString FormulaParserImpl::resolveOleTarget( sal_Int32 nRefId, bool bUseRefSheets ) const
{
- const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get();
+ const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId, bUseRefSheets ).get();
OSL_ENSURE( pExtLink && (pExtLink->getLinkType() == LINKTYPE_OLE), "FormulaParserImpl::resolveOleTarget - missing or wrong link" );
if( pExtLink && (pExtLink->getLinkType() == LINKTYPE_OLE) )
return getBaseFilter().getAbsoluteUrl( pExtLink->getTargetUrl() );
@@ -903,7 +896,7 @@ bool FormulaParserImpl::pushValueOperand( const Type& rValue, sal_Int32 nOpCode
bool FormulaParserImpl::pushBoolOperand( bool bValue )
{
- if( const FunctionInfo* pFuncInfo = getFuncInfoFromOobFuncId( bValue ? OOBIN_FUNC_TRUE : OOBIN_FUNC_FALSE ) )
+ if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiff12FuncId( bValue ? BIFF_FUNC_TRUE : BIFF_FUNC_FALSE ) )
return pushFunctionOperator( pFuncInfo->mnApiOpCode, 0 );
return pushValueOperand< double >( bValue ? 1.0 : 0.0 );
}
@@ -1234,7 +1227,7 @@ OUString FormulaParserImpl::resolveDefinedName( sal_Int32 nTokenIndex ) const
return OUString();
}
-// OOX parser implementation ==================================================
+// OOXML/BIFF12 parser implementation =========================================
class OoxFormulaParserImpl : public FormulaParserImpl
{
@@ -1245,40 +1238,40 @@ public:
FormulaContext& rContext,
const OUString& rFormulaString );
- virtual void importOobFormula(
+ virtual void importBiff12Formula(
FormulaContext& rContext,
- RecordInputStream& rStrm );
+ SequenceInputStream& rStrm );
private:
// import token contents and create API formula token ---------------------
- bool importAttrToken( RecordInputStream& rStrm );
- bool importSpaceToken( RecordInputStream& rStrm );
- bool importTableToken( RecordInputStream& rStrm );
- bool importArrayToken( RecordInputStream& rStrm );
- bool importRefToken( RecordInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
- bool importAreaToken( RecordInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
- bool importRef3dToken( RecordInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
- bool importArea3dToken( RecordInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
- bool importMemAreaToken( RecordInputStream& rStrm, bool bAddData );
- bool importMemFuncToken( RecordInputStream& rStrm );
- bool importNameToken( RecordInputStream& rStrm );
- bool importNameXToken( RecordInputStream& rStrm );
- bool importFuncToken( RecordInputStream& rStrm );
- bool importFuncVarToken( RecordInputStream& rStrm );
- bool importExpToken( RecordInputStream& rStrm );
-
- LinkSheetRange readSheetRange( RecordInputStream& rStrm );
-
- void swapStreamPosition( RecordInputStream& rStrm );
- void skipMemAreaAddData( RecordInputStream& rStrm );
+ bool importAttrToken( SequenceInputStream& rStrm );
+ bool importSpaceToken( SequenceInputStream& rStrm );
+ bool importTableToken( SequenceInputStream& rStrm );
+ bool importArrayToken( SequenceInputStream& rStrm );
+ bool importRefToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
+ bool importAreaToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
+ bool importRef3dToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
+ bool importArea3dToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
+ bool importMemAreaToken( SequenceInputStream& rStrm, bool bAddData );
+ bool importMemFuncToken( SequenceInputStream& rStrm );
+ bool importNameToken( SequenceInputStream& rStrm );
+ bool importNameXToken( SequenceInputStream& rStrm );
+ bool importFuncToken( SequenceInputStream& rStrm );
+ bool importFuncVarToken( SequenceInputStream& rStrm );
+ bool importExpToken( SequenceInputStream& rStrm );
+
+ LinkSheetRange readSheetRange( SequenceInputStream& rStrm );
+
+ void swapStreamPosition( SequenceInputStream& rStrm );
+ void skipMemAreaAddData( SequenceInputStream& rStrm );
// convert BIN token and push API operand or operator ---------------------
- bool pushOobName( sal_Int32 nNameId );
- bool pushOobExtName( sal_Int32 nRefId, sal_Int32 nNameId );
- bool pushOobFunction( sal_uInt16 nFuncId );
- bool pushOobFunction( sal_uInt16 nFuncId, sal_uInt8 nParamCount );
+ bool pushBiff12Name( sal_Int32 nNameId );
+ bool pushBiff12ExtName( sal_Int32 nRefId, sal_Int32 nNameId );
+ bool pushBiff12Function( sal_uInt16 nFuncId );
+ bool pushBiff12Function( sal_uInt16 nFuncId, sal_uInt8 nParamCount );
private:
ApiParserWrapper maApiParser; /// Wrapper for the API formula parser object.
@@ -1307,7 +1300,7 @@ void OoxFormulaParserImpl::importOoxFormula( FormulaContext& rContext, const OUS
finalizeImport( maApiParser.parseFormula( rFormulaString, rContext.getBaseAddress() ) );
}
-void OoxFormulaParserImpl::importOobFormula( FormulaContext& rContext, RecordInputStream& rStrm )
+void OoxFormulaParserImpl::importBiff12Formula( FormulaContext& rContext, SequenceInputStream& rStrm )
{
initializeImport( rContext );
@@ -1336,34 +1329,34 @@ void OoxFormulaParserImpl::importOobFormula( FormulaContext& rContext, RecordInp
// base tokens
switch( nBaseId )
{
- case BIFF_TOKID_EXP: bOk = importExpToken( rStrm ); break;
- case BIFF_TOKID_ADD: bOk = pushBinaryOperator( OPCODE_ADD ); break;
- case BIFF_TOKID_SUB: bOk = pushBinaryOperator( OPCODE_SUB ); break;
- case BIFF_TOKID_MUL: bOk = pushBinaryOperator( OPCODE_MULT ); break;
- case BIFF_TOKID_DIV: bOk = pushBinaryOperator( OPCODE_DIV ); break;
- case BIFF_TOKID_POWER: bOk = pushBinaryOperator( OPCODE_POWER ); break;
- case BIFF_TOKID_CONCAT: bOk = pushBinaryOperator( OPCODE_CONCAT ); break;
- case BIFF_TOKID_LT: bOk = pushBinaryOperator( OPCODE_LESS ); break;
- case BIFF_TOKID_LE: bOk = pushBinaryOperator( OPCODE_LESS_EQUAL ); break;
- case BIFF_TOKID_EQ: bOk = pushBinaryOperator( OPCODE_EQUAL ); break;
- case BIFF_TOKID_GE: bOk = pushBinaryOperator( OPCODE_GREATER_EQUAL ); break;
- case BIFF_TOKID_GT: bOk = pushBinaryOperator( OPCODE_GREATER ); break;
- case BIFF_TOKID_NE: bOk = pushBinaryOperator( OPCODE_NOT_EQUAL ); break;
- case BIFF_TOKID_ISECT: bOk = pushBinaryOperator( OPCODE_INTERSECT ); break;
- case BIFF_TOKID_LIST: bOk = pushBinaryOperator( OPCODE_LIST ); break;
- case BIFF_TOKID_RANGE: bOk = pushBinaryOperator( OPCODE_RANGE ); break;
- case BIFF_TOKID_UPLUS: bOk = pushUnaryPreOperator( OPCODE_PLUS_SIGN ); break;
- case BIFF_TOKID_UMINUS: bOk = pushUnaryPreOperator( OPCODE_MINUS_SIGN ); break;
- case BIFF_TOKID_PERCENT: bOk = pushUnaryPostOperator( OPCODE_PERCENT ); break;
- case BIFF_TOKID_PAREN: bOk = pushParenthesesOperator(); break;
- case BIFF_TOKID_MISSARG: bOk = pushOperand( OPCODE_MISSING ); break;
- case BIFF_TOKID_STR: bOk = pushValueOperand( rStrm.readString( false ) ); break;
- case BIFF_TOKID_NLR: bOk = importTableToken( rStrm ); break;
- case BIFF_TOKID_ATTR: bOk = importAttrToken( rStrm ); break;
- case BIFF_TOKID_ERR: bOk = pushBiffErrorOperand( rStrm.readuInt8() ); break;
- case BIFF_TOKID_BOOL: bOk = pushBiffBoolOperand( rStrm.readuInt8() ); break;
- case BIFF_TOKID_INT: bOk = pushValueOperand< double >( rStrm.readuInt16() ); break;
- case BIFF_TOKID_NUM: bOk = pushValueOperand( rStrm.readDouble() ); break;
+ case BIFF_TOKID_EXP: bOk = importExpToken( rStrm ); break;
+ case BIFF_TOKID_ADD: bOk = pushBinaryOperator( OPCODE_ADD ); break;
+ case BIFF_TOKID_SUB: bOk = pushBinaryOperator( OPCODE_SUB ); break;
+ case BIFF_TOKID_MUL: bOk = pushBinaryOperator( OPCODE_MULT ); break;
+ case BIFF_TOKID_DIV: bOk = pushBinaryOperator( OPCODE_DIV ); break;
+ case BIFF_TOKID_POWER: bOk = pushBinaryOperator( OPCODE_POWER ); break;
+ case BIFF_TOKID_CONCAT: bOk = pushBinaryOperator( OPCODE_CONCAT ); break;
+ case BIFF_TOKID_LT: bOk = pushBinaryOperator( OPCODE_LESS ); break;
+ case BIFF_TOKID_LE: bOk = pushBinaryOperator( OPCODE_LESS_EQUAL ); break;
+ case BIFF_TOKID_EQ: bOk = pushBinaryOperator( OPCODE_EQUAL ); break;
+ case BIFF_TOKID_GE: bOk = pushBinaryOperator( OPCODE_GREATER_EQUAL ); break;
+ case BIFF_TOKID_GT: bOk = pushBinaryOperator( OPCODE_GREATER ); break;
+ case BIFF_TOKID_NE: bOk = pushBinaryOperator( OPCODE_NOT_EQUAL ); break;
+ case BIFF_TOKID_ISECT: bOk = pushBinaryOperator( OPCODE_INTERSECT ); break;
+ case BIFF_TOKID_LIST: bOk = pushBinaryOperator( OPCODE_LIST ); break;
+ case BIFF_TOKID_RANGE: bOk = pushBinaryOperator( OPCODE_RANGE ); break;
+ case BIFF_TOKID_UPLUS: bOk = pushUnaryPreOperator( OPCODE_PLUS_SIGN ); break;
+ case BIFF_TOKID_UMINUS: bOk = pushUnaryPreOperator( OPCODE_MINUS_SIGN ); break;
+ case BIFF_TOKID_PERCENT: bOk = pushUnaryPostOperator( OPCODE_PERCENT ); break;
+ case BIFF_TOKID_PAREN: bOk = pushParenthesesOperator(); break;
+ case BIFF_TOKID_MISSARG: bOk = pushOperand( OPCODE_MISSING ); break;
+ case BIFF_TOKID_STR: bOk = pushValueOperand( BiffHelper::readString( rStrm, false ) ); break;
+ case BIFF_TOKID_NLR: bOk = importTableToken( rStrm ); break;
+ case BIFF_TOKID_ATTR: bOk = importAttrToken( rStrm ); break;
+ case BIFF_TOKID_ERR: bOk = pushBiffErrorOperand( rStrm.readuInt8() ); break;
+ case BIFF_TOKID_BOOL: bOk = pushBiffBoolOperand( rStrm.readuInt8() ); break;
+ case BIFF_TOKID_INT: bOk = pushValueOperand< double >( rStrm.readuInt16() ); break;
+ case BIFF_TOKID_NUM: bOk = pushValueOperand( rStrm.readDouble() ); break;
default: bOk = false;
}
}
@@ -1409,31 +1402,31 @@ void OoxFormulaParserImpl::importOobFormula( FormulaContext& rContext, RecordInp
// import token contents and create API formula token -------------------------
-bool OoxFormulaParserImpl::importAttrToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importAttrToken( SequenceInputStream& rStrm )
{
bool bOk = true;
sal_uInt8 nType;
rStrm >> nType;
- // equal flags in BIFF and OOBIN
+ // equal flags in all BIFFs
switch( nType )
{
case 0: // sometimes, tAttrSkip tokens miss the type flag
- case OOBIN_TOK_ATTR_VOLATILE:
- case OOBIN_TOK_ATTR_IF:
- case OOBIN_TOK_ATTR_SKIP:
- case OOBIN_TOK_ATTR_ASSIGN:
- case OOBIN_TOK_ATTR_IFERROR:
+ case BIFF_TOK_ATTR_VOLATILE:
+ case BIFF_TOK_ATTR_IF:
+ case BIFF_TOK_ATTR_SKIP:
+ case BIFF_TOK_ATTR_ASSIGN:
+ case BIFF_TOK_ATTR_IFERROR:
rStrm.skip( 2 );
break;
- case OOBIN_TOK_ATTR_CHOOSE:
+ case BIFF_TOK_ATTR_CHOOSE:
rStrm.skip( 2 * rStrm.readuInt16() + 2 );
break;
- case OOBIN_TOK_ATTR_SUM:
+ case BIFF_TOK_ATTR_SUM:
rStrm.skip( 2 );
- bOk = pushOobFunction( OOBIN_FUNC_SUM, 1 );
+ bOk = pushBiff12Function( BIFF_FUNC_SUM, 1 );
break;
- case OOBIN_TOK_ATTR_SPACE:
- case OOBIN_TOK_ATTR_SPACE_VOLATILE:
+ case BIFF_TOK_ATTR_SPACE:
+ case BIFF_TOK_ATTR_SPACE_VOLATILE:
bOk = importSpaceToken( rStrm );
break;
default:
@@ -1442,7 +1435,7 @@ bool OoxFormulaParserImpl::importAttrToken( RecordInputStream& rStrm )
return bOk;
}
-bool OoxFormulaParserImpl::importSpaceToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importSpaceToken( SequenceInputStream& rStrm )
{
// equal constants in BIFF and OOX
sal_uInt8 nType, nCount;
@@ -1471,7 +1464,7 @@ bool OoxFormulaParserImpl::importSpaceToken( RecordInputStream& rStrm )
return true;
}
-bool OoxFormulaParserImpl::importTableToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importTableToken( SequenceInputStream& rStrm )
{
sal_uInt16 nFlags, nTableId, nCol1, nCol2;
rStrm.skip( 3 );
@@ -1491,8 +1484,8 @@ bool OoxFormulaParserImpl::importTableToken( RecordInputStream& rStrm )
bool bFixedStartRow = true;
bool bFixedHeight = false;
- bool bSingleCol = getFlag( nFlags, OOBIN_TOK_TABLE_COLUMN );
- bool bColRange = getFlag( nFlags, OOBIN_TOK_TABLE_COLRANGE );
+ bool bSingleCol = getFlag( nFlags, BIFF12_TOK_TABLE_COLUMN );
+ bool bColRange = getFlag( nFlags, BIFF12_TOK_TABLE_COLRANGE );
bool bValidRef = !bSingleCol || !bColRange;
OSL_ENSURE( bValidRef, "OoxFormulaParserImpl::importTableToken - illegal combination of single column and column range" );
if( bValidRef )
@@ -1507,11 +1500,11 @@ bool OoxFormulaParserImpl::importTableToken( RecordInputStream& rStrm )
if( bValidRef )
{
- bool bAllRows = getFlag( nFlags, OOBIN_TOK_TABLE_ALL );
- bool bHeaderRows = getFlag( nFlags, OOBIN_TOK_TABLE_HEADERS );
- bool bDataRows = getFlag( nFlags, OOBIN_TOK_TABLE_DATA );
- bool bTotalsRows = getFlag( nFlags, OOBIN_TOK_TABLE_TOTALS );
- bool bThisRow = getFlag( nFlags, OOBIN_TOK_TABLE_THISROW );
+ bool bAllRows = getFlag( nFlags, BIFF12_TOK_TABLE_ALL );
+ bool bHeaderRows = getFlag( nFlags, BIFF12_TOK_TABLE_HEADERS );
+ bool bDataRows = getFlag( nFlags, BIFF12_TOK_TABLE_DATA );
+ bool bTotalsRows = getFlag( nFlags, BIFF12_TOK_TABLE_TOTALS );
+ bool bThisRow = getFlag( nFlags, BIFF12_TOK_TABLE_THISROW );
sal_Int32 nStartDataRow = xTable->getHeaderRows();
sal_Int32 nEndDataRow = nEndRow - xTable->getTotalsRows();
@@ -1567,8 +1560,8 @@ bool OoxFormulaParserImpl::importTableToken( RecordInputStream& rStrm )
if( (nStartCol == 0) && (nEndCol + 1 == nWidth) && (nStartRow == 0) && (nEndRow + 1 == nHeight) )
return pushValueOperand( nTokenIndex, OPCODE_DBAREA );
// create an OFFSET function call to refer to a subrange of the table
- const FunctionInfo* pRowsInfo = getFuncInfoFromOobFuncId( OOBIN_FUNC_ROWS );
- const FunctionInfo* pColumnsInfo = getFuncInfoFromOobFuncId( OOBIN_FUNC_COLUMNS );
+ const FunctionInfo* pRowsInfo = getFuncInfoFromBiff12FuncId( BIFF_FUNC_ROWS );
+ const FunctionInfo* pColumnsInfo = getFuncInfoFromBiff12FuncId( BIFF_FUNC_COLUMNS );
return
pRowsInfo && pColumnsInfo &&
pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
@@ -1590,13 +1583,13 @@ bool OoxFormulaParserImpl::importTableToken( RecordInputStream& rStrm )
(pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
pushFunctionOperatorToken( *pColumnsInfo, 1 )) :
pushValueOperandToken< double >( nEndCol - nStartCol + 1 )) &&
- pushOobFunction( OOBIN_FUNC_OFFSET, 5 );
+ pushBiff12Function( BIFF_FUNC_OFFSET, 5 );
}
}
return pushBiffErrorOperand( BIFF_ERR_REF );
}
-bool OoxFormulaParserImpl::importArrayToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importArrayToken( SequenceInputStream& rStrm )
{
rStrm.skip( 14 );
@@ -1622,16 +1615,16 @@ bool OoxFormulaParserImpl::importArrayToken( RecordInputStream& rStrm )
appendRawToken( OPCODE_ARRAY_COLSEP );
switch( rStrm.readuInt8() )
{
- case OOBIN_TOK_ARRAY_DOUBLE:
+ case BIFF_TOK_ARRAY_DOUBLE:
appendRawToken( OPCODE_PUSH ) <<= rStrm.readDouble();
break;
- case OOBIN_TOK_ARRAY_STRING:
- appendRawToken( OPCODE_PUSH ) <<= rStrm.readString( false );
+ case BIFF_TOK_ARRAY_STRING:
+ appendRawToken( OPCODE_PUSH ) <<= BiffHelper::readString( rStrm, false );
break;
- case OOBIN_TOK_ARRAY_BOOL:
+ case BIFF_TOK_ARRAY_BOOL:
appendRawToken( OPCODE_PUSH ) <<= static_cast< double >( (rStrm.readuInt8() == BIFF_TOK_BOOL_FALSE) ? 0.0 : 1.0 );
break;
- case OOBIN_TOK_ARRAY_ERROR:
+ case BIFF_TOK_ARRAY_ERROR:
appendRawToken( OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( rStrm.readuInt8() );
rStrm.skip( 3 );
break;
@@ -1649,37 +1642,37 @@ bool OoxFormulaParserImpl::importArrayToken( RecordInputStream& rStrm )
return true;
}
-bool OoxFormulaParserImpl::importRefToken( RecordInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
+bool OoxFormulaParserImpl::importRefToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
{
BinSingleRef2d aRef;
- aRef.readOobData( rStrm, bRelativeAsOffset );
+ aRef.readBiff12Data( rStrm, bRelativeAsOffset );
return pushReferenceOperand( aRef, bDeleted, bRelativeAsOffset );
}
-bool OoxFormulaParserImpl::importAreaToken( RecordInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
+bool OoxFormulaParserImpl::importAreaToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
{
BinComplexRef2d aRef;
- aRef.readOobData( rStrm, bRelativeAsOffset );
+ aRef.readBiff12Data( rStrm, bRelativeAsOffset );
return pushReferenceOperand( aRef, bDeleted, bRelativeAsOffset );
}
-bool OoxFormulaParserImpl::importRef3dToken( RecordInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
+bool OoxFormulaParserImpl::importRef3dToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
{
LinkSheetRange aSheetRange = readSheetRange( rStrm );
BinSingleRef2d aRef;
- aRef.readOobData( rStrm, bRelativeAsOffset );
+ aRef.readBiff12Data( rStrm, bRelativeAsOffset );
return pushReferenceOperand( aSheetRange, aRef, bDeleted, bRelativeAsOffset );
}
-bool OoxFormulaParserImpl::importArea3dToken( RecordInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
+bool OoxFormulaParserImpl::importArea3dToken( SequenceInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
{
LinkSheetRange aSheetRange = readSheetRange( rStrm );
BinComplexRef2d aRef;
- aRef.readOobData( rStrm, bRelativeAsOffset );
+ aRef.readBiff12Data( rStrm, bRelativeAsOffset );
return pushReferenceOperand( aSheetRange, aRef, bDeleted, bRelativeAsOffset );
}
-bool OoxFormulaParserImpl::importMemAreaToken( RecordInputStream& rStrm, bool bAddData )
+bool OoxFormulaParserImpl::importMemAreaToken( SequenceInputStream& rStrm, bool bAddData )
{
rStrm.skip( 6 );
if( bAddData )
@@ -1687,40 +1680,40 @@ bool OoxFormulaParserImpl::importMemAreaToken( RecordInputStream& rStrm, bool bA
return true;
}
-bool OoxFormulaParserImpl::importMemFuncToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importMemFuncToken( SequenceInputStream& rStrm )
{
rStrm.skip( 2 );
return true;
}
-bool OoxFormulaParserImpl::importNameToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importNameToken( SequenceInputStream& rStrm )
{
- return pushOobName( rStrm.readInt32() );
+ return pushBiff12Name( rStrm.readInt32() );
}
-bool OoxFormulaParserImpl::importNameXToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importNameXToken( SequenceInputStream& rStrm )
{
sal_Int32 nRefId = rStrm.readInt16();
sal_Int32 nNameId = rStrm.readInt32();
- return pushOobExtName( nRefId, nNameId );
+ return pushBiff12ExtName( nRefId, nNameId );
}
-bool OoxFormulaParserImpl::importFuncToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importFuncToken( SequenceInputStream& rStrm )
{
sal_uInt16 nFuncId;
rStrm >> nFuncId;
- return pushOobFunction( nFuncId );
+ return pushBiff12Function( nFuncId );
}
-bool OoxFormulaParserImpl::importFuncVarToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importFuncVarToken( SequenceInputStream& rStrm )
{
sal_uInt8 nParamCount;
sal_uInt16 nFuncId;
rStrm >> nParamCount >> nFuncId;
- return pushOobFunction( nFuncId, nParamCount );
+ return pushBiff12Function( nFuncId, nParamCount );
}
-bool OoxFormulaParserImpl::importExpToken( RecordInputStream& rStrm )
+bool OoxFormulaParserImpl::importExpToken( SequenceInputStream& rStrm )
{
BinAddress aBaseAddr;
rStrm >> aBaseAddr.mnRow;
@@ -1732,19 +1725,19 @@ bool OoxFormulaParserImpl::importExpToken( RecordInputStream& rStrm )
return false;
}
-LinkSheetRange OoxFormulaParserImpl::readSheetRange( RecordInputStream& rStrm )
+LinkSheetRange OoxFormulaParserImpl::readSheetRange( SequenceInputStream& rStrm )
{
return getExternalLinks().getSheetRange( rStrm.readInt16() );
}
-void OoxFormulaParserImpl::swapStreamPosition( RecordInputStream& rStrm )
+void OoxFormulaParserImpl::swapStreamPosition( SequenceInputStream& rStrm )
{
sal_Int64 nRecPos = rStrm.tell();
rStrm.seek( mnAddDataPos );
mnAddDataPos = nRecPos;
}
-void OoxFormulaParserImpl::skipMemAreaAddData( RecordInputStream& rStrm )
+void OoxFormulaParserImpl::skipMemAreaAddData( SequenceInputStream& rStrm )
{
swapStreamPosition( rStrm );
rStrm.skip( 16 * rStrm.readInt32() );
@@ -1753,38 +1746,38 @@ void OoxFormulaParserImpl::skipMemAreaAddData( RecordInputStream& rStrm )
// convert BIN token and push API operand or operator -------------------------
-bool OoxFormulaParserImpl::pushOobName( sal_Int32 nNameId )
+bool OoxFormulaParserImpl::pushBiff12Name( sal_Int32 nNameId )
{
- // one-based in OOBIN formulas
+ // one-based in BIFF12 formulas
return pushDefinedNameOperand( getDefinedNames().getByIndex( nNameId - 1 ) );
}
-bool OoxFormulaParserImpl::pushOobExtName( sal_Int32 nRefId, sal_Int32 nNameId )
+bool OoxFormulaParserImpl::pushBiff12ExtName( sal_Int32 nRefId, sal_Int32 nNameId )
{
if( const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get() )
{
if( pExtLink->getLinkType() == LINKTYPE_SELF )
- return pushOobName( nNameId );
- // external name indexes are one-based in OOBIN
+ return pushBiff12Name( nNameId );
+ // external name indexes are one-based in BIFF12
ExternalNameRef xExtName = pExtLink->getNameByIndex( nNameId - 1 );
return pushExternalNameOperand( xExtName, *pExtLink );
}
return pushBiffErrorOperand( BIFF_ERR_NAME );
}
-bool OoxFormulaParserImpl::pushOobFunction( sal_uInt16 nFuncId )
+bool OoxFormulaParserImpl::pushBiff12Function( sal_uInt16 nFuncId )
{
- if( const FunctionInfo* pFuncInfo = getFuncInfoFromOobFuncId( nFuncId ) )
+ if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiff12FuncId( nFuncId ) )
if( pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount )
return pushFunctionOperator( *pFuncInfo, pFuncInfo->mnMinParamCount );
return pushFunctionOperator( OPCODE_NONAME, 0 );
}
-bool OoxFormulaParserImpl::pushOobFunction( sal_uInt16 nFuncId, sal_uInt8 nParamCount )
+bool OoxFormulaParserImpl::pushBiff12Function( sal_uInt16 nFuncId, sal_uInt8 nParamCount )
{
if( getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD ) )
nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
- if( const FunctionInfo* pFuncInfo = getFuncInfoFromOobFuncId( nFuncId ) )
+ if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiff12FuncId( nFuncId ) )
return pushFunctionOperator( *pFuncInfo, nParamCount );
return pushFunctionOperator( OPCODE_NONAME, nParamCount );
}
@@ -2734,12 +2727,35 @@ bool BiffFormulaParserImpl::pushBiffFunction( sal_uInt16 nFuncId, sal_uInt8 nPar
// ============================================================================
+namespace {
+
+/** Extracts the reference identifier and the remaining data from a formula in
+ the format '[RefID]Remaining'. */
+bool lclExtractRefId( sal_Int32& rnRefId, OUString& rRemainder, const OUString& rFormulaString )
+{
+ if( (rFormulaString.getLength() >= 4) && (rFormulaString[ 0 ] == '[') )
+ {
+ sal_Int32 nBracketClose = rFormulaString.indexOf( ']', 1 );
+ if( nBracketClose >= 2 )
+ {
+ rnRefId = rFormulaString.copy( 1, nBracketClose - 1 ).toInt32();
+ rRemainder = rFormulaString.copy( nBracketClose + 1 );
+ return rRemainder.getLength() > 0;
+ }
+ }
+ return false;
+}
+
+}
+
+// ----------------------------------------------------------------------------
+
FormulaParser::FormulaParser( const WorkbookHelper& rHelper ) :
FormulaProcessorBase( rHelper )
{
switch( getFilterType() )
{
- case FILTER_OOX: mxImpl.reset( new OoxFormulaParserImpl( *this ) ); break;
+ case FILTER_OOXML: mxImpl.reset( new OoxFormulaParserImpl( *this ) ); break;
case FILTER_BIFF: mxImpl.reset( new BiffFormulaParserImpl( *this ) ); break;
case FILTER_UNKNOWN: break;
}
@@ -2754,9 +2770,9 @@ void FormulaParser::importFormula( FormulaContext& rContext, const OUString& rFo
mxImpl->importOoxFormula( rContext, rFormulaString );
}
-void FormulaParser::importFormula( FormulaContext& rContext, RecordInputStream& rStrm ) const
+void FormulaParser::importFormula( FormulaContext& rContext, SequenceInputStream& rStrm ) const
{
- mxImpl->importOobFormula( rContext, rStrm );
+ mxImpl->importBiff12Formula( rContext, rStrm );
}
void FormulaParser::importFormula( FormulaContext& rContext, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) const
@@ -2791,7 +2807,7 @@ void FormulaParser::convertNameToFormula( FormulaContext& rContext, sal_Int32 nT
void FormulaParser::convertNumberToHyperlink( FormulaContext& rContext, const OUString& rUrl, double fValue ) const
{
OSL_ENSURE( rUrl.getLength() > 0, "FormulaParser::convertNumberToHyperlink - missing URL" );
- if( const FunctionInfo* pFuncInfo = getFuncInfoFromOobFuncId( OOBIN_FUNC_HYPERLINK ) )
+ if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiff12FuncId( BIFF_FUNC_HYPERLINK ) )
{
ApiTokenSequence aTokens( 6 );
aTokens[ 0 ].OpCode = pFuncInfo->mnApiOpCode;
@@ -2808,27 +2824,15 @@ void FormulaParser::convertNumberToHyperlink( FormulaContext& rContext, const OU
OUString FormulaParser::importOleTargetLink( const OUString& rFormulaString )
{
- // obviously, this would overburden our formula parser, so we parse it manually
- OUString aTargetLink;
- sal_Int32 nFmlaLen = rFormulaString.getLength();
- if( (nFmlaLen >= 8) && (rFormulaString[ 0 ] == '[') )
- {
- // passed string is trimmed already
- sal_Int32 nBracketClose = rFormulaString.indexOf( ']' );
- sal_Int32 nExclamation = rFormulaString.indexOf( '!' );
- if( (nBracketClose >= 2) &&
- (nBracketClose + 1 == nExclamation) &&
- (rFormulaString[ nExclamation + 1 ] == '\'') &&
- (rFormulaString[ nFmlaLen - 1 ] == '\'') )
- {
- sal_Int32 nRefId = rFormulaString.copy( 1, nBracketClose - 1 ).toInt32();
- aTargetLink = mxImpl->resolveOleTarget( nRefId );
- }
- }
- return aTargetLink;
+ sal_Int32 nRefId = -1;
+ OUString aRemainder;
+ if( lclExtractRefId( nRefId, aRemainder, rFormulaString ) && (aRemainder.getLength() >= 3) &&
+ (aRemainder[ 0 ] == '!') && (aRemainder[ 1 ] == '\'') && (aRemainder[ aRemainder.getLength() - 1 ] == '\'') )
+ return mxImpl->resolveOleTarget( nRefId, false );
+ return OUString();
}
-OUString FormulaParser::importOleTargetLink( RecordInputStream& rStrm )
+OUString FormulaParser::importOleTargetLink( SequenceInputStream& rStrm )
{
OUString aTargetLink;
sal_Int32 nFmlaSize = rStrm.readInt32();
@@ -2840,7 +2844,7 @@ OUString FormulaParser::importOleTargetLink( RecordInputStream& rStrm )
sal_Int32 nNameId;
rStrm >> nToken >> nRefId >> nNameId;
if( nToken == (BIFF_TOKCLASS_VAL|BIFF_TOKID_NAMEX) )
- aTargetLink = mxImpl->resolveOleTarget( nRefId );
+ aTargetLink = mxImpl->resolveOleTarget( nRefId, true );
}
rStrm.seek( nFmlaEndPos );
return aTargetLink;
@@ -2854,8 +2858,60 @@ OUString FormulaParser::importOleTargetLink( BiffInputStream& rStrm, const sal_u
return aTargetLink;
}
+OUString FormulaParser::importMacroName( const OUString& rFormulaString )
+{
+ /* Valid macros are either sheet macros or VBA macros. OOXML and all BIFF
+ documents store defined names for sheet macros, but OOXML documents do
+ not store any defined name for VBA macros (while BIFF documents do).
+ Sheet macros may be defined locally to a sheet, or globally to the
+ document. As a result, all of the following macro specifiers are valid:
+
+ 1) Macros located in the own document:
+ [0]!MySheetMacro (global sheet macro 'MySheetMacro')
+ Macro1!MyMacro (sheet-local sheet macro 'MyMacro')
+ [0]!MyVBAProc (VBA macro 'MyVBAProc')
+ [0]!Mod1.MyVBAProc (VBA macro 'MyVBAProc' from code module 'Mod1')
+
+ 2) Macros from an external document:
+ [2]!MySheetMacro (global external sheet macro 'MySheetMacro')
+ [2]Macro1!MyMacro (sheet-local external sheet macro 'MyMacro')
+ [2]!MyVBAProc (external VBA macro 'MyVBAProc')
+ [2]!Mod1.MyVBAProc (external VBA macro from code module 'Mod1')
+
+ This implementation is only interested in VBA macros from the own
+ document, ignoring the valid syntax 'Macro1!MyMacro' for sheet-local
+ sheet macros.
+ */
+ sal_Int32 nRefId = -1;
+ OUString aRemainder;
+ if( lclExtractRefId( nRefId, aRemainder, rFormulaString ) && (aRemainder.getLength() > 1) && (aRemainder[ 0 ] == '!') )
+ {
+ /* In BIFF12 documents, the reference identifier is always the
+ one-based index of the external link as it is in OOXML documents
+ (it is not an index into the list of reference sheets as used in
+ cell formulas). Index 0 is an implicit placeholder for the own
+ document. In BIFF12 documents, the reference to the own document is
+ stored explicitly, mostly at the top of the list, so index 1 may
+ resolve to the own document too.
+ Passing 'false' to getExternalLink() specifies to ignore the
+ reference sheets list (if existing) and to access the list of
+ external links directly. */
+ const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId, false ).get();
+ OSL_ENSURE( pExtLink, "FormulaParser::importMacroName - missing link" );
+ // do not accept macros in external documents (not supported)
+ if( pExtLink && (pExtLink->getLinkType() == LINKTYPE_SELF) )
+ {
+ // ignore sheet macros (defined name for VBA macros may not exist, see above)
+ OUString aMacroName = aRemainder.copy( 1 );
+ const DefinedName* pDefName = getDefinedNames().getByModelName( aMacroName ).get();
+ if( !pDefName || pDefName->isVBName() )
+ return aMacroName;
+ }
+ }
+ return OUString();
+}
+
// ============================================================================
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/makefile.mk b/oox/source/xls/makefile.mk
index b5ede953bbfe..6ca6e6a271b9 100644
--- a/oox/source/xls/makefile.mk
+++ b/oox/source/xls/makefile.mk
@@ -42,6 +42,7 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES = \
$(SLO)$/addressconverter.obj \
+ $(SLO)$/autofilterbuffer.obj \
$(SLO)$/autofiltercontext.obj \
$(SLO)$/biffcodec.obj \
$(SLO)$/biffdetector.obj \
@@ -53,6 +54,7 @@ SLOFILES = \
$(SLO)$/commentsfragment.obj \
$(SLO)$/condformatbuffer.obj \
$(SLO)$/condformatcontext.obj \
+ $(SLO)$/connectionsbuffer.obj \
$(SLO)$/connectionsfragment.obj \
$(SLO)$/defnamesbuffer.obj \
$(SLO)$/drawingfragment.obj \
@@ -71,6 +73,7 @@ SLOFILES = \
$(SLO)$/pivotcachefragment.obj \
$(SLO)$/pivottablebuffer.obj \
$(SLO)$/pivottablefragment.obj \
+ $(SLO)$/querytablebuffer.obj \
$(SLO)$/querytablefragment.obj \
$(SLO)$/richstring.obj \
$(SLO)$/richstringcontext.obj \
@@ -87,13 +90,12 @@ SLOFILES = \
$(SLO)$/themebuffer.obj \
$(SLO)$/unitconverter.obj \
$(SLO)$/viewsettings.obj \
- $(SLO)$/webquerybuffer.obj \
$(SLO)$/workbookfragment.obj \
$(SLO)$/workbookhelper.obj \
$(SLO)$/workbooksettings.obj \
$(SLO)$/worksheetbuffer.obj \
$(SLO)$/worksheetfragment.obj \
- $(SLO)$/worksheethelper.obj \
+ $(SLO)$/worksheethelper.obj \
$(SLO)$/worksheetsettings.obj
# --- Targets -------------------------------------------------------
diff --git a/oox/source/xls/numberformatsbuffer.cxx b/oox/source/xls/numberformatsbuffer.cxx
index 4dfb00abeb59..c77381b2a1c8 100644
--- a/oox/source/xls/numberformatsbuffer.cxx
+++ b/oox/source/xls/numberformatsbuffer.cxx
@@ -26,43 +26,37 @@
************************************************************************/
#include "oox/xls/numberformatsbuffer.hxx"
+
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/i18n/NumberFormatIndex.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/util/XNumberFormats.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
-#include <com/sun/star/i18n/NumberFormatIndex.hpp>
-#include <osl/thread.h>
-#include <rtl/string.hxx>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <rtl/strbuf.hxx>
+#include <rtl/string.hxx>
+#include <osl/thread.h>
#include <rtl/ustrbuf.hxx>
-#include "properties.hxx"
+#include "oox/core/filterbase.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertymap.hxx"
-#include "oox/helper/recordinputstream.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
using ::rtl::OString;
using ::rtl::OStringBuffer;
+using ::rtl::OStringToOUString;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::rtl::OStringToOUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::lang::Locale;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::util::XNumberFormatsSupplier;
-using ::com::sun::star::util::XNumberFormats;
-using ::com::sun::star::util::XNumberFormatTypes;
-
-namespace oox {
-namespace xls {
// ============================================================================
@@ -2003,10 +1997,10 @@ NumberFormatRef NumberFormatsBuffer::importNumFmt( const AttributeList& rAttribs
return createNumFmt( nNumFmtId, aFmtCode );
}
-void NumberFormatsBuffer::importNumFmt( RecordInputStream& rStrm )
+void NumberFormatsBuffer::importNumFmt( SequenceInputStream& rStrm )
{
sal_Int32 nNumFmtId = rStrm.readuInt16();
- OUString aFmtCode = rStrm.readString();
+ OUString aFmtCode = BiffHelper::readString( rStrm );
createNumFmt( nNumFmtId, aFmtCode );
}
@@ -2120,4 +2114,3 @@ void NumberFormatsBuffer::insertBuiltinFormats()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/ooxformulaparser.cxx b/oox/source/xls/ooxformulaparser.cxx
index ec2668aef0f2..efa69abcb750 100644
--- a/oox/source/xls/ooxformulaparser.cxx
+++ b/oox/source/xls/ooxformulaparser.cxx
@@ -26,27 +26,24 @@
************************************************************************/
#include "oox/xls/ooxformulaparser.hxx"
+
#include <com/sun/star/uno/XComponentContext.hpp>
#include "oox/xls/formulaparser.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::XComponentContext;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::sheet::FormulaToken;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
class OOXMLFormulaParserImpl : private FormulaFinalizer
{
public:
@@ -64,7 +61,7 @@ private:
// ----------------------------------------------------------------------------
OOXMLFormulaParserImpl::OOXMLFormulaParserImpl( const Reference< XMultiServiceFactory >& rxFactory ) :
- FormulaFinalizer( OpCodeProvider( rxFactory, FILTER_OOX, BIFF_UNKNOWN, true ) ),
+ FormulaFinalizer( OpCodeProvider( rxFactory, FILTER_OOXML, BIFF_UNKNOWN, true ) ),
maApiParser( rxFactory, *this )
{
}
@@ -127,7 +124,7 @@ private:
// ----------------------------------------------------------------------------
OOXMLFormulaPrinterImpl::OOXMLFormulaPrinterImpl( const Reference< XMultiServiceFactory >& rxFactory ) :
- OpCodeProvider( rxFactory, FILTER_OOX, BIFF_UNKNOWN, false ),
+ OpCodeProvider( rxFactory, FILTER_OOXML, BIFF_UNKNOWN, false ),
maApiParser( rxFactory, *this )
{
}
@@ -143,7 +140,7 @@ Sequence< OUString > OOXMLFormulaParser_getSupportedServiceNames()
OUString OOXMLFormulaParser_getImplementationName()
{
- return CREATE_OUSTRING( "com.sun.star.comp.oox.OOXMLFormulaParser" );
+ return CREATE_OUSTRING( "com.sun.star.comp.oox.xls.FormulaParser" );
}
Reference< XInterface > SAL_CALL OOXMLFormulaParser_createInstance( const Reference< XComponentContext >& ) throw( Exception )
@@ -222,4 +219,3 @@ OUString SAL_CALL OOXMLFormulaParser::printFormula(
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/pagesettings.cxx b/oox/source/xls/pagesettings.cxx
index 0a5ce05a37df..188bf78544ec 100644
--- a/oox/source/xls/pagesettings.cxx
+++ b/oox/source/xls/pagesettings.cxx
@@ -26,10 +26,9 @@
************************************************************************/
#include "oox/xls/pagesettings.hxx"
-#include <set>
+
#include <algorithm>
-#include <rtl/strbuf.hxx>
-#include <rtl/ustrbuf.hxx>
+#include <set>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/sheet/XHeaderFooterContent.hpp>
@@ -38,39 +37,36 @@
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextCursor.hpp>
-#include "properties.hxx"
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "oox/core/xmlfilterbase.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/graphichelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
-#include "oox/core/xmlfilterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/excelhandlers.hxx"
#include "oox/xls/stylesbuffer.hxx"
#include "oox/xls/unitconverter.hxx"
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::Relations;
using ::rtl::OString;
using ::rtl::OStringBuffer;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XNamed;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::sheet::XHeaderFooterContent;
-using ::com::sun::star::style::XStyle;
-using ::com::sun::star::text::XText;
-using ::com::sun::star::text::XTextCursor;
-using ::com::sun::star::text::XTextContent;
-using ::com::sun::star::text::XTextRange;
-using ::oox::core::Relations;
-
-namespace oox {
-namespace xls {
// ============================================================================
@@ -80,32 +76,32 @@ const double OOX_MARGIN_DEFAULT_LR = 0.748; /// Left/right d
const double OOX_MARGIN_DEFAULT_TB = 0.984; /// Top/bottom default margin in inches.
const double OOX_MARGIN_DEFAULT_HF = 0.512; /// Header/footer default margin in inches.
-const sal_uInt16 OOBIN_PRINTOPT_HORCENTER = 0x0001;
-const sal_uInt16 OOBIN_PRINTOPT_VERCENTER = 0x0002;
-const sal_uInt16 OOBIN_PRINTOPT_PRINTHEADING = 0x0004;
-const sal_uInt16 OOBIN_PRINTOPT_PRINTGRID = 0x0008;
-
-const sal_uInt16 OOBIN_HEADERFOOTER_DIFFEVEN = 0x0001;
-const sal_uInt16 OOBIN_HEADERFOOTER_DIFFFIRST = 0x0002;
-const sal_uInt16 OOBIN_HEADERFOOTER_SCALEDOC = 0x0004;
-const sal_uInt16 OOBIN_HEADERFOOTER_ALIGNMARGIN = 0x0008;
-
-const sal_uInt16 OOBIN_PAGESETUP_INROWS = 0x0001;
-const sal_uInt16 OOBIN_PAGESETUP_LANDSCAPE = 0x0002;
-const sal_uInt16 OOBIN_PAGESETUP_INVALID = 0x0004;
-const sal_uInt16 OOBIN_PAGESETUP_BLACKWHITE = 0x0008;
-const sal_uInt16 OOBIN_PAGESETUP_DRAFTQUALITY = 0x0010;
-const sal_uInt16 OOBIN_PAGESETUP_PRINTNOTES = 0x0020;
-const sal_uInt16 OOBIN_PAGESETUP_DEFAULTORIENT = 0x0040;
-const sal_uInt16 OOBIN_PAGESETUP_USEFIRSTPAGE = 0x0080;
-const sal_uInt16 OOBIN_PAGESETUP_NOTES_END = 0x0100; // different to BIFF flag
-
-const sal_uInt16 OOBIN_CHARTPAGESETUP_LANDSCAPE = 0x0001;
-const sal_uInt16 OOBIN_CHARTPAGESETUP_INVALID = 0x0002;
-const sal_uInt16 OOBIN_CHARTPAGESETUP_BLACKWHITE = 0x0004;
-const sal_uInt16 OOBIN_CHARTPAGESETUP_DEFAULTORIENT = 0x0008;
-const sal_uInt16 OOBIN_CHARTPAGESETUP_USEFIRSTPAGE = 0x0010;
-const sal_uInt16 OOBIN_CHARTPAGESETUP_DRAFTQUALITY = 0x0020;
+const sal_uInt16 BIFF12_PRINTOPT_HORCENTER = 0x0001;
+const sal_uInt16 BIFF12_PRINTOPT_VERCENTER = 0x0002;
+const sal_uInt16 BIFF12_PRINTOPT_PRINTHEADING = 0x0004;
+const sal_uInt16 BIFF12_PRINTOPT_PRINTGRID = 0x0008;
+
+const sal_uInt16 BIFF12_HEADERFOOTER_DIFFEVEN = 0x0001;
+const sal_uInt16 BIFF12_HEADERFOOTER_DIFFFIRST = 0x0002;
+const sal_uInt16 BIFF12_HEADERFOOTER_SCALEDOC = 0x0004;
+const sal_uInt16 BIFF12_HEADERFOOTER_ALIGNMARGIN = 0x0008;
+
+const sal_uInt16 BIFF12_PAGESETUP_INROWS = 0x0001;
+const sal_uInt16 BIFF12_PAGESETUP_LANDSCAPE = 0x0002;
+const sal_uInt16 BIFF12_PAGESETUP_INVALID = 0x0004;
+const sal_uInt16 BIFF12_PAGESETUP_BLACKWHITE = 0x0008;
+const sal_uInt16 BIFF12_PAGESETUP_DRAFTQUALITY = 0x0010;
+const sal_uInt16 BIFF12_PAGESETUP_PRINTNOTES = 0x0020;
+const sal_uInt16 BIFF12_PAGESETUP_DEFAULTORIENT = 0x0040;
+const sal_uInt16 BIFF12_PAGESETUP_USEFIRSTPAGE = 0x0080;
+const sal_uInt16 BIFF12_PAGESETUP_NOTES_END = 0x0100; // different to BIFF flag
+
+const sal_uInt16 BIFF12_CHARTPAGESETUP_LANDSCAPE = 0x0001;
+const sal_uInt16 BIFF12_CHARTPAGESETUP_INVALID = 0x0002;
+const sal_uInt16 BIFF12_CHARTPAGESETUP_BLACKWHITE = 0x0004;
+const sal_uInt16 BIFF12_CHARTPAGESETUP_DEFAULTORIENT= 0x0008;
+const sal_uInt16 BIFF12_CHARTPAGESETUP_USEFIRSTPAGE = 0x0010;
+const sal_uInt16 BIFF12_CHARTPAGESETUP_DRAFTQUALITY = 0x0020;
const sal_uInt16 BIFF_PAGESETUP_INROWS = 0x0001;
const sal_uInt16 BIFF_PAGESETUP_PORTRAIT = 0x0002;
@@ -154,7 +150,7 @@ PageSettingsModel::PageSettingsModel() :
{
}
-void PageSettingsModel::setBinPrintErrors( sal_uInt8 nPrintErrors )
+void PageSettingsModel::setBiffPrintErrors( sal_uInt8 nPrintErrors )
{
static const sal_Int32 spnErrorIds[] = { XML_displayed, XML_none, XML_dash, XML_NA };
mnPrintErrors = STATIC_ARRAY_SELECT( spnErrorIds, nPrintErrors, XML_none );
@@ -245,24 +241,24 @@ void PageSettings::importPicture( const Relations& rRelations, const AttributeLi
importPictureData( rRelations, rAttribs.getString( R_TOKEN( id ), OUString() ) );
}
-void PageSettings::importPageMargins( RecordInputStream& rStrm )
+void PageSettings::importPageMargins( SequenceInputStream& rStrm )
{
rStrm >> maModel.mfLeftMargin >> maModel.mfRightMargin
>> maModel.mfTopMargin >> maModel.mfBottomMargin
>> maModel.mfHeaderMargin >> maModel.mfFooterMargin;
}
-void PageSettings::importPrintOptions( RecordInputStream& rStrm )
+void PageSettings::importPrintOptions( SequenceInputStream& rStrm )
{
sal_uInt16 nFlags;
rStrm >> nFlags;
- maModel.mbHorCenter = getFlag( nFlags, OOBIN_PRINTOPT_HORCENTER );
- maModel.mbVerCenter = getFlag( nFlags, OOBIN_PRINTOPT_VERCENTER );
- maModel.mbPrintGrid = getFlag( nFlags, OOBIN_PRINTOPT_PRINTGRID );
- maModel.mbPrintHeadings = getFlag( nFlags, OOBIN_PRINTOPT_PRINTHEADING );
+ maModel.mbHorCenter = getFlag( nFlags, BIFF12_PRINTOPT_HORCENTER );
+ maModel.mbVerCenter = getFlag( nFlags, BIFF12_PRINTOPT_VERCENTER );
+ maModel.mbPrintGrid = getFlag( nFlags, BIFF12_PRINTOPT_PRINTGRID );
+ maModel.mbPrintHeadings = getFlag( nFlags, BIFF12_PRINTOPT_PRINTHEADING );
}
-void PageSettings::importPageSetup( const Relations& rRelations, RecordInputStream& rStrm )
+void PageSettings::importPageSetup( const Relations& rRelations, SequenceInputStream& rStrm )
{
OUString aRelId;
sal_uInt16 nFlags;
@@ -271,18 +267,18 @@ void PageSettings::importPageSetup( const Relations& rRelations, RecordInputStre
>> maModel.mnCopies >> maModel.mnFirstPage
>> maModel.mnFitToWidth >> maModel.mnFitToHeight
>> nFlags >> aRelId;
- maModel.setBinPrintErrors( extractValue< sal_uInt8 >( nFlags, 9, 2 ) );
+ maModel.setBiffPrintErrors( extractValue< sal_uInt8 >( nFlags, 9, 2 ) );
maModel.maBinSettPath = rRelations.getFragmentPathFromRelId( aRelId );
- maModel.mnOrientation = getFlagValue( nFlags, OOBIN_PAGESETUP_DEFAULTORIENT, XML_default, getFlagValue( nFlags, OOBIN_PAGESETUP_LANDSCAPE, XML_landscape, XML_portrait ) );
- maModel.mnPageOrder = getFlagValue( nFlags, OOBIN_PAGESETUP_INROWS, XML_overThenDown, XML_downThenOver );
- maModel.mnCellComments = getFlagValue( nFlags, OOBIN_PAGESETUP_PRINTNOTES, getFlagValue( nFlags, OOBIN_PAGESETUP_NOTES_END, XML_atEnd, XML_asDisplayed ), XML_none );
- maModel.mbValidSettings = !getFlag( nFlags, OOBIN_PAGESETUP_INVALID );
- maModel.mbUseFirstPage = getFlag( nFlags, OOBIN_PAGESETUP_USEFIRSTPAGE );
- maModel.mbBlackWhite = getFlag( nFlags, OOBIN_PAGESETUP_BLACKWHITE );
- maModel.mbDraftQuality = getFlag( nFlags, OOBIN_PAGESETUP_DRAFTQUALITY );
+ maModel.mnOrientation = getFlagValue( nFlags, BIFF12_PAGESETUP_DEFAULTORIENT, XML_default, getFlagValue( nFlags, BIFF12_PAGESETUP_LANDSCAPE, XML_landscape, XML_portrait ) );
+ maModel.mnPageOrder = getFlagValue( nFlags, BIFF12_PAGESETUP_INROWS, XML_overThenDown, XML_downThenOver );
+ maModel.mnCellComments = getFlagValue( nFlags, BIFF12_PAGESETUP_PRINTNOTES, getFlagValue( nFlags, BIFF12_PAGESETUP_NOTES_END, XML_atEnd, XML_asDisplayed ), XML_none );
+ maModel.mbValidSettings = !getFlag( nFlags, BIFF12_PAGESETUP_INVALID );
+ maModel.mbUseFirstPage = getFlag( nFlags, BIFF12_PAGESETUP_USEFIRSTPAGE );
+ maModel.mbBlackWhite = getFlag( nFlags, BIFF12_PAGESETUP_BLACKWHITE );
+ maModel.mbDraftQuality = getFlag( nFlags, BIFF12_PAGESETUP_DRAFTQUALITY );
}
-void PageSettings::importChartPageSetup( const Relations& rRelations, RecordInputStream& rStrm )
+void PageSettings::importChartPageSetup( const Relations& rRelations, SequenceInputStream& rStrm )
{
OUString aRelId;
sal_uInt16 nFirstPage, nFlags;
@@ -290,27 +286,27 @@ void PageSettings::importChartPageSetup( const Relations& rRelations, RecordInpu
>> maModel.mnCopies >> nFirstPage >> nFlags >> aRelId;
maModel.maBinSettPath = rRelations.getFragmentPathFromRelId( aRelId );
maModel.mnFirstPage = nFirstPage; // 16-bit in CHARTPAGESETUP
- maModel.mnOrientation = getFlagValue( nFlags, OOBIN_CHARTPAGESETUP_DEFAULTORIENT, XML_default, getFlagValue( nFlags, OOBIN_CHARTPAGESETUP_LANDSCAPE, XML_landscape, XML_portrait ) );
- maModel.mbValidSettings = !getFlag( nFlags, OOBIN_CHARTPAGESETUP_INVALID );
- maModel.mbUseFirstPage = getFlag( nFlags, OOBIN_CHARTPAGESETUP_USEFIRSTPAGE );
- maModel.mbBlackWhite = getFlag( nFlags, OOBIN_CHARTPAGESETUP_BLACKWHITE );
- maModel.mbDraftQuality = getFlag( nFlags, OOBIN_CHARTPAGESETUP_DRAFTQUALITY );
+ maModel.mnOrientation = getFlagValue( nFlags, BIFF12_CHARTPAGESETUP_DEFAULTORIENT, XML_default, getFlagValue( nFlags, BIFF12_CHARTPAGESETUP_LANDSCAPE, XML_landscape, XML_portrait ) );
+ maModel.mbValidSettings = !getFlag( nFlags, BIFF12_CHARTPAGESETUP_INVALID );
+ maModel.mbUseFirstPage = getFlag( nFlags, BIFF12_CHARTPAGESETUP_USEFIRSTPAGE );
+ maModel.mbBlackWhite = getFlag( nFlags, BIFF12_CHARTPAGESETUP_BLACKWHITE );
+ maModel.mbDraftQuality = getFlag( nFlags, BIFF12_CHARTPAGESETUP_DRAFTQUALITY );
}
-void PageSettings::importHeaderFooter( RecordInputStream& rStrm )
+void PageSettings::importHeaderFooter( SequenceInputStream& rStrm )
{
sal_uInt16 nFlags;
rStrm >> nFlags
>> maModel.maOddHeader >> maModel.maOddFooter
>> maModel.maEvenHeader >> maModel.maEvenFooter
>> maModel.maFirstHeader >> maModel.maFirstFooter;
- maModel.mbUseEvenHF = getFlag( nFlags, OOBIN_HEADERFOOTER_DIFFEVEN );
- maModel.mbUseFirstHF = getFlag( nFlags, OOBIN_HEADERFOOTER_DIFFFIRST );
+ maModel.mbUseEvenHF = getFlag( nFlags, BIFF12_HEADERFOOTER_DIFFEVEN );
+ maModel.mbUseFirstHF = getFlag( nFlags, BIFF12_HEADERFOOTER_DIFFFIRST );
}
-void PageSettings::importPicture( const Relations& rRelations, RecordInputStream& rStrm )
+void PageSettings::importPicture( const Relations& rRelations, SequenceInputStream& rStrm )
{
- importPictureData( rRelations, rStrm.readString() );
+ importPictureData( rRelations, BiffHelper::readString( rStrm ) );
}
void PageSettings::importLeftMargin( BiffInputStream& rStrm )
@@ -364,7 +360,7 @@ void PageSettings::importPageSetup( BiffInputStream& rStrm )
if( getBiff() == BIFF8 )
{
- maModel.setBinPrintErrors( extractValue< sal_uInt8 >( nFlags, 10, 2 ) );
+ maModel.setBiffPrintErrors( extractValue< sal_uInt8 >( nFlags, 10, 2 ) );
maModel.mnCellComments = getFlagValue( nFlags, BIFF_PAGESETUP_PRINTNOTES, getFlagValue( nFlags, BIFF_PAGESETUP_NOTES_END, XML_atEnd, XML_asDisplayed ), XML_none );
}
}
@@ -680,8 +676,8 @@ double HeaderFooterParser::parse( const Reference< XHeaderFooterContent >& rxCon
appendField( xContent );
}
break;
- case 'Z': // file path (without file name), BIFF8 and OOX only
- if( (getFilterType() == FILTER_OOX) || ((getFilterType() == FILTER_BIFF) && (getBiff() == BIFF8)) )
+ case 'Z': // file path (without file name), OOXML, BIFF12, and BIFF8 only
+ if( (getFilterType() == FILTER_OOXML) || ((getFilterType() == FILTER_BIFF) && (getBiff() == BIFF8)) )
{
Reference< XTextContent > xContent = createField( maFileNameService );
PropertySet aPropSet( xContent );
@@ -749,7 +745,7 @@ double HeaderFooterParser::parse( const Reference< XHeaderFooterContent >& rxCon
break;
case 'K': // text color (not in BIFF)
- if( (getFilterType() == FILTER_OOX) && (pcChar + 6 < pcEnd) )
+ if( (getFilterType() == FILTER_OOXML) && (pcChar + 6 < pcEnd) )
{
setAttributes();
// eat the following 6 characters
@@ -1237,8 +1233,8 @@ sal_Int32 PageSettingsConverter::writeHeaderFooter(
sal_Int32 nHeight = 0;
if( rContent.getLength() > 0 )
{
- Reference< XHeaderFooterContent > xHFContent;
- if( rPropSet.getProperty( xHFContent, nPropId ) && xHFContent.is() )
+ Reference< XHeaderFooterContent > xHFContent( rPropSet.getAnyProperty( nPropId ), UNO_QUERY );
+ if( xHFContent.is() )
{
double fTotalHeight = mxHFParser->parse( xHFContent, rContent );
rPropSet.setProperty( nPropId, xHFContent );
@@ -1252,4 +1248,3 @@ sal_Int32 PageSettingsConverter::writeHeaderFooter(
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/pivotcachebuffer.cxx b/oox/source/xls/pivotcachebuffer.cxx
index d76ab81d07c4..e8ca3539e167 100644
--- a/oox/source/xls/pivotcachebuffer.cxx
+++ b/oox/source/xls/pivotcachebuffer.cxx
@@ -26,20 +26,20 @@
************************************************************************/
#include "oox/xls/pivotcachebuffer.hxx"
+
#include <set>
-#include <rtl/ustrbuf.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/table/XCell.hpp>
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
#include <com/sun/star/sheet/DataPilotFieldGroupInfo.hpp>
#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
-#include "properties.hxx"
+#include <com/sun/star/table/XCell.hpp>
+#include <rtl/ustrbuf.hxx>
+#include "oox/core/filterbase.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/defnamesbuffer.hxx"
#include "oox/xls/excelhandlers.hxx"
@@ -48,75 +48,71 @@
#include "oox/xls/unitconverter.hxx"
#include "oox/xls/worksheetbuffer.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNamed;
-using ::com::sun::star::util::DateTime;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::sheet::DataPilotFieldGroupInfo;
-using ::com::sun::star::table::XCell;
-using ::com::sun::star::sheet::XDataPilotField;
-using ::com::sun::star::sheet::XDataPilotFieldGrouping;
-using ::oox::core::Relations;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::oox::core::Relations;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
-const sal_uInt16 OOBIN_PCDFIELD_SERVERFIELD = 0x0001;
-const sal_uInt16 OOBIN_PCDFIELD_NOUNIQUEITEMS = 0x0002;
-const sal_uInt16 OOBIN_PCDFIELD_DATABASEFIELD = 0x0004;
-const sal_uInt16 OOBIN_PCDFIELD_HASCAPTION = 0x0008;
-const sal_uInt16 OOBIN_PCDFIELD_MEMBERPROPFIELD = 0x0010;
-const sal_uInt16 OOBIN_PCDFIELD_HASFORMULA = 0x0100;
-const sal_uInt16 OOBIN_PCDFIELD_HASPROPERTYNAME = 0x0200;
-
-const sal_uInt16 OOBIN_PCDFSITEMS_HASSEMIMIXED = 0x0001;
-const sal_uInt16 OOBIN_PCDFSITEMS_HASNONDATE = 0x0002;
-const sal_uInt16 OOBIN_PCDFSITEMS_HASDATE = 0x0004;
-const sal_uInt16 OOBIN_PCDFSITEMS_HASSTRING = 0x0008;
-const sal_uInt16 OOBIN_PCDFSITEMS_HASBLANK = 0x0010;
-const sal_uInt16 OOBIN_PCDFSITEMS_HASMIXED = 0x0020;
-const sal_uInt16 OOBIN_PCDFSITEMS_ISNUMERIC = 0x0040;
-const sal_uInt16 OOBIN_PCDFSITEMS_ISINTEGER = 0x0080;
-const sal_uInt16 OOBIN_PCDFSITEMS_HASMINMAX = 0x0100;
-const sal_uInt16 OOBIN_PCDFSITEMS_HASLONGTEXT = 0x0200;
-
-const sal_uInt16 OOBIN_PCITEM_ARRAY_DOUBLE = 0x0001;
-const sal_uInt16 OOBIN_PCITEM_ARRAY_STRING = 0x0002;
-const sal_uInt16 OOBIN_PCITEM_ARRAY_ERROR = 0x0010;
-const sal_uInt16 OOBIN_PCITEM_ARRAY_DATE = 0x0020;
-
-const sal_uInt8 OOBIN_PCDFRANGEPR_AUTOSTART = 0x01;
-const sal_uInt8 OOBIN_PCDFRANGEPR_AUTOEND = 0x02;
-const sal_uInt8 OOBIN_PCDFRANGEPR_DATEGROUP = 0x04;
-
-const sal_uInt8 OOBIN_PCDEFINITION_SAVEDATA = 0x01;
-const sal_uInt8 OOBIN_PCDEFINITION_INVALID = 0x02;
-const sal_uInt8 OOBIN_PCDEFINITION_REFRESHONLOAD = 0x04;
-const sal_uInt8 OOBIN_PCDEFINITION_OPTIMIZEMEMORY = 0x08;
-const sal_uInt8 OOBIN_PCDEFINITION_ENABLEREFRESH = 0x10;
-const sal_uInt8 OOBIN_PCDEFINITION_BACKGROUNDQUERY = 0x20;
-const sal_uInt8 OOBIN_PCDEFINITION_UPGRADEONREFR = 0x40;
-const sal_uInt8 OOBIN_PCDEFINITION_TUPELCACHE = 0x80;
-
-const sal_uInt8 OOBIN_PCDEFINITION_HASUSERNAME = 0x01;
-const sal_uInt8 OOBIN_PCDEFINITION_HASRELID = 0x02;
-const sal_uInt8 OOBIN_PCDEFINITION_SUPPORTSUBQUERY = 0x04;
-const sal_uInt8 OOBIN_PCDEFINITION_SUPPORTDRILL = 0x08;
-
-const sal_uInt8 OOBIN_PCDWBSOURCE_HASRELID = 0x01;
-const sal_uInt8 OOBIN_PCDWBSOURCE_HASSHEET = 0x02;
+const sal_uInt16 BIFF12_PCDFIELD_SERVERFIELD = 0x0001;
+const sal_uInt16 BIFF12_PCDFIELD_NOUNIQUEITEMS = 0x0002;
+const sal_uInt16 BIFF12_PCDFIELD_DATABASEFIELD = 0x0004;
+const sal_uInt16 BIFF12_PCDFIELD_HASCAPTION = 0x0008;
+const sal_uInt16 BIFF12_PCDFIELD_MEMBERPROPFIELD = 0x0010;
+const sal_uInt16 BIFF12_PCDFIELD_HASFORMULA = 0x0100;
+const sal_uInt16 BIFF12_PCDFIELD_HASPROPERTYNAME = 0x0200;
+
+const sal_uInt16 BIFF12_PCDFSITEMS_HASSEMIMIXED = 0x0001;
+const sal_uInt16 BIFF12_PCDFSITEMS_HASNONDATE = 0x0002;
+const sal_uInt16 BIFF12_PCDFSITEMS_HASDATE = 0x0004;
+const sal_uInt16 BIFF12_PCDFSITEMS_HASSTRING = 0x0008;
+const sal_uInt16 BIFF12_PCDFSITEMS_HASBLANK = 0x0010;
+const sal_uInt16 BIFF12_PCDFSITEMS_HASMIXED = 0x0020;
+const sal_uInt16 BIFF12_PCDFSITEMS_ISNUMERIC = 0x0040;
+const sal_uInt16 BIFF12_PCDFSITEMS_ISINTEGER = 0x0080;
+const sal_uInt16 BIFF12_PCDFSITEMS_HASMINMAX = 0x0100;
+const sal_uInt16 BIFF12_PCDFSITEMS_HASLONGTEXT = 0x0200;
+
+const sal_uInt16 BIFF12_PCITEM_ARRAY_DOUBLE = 0x0001;
+const sal_uInt16 BIFF12_PCITEM_ARRAY_STRING = 0x0002;
+const sal_uInt16 BIFF12_PCITEM_ARRAY_ERROR = 0x0010;
+const sal_uInt16 BIFF12_PCITEM_ARRAY_DATE = 0x0020;
+
+const sal_uInt8 BIFF12_PCDFRANGEPR_AUTOSTART = 0x01;
+const sal_uInt8 BIFF12_PCDFRANGEPR_AUTOEND = 0x02;
+const sal_uInt8 BIFF12_PCDFRANGEPR_DATEGROUP = 0x04;
+
+const sal_uInt8 BIFF12_PCDEFINITION_SAVEDATA = 0x01;
+const sal_uInt8 BIFF12_PCDEFINITION_INVALID = 0x02;
+const sal_uInt8 BIFF12_PCDEFINITION_REFRESHONLOAD = 0x04;
+const sal_uInt8 BIFF12_PCDEFINITION_OPTIMIZEMEMORY = 0x08;
+const sal_uInt8 BIFF12_PCDEFINITION_ENABLEREFRESH = 0x10;
+const sal_uInt8 BIFF12_PCDEFINITION_BACKGROUNDQUERY = 0x20;
+const sal_uInt8 BIFF12_PCDEFINITION_UPGRADEONREFR = 0x40;
+const sal_uInt8 BIFF12_PCDEFINITION_TUPELCACHE = 0x80;
+
+const sal_uInt8 BIFF12_PCDEFINITION_HASUSERNAME = 0x01;
+const sal_uInt8 BIFF12_PCDEFINITION_HASRELID = 0x02;
+const sal_uInt8 BIFF12_PCDEFINITION_SUPPORTSUBQUERY = 0x04;
+const sal_uInt8 BIFF12_PCDEFINITION_SUPPORTDRILL = 0x08;
+
+const sal_uInt8 BIFF12_PCDWBSOURCE_HASRELID = 0x01;
+const sal_uInt8 BIFF12_PCDWBSOURCE_HASSHEET = 0x02;
+
+// ----------------------------------------------------------------------------
const sal_uInt16 BIFF_PCDSOURCE_WORKSHEET = 0x0001;
const sal_uInt16 BIFF_PCDSOURCE_EXTERNAL = 0x0002;
@@ -216,19 +212,19 @@ void PivotCacheItem::readIndex( const AttributeList& rAttribs )
mnType = XML_x;
}
-void PivotCacheItem::readString( RecordInputStream& rStrm )
+void PivotCacheItem::readString( SequenceInputStream& rStrm )
{
- maValue <<= rStrm.readString();
+ maValue <<= BiffHelper::readString( rStrm );
mnType = XML_s;
}
-void PivotCacheItem::readDouble( RecordInputStream& rStrm )
+void PivotCacheItem::readDouble( SequenceInputStream& rStrm )
{
maValue <<= rStrm.readDouble();
mnType = XML_n;
}
-void PivotCacheItem::readDate( RecordInputStream& rStrm )
+void PivotCacheItem::readDate( SequenceInputStream& rStrm )
{
DateTime aDateTime;
aDateTime.Year = rStrm.readuInt16();
@@ -242,19 +238,19 @@ void PivotCacheItem::readDate( RecordInputStream& rStrm )
mnType = XML_d;
}
-void PivotCacheItem::readBool( RecordInputStream& rStrm )
+void PivotCacheItem::readBool( SequenceInputStream& rStrm )
{
maValue <<= (rStrm.readuInt8() != 0);
mnType = XML_b;
}
-void PivotCacheItem::readError( RecordInputStream& rStrm )
+void PivotCacheItem::readError( SequenceInputStream& rStrm )
{
maValue <<= static_cast< sal_Int32 >( rStrm.readuInt8() );
mnType = XML_e;
}
-void PivotCacheItem::readIndex( RecordInputStream& rStrm )
+void PivotCacheItem::readIndex( SequenceInputStream& rStrm )
{
maValue <<= rStrm.readInt32();
mnType = XML_x;
@@ -342,9 +338,9 @@ void PivotCacheItemList::importItem( sal_Int32 nElement, const AttributeList& rA
}
}
-void PivotCacheItemList::importItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+void PivotCacheItemList::importItem( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
- if( nRecId == OOBIN_ID_PCITEM_ARRAY )
+ if( nRecId == BIFF12_ID_PCITEM_ARRAY )
{
importArray( rStrm );
return;
@@ -353,18 +349,18 @@ void PivotCacheItemList::importItem( sal_Int32 nRecId, RecordInputStream& rStrm
PivotCacheItem& rItem = createItem();
switch( nRecId )
{
- case OOBIN_ID_PCITEM_MISSING:
- case OOBIN_ID_PCITEMA_MISSING: break;
- case OOBIN_ID_PCITEM_STRING:
- case OOBIN_ID_PCITEMA_STRING: rItem.readString( rStrm ); break;
- case OOBIN_ID_PCITEM_DOUBLE:
- case OOBIN_ID_PCITEMA_DOUBLE: rItem.readDouble( rStrm ); break;
- case OOBIN_ID_PCITEM_DATE:
- case OOBIN_ID_PCITEMA_DATE: rItem.readDate( rStrm ); break;
- case OOBIN_ID_PCITEM_BOOL:
- case OOBIN_ID_PCITEMA_BOOL: rItem.readBool( rStrm ); break;
- case OOBIN_ID_PCITEM_ERROR:
- case OOBIN_ID_PCITEMA_ERROR: rItem.readError( rStrm ); break;
+ case BIFF12_ID_PCITEM_MISSING:
+ case BIFF12_ID_PCITEMA_MISSING: break;
+ case BIFF12_ID_PCITEM_STRING:
+ case BIFF12_ID_PCITEMA_STRING: rItem.readString( rStrm ); break;
+ case BIFF12_ID_PCITEM_DOUBLE:
+ case BIFF12_ID_PCITEMA_DOUBLE: rItem.readDouble( rStrm ); break;
+ case BIFF12_ID_PCITEM_DATE:
+ case BIFF12_ID_PCITEMA_DATE: rItem.readDate( rStrm ); break;
+ case BIFF12_ID_PCITEM_BOOL:
+ case BIFF12_ID_PCITEMA_BOOL: rItem.readBool( rStrm ); break;
+ case BIFF12_ID_PCITEM_ERROR:
+ case BIFF12_ID_PCITEMA_ERROR: rItem.readError( rStrm ); break;
default: OSL_ENSURE( false, "PivotCacheItemList::importItem - unknown record type" );
}
}
@@ -411,7 +407,7 @@ PivotCacheItem& PivotCacheItemList::createItem()
return maItems.back();
}
-void PivotCacheItemList::importArray( RecordInputStream& rStrm )
+void PivotCacheItemList::importArray( SequenceInputStream& rStrm )
{
sal_uInt16 nType = rStrm.readuInt16();
sal_Int32 nCount = rStrm.readInt32();
@@ -419,10 +415,10 @@ void PivotCacheItemList::importArray( RecordInputStream& rStrm )
{
switch( nType )
{
- case OOBIN_PCITEM_ARRAY_DOUBLE: createItem().readDouble( rStrm ); break;
- case OOBIN_PCITEM_ARRAY_STRING: createItem().readString( rStrm ); break;
- case OOBIN_PCITEM_ARRAY_ERROR: createItem().readError( rStrm ); break;
- case OOBIN_PCITEM_ARRAY_DATE: createItem().readDate( rStrm ); break;
+ case BIFF12_PCITEM_ARRAY_DOUBLE: createItem().readDouble( rStrm ); break;
+ case BIFF12_PCITEM_ARRAY_STRING: createItem().readString( rStrm ); break;
+ case BIFF12_PCITEM_ARRAY_ERROR: createItem().readError( rStrm ); break;
+ case BIFF12_PCITEM_ARRAY_DATE: createItem().readDate( rStrm ); break;
default:
OSL_ENSURE( false, "PivotCacheItemList::importArray - unknown data type" );
nIdx = nCount;
@@ -477,7 +473,7 @@ PCFieldGroupModel::PCFieldGroupModel() :
{
}
-void PCFieldGroupModel::setBinGroupBy( sal_uInt8 nGroupBy )
+void PCFieldGroupModel::setBiffGroupBy( sal_uInt8 nGroupBy )
{
static const sal_Int32 spnGroupBy[] = { XML_range,
XML_seconds, XML_minutes, XML_hours, XML_days, XML_months, XML_quarters, XML_years };
@@ -562,62 +558,62 @@ void PivotCacheField::importGroupItem( sal_Int32 nElement, const AttributeList&
maGroupItems.importItem( nElement, rAttribs );
}
-void PivotCacheField::importPCDField( RecordInputStream& rStrm )
+void PivotCacheField::importPCDField( SequenceInputStream& rStrm )
{
sal_uInt16 nFlags;
rStrm >> nFlags >> maFieldModel.mnNumFmtId;
maFieldModel.mnSqlType = rStrm.readInt16();
rStrm >> maFieldModel.mnHierarchy >> maFieldModel.mnLevel >> maFieldModel.mnMappingCount >> maFieldModel.maName;
- if( getFlag( nFlags, OOBIN_PCDFIELD_HASCAPTION ) )
+ if( getFlag( nFlags, BIFF12_PCDFIELD_HASCAPTION ) )
rStrm >> maFieldModel.maCaption;
- if( getFlag( nFlags, OOBIN_PCDFIELD_HASFORMULA ) )
+ if( getFlag( nFlags, BIFF12_PCDFIELD_HASFORMULA ) )
rStrm.skip( ::std::max< sal_Int32 >( rStrm.readInt32(), 0 ) );
if( maFieldModel.mnMappingCount > 0 )
rStrm.skip( ::std::max< sal_Int32 >( rStrm.readInt32(), 0 ) );
- if( getFlag( nFlags, OOBIN_PCDFIELD_HASPROPERTYNAME ) )
+ if( getFlag( nFlags, BIFF12_PCDFIELD_HASPROPERTYNAME ) )
rStrm >> maFieldModel.maPropertyName;
- maFieldModel.mbDatabaseField = getFlag( nFlags, OOBIN_PCDFIELD_DATABASEFIELD );
- maFieldModel.mbServerField = getFlag( nFlags, OOBIN_PCDFIELD_SERVERFIELD );
- maFieldModel.mbUniqueList = !getFlag( nFlags, OOBIN_PCDFIELD_NOUNIQUEITEMS );
- maFieldModel.mbMemberPropField = getFlag( nFlags, OOBIN_PCDFIELD_MEMBERPROPFIELD );
+ maFieldModel.mbDatabaseField = getFlag( nFlags, BIFF12_PCDFIELD_DATABASEFIELD );
+ maFieldModel.mbServerField = getFlag( nFlags, BIFF12_PCDFIELD_SERVERFIELD );
+ maFieldModel.mbUniqueList = !getFlag( nFlags, BIFF12_PCDFIELD_NOUNIQUEITEMS );
+ maFieldModel.mbMemberPropField = getFlag( nFlags, BIFF12_PCDFIELD_MEMBERPROPFIELD );
}
-void PivotCacheField::importPCDFSharedItems( RecordInputStream& rStrm )
+void PivotCacheField::importPCDFSharedItems( SequenceInputStream& rStrm )
{
sal_uInt16 nFlags;
rStrm >> nFlags;
- maSharedItemsModel.mbHasSemiMixed = getFlag( nFlags, OOBIN_PCDFSITEMS_HASSEMIMIXED );
- maSharedItemsModel.mbHasNonDate = getFlag( nFlags, OOBIN_PCDFSITEMS_HASNONDATE );
- maSharedItemsModel.mbHasDate = getFlag( nFlags, OOBIN_PCDFSITEMS_HASDATE );
- maSharedItemsModel.mbHasString = getFlag( nFlags, OOBIN_PCDFSITEMS_HASSTRING );
- maSharedItemsModel.mbHasBlank = getFlag( nFlags, OOBIN_PCDFSITEMS_HASBLANK );
- maSharedItemsModel.mbHasMixed = getFlag( nFlags, OOBIN_PCDFSITEMS_HASMIXED );
- maSharedItemsModel.mbIsNumeric = getFlag( nFlags, OOBIN_PCDFSITEMS_ISNUMERIC );
- maSharedItemsModel.mbIsInteger = getFlag( nFlags, OOBIN_PCDFSITEMS_ISINTEGER );
- maSharedItemsModel.mbHasLongText = getFlag( nFlags, OOBIN_PCDFSITEMS_HASLONGTEXT );
+ maSharedItemsModel.mbHasSemiMixed = getFlag( nFlags, BIFF12_PCDFSITEMS_HASSEMIMIXED );
+ maSharedItemsModel.mbHasNonDate = getFlag( nFlags, BIFF12_PCDFSITEMS_HASNONDATE );
+ maSharedItemsModel.mbHasDate = getFlag( nFlags, BIFF12_PCDFSITEMS_HASDATE );
+ maSharedItemsModel.mbHasString = getFlag( nFlags, BIFF12_PCDFSITEMS_HASSTRING );
+ maSharedItemsModel.mbHasBlank = getFlag( nFlags, BIFF12_PCDFSITEMS_HASBLANK );
+ maSharedItemsModel.mbHasMixed = getFlag( nFlags, BIFF12_PCDFSITEMS_HASMIXED );
+ maSharedItemsModel.mbIsNumeric = getFlag( nFlags, BIFF12_PCDFSITEMS_ISNUMERIC );
+ maSharedItemsModel.mbIsInteger = getFlag( nFlags, BIFF12_PCDFSITEMS_ISINTEGER );
+ maSharedItemsModel.mbHasLongText = getFlag( nFlags, BIFF12_PCDFSITEMS_HASLONGTEXT );
}
-void PivotCacheField::importPCDFSharedItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+void PivotCacheField::importPCDFSharedItem( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
maSharedItems.importItem( nRecId, rStrm );
}
-void PivotCacheField::importPCDFieldGroup( RecordInputStream& rStrm )
+void PivotCacheField::importPCDFieldGroup( SequenceInputStream& rStrm )
{
rStrm >> maFieldGroupModel.mnParentField >> maFieldGroupModel.mnBaseField;
}
-void PivotCacheField::importPCDFRangePr( RecordInputStream& rStrm )
+void PivotCacheField::importPCDFRangePr( SequenceInputStream& rStrm )
{
sal_uInt8 nGroupBy, nFlags;
rStrm >> nGroupBy >> nFlags >> maFieldGroupModel.mfStartValue >> maFieldGroupModel.mfEndValue >> maFieldGroupModel.mfInterval;
- maFieldGroupModel.setBinGroupBy( nGroupBy );
+ maFieldGroupModel.setBiffGroupBy( nGroupBy );
maFieldGroupModel.mbRangeGroup = true;
- maFieldGroupModel.mbDateGroup = getFlag( nFlags, OOBIN_PCDFRANGEPR_DATEGROUP );
- maFieldGroupModel.mbAutoStart = getFlag( nFlags, OOBIN_PCDFRANGEPR_AUTOSTART );
- maFieldGroupModel.mbAutoEnd = getFlag( nFlags, OOBIN_PCDFRANGEPR_AUTOEND );
+ maFieldGroupModel.mbDateGroup = getFlag( nFlags, BIFF12_PCDFRANGEPR_DATEGROUP );
+ maFieldGroupModel.mbAutoStart = getFlag( nFlags, BIFF12_PCDFRANGEPR_AUTOSTART );
+ maFieldGroupModel.mbAutoEnd = getFlag( nFlags, BIFF12_PCDFRANGEPR_AUTOEND );
OSL_ENSURE( maFieldGroupModel.mbDateGroup == (maFieldGroupModel.mnGroupBy != XML_range), "PivotCacheField::importPCDFRangePr - wrong date flag" );
if( maFieldGroupModel.mbDateGroup )
@@ -627,14 +623,14 @@ void PivotCacheField::importPCDFRangePr( RecordInputStream& rStrm )
}
}
-void PivotCacheField::importPCDFDiscretePrItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+void PivotCacheField::importPCDFDiscretePrItem( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
- OSL_ENSURE( nRecId == OOBIN_ID_PCITEM_INDEX, "PivotCacheField::importPCDFDiscretePrItem - unexpected record" );
- if( nRecId == OOBIN_ID_PCITEM_INDEX )
+ OSL_ENSURE( nRecId == BIFF12_ID_PCITEM_INDEX, "PivotCacheField::importPCDFDiscretePrItem - unexpected record" );
+ if( nRecId == BIFF12_ID_PCITEM_INDEX )
maDiscreteItems.push_back( rStrm.readInt32() );
}
-void PivotCacheField::importPCDFGroupItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+void PivotCacheField::importPCDFGroupItem( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
maGroupItems.importItem( nRecId, rStrm );
}
@@ -696,7 +692,7 @@ void PivotCacheField::importPCDFRangePr( BiffInputStream& rStrm )
{
sal_uInt16 nFlags;
rStrm >> nFlags;
- maFieldGroupModel.setBinGroupBy( extractValue< sal_uInt8 >( nFlags, 2, 3 ) );
+ maFieldGroupModel.setBiffGroupBy( extractValue< sal_uInt8 >( nFlags, 2, 3 ) );
maFieldGroupModel.mbRangeGroup = true;
maFieldGroupModel.mbDateGroup = maFieldGroupModel.mnGroupBy != XML_range;
maFieldGroupModel.mbAutoStart = getFlag( nFlags, BIFF_PCDFRANGEPR_AUTOSTART );
@@ -837,7 +833,7 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie
typedef ::std::vector< GroupItemList > GroupItemMap;
GroupItemMap aItemMap( maGroupItems.size() );
for( IndexVector::const_iterator aBeg = maDiscreteItems.begin(), aIt = aBeg, aEnd = maDiscreteItems.end(); aIt != aEnd; ++aIt )
- if( GroupItemList* pItems = ContainerHelper::getVectorElement( aItemMap, *aIt ) )
+ if( GroupItemList* pItems = ContainerHelper::getVectorElementAccess( aItemMap, *aIt ) )
pItems->push_back( static_cast< sal_Int32 >( aIt - aBeg ) );
// process all groups
@@ -924,7 +920,7 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie
}
// replace original item names in passed vector with group name
for( GroupItemList::iterator aIt2 = aIt->begin(), aEnd2 = aIt->end(); aIt2 != aEnd2; ++aIt2 )
- if( PivotCacheGroupItem* pName = ContainerHelper::getVectorElement( orItemNames, *aIt2 ) )
+ if( PivotCacheGroupItem* pName = ContainerHelper::getVectorElementAccess( orItemNames, *aIt2 ) )
pName->maGroupName = aGroupName;
}
}
@@ -953,7 +949,7 @@ void PivotCacheField::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_In
writeItemToSourceDataCell( rSheetHelper, nCol, nRow, rItem );
}
-void PivotCacheField::importPCRecordItem( RecordInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const
+void PivotCacheField::importPCRecordItem( SequenceInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const
{
if( hasSharedItems() )
{
@@ -1088,29 +1084,29 @@ void PivotCache::importWorksheetSource( const AttributeList& rAttribs, const Rel
getAddressConverter().convertToCellRangeUnchecked( maSheetSrcModel.maRange, rAttribs.getString( XML_ref, OUString() ), 0 );
}
-void PivotCache::importPCDefinition( RecordInputStream& rStrm )
+void PivotCache::importPCDefinition( SequenceInputStream& rStrm )
{
sal_uInt8 nFlags1, nFlags2;
rStrm.skip( 3 ); // create/refresh version id's
rStrm >> nFlags1 >> maDefModel.mnMissItemsLimit >> maDefModel.mfRefreshedDate >> nFlags2 >> maDefModel.mnRecords;
- if( getFlag( nFlags2, OOBIN_PCDEFINITION_HASUSERNAME ) )
+ if( getFlag( nFlags2, BIFF12_PCDEFINITION_HASUSERNAME ) )
rStrm >> maDefModel.maRefreshedBy;
- if( getFlag( nFlags2, OOBIN_PCDEFINITION_HASRELID ) )
+ if( getFlag( nFlags2, BIFF12_PCDEFINITION_HASRELID ) )
rStrm >> maDefModel.maRelId;
- maDefModel.mbInvalid = getFlag( nFlags1, OOBIN_PCDEFINITION_INVALID );
- maDefModel.mbSaveData = getFlag( nFlags1, OOBIN_PCDEFINITION_SAVEDATA );
- maDefModel.mbRefreshOnLoad = getFlag( nFlags1, OOBIN_PCDEFINITION_REFRESHONLOAD );
- maDefModel.mbOptimizeMemory = getFlag( nFlags1, OOBIN_PCDEFINITION_OPTIMIZEMEMORY );
- maDefModel.mbEnableRefresh = getFlag( nFlags1, OOBIN_PCDEFINITION_ENABLEREFRESH );
- maDefModel.mbBackgroundQuery = getFlag( nFlags1, OOBIN_PCDEFINITION_BACKGROUNDQUERY );
- maDefModel.mbUpgradeOnRefresh = getFlag( nFlags1, OOBIN_PCDEFINITION_UPGRADEONREFR );
- maDefModel.mbTupleCache = getFlag( nFlags1, OOBIN_PCDEFINITION_TUPELCACHE );
- maDefModel.mbSupportSubquery = getFlag( nFlags2, OOBIN_PCDEFINITION_SUPPORTSUBQUERY );
- maDefModel.mbSupportDrill = getFlag( nFlags2, OOBIN_PCDEFINITION_SUPPORTDRILL );
+ maDefModel.mbInvalid = getFlag( nFlags1, BIFF12_PCDEFINITION_INVALID );
+ maDefModel.mbSaveData = getFlag( nFlags1, BIFF12_PCDEFINITION_SAVEDATA );
+ maDefModel.mbRefreshOnLoad = getFlag( nFlags1, BIFF12_PCDEFINITION_REFRESHONLOAD );
+ maDefModel.mbOptimizeMemory = getFlag( nFlags1, BIFF12_PCDEFINITION_OPTIMIZEMEMORY );
+ maDefModel.mbEnableRefresh = getFlag( nFlags1, BIFF12_PCDEFINITION_ENABLEREFRESH );
+ maDefModel.mbBackgroundQuery = getFlag( nFlags1, BIFF12_PCDEFINITION_BACKGROUNDQUERY );
+ maDefModel.mbUpgradeOnRefresh = getFlag( nFlags1, BIFF12_PCDEFINITION_UPGRADEONREFR );
+ maDefModel.mbTupleCache = getFlag( nFlags1, BIFF12_PCDEFINITION_TUPELCACHE );
+ maDefModel.mbSupportSubquery = getFlag( nFlags2, BIFF12_PCDEFINITION_SUPPORTSUBQUERY );
+ maDefModel.mbSupportDrill = getFlag( nFlags2, BIFF12_PCDEFINITION_SUPPORTDRILL );
}
-void PivotCache::importPCDSource( RecordInputStream& rStrm )
+void PivotCache::importPCDSource( SequenceInputStream& rStrm )
{
sal_Int32 nSourceType;
rStrm >> nSourceType >> maSourceModel.mnConnectionId;
@@ -1118,13 +1114,13 @@ void PivotCache::importPCDSource( RecordInputStream& rStrm )
maSourceModel.mnSourceType = STATIC_ARRAY_SELECT( spnSourceTypes, nSourceType, XML_TOKEN_INVALID );
}
-void PivotCache::importPCDSheetSource( RecordInputStream& rStrm, const Relations& rRelations )
+void PivotCache::importPCDSheetSource( SequenceInputStream& rStrm, const Relations& rRelations )
{
sal_uInt8 nIsDefName, nIsBuiltinName, nFlags;
rStrm >> nIsDefName >> nIsBuiltinName >> nFlags;
- if( getFlag( nFlags, OOBIN_PCDWBSOURCE_HASSHEET ) )
+ if( getFlag( nFlags, BIFF12_PCDWBSOURCE_HASSHEET ) )
rStrm >> maSheetSrcModel.maSheet;
- if( getFlag( nFlags, OOBIN_PCDWBSOURCE_HASRELID ) )
+ if( getFlag( nFlags, BIFF12_PCDWBSOURCE_HASRELID ) )
rStrm >> maSheetSrcModel.maRelId;
// read cell range or defined name
@@ -1268,7 +1264,7 @@ const PivotCacheField* PivotCache::getCacheField( sal_Int32 nFieldIdx ) const
sal_Int32 PivotCache::getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const
{
- return ContainerHelper::getVectorElement< sal_Int32 >( maDatabaseIndexes, nFieldIdx, -1 );
+ return ContainerHelper::getVectorElement( maDatabaseIndexes, nFieldIdx, -1 );
}
void PivotCache::writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const
@@ -1290,7 +1286,7 @@ void PivotCache::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 n
pCacheField->writeSourceDataCell( rSheetHelper, maSheetSrcModel.maRange.StartColumn + nCol, maSheetSrcModel.maRange.StartRow + nRow, rItem );
}
-void PivotCache::importPCRecord( RecordInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const
+void PivotCache::importPCRecord( SequenceInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const
{
OSL_ENSURE( (0 < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow - maSheetSrcModel.maRange.StartRow), "PivotCache::importPCRecord - invalid row index" );
sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn;
@@ -1411,7 +1407,7 @@ void PivotCache::finalizeExternalSheetSource()
{
/* If pivot cache is based on external sheet data, try to restore sheet
data from cache records. No support for external defined names or tables,
- sheet name and path to cache records fragment (OOX only) are required. */
+ sheet name and path to cache records fragment (OOXML only) are required. */
bool bHasRelation = (getFilterType() == FILTER_BIFF) || (maDefModel.maRelId.getLength() > 0);
if( bHasRelation && (maSheetSrcModel.maDefName.getLength() == 0) && (maSheetSrcModel.maSheet.getLength() > 0) )
prepareSourceDataSheet();
@@ -1471,6 +1467,29 @@ PivotCache* PivotCacheBuffer::importPivotCacheFragment( sal_Int32 nCacheId )
{
switch( getFilterType() )
{
+ /* OOXML/BIFF12 filter: On first call for the cache ID, the pivot
+ cache object is created and inserted into maCaches. Then, the cache
+ definition fragment is read and the cache is returned. On
+ subsequent calls, the created cache will be found in maCaches and
+ returned immediately. */
+ case FILTER_OOXML:
+ {
+ // try to find an imported pivot cache
+ if( PivotCache* pCache = maCaches.get( nCacheId ).get() )
+ return pCache;
+
+ // check if a fragment path exists for the passed cache identifier
+ FragmentPathMap::iterator aIt = maFragmentPaths.find( nCacheId );
+ if( aIt == maFragmentPaths.end() )
+ return 0;
+
+ /* Import the cache fragment. This may create a dummy data sheet
+ for external sheet sources. */
+ PivotCache& rCache = createPivotCache( nCacheId );
+ importOoxFragment( new PivotCacheDefinitionFragment( *this, aIt->second, rCache ) );
+ return &rCache;
+ }
+
/* BIFF filter: Pivot table provides 0-based index into list of pivot
cache source links (PIVOTCACHE/PCDSOURCE/... record blocks in
workbook stream). First, this index has to be resolved to the cache
@@ -1485,7 +1504,7 @@ PivotCache* PivotCacheBuffer::importPivotCacheFragment( sal_Int32 nCacheId )
{
/* Resolve cache index to cache identifier and try to find pivot
cache. Cache must exist already for a valid cache index. */
- nCacheId = ContainerHelper::getVectorElement< sal_Int32 >( maCacheIds, nCacheId, -1 );
+ nCacheId = ContainerHelper::getVectorElement( maCacheIds, nCacheId, -1 );
PivotCache* pCache = maCaches.get( nCacheId ).get();
if( !pCache )
return 0;
@@ -1504,29 +1523,6 @@ PivotCache* PivotCacheBuffer::importPivotCacheFragment( sal_Int32 nCacheId )
return pCache;
}
- /* OOX/OOBIN filter: On first call for the cache ID, the pivot cache
- object is created and inserted into maCaches. Then, the cache
- definition fragment is read and the cache is returned. On
- subsequent calls, the created cache will be found in maCaches and
- returned immediately. */
- case FILTER_OOX:
- {
- // try to find an imported pivot cache
- if( PivotCache* pCache = maCaches.get( nCacheId ).get() )
- return pCache;
-
- // check if a fragment path exists for the passed cache identifier
- FragmentPathMap::iterator aIt = maFragmentPaths.find( nCacheId );
- if( aIt == maFragmentPaths.end() )
- return 0;
-
- /* Import the cache fragment. This may create a dummy data sheet
- for external sheet sources. */
- PivotCache& rCache = createPivotCache( nCacheId );
- importOoxFragment( new OoxPivotCacheDefinitionFragment( *this, aIt->second, rCache ) );
- return &rCache;
- }
-
case FILTER_UNKNOWN:
OSL_ENSURE( false, "PivotCacheBuffer::importPivotCacheFragment - unknown filter type" );
}
@@ -1545,4 +1541,3 @@ PivotCache& PivotCacheBuffer::createPivotCache( sal_Int32 nCacheId )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/pivotcachefragment.cxx b/oox/source/xls/pivotcachefragment.cxx
index 440fcd1e0903..d49077af4f91 100644
--- a/oox/source/xls/pivotcachefragment.cxx
+++ b/oox/source/xls/pivotcachefragment.cxx
@@ -26,29 +26,31 @@
************************************************************************/
#include "oox/xls/pivotcachefragment.hxx"
+
#include "oox/helper/attributelist.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/pivotcachebuffer.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
-
namespace oox {
namespace xls {
// ============================================================================
-OoxPivotCacheFieldContext::OoxPivotCacheFieldContext( OoxWorkbookFragmentBase& rFragment, PivotCacheField& rCacheField ) :
- OoxWorkbookContextBase( rFragment ),
+using namespace ::com::sun::star::uno;
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+PivotCacheFieldContext::PivotCacheFieldContext( WorkbookFragmentBase& rFragment, PivotCacheField& rCacheField ) :
+ WorkbookContextBase( rFragment ),
mrCacheField( rCacheField )
{
}
-ContextHandlerRef OoxPivotCacheFieldContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef PivotCacheFieldContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -73,41 +75,41 @@ ContextHandlerRef OoxPivotCacheFieldContext::onCreateContext( sal_Int32 nElement
return 0;
}
-void OoxPivotCacheFieldContext::onStartElement( const AttributeList& rAttribs )
+void PivotCacheFieldContext::onStartElement( const AttributeList& rAttribs )
{
if( isRootElement() )
mrCacheField.importCacheField( rAttribs );
}
-ContextHandlerRef OoxPivotCacheFieldContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef PivotCacheFieldContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_PCDFIELD:
+ case BIFF12_ID_PCDFIELD:
switch( nRecId )
{
- case OOBIN_ID_PCDFSHAREDITEMS: mrCacheField.importPCDFSharedItems( rStrm ); return this;
- case OOBIN_ID_PCDFIELDGROUP: mrCacheField.importPCDFieldGroup( rStrm ); return this;
+ case BIFF12_ID_PCDFSHAREDITEMS: mrCacheField.importPCDFSharedItems( rStrm ); return this;
+ case BIFF12_ID_PCDFIELDGROUP: mrCacheField.importPCDFieldGroup( rStrm ); return this;
}
break;
- case OOBIN_ID_PCDFIELDGROUP:
+ case BIFF12_ID_PCDFIELDGROUP:
switch( nRecId )
{
- case OOBIN_ID_PCDFRANGEPR: mrCacheField.importPCDFRangePr( rStrm ); break;
- case OOBIN_ID_PCDFDISCRETEPR: return this;
- case OOBIN_ID_PCDFGROUPITEMS: return this;
+ case BIFF12_ID_PCDFRANGEPR: mrCacheField.importPCDFRangePr( rStrm ); break;
+ case BIFF12_ID_PCDFDISCRETEPR: return this;
+ case BIFF12_ID_PCDFGROUPITEMS: return this;
}
break;
- case OOBIN_ID_PCDFSHAREDITEMS: mrCacheField.importPCDFSharedItem( nRecId, rStrm ); break;
- case OOBIN_ID_PCDFDISCRETEPR: mrCacheField.importPCDFDiscretePrItem( nRecId, rStrm ); break;
- case OOBIN_ID_PCDFGROUPITEMS: mrCacheField.importPCDFGroupItem( nRecId, rStrm ); break;
+ case BIFF12_ID_PCDFSHAREDITEMS: mrCacheField.importPCDFSharedItem( nRecId, rStrm ); break;
+ case BIFF12_ID_PCDFDISCRETEPR: mrCacheField.importPCDFDiscretePrItem( nRecId, rStrm ); break;
+ case BIFF12_ID_PCDFGROUPITEMS: mrCacheField.importPCDFGroupItem( nRecId, rStrm ); break;
}
return 0;
}
-void OoxPivotCacheFieldContext::onStartRecord( RecordInputStream& rStrm )
+void PivotCacheFieldContext::onStartRecord( SequenceInputStream& rStrm )
{
if( isRootElement() )
mrCacheField.importPCDField( rStrm );
@@ -115,14 +117,14 @@ void OoxPivotCacheFieldContext::onStartRecord( RecordInputStream& rStrm )
// ============================================================================
-OoxPivotCacheDefinitionFragment::OoxPivotCacheDefinitionFragment(
+PivotCacheDefinitionFragment::PivotCacheDefinitionFragment(
const WorkbookHelper& rHelper, const OUString& rFragmentPath, PivotCache& rPivotCache ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath ),
+ WorkbookFragmentBase( rHelper, rFragmentPath ),
mrPivotCache( rPivotCache )
{
}
-ContextHandlerRef OoxPivotCacheDefinitionFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef PivotCacheDefinitionFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -143,60 +145,60 @@ ContextHandlerRef OoxPivotCacheDefinitionFragment::onCreateContext( sal_Int32 nE
break;
case XLS_TOKEN( cacheFields ):
- if( nElement == XLS_TOKEN( cacheField ) ) return new OoxPivotCacheFieldContext( *this, mrPivotCache.createCacheField() );
+ if( nElement == XLS_TOKEN( cacheField ) ) return new PivotCacheFieldContext( *this, mrPivotCache.createCacheField() );
break;
}
return 0;
}
-ContextHandlerRef OoxPivotCacheDefinitionFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef PivotCacheDefinitionFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_PCDEFINITION ) { mrPivotCache.importPCDefinition( rStrm ); return this; }
+ if( nRecId == BIFF12_ID_PCDEFINITION ) { mrPivotCache.importPCDefinition( rStrm ); return this; }
break;
- case OOBIN_ID_PCDEFINITION:
+ case BIFF12_ID_PCDEFINITION:
switch( nRecId )
{
- case OOBIN_ID_PCDSOURCE: mrPivotCache.importPCDSource( rStrm ); return this;
- case OOBIN_ID_PCDFIELDS: return this;
+ case BIFF12_ID_PCDSOURCE: mrPivotCache.importPCDSource( rStrm ); return this;
+ case BIFF12_ID_PCDFIELDS: return this;
}
break;
- case OOBIN_ID_PCDSOURCE:
- if( nRecId == OOBIN_ID_PCDSHEETSOURCE ) mrPivotCache.importPCDSheetSource( rStrm, getRelations() );
+ case BIFF12_ID_PCDSOURCE:
+ if( nRecId == BIFF12_ID_PCDSHEETSOURCE ) mrPivotCache.importPCDSheetSource( rStrm, getRelations() );
break;
- case OOBIN_ID_PCDFIELDS:
- if( nRecId == OOBIN_ID_PCDFIELD ) return new OoxPivotCacheFieldContext( *this, mrPivotCache.createCacheField() );
+ case BIFF12_ID_PCDFIELDS:
+ if( nRecId == BIFF12_ID_PCDFIELD ) return new PivotCacheFieldContext( *this, mrPivotCache.createCacheField() );
break;
}
return 0;
}
-const RecordInfo* OoxPivotCacheDefinitionFragment::getRecordInfos() const
+const RecordInfo* PivotCacheDefinitionFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_PCDEFINITION, OOBIN_ID_PCDEFINITION + 1 },
- { OOBIN_ID_PCDFDISCRETEPR, OOBIN_ID_PCDFDISCRETEPR + 1 },
- { OOBIN_ID_PCDFGROUPITEMS, OOBIN_ID_PCDFGROUPITEMS + 1 },
- { OOBIN_ID_PCDFIELD, OOBIN_ID_PCDFIELD + 1 },
- { OOBIN_ID_PCDFIELDGROUP, OOBIN_ID_PCDFIELDGROUP + 1 },
- { OOBIN_ID_PCDFIELDS, OOBIN_ID_PCDFIELDS + 1 },
- { OOBIN_ID_PCDFRANGEPR, OOBIN_ID_PCDFRANGEPR + 1 },
- { OOBIN_ID_PCDFSHAREDITEMS, OOBIN_ID_PCDFSHAREDITEMS + 1 },
- { OOBIN_ID_PCITEM_ARRAY, OOBIN_ID_PCITEM_ARRAY + 1 },
- { OOBIN_ID_PCDSHEETSOURCE, OOBIN_ID_PCDSHEETSOURCE + 1 },
- { OOBIN_ID_PCDSOURCE, OOBIN_ID_PCDSOURCE + 1 },
- { -1, -1 }
+ { BIFF12_ID_PCDEFINITION, BIFF12_ID_PCDEFINITION + 1 },
+ { BIFF12_ID_PCDFDISCRETEPR, BIFF12_ID_PCDFDISCRETEPR + 1 },
+ { BIFF12_ID_PCDFGROUPITEMS, BIFF12_ID_PCDFGROUPITEMS + 1 },
+ { BIFF12_ID_PCDFIELD, BIFF12_ID_PCDFIELD + 1 },
+ { BIFF12_ID_PCDFIELDGROUP, BIFF12_ID_PCDFIELDGROUP + 1 },
+ { BIFF12_ID_PCDFIELDS, BIFF12_ID_PCDFIELDS + 1 },
+ { BIFF12_ID_PCDFRANGEPR, BIFF12_ID_PCDFRANGEPR + 1 },
+ { BIFF12_ID_PCDFSHAREDITEMS, BIFF12_ID_PCDFSHAREDITEMS + 1 },
+ { BIFF12_ID_PCITEM_ARRAY, BIFF12_ID_PCITEM_ARRAY + 1 },
+ { BIFF12_ID_PCDSHEETSOURCE, BIFF12_ID_PCDSHEETSOURCE + 1 },
+ { BIFF12_ID_PCDSOURCE, BIFF12_ID_PCDSOURCE + 1 },
+ { -1, -1 }
};
return spRecInfos;
}
-void OoxPivotCacheDefinitionFragment::finalizeImport()
+void PivotCacheDefinitionFragment::finalizeImport()
{
// finalize the cache (check source range etc.)
mrPivotCache.finalizeImport();
@@ -206,15 +208,15 @@ void OoxPivotCacheDefinitionFragment::finalizeImport()
{
OUString aRecFragmentPath = getRelations().getFragmentPathFromRelId( mrPivotCache.getRecordsRelId() );
if( aRecFragmentPath.getLength() > 0 )
- importOoxFragment( new OoxPivotCacheRecordsFragment( *this, aRecFragmentPath, mrPivotCache ) );
+ importOoxFragment( new PivotCacheRecordsFragment( *this, aRecFragmentPath, mrPivotCache ) );
}
}
// ============================================================================
-OoxPivotCacheRecordsFragment::OoxPivotCacheRecordsFragment( const WorkbookHelper& rHelper,
+PivotCacheRecordsFragment::PivotCacheRecordsFragment( const WorkbookHelper& rHelper,
const OUString& rFragmentPath, const PivotCache& rPivotCache ) :
- OoxWorksheetFragmentBase( rHelper, rFragmentPath, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ),
+ WorksheetFragmentBase( rHelper, rFragmentPath, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ),
mrPivotCache( rPivotCache ),
mnCol( 0 ),
mnRow( 0 ),
@@ -224,7 +226,7 @@ OoxPivotCacheRecordsFragment::OoxPivotCacheRecordsFragment( const WorkbookHelper
rPivotCache.writeSourceHeaderCells( *this );
}
-ContextHandlerRef OoxPivotCacheRecordsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef PivotCacheRecordsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -248,7 +250,7 @@ ContextHandlerRef OoxPivotCacheRecordsFragment::onCreateContext( sal_Int32 nElem
case XLS_TOKEN( b ): aItem.readBool( rAttribs ); break;
case XLS_TOKEN( e ): aItem.readError( rAttribs, getUnitConverter() ); break;
case XLS_TOKEN( x ): aItem.readIndex( rAttribs ); break;
- default: OSL_ENSURE( false, "OoxPivotCacheRecordsFragment::onCreateContext - unexpected element" );
+ default: OSL_ENSURE( false, "PivotCacheRecordsFragment::onCreateContext - unexpected element" );
}
mrPivotCache.writeSourceDataCell( *this, mnCol, mnRow, aItem );
++mnCol;
@@ -258,19 +260,19 @@ ContextHandlerRef OoxPivotCacheRecordsFragment::onCreateContext( sal_Int32 nElem
return 0;
}
-ContextHandlerRef OoxPivotCacheRecordsFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef PivotCacheRecordsFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_PCRECORDS ) return this;
+ if( nRecId == BIFF12_ID_PCRECORDS ) return this;
break;
- case OOBIN_ID_PCRECORDS:
+ case BIFF12_ID_PCRECORDS:
switch( nRecId )
{
- case OOBIN_ID_PCRECORD: importPCRecord( rStrm ); break;
- case OOBIN_ID_PCRECORDDT: startCacheRecord(); break;
+ case BIFF12_ID_PCRECORD: importPCRecord( rStrm ); break;
+ case BIFF12_ID_PCRECORDDT: startCacheRecord(); break;
default: importPCRecordItem( nRecId, rStrm ); break;
}
break;
@@ -278,11 +280,11 @@ ContextHandlerRef OoxPivotCacheRecordsFragment::onCreateRecordContext( sal_Int32
return 0;
}
-const RecordInfo* OoxPivotCacheRecordsFragment::getRecordInfos() const
+const RecordInfo* PivotCacheRecordsFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_PCRECORDS, OOBIN_ID_PCRECORDS + 1 },
+ { BIFF12_ID_PCRECORDS, BIFF12_ID_PCRECORDS + 1 },
{ -1, -1 }
};
return spRecInfos;
@@ -290,35 +292,35 @@ const RecordInfo* OoxPivotCacheRecordsFragment::getRecordInfos() const
// private --------------------------------------------------------------------
-void OoxPivotCacheRecordsFragment::startCacheRecord()
+void PivotCacheRecordsFragment::startCacheRecord()
{
mnCol = 0;
++mnRow;
mbInRecord = true;
}
-void OoxPivotCacheRecordsFragment::importPCRecord( RecordInputStream& rStrm )
+void PivotCacheRecordsFragment::importPCRecord( SequenceInputStream& rStrm )
{
startCacheRecord();
mrPivotCache.importPCRecord( rStrm, *this, mnRow );
mbInRecord = false;
}
-void OoxPivotCacheRecordsFragment::importPCRecordItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+void PivotCacheRecordsFragment::importPCRecordItem( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
if( mbInRecord )
{
PivotCacheItem aItem;
switch( nRecId )
{
- case OOBIN_ID_PCITEM_MISSING: break;
- case OOBIN_ID_PCITEM_STRING: aItem.readString( rStrm ); break;
- case OOBIN_ID_PCITEM_DOUBLE: aItem.readDouble( rStrm ); break;
- case OOBIN_ID_PCITEM_DATE: aItem.readDate( rStrm ); break;
- case OOBIN_ID_PCITEM_BOOL: aItem.readBool( rStrm ); break;
- case OOBIN_ID_PCITEM_ERROR: aItem.readError( rStrm ); break;
- case OOBIN_ID_PCITEM_INDEX: aItem.readIndex( rStrm ); break;
- default: OSL_ENSURE( false, "OoxPivotCacheRecordsFragment::importPCRecordItem - unexpected record" );
+ case BIFF12_ID_PCITEM_MISSING: break;
+ case BIFF12_ID_PCITEM_STRING: aItem.readString( rStrm ); break;
+ case BIFF12_ID_PCITEM_DOUBLE: aItem.readDouble( rStrm ); break;
+ case BIFF12_ID_PCITEM_DATE: aItem.readDate( rStrm ); break;
+ case BIFF12_ID_PCITEM_BOOL: aItem.readBool( rStrm ); break;
+ case BIFF12_ID_PCITEM_ERROR: aItem.readError( rStrm ); break;
+ case BIFF12_ID_PCITEM_INDEX: aItem.readIndex( rStrm ); break;
+ default: OSL_ENSURE( false, "PivotCacheRecordsFragment::importPCRecordItem - unexpected record" );
}
mrPivotCache.writeSourceDataCell( *this, mnCol, mnRow, aItem );
++mnCol;
@@ -345,7 +347,7 @@ bool lclSeekToPCDField( BiffInputStream& rStrm )
// ----------------------------------------------------------------------------
BiffPivotCacheFragment::BiffPivotCacheFragment(
- const WorkbookHelper& rHelper, const ::rtl::OUString& rStrmName, PivotCache& rPivotCache ) :
+ const WorkbookHelper& rHelper, const OUString& rStrmName, PivotCache& rPivotCache ) :
BiffWorkbookFragmentBase( rHelper, rStrmName, true ),
mrPivotCache( rPivotCache )
{
@@ -353,14 +355,15 @@ BiffPivotCacheFragment::BiffPivotCacheFragment(
bool BiffPivotCacheFragment::importFragment()
{
- if( mrStrm.startNextRecord() && (mrStrm.getRecId() == BIFF_ID_PCDEFINITION) )
+ BiffInputStream& rStrm = getInputStream();
+ if( rStrm.startNextRecord() && (rStrm.getRecId() == BIFF_ID_PCDEFINITION) )
{
// read PCDEFINITION and optional PCDEFINITION2 records
- mrPivotCache.importPCDefinition( mrStrm );
+ mrPivotCache.importPCDefinition( rStrm );
// read cache fields as long as another PCDFIELD record can be found
- while( lclSeekToPCDField( mrStrm ) )
- mrPivotCache.createCacheField( true ).importPCDField( mrStrm );
+ while( lclSeekToPCDField( rStrm ) )
+ mrPivotCache.createCacheField( true ).importPCDField( rStrm );
// finalize the cache (check source range etc.)
mrPivotCache.finalizeImport();
@@ -372,19 +375,18 @@ bool BiffPivotCacheFragment::importFragment()
unchanged. Stream should point to source data table now. */
BiffPivotCacheRecordsContext aContext( *this, mrPivotCache );
if( aContext.isValidSheet() )
- while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
- aContext.importRecord();
+ while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
+ aContext.importRecord( rStrm );
}
}
- return mrStrm.getRecId() == BIFF_ID_EOF;
+ return rStrm.getRecId() == BIFF_ID_EOF;
}
// ============================================================================
-BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext(
- const BiffWorkbookFragmentBase& rFragment, const PivotCache& rPivotCache ) :
- BiffWorksheetContextBase( rFragment, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ),
+BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext( const WorkbookHelper& rHelper, const PivotCache& rPivotCache ) :
+ BiffWorksheetContextBase( rHelper, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ),
mrPivotCache( rPivotCache ),
mnColIdx( 0 ),
mnRow( 0 ),
@@ -409,28 +411,28 @@ BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext(
}
}
-void BiffPivotCacheRecordsContext::importRecord()
+void BiffPivotCacheRecordsContext::importRecord( BiffInputStream& rStrm )
{
- if( mrStrm.getRecId() == BIFF_ID_PCITEM_INDEXLIST )
+ if( rStrm.getRecId() == BIFF_ID_PCITEM_INDEXLIST )
{
OSL_ENSURE( mbHasShared, "BiffPivotCacheRecordsContext::importRecord - unexpected PCITEM_INDEXLIST record" );
// PCITEM_INDEXLIST record always in front of a new data row
startNextRow();
- mrPivotCache.importPCItemIndexList( mrStrm, *this, mnRow );
+ mrPivotCache.importPCItemIndexList( rStrm, *this, mnRow );
mbInRow = !maUnsharedCols.empty(); // mbInRow remains true, if unshared items are expected
return;
}
PivotCacheItem aItem;
- switch( mrStrm.getRecId() )
+ switch( rStrm.getRecId() )
{
case BIFF_ID_PCITEM_MISSING: break;
- case BIFF_ID_PCITEM_STRING: aItem.readString( mrStrm, *this ); break;
- case BIFF_ID_PCITEM_DOUBLE: aItem.readDouble( mrStrm ); break;
- case BIFF_ID_PCITEM_INTEGER: aItem.readInteger( mrStrm ); break;
- case BIFF_ID_PCITEM_DATE: aItem.readDate( mrStrm ); break;
- case BIFF_ID_PCITEM_BOOL: aItem.readBool( mrStrm ); break;
- case BIFF_ID_PCITEM_ERROR: aItem.readError( mrStrm ); break;
+ case BIFF_ID_PCITEM_STRING: aItem.readString( rStrm, *this ); break;
+ case BIFF_ID_PCITEM_DOUBLE: aItem.readDouble( rStrm ); break;
+ case BIFF_ID_PCITEM_INTEGER: aItem.readInteger( rStrm ); break;
+ case BIFF_ID_PCITEM_DATE: aItem.readDate( rStrm ); break;
+ case BIFF_ID_PCITEM_BOOL: aItem.readBool( rStrm ); break;
+ case BIFF_ID_PCITEM_ERROR: aItem.readError( rStrm ); break;
default: return; // unknown record, ignore
}
@@ -462,4 +464,3 @@ void BiffPivotCacheRecordsContext::startNextRow()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/pivottablebuffer.cxx b/oox/source/xls/pivottablebuffer.cxx
index b4e3e1c52a65..7cdeddaa879b 100644
--- a/oox/source/xls/pivottablebuffer.cxx
+++ b/oox/source/xls/pivottablebuffer.cxx
@@ -26,6 +26,7 @@
************************************************************************/
#include "oox/xls/pivottablebuffer.hxx"
+
#include <set>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -45,37 +46,26 @@
#include <com/sun/star/sheet/XDataPilotField.hpp>
#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
#include <com/sun/star/sheet/XSheetOperation.hpp>
-#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-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::beans::XPropertySet;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNamed;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::sheet::DataPilotFieldOrientation;
-using ::com::sun::star::sheet::XDataPilotDataLayoutFieldSupplier;
-using ::com::sun::star::sheet::XDataPilotDescriptor;
-using ::com::sun::star::sheet::XDataPilotField;
-using ::com::sun::star::sheet::XDataPilotTables;
-using ::com::sun::star::sheet::XDataPilotTablesSupplier;
-using ::com::sun::star::sheet::XSheetOperation;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
const sal_Int32 OOX_PT_DATALAYOUTFIELD = -2; /// Placeholder index of data layout field.
@@ -85,83 +75,90 @@ const sal_Int32 OOX_PT_NEXT_ITEM = 0x001000FD; /// Calculat
// ----------------------------------------------------------------------------
-const sal_uInt32 OOBIN_PTFIELD_DATAFIELD = 0x00000008;
-const sal_uInt32 OOBIN_PTFIELD_DEFAULT = 0x00000100;
-const sal_uInt32 OOBIN_PTFIELD_SUM = 0x00000200;
-const sal_uInt32 OOBIN_PTFIELD_COUNTA = 0x00000400;
-const sal_uInt32 OOBIN_PTFIELD_AVERAGE = 0x00000800;
-const sal_uInt32 OOBIN_PTFIELD_MAX = 0x00001000;
-const sal_uInt32 OOBIN_PTFIELD_MIN = 0x00002000;
-const sal_uInt32 OOBIN_PTFIELD_PRODUCT = 0x00004000;
-const sal_uInt32 OOBIN_PTFIELD_COUNT = 0x00008000;
-const sal_uInt32 OOBIN_PTFIELD_STDDEV = 0x00010000;
-const sal_uInt32 OOBIN_PTFIELD_STDDEVP = 0x00020000;
-const sal_uInt32 OOBIN_PTFIELD_VAR = 0x00040000;
-const sal_uInt32 OOBIN_PTFIELD_VARP = 0x00080000;
-
-const sal_uInt32 OOBIN_PTFIELD_SHOWALL = 0x00000020;
-const sal_uInt32 OOBIN_PTFIELD_OUTLINE = 0x00000040;
-const sal_uInt32 OOBIN_PTFIELD_INSERTBLANKROW = 0x00000080;
-const sal_uInt32 OOBIN_PTFIELD_SUBTOTALTOP = 0x00000100;
-const sal_uInt32 OOBIN_PTFIELD_INSERTPAGEBREAK = 0x00000800;
-const sal_uInt32 OOBIN_PTFIELD_AUTOSORT = 0x00001000;
-const sal_uInt32 OOBIN_PTFIELD_SORTASCENDING = 0x00002000;
-const sal_uInt32 OOBIN_PTFIELD_AUTOSHOW = 0x00004000;
-const sal_uInt32 OOBIN_PTFIELD_AUTOSHOWTOP = 0x00008000;
-const sal_uInt32 OOBIN_PTFIELD_MULTIPAGEITEMS = 0x00080000;
-
-const sal_uInt16 OOBIN_PTFITEM_HIDDEN = 0x0001;
-const sal_uInt16 OOBIN_PTFITEM_HIDEDETAILS = 0x0002;
-
-const sal_uInt8 OOBIN_PTPAGEFIELD_HASNAME = 0x01;
-const sal_uInt8 OOBIN_PTPAGEFIELD_HASOLAPCAPTION = 0x02;
-const sal_Int32 OOBIN_PTPAGEFIELD_MULTIITEMS = 0x001000FE;
-
-const sal_uInt16 OOBIN_PTFILTER_HASNAME = 0x0001;
-const sal_uInt16 OOBIN_PTFILTER_HASDESCRIPTION = 0x0002;
-const sal_uInt16 OOBIN_PTFILTER_HASSTRVALUE1 = 0x0004;
-const sal_uInt16 OOBIN_PTFILTER_HASSTRVALUE2 = 0x0008;
-
-const sal_uInt8 OOBIN_TOP10FILTER_TOP = 0x01;
-const sal_uInt8 OOBIN_TOP10FILTER_PERCENT = 0x02;
-
-const sal_uInt32 OOBIN_PTDEF_SHOWITEMS = 0x00000100;
-const sal_uInt32 OOBIN_PTDEF_DISABLEFIELDLIST = 0x00000400;
-const sal_uInt32 OOBIN_PTDEF_HIDECALCMEMBERS = 0x00001000;
-const sal_uInt32 OOBIN_PTDEF_WITHHIDDENTOTALS = 0x00002000;
-const sal_uInt32 OOBIN_PTDEF_HIDEDRILL = 0x00100000;
-const sal_uInt32 OOBIN_PTDEF_PRINTDRILL = 0x00200000;
-const sal_uInt32 OOBIN_PTDEF_HIDEHEADERS = 0x80000000;
-
-const sal_uInt32 OOBIN_PTDEF_SHOWEMPTYROW = 0x00000004;
-const sal_uInt32 OOBIN_PTDEF_SHOWEMPTYCOL = 0x00000008;
-const sal_uInt32 OOBIN_PTDEF_ENABLEDRILL = 0x00000020;
-const sal_uInt32 OOBIN_PTDEF_PRESERVEFORMATTING = 0x00000080;
-const sal_uInt32 OOBIN_PTDEF_SHOWERROR = 0x00000200;
-const sal_uInt32 OOBIN_PTDEF_SHOWMISSING = 0x00000400;
-const sal_uInt32 OOBIN_PTDEF_PAGEOVERTHENDOWN = 0x00000800;
-const sal_uInt32 OOBIN_PTDEF_SUBTOTALHIDDENITEMS = 0x00001000;
-const sal_uInt32 OOBIN_PTDEF_ROWGRANDTOTALS = 0x00002000;
-const sal_uInt32 OOBIN_PTDEF_COLGRANDTOTALS = 0x00004000;
-const sal_uInt32 OOBIN_PTDEF_FIELDPRINTTITLES = 0x00008000;
-const sal_uInt32 OOBIN_PTDEF_ITEMPRINTTITLES = 0x00020000;
-const sal_uInt32 OOBIN_PTDEF_MERGEITEM = 0x00040000;
-const sal_uInt32 OOBIN_PTDEF_HASDATACAPTION = 0x00080000;
-const sal_uInt32 OOBIN_PTDEF_HASGRANDTOTALCAPTION = 0x00100000;
-const sal_uInt32 OOBIN_PTDEF_HASPAGESTYLE = 0x00200000;
-const sal_uInt32 OOBIN_PTDEF_HASPIVOTTABLESTYLE = 0x00400000;
-const sal_uInt32 OOBIN_PTDEF_HASVACATEDSTYLE = 0x00800000;
-const sal_uInt32 OOBIN_PTDEF_HASTAG = 0x40000000;
-
-const sal_uInt32 OOBIN_PTDEF_NOERRORCAPTION = 0x00000040;
-const sal_uInt32 OOBIN_PTDEF_NOMISSINGCAPTION = 0x00000080;
-const sal_uInt32 OOBIN_PTDEF_HASROWHEADERCAPTION = 0x00000400;
-const sal_uInt32 OOBIN_PTDEF_HASCOLHEADERCAPTION = 0x00000800;
-const sal_uInt32 OOBIN_PTDEF_FIELDLISTSORTASC = 0x00001000;
-const sal_uInt32 OOBIN_PTDEF_NOCUSTOMLISTSORT = 0x00004000;
-
-const sal_uInt8 OOBIN_PTDEF_ROWAXIS = 1;
-const sal_uInt8 OOBIN_PTDEF_COLAXIS = 2;
+const sal_uInt32 BIFF12_PTFIELD_DATAFIELD = 0x00000008;
+const sal_uInt32 BIFF12_PTFIELD_DEFAULT = 0x00000100;
+const sal_uInt32 BIFF12_PTFIELD_SUM = 0x00000200;
+const sal_uInt32 BIFF12_PTFIELD_COUNTA = 0x00000400;
+const sal_uInt32 BIFF12_PTFIELD_AVERAGE = 0x00000800;
+const sal_uInt32 BIFF12_PTFIELD_MAX = 0x00001000;
+const sal_uInt32 BIFF12_PTFIELD_MIN = 0x00002000;
+const sal_uInt32 BIFF12_PTFIELD_PRODUCT = 0x00004000;
+const sal_uInt32 BIFF12_PTFIELD_COUNT = 0x00008000;
+const sal_uInt32 BIFF12_PTFIELD_STDDEV = 0x00010000;
+const sal_uInt32 BIFF12_PTFIELD_STDDEVP = 0x00020000;
+const sal_uInt32 BIFF12_PTFIELD_VAR = 0x00040000;
+const sal_uInt32 BIFF12_PTFIELD_VARP = 0x00080000;
+
+const sal_uInt32 BIFF12_PTFIELD_SHOWALL = 0x00000020;
+const sal_uInt32 BIFF12_PTFIELD_OUTLINE = 0x00000040;
+const sal_uInt32 BIFF12_PTFIELD_INSERTBLANKROW = 0x00000080;
+const sal_uInt32 BIFF12_PTFIELD_SUBTOTALTOP = 0x00000100;
+const sal_uInt32 BIFF12_PTFIELD_INSERTPAGEBREAK = 0x00000800;
+const sal_uInt32 BIFF12_PTFIELD_AUTOSORT = 0x00001000;
+const sal_uInt32 BIFF12_PTFIELD_SORTASCENDING = 0x00002000;
+const sal_uInt32 BIFF12_PTFIELD_AUTOSHOW = 0x00004000;
+const sal_uInt32 BIFF12_PTFIELD_AUTOSHOWTOP = 0x00008000;
+const sal_uInt32 BIFF12_PTFIELD_MULTIPAGEITEMS = 0x00080000;
+
+const sal_uInt16 BIFF12_PTFITEM_HIDDEN = 0x0001;
+const sal_uInt16 BIFF12_PTFITEM_HIDEDETAILS = 0x0002;
+
+const sal_uInt8 BIFF12_PTPAGEFIELD_HASNAME = 0x01;
+const sal_uInt8 BIFF12_PTPAGEFIELD_HASOLAPCAPTION = 0x02;
+const sal_Int32 BIFF12_PTPAGEFIELD_MULTIITEMS = 0x001000FE;
+
+const sal_uInt16 BIFF12_PTFILTER_HASNAME = 0x0001;
+const sal_uInt16 BIFF12_PTFILTER_HASDESCRIPTION = 0x0002;
+const sal_uInt16 BIFF12_PTFILTER_HASSTRVALUE1 = 0x0004;
+const sal_uInt16 BIFF12_PTFILTER_HASSTRVALUE2 = 0x0008;
+
+const sal_uInt8 BIFF12_TOP10FILTER_TOP = 0x01;
+const sal_uInt8 BIFF12_TOP10FILTER_PERCENT = 0x02;
+
+const sal_uInt32 BIFF12_PTDEF_SHOWITEMS = 0x00000100;
+const sal_uInt32 BIFF12_PTDEF_DISABLEFIELDLIST = 0x00000400;
+const sal_uInt32 BIFF12_PTDEF_HIDECALCMEMBERS = 0x00001000;
+const sal_uInt32 BIFF12_PTDEF_WITHHIDDENTOTALS = 0x00002000;
+const sal_uInt32 BIFF12_PTDEF_HIDEDRILL = 0x00100000;
+const sal_uInt32 BIFF12_PTDEF_PRINTDRILL = 0x00200000;
+const sal_uInt32 BIFF12_PTDEF_HIDEHEADERS = 0x80000000;
+
+const sal_uInt32 BIFF12_PTDEF_SHOWEMPTYROW = 0x00000004;
+const sal_uInt32 BIFF12_PTDEF_SHOWEMPTYCOL = 0x00000008;
+const sal_uInt32 BIFF12_PTDEF_ENABLEDRILL = 0x00000020;
+const sal_uInt32 BIFF12_PTDEF_PRESERVEFORMATTING = 0x00000080;
+const sal_uInt32 BIFF12_PTDEF_USEAUTOFORMAT = 0x00000100;
+const sal_uInt32 BIFF12_PTDEF_SHOWERROR = 0x00000200;
+const sal_uInt32 BIFF12_PTDEF_SHOWMISSING = 0x00000400;
+const sal_uInt32 BIFF12_PTDEF_PAGEOVERTHENDOWN = 0x00000800;
+const sal_uInt32 BIFF12_PTDEF_SUBTOTALHIDDENITEMS = 0x00001000;
+const sal_uInt32 BIFF12_PTDEF_ROWGRANDTOTALS = 0x00002000;
+const sal_uInt32 BIFF12_PTDEF_COLGRANDTOTALS = 0x00004000;
+const sal_uInt32 BIFF12_PTDEF_FIELDPRINTTITLES = 0x00008000;
+const sal_uInt32 BIFF12_PTDEF_ITEMPRINTTITLES = 0x00020000;
+const sal_uInt32 BIFF12_PTDEF_MERGEITEM = 0x00040000;
+const sal_uInt32 BIFF12_PTDEF_HASDATACAPTION = 0x00080000;
+const sal_uInt32 BIFF12_PTDEF_HASGRANDTOTALCAPTION = 0x00100000;
+const sal_uInt32 BIFF12_PTDEF_HASPAGESTYLE = 0x00200000;
+const sal_uInt32 BIFF12_PTDEF_HASPIVOTTABLESTYLE = 0x00400000;
+const sal_uInt32 BIFF12_PTDEF_HASVACATEDSTYLE = 0x00800000;
+const sal_uInt32 BIFF12_PTDEF_APPLYNUMFMT = 0x01000000;
+const sal_uInt32 BIFF12_PTDEF_APPLYFONT = 0x02000000;
+const sal_uInt32 BIFF12_PTDEF_APPLYALIGNMENT = 0x04000000;
+const sal_uInt32 BIFF12_PTDEF_APPLYBORDER = 0x08000000;
+const sal_uInt32 BIFF12_PTDEF_APPLYFILL = 0x10000000;
+const sal_uInt32 BIFF12_PTDEF_APPLYPROTECTION = 0x20000000;
+const sal_uInt32 BIFF12_PTDEF_HASTAG = 0x40000000;
+
+const sal_uInt32 BIFF12_PTDEF_NOERRORCAPTION = 0x00000040;
+const sal_uInt32 BIFF12_PTDEF_NOMISSINGCAPTION = 0x00000080;
+const sal_uInt32 BIFF12_PTDEF_HASROWHEADERCAPTION = 0x00000400;
+const sal_uInt32 BIFF12_PTDEF_HASCOLHEADERCAPTION = 0x00000800;
+const sal_uInt32 BIFF12_PTDEF_FIELDLISTSORTASC = 0x00001000;
+const sal_uInt32 BIFF12_PTDEF_NOCUSTOMLISTSORT = 0x00004000;
+
+const sal_uInt8 BIFF12_PTDEF_ROWAXIS = 1;
+const sal_uInt8 BIFF12_PTDEF_COLAXIS = 2;
// ----------------------------------------------------------------------------
@@ -233,7 +230,7 @@ PTFieldItemModel::PTFieldItemModel() :
{
}
-void PTFieldItemModel::setBinType( sal_uInt16 nType )
+void PTFieldItemModel::setBiffType( sal_uInt16 nType )
{
static const sal_Int32 spnTypes[] = { XML_data, XML_default,
XML_sum, XML_countA, XML_avg, XML_max, XML_min, XML_product, XML_count,
@@ -275,7 +272,7 @@ PTFieldModel::PTFieldModel() :
{
}
-void PTFieldModel::setBinAxis( sal_uInt8 nAxis )
+void PTFieldModel::setBiffAxis( sal_uInt8 nAxis )
{
/* Weird. The axis field is organized as bit field, but only one of the
row/col/page flags are allowed at the same time and refer to the values
@@ -293,7 +290,7 @@ void PTFieldModel::setBinAxis( sal_uInt8 nAxis )
PTPageFieldModel::PTPageFieldModel() :
mnField( -1 ),
- mnItem( OOBIN_PTPAGEFIELD_MULTIITEMS )
+ mnItem( BIFF12_PTPAGEFIELD_MULTIITEMS )
{
}
@@ -309,13 +306,13 @@ PTDataFieldModel::PTDataFieldModel() :
{
}
-void PTDataFieldModel::setBinSubtotal( sal_Int32 nSubtotal )
+void PTDataFieldModel::setBiffSubtotal( sal_Int32 nSubtotal )
{
static sal_Int32 spnSubtotals[] = { XML_sum, XML_count, XML_average, XML_max, XML_min, XML_product, XML_countNums, XML_stdDev, XML_stdDevp, XML_var, XML_varp };
mnSubtotal = STATIC_ARRAY_SELECT( spnSubtotals, nSubtotal, XML_TOKEN_INVALID );
}
-void PTDataFieldModel::setBinShowDataAs( sal_Int32 nShowDataAs )
+void PTDataFieldModel::setBiffShowDataAs( sal_Int32 nShowDataAs )
{
static sal_Int32 spnShowDataAs[] = { XML_normal, XML_difference, XML_percent, XML_percentDiff, XML_runTotal, XML_percentOfRow, XML_percentOfCol, XML_percentOfTotal, XML_index };
mnShowDataAs = STATIC_ARRAY_SELECT( spnShowDataAs, nShowDataAs, XML_TOKEN_INVALID );
@@ -386,60 +383,60 @@ void PivotTableField::importReferenceItem( const AttributeList& rAttribs )
maModel.mnSortRefItem = rAttribs.getInteger( XML_v, -1 );
}
-void PivotTableField::importPTField( RecordInputStream& rStrm )
+void PivotTableField::importPTField( SequenceInputStream& rStrm )
{
sal_uInt32 nFlags1, nFlags2;
rStrm >> nFlags1 >> maModel.mnNumFmtId >> nFlags2 >> maModel.mnAutoShowItems >> maModel.mnAutoShowRankBy;
- maModel.setBinAxis( extractValue< sal_uInt8 >( nFlags1, 0, 3 ) );
- maModel.mbDataField = getFlag( nFlags1, OOBIN_PTFIELD_DATAFIELD );
- maModel.mbDefaultSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_DEFAULT );
- maModel.mbSumSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_SUM );
- maModel.mbCountASubtotal = getFlag( nFlags1, OOBIN_PTFIELD_COUNTA );
- maModel.mbAverageSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_AVERAGE );
- maModel.mbMaxSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_MAX );
- maModel.mbMinSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_MIN );
- maModel.mbProductSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_PRODUCT );
- maModel.mbCountSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_COUNT );
- maModel.mbStdDevSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_STDDEV );
- maModel.mbStdDevPSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_STDDEVP );
- maModel.mbVarSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_VAR );
- maModel.mbVarPSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_VARP );
-
- maModel.mbShowAll = getFlag( nFlags2, OOBIN_PTFIELD_SHOWALL );
- maModel.mbOutline = getFlag( nFlags2, OOBIN_PTFIELD_OUTLINE );
- maModel.mbSubtotalTop = getFlag( nFlags2, OOBIN_PTFIELD_SUBTOTALTOP );
- maModel.mbInsertBlankRow = getFlag( nFlags2, OOBIN_PTFIELD_INSERTBLANKROW );
- maModel.mbInsertPageBreak = getFlag( nFlags2, OOBIN_PTFIELD_INSERTPAGEBREAK );
- maModel.mbAutoShow = getFlag( nFlags2, OOBIN_PTFIELD_AUTOSHOW );
- maModel.mbTopAutoShow = getFlag( nFlags2, OOBIN_PTFIELD_AUTOSHOWTOP );
- maModel.mbMultiPageItems = getFlag( nFlags2, OOBIN_PTFIELD_MULTIPAGEITEMS );
-
- bool bAutoSort = getFlag( nFlags2, OOBIN_PTFIELD_AUTOSORT );
- bool bAscending = getFlag( nFlags2, OOBIN_PTFIELD_SORTASCENDING );
+ maModel.setBiffAxis( extractValue< sal_uInt8 >( nFlags1, 0, 3 ) );
+ maModel.mbDataField = getFlag( nFlags1, BIFF12_PTFIELD_DATAFIELD );
+ maModel.mbDefaultSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_DEFAULT );
+ maModel.mbSumSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_SUM );
+ maModel.mbCountASubtotal = getFlag( nFlags1, BIFF12_PTFIELD_COUNTA );
+ maModel.mbAverageSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_AVERAGE );
+ maModel.mbMaxSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_MAX );
+ maModel.mbMinSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_MIN );
+ maModel.mbProductSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_PRODUCT );
+ maModel.mbCountSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_COUNT );
+ maModel.mbStdDevSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_STDDEV );
+ maModel.mbStdDevPSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_STDDEVP );
+ maModel.mbVarSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_VAR );
+ maModel.mbVarPSubtotal = getFlag( nFlags1, BIFF12_PTFIELD_VARP );
+
+ maModel.mbShowAll = getFlag( nFlags2, BIFF12_PTFIELD_SHOWALL );
+ maModel.mbOutline = getFlag( nFlags2, BIFF12_PTFIELD_OUTLINE );
+ maModel.mbSubtotalTop = getFlag( nFlags2, BIFF12_PTFIELD_SUBTOTALTOP );
+ maModel.mbInsertBlankRow = getFlag( nFlags2, BIFF12_PTFIELD_INSERTBLANKROW );
+ maModel.mbInsertPageBreak = getFlag( nFlags2, BIFF12_PTFIELD_INSERTPAGEBREAK );
+ maModel.mbAutoShow = getFlag( nFlags2, BIFF12_PTFIELD_AUTOSHOW );
+ maModel.mbTopAutoShow = getFlag( nFlags2, BIFF12_PTFIELD_AUTOSHOWTOP );
+ maModel.mbMultiPageItems = getFlag( nFlags2, BIFF12_PTFIELD_MULTIPAGEITEMS );
+
+ bool bAutoSort = getFlag( nFlags2, BIFF12_PTFIELD_AUTOSORT );
+ bool bAscending = getFlag( nFlags2, BIFF12_PTFIELD_SORTASCENDING );
maModel.mnSortType = bAutoSort ? (bAscending ? XML_ascending : XML_descending) : XML_manual;
}
-void PivotTableField::importPTFItem( RecordInputStream& rStrm )
+void PivotTableField::importPTFItem( SequenceInputStream& rStrm )
{
PTFieldItemModel aModel;
sal_uInt8 nType;
sal_uInt16 nFlags;
rStrm >> nType >> nFlags >> aModel.mnCacheItem;
- aModel.setBinType( nType );
- aModel.mbShowDetails = !getFlag( nFlags, OOBIN_PTFITEM_HIDEDETAILS );
- aModel.mbHidden = getFlag( nFlags, OOBIN_PTFITEM_HIDDEN );
+ aModel.setBiffType( nType );
+ aModel.mbShowDetails = !getFlag( nFlags, BIFF12_PTFITEM_HIDEDETAILS );
+ aModel.mbHidden = getFlag( nFlags, BIFF12_PTFITEM_HIDDEN );
maItems.push_back( aModel );
}
-void PivotTableField::importPTReference( RecordInputStream& rStrm )
+void PivotTableField::importPTReference( SequenceInputStream& rStrm )
{
rStrm >> maModel.mnSortRefField;
}
-void PivotTableField::importPTReferenceItem( RecordInputStream& rStrm )
+void PivotTableField::importPTReferenceItem( SequenceInputStream& rStrm )
{
rStrm >> maModel.mnSortRefItem;
}
@@ -450,7 +447,7 @@ void PivotTableField::importPTField( BiffInputStream& rStrm )
rStrm >> nAxis >> nSubtCount >> nSubtotals;
rStrm.skip( 2 ); // item count
- maModel.setBinAxis( extractValue< sal_uInt8 >( nAxis, 0, 3 ) );
+ maModel.setBiffAxis( extractValue< sal_uInt8 >( nAxis, 0, 3 ) );
maModel.mbDataField = getFlag( nAxis, BIFF_PTFIELD_DATAFIELD );
maModel.mbDefaultSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_DEFAULT );
@@ -509,7 +506,7 @@ void PivotTableField::importPTFItem( BiffInputStream& rStrm )
sal_Int16 nCacheItem;
rStrm >> nType >> nFlags >> nCacheItem;
- aModel.setBinType( nType );
+ aModel.setBiffType( nType );
aModel.mnCacheItem = nCacheItem;
aModel.mbShowDetails = !getFlag( nFlags, BIFF_PTFITEM_HIDEDETAILS );
aModel.mbHidden = getFlag( nFlags, BIFF_PTFITEM_HIDDEN );
@@ -627,7 +624,7 @@ void PivotTableField::convertPageField( const PTPageFieldModel& rPageField )
if( maModel.mbMultiPageItems )
{
// multiple items may be selected
- OSL_ENSURE( rPageField.mnItem == OOBIN_PTPAGEFIELD_MULTIITEMS, "PivotTableField::convertPageField - unexpected cache item index" );
+ OSL_ENSURE( rPageField.mnItem == BIFF12_PTPAGEFIELD_MULTIITEMS, "PivotTableField::convertPageField - unexpected cache item index" );
// try to find a single visible item
bool bHasMultiItems = false;
for( ItemModelVector::iterator aIt = maItems.begin(), aEnd = maItems.end(); (aIt != aEnd) && !bHasMultiItems; ++aIt )
@@ -799,7 +796,7 @@ Reference< XDataPilotField > PivotTableField::convertRowColPageField( sal_Int32
aPropSet.setProperty( PROP_LayoutInfo, aLayoutInfo );
aPropSet.setProperty( PROP_ShowEmpty, maModel.mbShowAll );
- // auto show (OOXML3/OOBIN3 only)
+ // auto show (OOXML/BIFF12 only)
if( maModel.mbAutoShow )
{
DataPilotFieldAutoShowInfo aAutoShowInfo;
@@ -909,20 +906,20 @@ void PivotTableFilter::importTop10( const AttributeList& rAttribs )
maModel.mbTopFilter = rAttribs.getBool( XML_top, true );
}
-void PivotTableFilter::importPTFilter( RecordInputStream& rStrm )
+void PivotTableFilter::importPTFilter( SequenceInputStream& rStrm )
{
sal_Int32 nType;
sal_uInt16 nFlags;
rStrm >> maModel.mnField >> maModel.mnMemPropField >> nType;
rStrm.skip( 4 ); // unused
rStrm >> maModel.mnId >> maModel.mnMeasureField >> maModel.mnMeasureHier >> nFlags;
- if( getFlag( nFlags, OOBIN_PTFILTER_HASNAME ) )
+ if( getFlag( nFlags, BIFF12_PTFILTER_HASNAME ) )
rStrm >> maModel.maName;
- if( getFlag( nFlags, OOBIN_PTFILTER_HASDESCRIPTION ) )
+ if( getFlag( nFlags, BIFF12_PTFILTER_HASDESCRIPTION ) )
rStrm >> maModel.maDescription;
- if( getFlag( nFlags, OOBIN_PTFILTER_HASSTRVALUE1 ) )
+ if( getFlag( nFlags, BIFF12_PTFILTER_HASSTRVALUE1 ) )
rStrm >> maModel.maStrValue1;
- if( getFlag( nFlags, OOBIN_PTFILTER_HASSTRVALUE2 ) )
+ if( getFlag( nFlags, BIFF12_PTFILTER_HASSTRVALUE2 ) )
rStrm >> maModel.maStrValue2;
static sal_Int32 spnTypes[] =
@@ -949,14 +946,14 @@ void PivotTableFilter::importPTFilter( RecordInputStream& rStrm )
maModel.mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
}
-void PivotTableFilter::importTop10Filter( RecordInputStream& rStrm )
+void PivotTableFilter::importTop10Filter( SequenceInputStream& rStrm )
{
sal_uInt8 nFlags;
rStrm >> nFlags >> maModel.mfValue;
- OSL_ENSURE( getFlag( nFlags, OOBIN_TOP10FILTER_PERCENT ) == (maModel.mnType == XML_percent),
+ OSL_ENSURE( getFlag( nFlags, BIFF12_TOP10FILTER_PERCENT ) == (maModel.mnType == XML_percent),
"PivotTableFilter::importTop10 - unexpected value of percent attribute" );
- maModel.mbTopFilter = getFlag( nFlags, OOBIN_TOP10FILTER_TOP );
+ maModel.mbTopFilter = getFlag( nFlags, BIFF12_TOP10FILTER_TOP );
}
void PivotTableFilter::finalizeImport()
@@ -1000,6 +997,7 @@ PTDefinitionModel::PTDefinitionModel() :
mbPrintDrill( false ),
mbEnableDrill( true ),
mbPreserveFormatting( true ),
+ mbUseAutoFormat( false ),
mbPageOverThenDown( false ),
mbSubtotalHiddenItems( false ),
mbRowGrandTotals( true ),
@@ -1053,6 +1051,7 @@ void PivotTable::importPivotTableDefinition( const AttributeList& rAttribs )
maDefModel.mnPageWrap = rAttribs.getInteger( XML_pageWrap, 0 );
maDefModel.mnIndent = rAttribs.getInteger( XML_indent, 1 );
maDefModel.mnChartFormat = rAttribs.getInteger( XML_chartFormat, 0 );
+ maDefModel.mnAutoFormatId = rAttribs.getInteger( XML_autoFormatId, 0 );
maDefModel.mbDataOnRows = rAttribs.getBool( XML_dataOnRows, false );
maDefModel.mbShowError = rAttribs.getBool( XML_showError, false );
maDefModel.mbShowMissing = rAttribs.getBool( XML_showMissing, true );
@@ -1064,6 +1063,7 @@ void PivotTable::importPivotTableDefinition( const AttributeList& rAttribs )
maDefModel.mbPrintDrill = rAttribs.getBool( XML_printDrill, false );
maDefModel.mbEnableDrill = rAttribs.getBool( XML_enableDrill, true );
maDefModel.mbPreserveFormatting = rAttribs.getBool( XML_preserveFormatting, true );
+ maDefModel.mbUseAutoFormat = rAttribs.getBool( XML_useAutoFormatting, false );
maDefModel.mbPageOverThenDown = rAttribs.getBool( XML_pageOverThenDown, false );
maDefModel.mbSubtotalHiddenItems = rAttribs.getBool( XML_subtotalHiddenItems, false );
maDefModel.mbRowGrandTotals = rAttribs.getBool( XML_rowGrandTotals, true );
@@ -1076,6 +1076,13 @@ void PivotTable::importPivotTableDefinition( const AttributeList& rAttribs )
maDefModel.mbShowHeaders = rAttribs.getBool( XML_showHeaders, true );
maDefModel.mbFieldListSortAsc = rAttribs.getBool( XML_fieldListSortAscending, false );
maDefModel.mbCustomListSort = rAttribs.getBool( XML_customListSort, true );
+ maDefModel.mbApplyNumFmt = rAttribs.getBool( XML_applyNumberFormats, false );
+ maDefModel.mbApplyFont = rAttribs.getBool( XML_applyFontFormats, false );
+ maDefModel.mbApplyAlignment = rAttribs.getBool( XML_applyAlignmentFormats, false );
+ maDefModel.mbApplyBorder = rAttribs.getBool( XML_applyBorderFormats, false );
+ maDefModel.mbApplyFill = rAttribs.getBool( XML_applyPatternFormats, false );
+ // OOXML and BIFF12 documentation differ: OOXML mentions width/height, BIFF12 mentions protection
+ maDefModel.mbApplyProtection = rAttribs.getBool( XML_applyWidthHeightFormats, false );
}
void PivotTable::importLocation( const AttributeList& rAttribs, sal_Int16 nSheet )
@@ -1104,7 +1111,7 @@ void PivotTable::importPageField( const AttributeList& rAttribs )
aModel.maName = rAttribs.getXString( XML_name, OUString() );
aModel.mnField = rAttribs.getInteger( XML_fld, -1 );
// specification is wrong, XML_item is not the cache item, but the field item
- aModel.mnItem = rAttribs.getInteger( XML_item, OOBIN_PTPAGEFIELD_MULTIITEMS );
+ aModel.mnItem = rAttribs.getInteger( XML_item, BIFF12_PTPAGEFIELD_MULTIITEMS );
maPageFields.push_back( aModel );
}
@@ -1121,7 +1128,7 @@ void PivotTable::importDataField( const AttributeList& rAttribs )
maDataFields.push_back( aModel );
}
-void PivotTable::importPTDefinition( RecordInputStream& rStrm )
+void PivotTable::importPTDefinition( SequenceInputStream& rStrm )
{
sal_uInt32 nFlags1, nFlags2, nFlags3;
sal_uInt8 nDataAxis;
@@ -1129,59 +1136,67 @@ void PivotTable::importPTDefinition( RecordInputStream& rStrm )
maDefModel.mnPageWrap = rStrm.readuInt8();
rStrm.skip( 2 ); // refresh versions
rStrm >> maDefModel.mnDataPosition;
- rStrm.skip( 4 ); // 2 bytes autoformat id, 2 bytes unused
+ maDefModel.mnAutoFormatId = rStrm.readuInt16();
+ rStrm.skip( 2 ); // unused
rStrm >> maDefModel.mnChartFormat >> maDefModel.mnCacheId >> maDefModel.maName;
- if( getFlag( nFlags2, OOBIN_PTDEF_HASDATACAPTION ) )
+ if( getFlag( nFlags2, BIFF12_PTDEF_HASDATACAPTION ) )
rStrm >> maDefModel.maDataCaption;
- if( getFlag( nFlags2, OOBIN_PTDEF_HASGRANDTOTALCAPTION ) )
+ if( getFlag( nFlags2, BIFF12_PTDEF_HASGRANDTOTALCAPTION ) )
rStrm >> maDefModel.maGrandTotalCaption;
- if( !getFlag( nFlags3, OOBIN_PTDEF_NOERRORCAPTION ) ) // missing flag indicates existing string
+ if( !getFlag( nFlags3, BIFF12_PTDEF_NOERRORCAPTION ) ) // missing flag indicates existing string
rStrm >> maDefModel.maErrorCaption;
- if( !getFlag( nFlags3, OOBIN_PTDEF_NOMISSINGCAPTION ) ) // missing flag indicates existing string
+ if( !getFlag( nFlags3, BIFF12_PTDEF_NOMISSINGCAPTION ) ) // missing flag indicates existing string
rStrm >> maDefModel.maMissingCaption;
- if( getFlag( nFlags2, OOBIN_PTDEF_HASPAGESTYLE ) )
+ if( getFlag( nFlags2, BIFF12_PTDEF_HASPAGESTYLE ) )
rStrm >> maDefModel.maPageStyle;
- if( getFlag( nFlags2, OOBIN_PTDEF_HASPIVOTTABLESTYLE ) )
+ if( getFlag( nFlags2, BIFF12_PTDEF_HASPIVOTTABLESTYLE ) )
rStrm >> maDefModel.maPivotTableStyle;
- if( getFlag( nFlags2, OOBIN_PTDEF_HASVACATEDSTYLE ) )
+ if( getFlag( nFlags2, BIFF12_PTDEF_HASVACATEDSTYLE ) )
rStrm >> maDefModel.maVacatedStyle;
- if( getFlag( nFlags2, OOBIN_PTDEF_HASTAG ) )
+ if( getFlag( nFlags2, BIFF12_PTDEF_HASTAG ) )
rStrm >> maDefModel.maTag;
- if( getFlag( nFlags3, OOBIN_PTDEF_HASCOLHEADERCAPTION ) ) // TODO: right order (col/row)? spec is unclear
+ if( getFlag( nFlags3, BIFF12_PTDEF_HASCOLHEADERCAPTION ) ) // TODO: right order (col/row)? spec is unclear
rStrm >> maDefModel.maColHeaderCaption;
- if( getFlag( nFlags3, OOBIN_PTDEF_HASROWHEADERCAPTION ) )
+ if( getFlag( nFlags3, BIFF12_PTDEF_HASROWHEADERCAPTION ) )
rStrm >> maDefModel.maRowHeaderCaption;
- OSL_ENSURE( (nDataAxis == OOBIN_PTDEF_ROWAXIS) || (nDataAxis == OOBIN_PTDEF_COLAXIS),
+ OSL_ENSURE( (nDataAxis == BIFF12_PTDEF_ROWAXIS) || (nDataAxis == BIFF12_PTDEF_COLAXIS),
"PivotTable::importPTDefinition - unexpected axis position for data field" );
maDefModel.mnIndent = extractValue< sal_uInt8 >( nFlags1, 24, 7 );
- maDefModel.mbDataOnRows = nDataAxis == OOBIN_PTDEF_ROWAXIS;
- maDefModel.mbShowError = getFlag( nFlags2, OOBIN_PTDEF_SHOWERROR );
- maDefModel.mbShowMissing = getFlag( nFlags2, OOBIN_PTDEF_SHOWMISSING );
- maDefModel.mbShowItems = getFlag( nFlags1, OOBIN_PTDEF_SHOWITEMS );
- maDefModel.mbDisableFieldList = getFlag( nFlags1, OOBIN_PTDEF_DISABLEFIELDLIST );
- maDefModel.mbShowCalcMembers = !getFlag( nFlags1, OOBIN_PTDEF_HIDECALCMEMBERS );
- maDefModel.mbVisualTotals = !getFlag( nFlags1, OOBIN_PTDEF_WITHHIDDENTOTALS );
- maDefModel.mbShowDrill = !getFlag( nFlags1, OOBIN_PTDEF_HIDEDRILL );
- maDefModel.mbPrintDrill = getFlag( nFlags1, OOBIN_PTDEF_PRINTDRILL );
- maDefModel.mbEnableDrill = getFlag( nFlags2, OOBIN_PTDEF_ENABLEDRILL );
- maDefModel.mbPreserveFormatting = getFlag( nFlags2, OOBIN_PTDEF_PRESERVEFORMATTING );
- maDefModel.mbPageOverThenDown = getFlag( nFlags2, OOBIN_PTDEF_PAGEOVERTHENDOWN );
- maDefModel.mbSubtotalHiddenItems = getFlag( nFlags2, OOBIN_PTDEF_SUBTOTALHIDDENITEMS );
- maDefModel.mbRowGrandTotals = getFlag( nFlags2, OOBIN_PTDEF_ROWGRANDTOTALS );
- maDefModel.mbColGrandTotals = getFlag( nFlags2, OOBIN_PTDEF_COLGRANDTOTALS );
- maDefModel.mbFieldPrintTitles = getFlag( nFlags2, OOBIN_PTDEF_FIELDPRINTTITLES );
- maDefModel.mbItemPrintTitles = getFlag( nFlags2, OOBIN_PTDEF_ITEMPRINTTITLES );
- maDefModel.mbMergeItem = getFlag( nFlags2, OOBIN_PTDEF_MERGEITEM );
- maDefModel.mbShowEmptyRow = getFlag( nFlags2, OOBIN_PTDEF_SHOWEMPTYROW );
- maDefModel.mbShowEmptyCol = getFlag( nFlags2, OOBIN_PTDEF_SHOWEMPTYCOL );
- maDefModel.mbShowHeaders = !getFlag( nFlags1, OOBIN_PTDEF_HIDEHEADERS );
- maDefModel.mbFieldListSortAsc = getFlag( nFlags3, OOBIN_PTDEF_FIELDLISTSORTASC );
- maDefModel.mbCustomListSort = !getFlag( nFlags3, OOBIN_PTDEF_NOCUSTOMLISTSORT );
-}
-
-void PivotTable::importPTLocation( RecordInputStream& rStrm, sal_Int16 nSheet )
+ maDefModel.mbDataOnRows = nDataAxis == BIFF12_PTDEF_ROWAXIS;
+ maDefModel.mbShowError = getFlag( nFlags2, BIFF12_PTDEF_SHOWERROR );
+ maDefModel.mbShowMissing = getFlag( nFlags2, BIFF12_PTDEF_SHOWMISSING );
+ maDefModel.mbShowItems = getFlag( nFlags1, BIFF12_PTDEF_SHOWITEMS );
+ maDefModel.mbDisableFieldList = getFlag( nFlags1, BIFF12_PTDEF_DISABLEFIELDLIST );
+ maDefModel.mbShowCalcMembers = !getFlag( nFlags1, BIFF12_PTDEF_HIDECALCMEMBERS );
+ maDefModel.mbVisualTotals = !getFlag( nFlags1, BIFF12_PTDEF_WITHHIDDENTOTALS );
+ maDefModel.mbShowDrill = !getFlag( nFlags1, BIFF12_PTDEF_HIDEDRILL );
+ maDefModel.mbPrintDrill = getFlag( nFlags1, BIFF12_PTDEF_PRINTDRILL );
+ maDefModel.mbEnableDrill = getFlag( nFlags2, BIFF12_PTDEF_ENABLEDRILL );
+ maDefModel.mbPreserveFormatting = getFlag( nFlags2, BIFF12_PTDEF_PRESERVEFORMATTING );
+ maDefModel.mbUseAutoFormat = getFlag( nFlags2, BIFF12_PTDEF_USEAUTOFORMAT );
+ maDefModel.mbPageOverThenDown = getFlag( nFlags2, BIFF12_PTDEF_PAGEOVERTHENDOWN );
+ maDefModel.mbSubtotalHiddenItems = getFlag( nFlags2, BIFF12_PTDEF_SUBTOTALHIDDENITEMS );
+ maDefModel.mbRowGrandTotals = getFlag( nFlags2, BIFF12_PTDEF_ROWGRANDTOTALS );
+ maDefModel.mbColGrandTotals = getFlag( nFlags2, BIFF12_PTDEF_COLGRANDTOTALS );
+ maDefModel.mbFieldPrintTitles = getFlag( nFlags2, BIFF12_PTDEF_FIELDPRINTTITLES );
+ maDefModel.mbItemPrintTitles = getFlag( nFlags2, BIFF12_PTDEF_ITEMPRINTTITLES );
+ maDefModel.mbMergeItem = getFlag( nFlags2, BIFF12_PTDEF_MERGEITEM );
+ maDefModel.mbApplyNumFmt = getFlag( nFlags2, BIFF12_PTDEF_APPLYNUMFMT );
+ maDefModel.mbApplyFont = getFlag( nFlags2, BIFF12_PTDEF_APPLYFONT );
+ maDefModel.mbApplyAlignment = getFlag( nFlags2, BIFF12_PTDEF_APPLYALIGNMENT );
+ maDefModel.mbApplyBorder = getFlag( nFlags2, BIFF12_PTDEF_APPLYBORDER );
+ maDefModel.mbApplyFill = getFlag( nFlags2, BIFF12_PTDEF_APPLYFILL );
+ maDefModel.mbApplyProtection = getFlag( nFlags2, BIFF12_PTDEF_APPLYPROTECTION );
+ maDefModel.mbShowEmptyRow = getFlag( nFlags2, BIFF12_PTDEF_SHOWEMPTYROW );
+ maDefModel.mbShowEmptyCol = getFlag( nFlags2, BIFF12_PTDEF_SHOWEMPTYCOL );
+ maDefModel.mbShowHeaders = !getFlag( nFlags1, BIFF12_PTDEF_HIDEHEADERS );
+ maDefModel.mbFieldListSortAsc = getFlag( nFlags3, BIFF12_PTDEF_FIELDLISTSORTASC );
+ maDefModel.mbCustomListSort = !getFlag( nFlags3, BIFF12_PTDEF_NOCUSTOMLISTSORT );
+}
+
+void PivotTable::importPTLocation( SequenceInputStream& rStrm, sal_Int16 nSheet )
{
BinRange aBinRange;
rStrm >> aBinRange >> maLocationModel.mnFirstHeaderRow
@@ -1190,29 +1205,29 @@ void PivotTable::importPTLocation( RecordInputStream& rStrm, sal_Int16 nSheet )
getAddressConverter().convertToCellRangeUnchecked( maLocationModel.maRange, aBinRange, nSheet );
}
-void PivotTable::importPTRowFields( RecordInputStream& rStrm )
+void PivotTable::importPTRowFields( SequenceInputStream& rStrm )
{
importFields( maRowFields, rStrm );
}
-void PivotTable::importPTColFields( RecordInputStream& rStrm )
+void PivotTable::importPTColFields( SequenceInputStream& rStrm )
{
importFields( maColFields, rStrm );
}
-void PivotTable::importPTPageField( RecordInputStream& rStrm )
+void PivotTable::importPTPageField( SequenceInputStream& rStrm )
{
PTPageFieldModel aModel;
sal_uInt8 nFlags;
rStrm >> aModel.mnField >> aModel.mnItem;
rStrm.skip( 4 ); // hierarchy
rStrm >> nFlags;
- if( getFlag( nFlags, OOBIN_PTPAGEFIELD_HASNAME ) )
+ if( getFlag( nFlags, BIFF12_PTPAGEFIELD_HASNAME ) )
rStrm >> aModel.maName;
maPageFields.push_back( aModel );
}
-void PivotTable::importPTDataField( RecordInputStream& rStrm )
+void PivotTable::importPTDataField( SequenceInputStream& rStrm )
{
PTDataFieldModel aModel;
sal_Int32 nSubtotal, nShowDataAs;
@@ -1220,8 +1235,8 @@ void PivotTable::importPTDataField( RecordInputStream& rStrm )
rStrm >> aModel.mnField >> nSubtotal >> nShowDataAs >> aModel.mnBaseField >> aModel.mnBaseItem >> aModel.mnNumFmtId >> nHasName;
if( nHasName == 1 )
rStrm >> aModel.maName;
- aModel.setBinSubtotal( nSubtotal );
- aModel.setBinShowDataAs( nShowDataAs );
+ aModel.setBiffSubtotal( nSubtotal );
+ aModel.setBiffShowDataAs( nShowDataAs );
maDataFields.push_back( aModel );
}
@@ -1297,7 +1312,7 @@ void PivotTable::importPTPageFields( BiffInputStream& rStrm )
rStrm >> nField >> nItem;
rStrm.skip( 2 ); // dropdown object ID
aModel.mnField = nField;
- aModel.mnItem = (nItem == BIFF_PTPAGEFIELDS_ALLITEMS) ? OOBIN_PTPAGEFIELD_MULTIITEMS : nItem;
+ aModel.mnItem = (nItem == BIFF_PTPAGEFIELDS_ALLITEMS) ? BIFF12_PTPAGEFIELD_MULTIITEMS : nItem;
maPageFields.push_back( aModel );
}
}
@@ -1311,8 +1326,8 @@ void PivotTable::importPTDataField( BiffInputStream& rStrm )
aModel.maName = lclReadPivotString( *this, rStrm, nNameLen );
aModel.mnField = nField;
- aModel.setBinSubtotal( nSubtotal );
- aModel.setBinShowDataAs( nShowDataAs );
+ aModel.setBiffSubtotal( nSubtotal );
+ aModel.setBiffShowDataAs( nShowDataAs );
aModel.mnBaseField = nBaseField;
switch( nBaseItem )
{
@@ -1506,7 +1521,7 @@ void PivotTable::importField( IndexVector& orFields, const AttributeList& rAttri
orFields.push_back( rAttribs.getInteger( XML_x, -1 ) );
}
-void PivotTable::importFields( IndexVector& orFields, RecordInputStream& rStrm )
+void PivotTable::importFields( IndexVector& orFields, SequenceInputStream& rStrm )
{
OSL_ENSURE( orFields.empty(), "PivotTable::importFields - multiple record instances" );
orFields.clear();
@@ -1550,4 +1565,3 @@ void PivotTableBuffer::finalizeImport()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/pivottablefragment.cxx b/oox/source/xls/pivottablefragment.cxx
index 9b34e1bda593..6e28118711c9 100644
--- a/oox/source/xls/pivottablefragment.cxx
+++ b/oox/source/xls/pivottablefragment.cxx
@@ -26,25 +26,28 @@
************************************************************************/
#include "oox/xls/pivottablefragment.hxx"
+
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/pivottablebuffer.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
-
namespace oox {
namespace xls {
// ============================================================================
-OoxPivotTableFieldContext::OoxPivotTableFieldContext( OoxWorksheetFragmentBase& rFragment, PivotTableField& rTableField ) :
- OoxWorksheetContextBase( rFragment ),
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+PivotTableFieldContext::PivotTableFieldContext( WorksheetFragmentBase& rFragment, PivotTableField& rTableField ) :
+ WorksheetContextBase( rFragment ),
mrTableField( rTableField )
{
}
-ContextHandlerRef OoxPivotTableFieldContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef PivotTableFieldContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -74,43 +77,43 @@ ContextHandlerRef OoxPivotTableFieldContext::onCreateContext( sal_Int32 nElement
return 0;
}
-void OoxPivotTableFieldContext::onStartElement( const AttributeList& rAttribs )
+void PivotTableFieldContext::onStartElement( const AttributeList& rAttribs )
{
if( isRootElement() )
mrTableField.importPivotField( rAttribs );
}
-ContextHandlerRef OoxPivotTableFieldContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef PivotTableFieldContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_PTFIELD:
+ case BIFF12_ID_PTFIELD:
switch( nRecId )
{
- case OOBIN_ID_PTFITEMS: return this;
- case OOBIN_ID_AUTOSORTSCOPE: return this;
+ case BIFF12_ID_PTFITEMS: return this;
+ case BIFF12_ID_AUTOSORTSCOPE: return this;
}
break;
- case OOBIN_ID_PTFITEMS:
- if( nRecId == OOBIN_ID_PTFITEM ) mrTableField.importPTFItem( rStrm );
+ case BIFF12_ID_PTFITEMS:
+ if( nRecId == BIFF12_ID_PTFITEM ) mrTableField.importPTFItem( rStrm );
break;
- case OOBIN_ID_AUTOSORTSCOPE:
- if( nRecId == OOBIN_ID_PIVOTAREA ) return this;
+ case BIFF12_ID_AUTOSORTSCOPE:
+ if( nRecId == BIFF12_ID_PIVOTAREA ) return this;
break;
- case OOBIN_ID_PIVOTAREA:
- if( nRecId == OOBIN_ID_PTREFERENCES ) return this;
+ case BIFF12_ID_PIVOTAREA:
+ if( nRecId == BIFF12_ID_PTREFERENCES ) return this;
break;
- case OOBIN_ID_PTREFERENCES:
- if( nRecId == OOBIN_ID_PTREFERENCE ) { mrTableField.importPTReference( rStrm ); return this; }
+ case BIFF12_ID_PTREFERENCES:
+ if( nRecId == BIFF12_ID_PTREFERENCE ) { mrTableField.importPTReference( rStrm ); return this; }
break;
- case OOBIN_ID_PTREFERENCE:
- if( nRecId == OOBIN_ID_PTREFERENCEITEM ) mrTableField.importPTReferenceItem( rStrm );
+ case BIFF12_ID_PTREFERENCE:
+ if( nRecId == BIFF12_ID_PTREFERENCEITEM ) mrTableField.importPTReferenceItem( rStrm );
break;
}
return 0;
}
-void OoxPivotTableFieldContext::onStartRecord( RecordInputStream& rStrm )
+void PivotTableFieldContext::onStartRecord( SequenceInputStream& rStrm )
{
if( isRootElement() )
mrTableField.importPTField( rStrm );
@@ -118,13 +121,13 @@ void OoxPivotTableFieldContext::onStartRecord( RecordInputStream& rStrm )
// ============================================================================
-OoxPivotTableFilterContext::OoxPivotTableFilterContext( OoxWorksheetFragmentBase& rFragment, PivotTableFilter& rTableFilter ) :
- OoxWorksheetContextBase( rFragment ),
+PivotTableFilterContext::PivotTableFilterContext( WorksheetFragmentBase& rFragment, PivotTableFilter& rTableFilter ) :
+ WorksheetContextBase( rFragment ),
mrTableFilter( rTableFilter )
{
}
-ContextHandlerRef OoxPivotTableFilterContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef PivotTableFilterContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -141,30 +144,30 @@ ContextHandlerRef OoxPivotTableFilterContext::onCreateContext( sal_Int32 nElemen
return 0;
}
-void OoxPivotTableFilterContext::onStartElement( const AttributeList& rAttribs )
+void PivotTableFilterContext::onStartElement( const AttributeList& rAttribs )
{
if( isRootElement() )
mrTableFilter.importFilter( rAttribs );
}
-ContextHandlerRef OoxPivotTableFilterContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef PivotTableFilterContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_PTFILTER:
- if( nRecId == OOBIN_ID_AUTOFILTER ) return this;
+ case BIFF12_ID_PTFILTER:
+ if( nRecId == BIFF12_ID_AUTOFILTER ) return this;
break;
- case OOBIN_ID_AUTOFILTER:
- if( nRecId == OOBIN_ID_FILTERCOLUMN ) return this;
+ case BIFF12_ID_AUTOFILTER:
+ if( nRecId == BIFF12_ID_FILTERCOLUMN ) return this;
break;
- case OOBIN_ID_FILTERCOLUMN:
- if( nRecId == OOBIN_ID_TOP10FILTER ) mrTableFilter.importTop10Filter( rStrm );
+ case BIFF12_ID_FILTERCOLUMN:
+ if( nRecId == BIFF12_ID_TOP10FILTER ) mrTableFilter.importTop10Filter( rStrm );
break;
}
return 0;
}
-void OoxPivotTableFilterContext::onStartRecord( RecordInputStream& rStrm )
+void PivotTableFilterContext::onStartRecord( SequenceInputStream& rStrm )
{
if( isRootElement() )
mrTableFilter.importPTFilter( rStrm );
@@ -172,13 +175,13 @@ void OoxPivotTableFilterContext::onStartRecord( RecordInputStream& rStrm )
// ============================================================================
-OoxPivotTableFragment::OoxPivotTableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorksheetFragmentBase( rHelper, rFragmentPath ),
- mrPivotTable( rHelper.getPivotTables().createPivotTable() )
+PivotTableFragment::PivotTableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
+ WorksheetFragmentBase( rHelper, rFragmentPath ),
+ mrPivotTable( getPivotTables().createPivotTable() )
{
}
-ContextHandlerRef OoxPivotTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef PivotTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -200,7 +203,7 @@ ContextHandlerRef OoxPivotTableFragment::onCreateContext( sal_Int32 nElement, co
break;
case XLS_TOKEN( pivotFields ):
- if( nElement == XLS_TOKEN( pivotField ) ) return new OoxPivotTableFieldContext( *this, mrPivotTable.createTableField() );
+ if( nElement == XLS_TOKEN( pivotField ) ) return new PivotTableFieldContext( *this, mrPivotTable.createTableField() );
break;
case XLS_TOKEN( rowFields ):
if( nElement == XLS_TOKEN( field ) ) mrPivotTable.importRowField( rAttribs );
@@ -215,75 +218,75 @@ ContextHandlerRef OoxPivotTableFragment::onCreateContext( sal_Int32 nElement, co
if( nElement == XLS_TOKEN( dataField ) ) mrPivotTable.importDataField( rAttribs );
break;
case XLS_TOKEN( filters ):
- if( nElement == XLS_TOKEN( filter ) ) return new OoxPivotTableFilterContext( *this, mrPivotTable.createTableFilter() );
+ if( nElement == XLS_TOKEN( filter ) ) return new PivotTableFilterContext( *this, mrPivotTable.createTableFilter() );
break;
}
return 0;
}
-ContextHandlerRef OoxPivotTableFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef PivotTableFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_PTDEFINITION ) { mrPivotTable.importPTDefinition( rStrm ); return this; }
+ if( nRecId == BIFF12_ID_PTDEFINITION ) { mrPivotTable.importPTDefinition( rStrm ); return this; }
break;
- case OOBIN_ID_PTDEFINITION:
+ case BIFF12_ID_PTDEFINITION:
switch( nRecId )
{
- case OOBIN_ID_PTLOCATION: mrPivotTable.importPTLocation( rStrm, getSheetIndex() ); break;
- case OOBIN_ID_PTFIELDS: return this;
- case OOBIN_ID_PTROWFIELDS: mrPivotTable.importPTRowFields( rStrm ); break;
- case OOBIN_ID_PTCOLFIELDS: mrPivotTable.importPTColFields( rStrm ); break;
- case OOBIN_ID_PTPAGEFIELDS: return this;
- case OOBIN_ID_PTDATAFIELDS: return this;
- case OOBIN_ID_PTFILTERS: return this;
+ case BIFF12_ID_PTLOCATION: mrPivotTable.importPTLocation( rStrm, getSheetIndex() ); break;
+ case BIFF12_ID_PTFIELDS: return this;
+ case BIFF12_ID_PTROWFIELDS: mrPivotTable.importPTRowFields( rStrm ); break;
+ case BIFF12_ID_PTCOLFIELDS: mrPivotTable.importPTColFields( rStrm ); break;
+ case BIFF12_ID_PTPAGEFIELDS: return this;
+ case BIFF12_ID_PTDATAFIELDS: return this;
+ case BIFF12_ID_PTFILTERS: return this;
}
break;
- case OOBIN_ID_PTFIELDS:
- if( nRecId == OOBIN_ID_PTFIELD ) return new OoxPivotTableFieldContext( *this, mrPivotTable.createTableField() );
+ case BIFF12_ID_PTFIELDS:
+ if( nRecId == BIFF12_ID_PTFIELD ) return new PivotTableFieldContext( *this, mrPivotTable.createTableField() );
break;
- case OOBIN_ID_PTPAGEFIELDS:
- if( nRecId == OOBIN_ID_PTPAGEFIELD ) mrPivotTable.importPTPageField( rStrm );
+ case BIFF12_ID_PTPAGEFIELDS:
+ if( nRecId == BIFF12_ID_PTPAGEFIELD ) mrPivotTable.importPTPageField( rStrm );
break;
- case OOBIN_ID_PTDATAFIELDS:
- if( nRecId == OOBIN_ID_PTDATAFIELD ) mrPivotTable.importPTDataField( rStrm );
+ case BIFF12_ID_PTDATAFIELDS:
+ if( nRecId == BIFF12_ID_PTDATAFIELD ) mrPivotTable.importPTDataField( rStrm );
break;
- case OOBIN_ID_PTFILTERS:
- if( nRecId == OOBIN_ID_PTFILTER ) return new OoxPivotTableFilterContext( *this, mrPivotTable.createTableFilter() );
+ case BIFF12_ID_PTFILTERS:
+ if( nRecId == BIFF12_ID_PTFILTER ) return new PivotTableFilterContext( *this, mrPivotTable.createTableFilter() );
break;
}
return 0;
}
-const RecordInfo* OoxPivotTableFragment::getRecordInfos() const
+const RecordInfo* PivotTableFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_AUTOFILTER, OOBIN_ID_AUTOFILTER + 1 },
- { OOBIN_ID_AUTOSORTSCOPE, OOBIN_ID_AUTOSORTSCOPE + 1 },
- { OOBIN_ID_FILTERCOLUMN, OOBIN_ID_FILTERCOLUMN + 1 },
- { OOBIN_ID_PIVOTAREA, OOBIN_ID_PIVOTAREA + 1 },
- { OOBIN_ID_PTCOLFIELDS, OOBIN_ID_PTCOLFIELDS + 1 },
- { OOBIN_ID_PTDATAFIELD, OOBIN_ID_PTDATAFIELD + 1 },
- { OOBIN_ID_PTDATAFIELDS, OOBIN_ID_PTDATAFIELDS + 1 },
- { OOBIN_ID_PTDEFINITION, OOBIN_ID_PTDEFINITION + 35 },
- { OOBIN_ID_PTFIELD, OOBIN_ID_PTFIELD + 1 },
- { OOBIN_ID_PTFIELDS, OOBIN_ID_PTFIELDS + 1 },
- { OOBIN_ID_PTFILTER, OOBIN_ID_PTFILTER + 1 },
- { OOBIN_ID_PTFILTERS, OOBIN_ID_PTFILTERS + 1 },
- { OOBIN_ID_PTFITEM, OOBIN_ID_PTFITEM - 1 },
- { OOBIN_ID_PTFITEMS, OOBIN_ID_PTFITEMS + 1 },
- { OOBIN_ID_PTLOCATION, OOBIN_ID_PTLOCATION - 1 },
- { OOBIN_ID_PTPAGEFIELD, OOBIN_ID_PTPAGEFIELD + 1 },
- { OOBIN_ID_PTPAGEFIELDS, OOBIN_ID_PTPAGEFIELDS + 1 },
- { OOBIN_ID_PTREFERENCE, OOBIN_ID_PTREFERENCE + 1 },
- { OOBIN_ID_PTREFERENCEITEM, OOBIN_ID_PTREFERENCEITEM + 1 },
- { OOBIN_ID_PTREFERENCES, OOBIN_ID_PTREFERENCES + 1 },
- { OOBIN_ID_PTROWFIELDS, OOBIN_ID_PTROWFIELDS + 1 },
- { -1, -1 }
+ { BIFF12_ID_AUTOFILTER, BIFF12_ID_AUTOFILTER + 1 },
+ { BIFF12_ID_AUTOSORTSCOPE, BIFF12_ID_AUTOSORTSCOPE + 1 },
+ { BIFF12_ID_FILTERCOLUMN, BIFF12_ID_FILTERCOLUMN + 1 },
+ { BIFF12_ID_PIVOTAREA, BIFF12_ID_PIVOTAREA + 1 },
+ { BIFF12_ID_PTCOLFIELDS, BIFF12_ID_PTCOLFIELDS + 1 },
+ { BIFF12_ID_PTDATAFIELD, BIFF12_ID_PTDATAFIELD + 1 },
+ { BIFF12_ID_PTDATAFIELDS, BIFF12_ID_PTDATAFIELDS + 1 },
+ { BIFF12_ID_PTDEFINITION, BIFF12_ID_PTDEFINITION + 35 },
+ { BIFF12_ID_PTFIELD, BIFF12_ID_PTFIELD + 1 },
+ { BIFF12_ID_PTFIELDS, BIFF12_ID_PTFIELDS + 1 },
+ { BIFF12_ID_PTFILTER, BIFF12_ID_PTFILTER + 1 },
+ { BIFF12_ID_PTFILTERS, BIFF12_ID_PTFILTERS + 1 },
+ { BIFF12_ID_PTFITEM, BIFF12_ID_PTFITEM - 1 },
+ { BIFF12_ID_PTFITEMS, BIFF12_ID_PTFITEMS + 1 },
+ { BIFF12_ID_PTLOCATION, BIFF12_ID_PTLOCATION - 1 },
+ { BIFF12_ID_PTPAGEFIELD, BIFF12_ID_PTPAGEFIELD + 1 },
+ { BIFF12_ID_PTPAGEFIELDS, BIFF12_ID_PTPAGEFIELDS + 1 },
+ { BIFF12_ID_PTREFERENCE, BIFF12_ID_PTREFERENCE + 1 },
+ { BIFF12_ID_PTREFERENCEITEM, BIFF12_ID_PTREFERENCEITEM + 1 },
+ { BIFF12_ID_PTREFERENCES, BIFF12_ID_PTREFERENCES + 1 },
+ { BIFF12_ID_PTROWFIELDS, BIFF12_ID_PTROWFIELDS + 1 },
+ { -1, -1 }
};
return spRecInfos;
}
@@ -291,22 +294,22 @@ const RecordInfo* OoxPivotTableFragment::getRecordInfos() const
// ============================================================================
// ============================================================================
-BiffPivotTableContext::BiffPivotTableContext( const BiffWorksheetFragmentBase& rFragment, PivotTable& rPivotTable ) :
- BiffWorksheetContextBase( rFragment ),
- mrPivotTable( rPivotTable )
+BiffPivotTableContext::BiffPivotTableContext( const WorksheetHelper& rHelper ) :
+ BiffWorksheetContextBase( rHelper ),
+ mrPivotTable( getPivotTables().createPivotTable() )
{
}
-void BiffPivotTableContext::importRecord()
+void BiffPivotTableContext::importRecord( BiffInputStream& rStrm )
{
- switch( mrStrm.getRecId() )
+ switch( rStrm.getRecId() )
{
- case BIFF_ID_PTDEFINITION: mrPivotTable.importPTDefinition( mrStrm, getSheetIndex() ); break;
- case BIFF_ID_PTDEFINITION2: mrPivotTable.importPTDefinition2( mrStrm ); break;
- case BIFF_ID_PTFIELD: mrPivotTable.createTableField().importPTField( mrStrm ); break;
- case BIFF_ID_PTROWCOLFIELDS: mrPivotTable.importPTRowColFields( mrStrm ); break;
- case BIFF_ID_PTPAGEFIELDS: mrPivotTable.importPTPageFields( mrStrm ); break;
- case BIFF_ID_PTDATAFIELD: mrPivotTable.importPTDataField( mrStrm ); break;
+ case BIFF_ID_PTDEFINITION: mrPivotTable.importPTDefinition( rStrm, getSheetIndex() ); break;
+ case BIFF_ID_PTDEFINITION2: mrPivotTable.importPTDefinition2( rStrm ); break;
+ case BIFF_ID_PTFIELD: mrPivotTable.createTableField().importPTField( rStrm ); break;
+ case BIFF_ID_PTROWCOLFIELDS: mrPivotTable.importPTRowColFields( rStrm ); break;
+ case BIFF_ID_PTPAGEFIELDS: mrPivotTable.importPTPageFields( rStrm ); break;
+ case BIFF_ID_PTDATAFIELD: mrPivotTable.importPTDataField( rStrm ); break;
}
}
@@ -314,4 +317,3 @@ void BiffPivotTableContext::importRecord()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/querytablebuffer.cxx b/oox/source/xls/querytablebuffer.cxx
new file mode 100644
index 000000000000..28ace4de52d8
--- /dev/null
+++ b/oox/source/xls/querytablebuffer.cxx
@@ -0,0 +1,390 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "oox/xls/querytablebuffer.hxx"
+
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/sheet/XAreaLink.hpp>
+#include <com/sun/star/sheet/XAreaLinks.hpp>
+#include "oox/core/filterbase.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "oox/xls/addressconverter.hxx"
+#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/connectionsbuffer.hxx"
+#include "oox/xls/defnamesbuffer.hxx"
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt32 BIFF12_QUERYTABLE_HEADERS = 0x00000001;
+const sal_uInt32 BIFF12_QUERYTABLE_ROWNUMBERS = 0x00000002;
+const sal_uInt32 BIFF12_QUERYTABLE_DISABLEREFRESH = 0x00000004;
+const sal_uInt32 BIFF12_QUERYTABLE_BACKGROUND = 0x00000008;
+const sal_uInt32 BIFF12_QUERYTABLE_FIRSTBACKGROUND = 0x00000010;
+const sal_uInt32 BIFF12_QUERYTABLE_REFRESHONLOAD = 0x00000020;
+const sal_uInt32 BIFF12_QUERYTABLE_FILLFORMULAS = 0x00000100;
+const sal_uInt32 BIFF12_QUERYTABLE_SAVEDATA = 0x00000200;
+const sal_uInt32 BIFF12_QUERYTABLE_DISABLEEDIT = 0x00000400;
+const sal_uInt32 BIFF12_QUERYTABLE_PRESERVEFORMAT = 0x00000800;
+const sal_uInt32 BIFF12_QUERYTABLE_ADJUSTCOLWIDTH = 0x00001000;
+const sal_uInt32 BIFF12_QUERYTABLE_INTERMEDIATE = 0x00002000;
+const sal_uInt32 BIFF12_QUERYTABLE_APPLYNUMFMT = 0x00004000;
+const sal_uInt32 BIFF12_QUERYTABLE_APPLYFONT = 0x00008000;
+const sal_uInt32 BIFF12_QUERYTABLE_APPLYALIGNMENT = 0x00010000;
+const sal_uInt32 BIFF12_QUERYTABLE_APPLYBORDER = 0x00020000;
+const sal_uInt32 BIFF12_QUERYTABLE_APPLYFILL = 0x00040000;
+const sal_uInt32 BIFF12_QUERYTABLE_APPLYPROTECTION = 0x00080000;
+
+const sal_uInt16 BIFF_QUERYTABLE_HEADERS = 0x0001;
+const sal_uInt16 BIFF_QUERYTABLE_ROWNUMBERS = 0x0002;
+const sal_uInt16 BIFF_QUERYTABLE_DISABLEREFRESH = 0x0004;
+const sal_uInt16 BIFF_QUERYTABLE_BACKGROUND = 0x0008;
+const sal_uInt16 BIFF_QUERYTABLE_FIRSTBACKGROUND = 0x0010;
+const sal_uInt16 BIFF_QUERYTABLE_REFRESHONLOAD = 0x0020;
+const sal_uInt16 BIFF_QUERYTABLE_DELETEUNUSED = 0x0040;
+const sal_uInt16 BIFF_QUERYTABLE_FILLFORMULAS = 0x0080;
+const sal_uInt16 BIFF_QUERYTABLE_ADJUSTCOLWIDTH = 0x0100;
+const sal_uInt16 BIFF_QUERYTABLE_SAVEDATA = 0x0200;
+const sal_uInt16 BIFF_QUERYTABLE_DISABLEEDIT = 0x0400;
+const sal_uInt16 BIFF_QUERYTABLE_OVERWRITEEXISTING = 0x2000;
+
+const sal_uInt16 BIFF_QUERYTABLE_APPLYNUMFMT = 0x0001;
+const sal_uInt16 BIFF_QUERYTABLE_APPLYFONT = 0x0002;
+const sal_uInt16 BIFF_QUERYTABLE_APPLYALIGNMENT = 0x0004;
+const sal_uInt16 BIFF_QUERYTABLE_APPLYBORDER = 0x0008;
+const sal_uInt16 BIFF_QUERYTABLE_APPLYFILL = 0x0010;
+const sal_uInt16 BIFF_QUERYTABLE_APPLYPROTECTION = 0x0020;
+
+const sal_uInt32 BIFF_QTREFRESH_PRESERVEFORMAT = 0x00000001;
+const sal_uInt32 BIFF_QTREFRESH_ADJUSTCOLWIDTH = 0x00000002;
+
+// ----------------------------------------------------------------------------
+
+void lclAppendWebQueryTableName( OUStringBuffer& rTables, const OUString& rTableName )
+{
+ if( rTableName.getLength() > 0 )
+ {
+ if( rTables.getLength() > 0 )
+ rTables.append( sal_Unicode( ';' ) );
+ rTables.appendAscii( RTL_CONSTASCII_STRINGPARAM( "HTML__" ) ).append( rTableName );
+ }
+}
+
+void lclAppendWebQueryTableIndex( OUStringBuffer& rTables, sal_Int32 nTableIndex )
+{
+ if( nTableIndex > 0 )
+ {
+ if( rTables.getLength() > 0 )
+ rTables.append( sal_Unicode( ';' ) );
+ rTables.appendAscii( RTL_CONSTASCII_STRINGPARAM( "HTML_" ) ).append( nTableIndex );
+ }
+}
+
+OUString lclBuildWebQueryTables( const WebPrModel::TablesVector& rTables )
+{
+ if( rTables.empty() )
+ return CREATE_OUSTRING( "HTML_tables" );
+
+ OUStringBuffer aTables;
+ for( WebPrModel::TablesVector::const_iterator aIt = rTables.begin(), aEnd = rTables.end(); aIt != aEnd; ++aIt )
+ {
+ if( aIt->has< OUString >() )
+ lclAppendWebQueryTableName( aTables, aIt->get< OUString >() );
+ else if( aIt->has< sal_Int32 >() )
+ lclAppendWebQueryTableIndex( aTables, aIt->get< sal_Int32 >() );
+ }
+ return aTables.makeStringAndClear();
+}
+
+Reference< XAreaLink > lclFindAreaLink(
+ const Reference< XAreaLinks >& rxAreaLinks, const CellAddress& rDestPos,
+ const OUString& rFileUrl, const OUString& rTables, const OUString& rFilterName, const OUString& rFilterOptions )
+{
+ try
+ {
+ Reference< XEnumerationAccess > xAreaLinksEA( rxAreaLinks, UNO_QUERY_THROW );
+ Reference< XEnumeration > xAreaLinksEnum( xAreaLinksEA->createEnumeration(), UNO_SET_THROW );
+ while( xAreaLinksEnum->hasMoreElements() )
+ {
+ Reference< XAreaLink > xAreaLink( xAreaLinksEnum->nextElement(), UNO_QUERY_THROW );
+ PropertySet aPropSet( xAreaLink );
+ CellRangeAddress aDestArea = xAreaLink->getDestArea();
+ OUString aString;
+ if( (rDestPos.Sheet == aDestArea.Sheet) && (rDestPos.Column == aDestArea.StartColumn) && (rDestPos.Row == aDestArea.StartRow) &&
+ (rTables == xAreaLink->getSourceArea()) &&
+ aPropSet.getProperty( aString, PROP_Url ) && (rFileUrl == aString) &&
+ aPropSet.getProperty( aString, PROP_Filter ) && (rFilterName == aString) &&
+ aPropSet.getProperty( aString, PROP_FilterOptions ) && (rFilterOptions == aString) )
+ return xAreaLink;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ return Reference< XAreaLink >();
+}
+
+} // namespace
+
+// ============================================================================
+
+QueryTableModel::QueryTableModel() :
+ mnConnId( -1 ),
+ mnGrowShrinkType( XML_insertDelete ),
+ mbHeaders( true ),
+ mbRowNumbers( false ),
+ mbDisableRefresh( false ),
+ mbBackground( true ),
+ mbFirstBackground( false ),
+ mbRefreshOnLoad( false ),
+ mbFillFormulas( false ),
+ mbRemoveDataOnSave( false ),
+ mbDisableEdit( false ),
+ mbPreserveFormat( true ),
+ mbAdjustColWidth( true ),
+ mbIntermediate( false )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+QueryTable::QueryTable( const WorksheetHelper& rHelper ) :
+ WorksheetHelper( rHelper )
+{
+}
+
+void QueryTable::importQueryTable( const AttributeList& rAttribs )
+{
+ maModel.maDefName = rAttribs.getXString( XML_name, OUString() );
+ maModel.mnConnId = rAttribs.getInteger( XML_connectionId, -1 );
+ maModel.mnGrowShrinkType = rAttribs.getToken( XML_growShrinkType, XML_insertDelete );
+ maModel.mnAutoFormatId = rAttribs.getInteger( XML_autoFormatId, 0 );
+ maModel.mbHeaders = rAttribs.getBool( XML_headers, true );
+ maModel.mbRowNumbers = rAttribs.getBool( XML_rowNumbers, false );
+ maModel.mbDisableRefresh = rAttribs.getBool( XML_disableRefresh, false );
+ maModel.mbBackground = rAttribs.getBool( XML_backgroundRefresh, true );
+ maModel.mbFirstBackground = rAttribs.getBool( XML_firstBackgroundRefresh, false );
+ maModel.mbRefreshOnLoad = rAttribs.getBool( XML_refreshOnLoad, false );
+ maModel.mbFillFormulas = rAttribs.getBool( XML_fillFormulas, false );
+ maModel.mbRemoveDataOnSave = rAttribs.getBool( XML_removeDataOnSave, false );
+ maModel.mbDisableEdit = rAttribs.getBool( XML_disableEdit, false );
+ maModel.mbPreserveFormat = rAttribs.getBool( XML_preserveFormatting, true );
+ maModel.mbAdjustColWidth = rAttribs.getBool( XML_adjustColumnWidth, true );
+ maModel.mbIntermediate = rAttribs.getBool( XML_intermediate, false );
+ maModel.mbApplyNumFmt = rAttribs.getBool( XML_applyNumberFormats, false );
+ maModel.mbApplyFont = rAttribs.getBool( XML_applyFontFormats, false );
+ maModel.mbApplyAlignment = rAttribs.getBool( XML_applyAlignmentFormats, false );
+ maModel.mbApplyBorder = rAttribs.getBool( XML_applyBorderFormats, false );
+ maModel.mbApplyFill = rAttribs.getBool( XML_applyPatternFormats, false );
+ // OOXML and BIFF12 documentation differ: OOXML mentions width/height, BIFF12 mentions protection
+ maModel.mbApplyProtection = rAttribs.getBool( XML_applyWidthHeightFormats, false );
+}
+
+void QueryTable::importQueryTable( SequenceInputStream& rStrm )
+{
+ sal_uInt32 nFlags;
+ rStrm >> nFlags;
+ maModel.mnAutoFormatId = rStrm.readuInt16();
+ rStrm >> maModel.mnConnId >> maModel.maDefName;
+
+ static const sal_Int32 spnGrowShrinkTypes[] = { XML_insertClear, XML_insertDelete, XML_overwriteClear };
+ maModel.mnGrowShrinkType = STATIC_ARRAY_SELECT( spnGrowShrinkTypes, extractValue< sal_uInt8 >( nFlags, 6, 2 ), XML_insertDelete );
+
+ maModel.mbHeaders = getFlag( nFlags, BIFF12_QUERYTABLE_HEADERS );
+ maModel.mbRowNumbers = getFlag( nFlags, BIFF12_QUERYTABLE_ROWNUMBERS );
+ maModel.mbDisableRefresh = getFlag( nFlags, BIFF12_QUERYTABLE_DISABLEREFRESH );
+ maModel.mbBackground = getFlag( nFlags, BIFF12_QUERYTABLE_BACKGROUND );
+ maModel.mbFirstBackground = getFlag( nFlags, BIFF12_QUERYTABLE_FIRSTBACKGROUND );
+ maModel.mbRefreshOnLoad = getFlag( nFlags, BIFF12_QUERYTABLE_REFRESHONLOAD );
+ maModel.mbFillFormulas = getFlag( nFlags, BIFF12_QUERYTABLE_FILLFORMULAS );
+ maModel.mbRemoveDataOnSave = !getFlag( nFlags, BIFF12_QUERYTABLE_SAVEDATA ); // flag negated in BIFF12
+ maModel.mbDisableEdit = getFlag( nFlags, BIFF12_QUERYTABLE_DISABLEEDIT );
+ maModel.mbPreserveFormat = getFlag( nFlags, BIFF12_QUERYTABLE_PRESERVEFORMAT );
+ maModel.mbAdjustColWidth = getFlag( nFlags, BIFF12_QUERYTABLE_ADJUSTCOLWIDTH );
+ maModel.mbIntermediate = getFlag( nFlags, BIFF12_QUERYTABLE_INTERMEDIATE );
+ maModel.mbApplyNumFmt = getFlag( nFlags, BIFF12_QUERYTABLE_APPLYNUMFMT );
+ maModel.mbApplyFont = getFlag( nFlags, BIFF12_QUERYTABLE_APPLYFONT );
+ maModel.mbApplyAlignment = getFlag( nFlags, BIFF12_QUERYTABLE_APPLYALIGNMENT );
+ maModel.mbApplyBorder = getFlag( nFlags, BIFF12_QUERYTABLE_APPLYBORDER );
+ maModel.mbApplyFill = getFlag( nFlags, BIFF12_QUERYTABLE_APPLYFILL );
+ maModel.mbApplyProtection = getFlag( nFlags, BIFF12_QUERYTABLE_APPLYPROTECTION );
+}
+
+void QueryTable::importQueryTable( BiffInputStream& rStrm )
+{
+ sal_uInt16 nFlags, nAutoFormatFlags;
+ rStrm >> nFlags;
+ maModel.mnAutoFormatId = rStrm.readuInt16();
+ rStrm >> nAutoFormatFlags;
+ rStrm.skip( 4 );
+ maModel.maDefName = rStrm.readUniString();
+
+ bool bDeleteUnused = getFlag( nFlags, BIFF_QUERYTABLE_DELETEUNUSED );
+ bool bOverwriteExisting = getFlag( nFlags, BIFF_QUERYTABLE_OVERWRITEEXISTING );
+ OSL_ENSURE( !bDeleteUnused || !bOverwriteExisting, "QueryTable::importQueryTable - invalid flags" );
+ maModel.mnGrowShrinkType = bDeleteUnused ? XML_insertDelete : (bOverwriteExisting ? XML_overwriteClear : XML_insertClear);
+
+ maModel.mbHeaders = getFlag( nFlags, BIFF_QUERYTABLE_HEADERS );
+ maModel.mbRowNumbers = getFlag( nFlags, BIFF_QUERYTABLE_ROWNUMBERS );
+ maModel.mbDisableRefresh = getFlag( nFlags, BIFF_QUERYTABLE_DISABLEREFRESH );
+ maModel.mbBackground = getFlag( nFlags, BIFF_QUERYTABLE_BACKGROUND );
+ maModel.mbFirstBackground = getFlag( nFlags, BIFF_QUERYTABLE_FIRSTBACKGROUND );
+ maModel.mbRefreshOnLoad = getFlag( nFlags, BIFF_QUERYTABLE_REFRESHONLOAD );
+ maModel.mbFillFormulas = getFlag( nFlags, BIFF_QUERYTABLE_FILLFORMULAS );
+ maModel.mbRemoveDataOnSave = !getFlag( nFlags, BIFF_QUERYTABLE_SAVEDATA ); // flag negated in BIFF
+ maModel.mbDisableEdit = getFlag( nFlags, BIFF_QUERYTABLE_DISABLEEDIT );
+ maModel.mbAdjustColWidth = getFlag( nFlags, BIFF_QUERYTABLE_ADJUSTCOLWIDTH );
+ maModel.mbApplyNumFmt = getFlag( nAutoFormatFlags, BIFF_QUERYTABLE_APPLYNUMFMT );
+ maModel.mbApplyFont = getFlag( nAutoFormatFlags, BIFF_QUERYTABLE_APPLYFONT );
+ maModel.mbApplyAlignment = getFlag( nAutoFormatFlags, BIFF_QUERYTABLE_APPLYALIGNMENT );
+ maModel.mbApplyBorder = getFlag( nAutoFormatFlags, BIFF_QUERYTABLE_APPLYBORDER );
+ maModel.mbApplyFill = getFlag( nAutoFormatFlags, BIFF_QUERYTABLE_APPLYFILL );
+ maModel.mbApplyProtection = getFlag( nAutoFormatFlags, BIFF_QUERYTABLE_APPLYPROTECTION );
+
+ // create a new connection object that will store settings from following records
+ OSL_ENSURE( maModel.mnConnId == -1, "QueryTable::importQueryTable - multiple call" );
+ Connection& rConnection = getConnections().createConnectionWithId();
+ maModel.mnConnId = rConnection.getConnectionId();
+
+ // a DBQUERY record with some PCITEM_STRING records must follow
+ bool bHasDbQuery = (rStrm.getNextRecId() == BIFF_ID_DBQUERY) && rStrm.startNextRecord();
+ OSL_ENSURE( bHasDbQuery, "QueryTable::importQueryTable - missing DBQUERY record" );
+ if( bHasDbQuery )
+ rConnection.importDbQuery( rStrm );
+}
+
+void QueryTable::importQueryTableRefresh( BiffInputStream& rStrm )
+{
+ rStrm.skip( 4 );
+ bool bPivot = rStrm.readuInt16() != 0;
+ OSL_ENSURE( !bPivot, "QueryTable::importQueryTableRefresh - unexpected pivot flag" );
+ if( !bPivot )
+ {
+ rStrm.skip( 2 );
+ sal_uInt32 nFlags = rStrm.readuInt32();
+ maModel.mbPreserveFormat = getFlag( nFlags, BIFF_QTREFRESH_PRESERVEFORMAT );
+ maModel.mbAdjustColWidth = getFlag( nFlags, BIFF_QTREFRESH_ADJUSTCOLWIDTH );
+ }
+}
+
+void QueryTable::importQueryTableSettings( BiffInputStream& rStrm )
+{
+ ConnectionRef xConnection = getConnections().getConnection( maModel.mnConnId );
+ OSL_ENSURE( xConnection.get(), "QueryTable::importQueryTableSettings - missing connection object" );
+ if( xConnection.get() )
+ xConnection->importQueryTableSettings( rStrm );
+}
+
+void QueryTable::finalizeImport()
+{
+ ConnectionRef xConnection = getConnections().getConnection( maModel.mnConnId );
+ OSL_ENSURE( xConnection.get(), "QueryTable::finalizeImport - missing connection object" );
+ if( xConnection.get() && (xConnection->getConnectionType() == BIFF12_CONNECTION_HTML) )
+ {
+ // check that valid web query properties exist
+ const WebPrModel* pWebPr = xConnection->getModel().mxWebPr.get();
+ if( pWebPr && !pWebPr->mbXml )
+ {
+ OUString aFileUrl = getBaseFilter().getAbsoluteUrl( pWebPr->maUrl );
+ if( aFileUrl.getLength() > 0 )
+ {
+ // resolve destination cell range (stored as defined name containing the range)
+ OUString aDefName = maModel.maDefName.replace( ' ', '_' ).replace( '-', '_' );
+ DefinedNameRef xDefName = getDefinedNames().getByModelName( aDefName, getSheetIndex() );
+ OSL_ENSURE( xDefName.get(), "QueryTable::finalizeImport - missing defined name" );
+ if( xDefName.get() )
+ {
+ CellRangeAddress aDestRange;
+ bool bIsRange = xDefName->getAbsoluteRange( aDestRange ) && (aDestRange.Sheet == getSheetIndex());
+ OSL_ENSURE( bIsRange, "QueryTable::finalizeImport - defined name does not contain valid cell range" );
+ if( bIsRange && getAddressConverter().checkCellRange( aDestRange, false, true ) )
+ {
+ CellAddress aDestPos( aDestRange.Sheet, aDestRange.StartColumn, aDestRange.StartRow );
+ // find tables mode: entire document, all tables, or specific tables
+ OUString aTables = pWebPr->mbHtmlTables ? lclBuildWebQueryTables( pWebPr->maTables ) : CREATE_OUSTRING( "HTML_all" );
+ if( aTables.getLength() > 0 ) try
+ {
+ PropertySet aDocProps( getDocument() );
+ Reference< XAreaLinks > xAreaLinks( aDocProps.getAnyProperty( PROP_AreaLinks ), UNO_QUERY_THROW );
+ OUString aFilterName = CREATE_OUSTRING( "calc_HTML_WebQuery" );
+ OUString aFilterOptions;
+ xAreaLinks->insertAtPosition( aDestPos, aFileUrl, aTables, aFilterName, aFilterOptions );
+ // set refresh interval (convert minutes to seconds)
+ sal_Int32 nRefreshPeriod = xConnection->getModel().mnInterval * 60;
+ if( nRefreshPeriod > 0 )
+ {
+ PropertySet aPropSet( lclFindAreaLink( xAreaLinks, aDestPos, aFileUrl, aTables, aFilterName, aFilterOptions ) );
+ aPropSet.setProperty( PROP_RefreshPeriod, nRefreshPeriod );
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+// ============================================================================
+
+QueryTableBuffer::QueryTableBuffer( const WorksheetHelper& rHelper ) :
+ WorksheetHelper( rHelper )
+{
+}
+
+QueryTable& QueryTableBuffer::createQueryTable()
+{
+ QueryTableVector::value_type xQueryTable( new QueryTable( *this ) );
+ maQueryTables.push_back( xQueryTable );
+ return *xQueryTable;
+}
+
+void QueryTableBuffer::finalizeImport()
+{
+ maQueryTables.forEachMem( &QueryTable::finalizeImport );
+}
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
diff --git a/oox/source/xls/querytablefragment.cxx b/oox/source/xls/querytablefragment.cxx
index 303852b8492b..c74aa53a581e 100644
--- a/oox/source/xls/querytablefragment.cxx
+++ b/oox/source/xls/querytablefragment.cxx
@@ -26,31 +26,81 @@
************************************************************************/
#include "oox/xls/querytablefragment.hxx"
-#include "oox/xls/webquerybuffer.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
+#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/querytablebuffer.hxx"
namespace oox {
namespace xls {
-OoxQueryTableFragment::OoxQueryTableFragment(
- const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath )
+// ============================================================================
+
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+QueryTableFragment::QueryTableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
+ WorksheetFragmentBase( rHelper, rFragmentPath ),
+ mrQueryTable( getQueryTables().createQueryTable() )
{
}
-ContextHandlerRef OoxQueryTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef QueryTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nElement == XLS_TOKEN( queryTable ) )
+ mrQueryTable.importQueryTable( rAttribs );
+ break;
+ }
+ return 0;
+}
+
+ContextHandlerRef QueryTableFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nElement == XLS_TOKEN( queryTable ) ) getWebQueries().importQueryTable( rAttribs );
+ if( nRecId == BIFF12_ID_QUERYTABLE )
+ mrQueryTable.importQueryTable( rStrm );
break;
}
return 0;
}
+const RecordInfo* QueryTableFragment::getRecordInfos() const
+{
+ static const RecordInfo spRecInfos[] =
+ {
+ { BIFF12_ID_QUERYTABLE, BIFF12_ID_QUERYTABLE + 1 },
+ { BIFF12_ID_QUERYTABLEREFRESH, BIFF12_ID_QUERYTABLEREFRESH + 1 },
+ { -1, -1 }
+ };
+ return spRecInfos;
+}
+
+// ============================================================================
+
+BiffQueryTableContext::BiffQueryTableContext( const WorksheetHelper& rHelper ) :
+ BiffWorksheetContextBase( rHelper ),
+ mrQueryTable( getQueryTables().createQueryTable() )
+{
+}
+
+void BiffQueryTableContext::importRecord( BiffInputStream& rStrm )
+{
+ switch( rStrm.getRecId() )
+ {
+ case BIFF_ID_QUERYTABLE: mrQueryTable.importQueryTable( rStrm ); break;
+ case BIFF_ID_QUERYTABLEREFRESH: mrQueryTable.importQueryTableRefresh( rStrm ); break;
+ case BIFF_ID_QUERYTABLESETTINGS: mrQueryTable.importQueryTableSettings( rStrm ); break;
+ }
+}
+
+// ============================================================================
+
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx
index 4e82b1e696f0..5c79373b09b2 100644
--- a/oox/source/xls/richstring.cxx
+++ b/oox/source/xls/richstring.cxx
@@ -26,29 +26,31 @@
************************************************************************/
#include "oox/xls/richstring.hxx"
-#include <rtl/ustrbuf.hxx>
+
#include <com/sun/star/text/XText.hpp>
+#include <rtl/ustrbuf.hxx>
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/biffinputstream.hxx"
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+
using ::rtl::OString;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::text::XText;
-using ::com::sun::star::text::XTextRange;
-
-namespace oox {
-namespace xls {
// ============================================================================
namespace {
-const sal_uInt8 OOBIN_STRINGFLAG_FONTS = 0x01;
-const sal_uInt8 OOBIN_STRINGFLAG_PHONETICS = 0x02;
+const sal_uInt8 BIFF12_STRINGFLAG_FONTS = 0x01;
+const sal_uInt8 BIFF12_STRINGFLAG_PHONETICS = 0x02;
} // namespace
@@ -105,7 +107,7 @@ void RichStringPortion::convert( const Reference< XText >& rxText, sal_Int32 nXf
// ----------------------------------------------------------------------------
-void FontPortionModel::read( RecordInputStream& rStrm )
+void FontPortionModel::read( SequenceInputStream& rStrm )
{
mnPos = rStrm.readuInt16();
mnFontId = rStrm.readuInt16();
@@ -143,7 +145,7 @@ void FontPortionModelList::appendPortion( const FontPortionModel& rPortion )
back().mnFontId = rPortion.mnFontId;
}
-void FontPortionModelList::importPortions( RecordInputStream& rStrm )
+void FontPortionModelList::importPortions( SequenceInputStream& rStrm )
{
sal_Int32 nCount = rStrm.readInt32();
clear();
@@ -190,7 +192,7 @@ PhoneticDataModel::PhoneticDataModel() :
{
}
-void PhoneticDataModel::setBinData( sal_Int32 nType, sal_Int32 nAlignment )
+void PhoneticDataModel::setBiffData( sal_Int32 nType, sal_Int32 nAlignment )
{
static const sal_Int32 spnTypeIds[] = { XML_halfwidthKatakana, XML_fullwidthKatakana, XML_hiragana, XML_noConversion };
mnType = STATIC_ARRAY_SELECT( spnTypeIds, nType, XML_fullwidthKatakana );
@@ -213,13 +215,13 @@ void PhoneticSettings::importPhoneticPr( const AttributeList& rAttribs )
maModel.mnAlignment = rAttribs.getToken( XML_alignment, XML_left );
}
-void PhoneticSettings::importPhoneticPr( RecordInputStream& rStrm )
+void PhoneticSettings::importPhoneticPr( SequenceInputStream& rStrm )
{
sal_uInt16 nFontId;
sal_Int32 nType, nAlignment;
rStrm >> nFontId >> nType >> nAlignment;
maModel.mnFontId = nFontId;
- maModel.setBinData( nType, nAlignment );
+ maModel.setBiffData( nType, nAlignment );
}
void PhoneticSettings::importPhoneticPr( BiffInputStream& rStrm )
@@ -227,16 +229,16 @@ void PhoneticSettings::importPhoneticPr( BiffInputStream& rStrm )
sal_uInt16 nFontId, nFlags;
rStrm >> nFontId >> nFlags;
maModel.mnFontId = nFontId;
- maModel.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
+ maModel.setBiffData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
// following: range list with cells showing phonetic text
}
-void PhoneticSettings::importStringData( RecordInputStream& rStrm )
+void PhoneticSettings::importStringData( SequenceInputStream& rStrm )
{
sal_uInt16 nFontId, nFlags;
rStrm >> nFontId >> nFlags;
maModel.mnFontId = nFontId;
- maModel.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
+ maModel.setBiffData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
}
void PhoneticSettings::importStringData( BiffInputStream& rStrm )
@@ -244,7 +246,7 @@ void PhoneticSettings::importStringData( BiffInputStream& rStrm )
sal_uInt16 nFontId, nFlags;
rStrm >> nFontId >> nFlags;
maModel.mnFontId = nFontId;
- maModel.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
+ maModel.setBiffData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
}
// ============================================================================
@@ -275,7 +277,7 @@ void RichStringPhonetic::setBaseRange( sal_Int32 nBasePos, sal_Int32 nBaseEnd )
// ----------------------------------------------------------------------------
-void PhoneticPortionModel::read( RecordInputStream& rStrm )
+void PhoneticPortionModel::read( SequenceInputStream& rStrm )
{
mnPos = rStrm.readuInt16();
mnBasePos = rStrm.readuInt16();
@@ -308,7 +310,7 @@ void PhoneticPortionModelList::appendPortion( const PhoneticPortionModel& rPorti
}
}
-void PhoneticPortionModelList::importPortions( RecordInputStream& rStrm )
+void PhoneticPortionModelList::importPortions( SequenceInputStream& rStrm )
{
sal_Int32 nCount = rStrm.readInt32();
clear();
@@ -380,12 +382,12 @@ void RichString::importPhoneticPr( const AttributeList& rAttribs )
maPhonSettings.importPhoneticPr( rAttribs );
}
-void RichString::importString( RecordInputStream& rStrm, bool bRich )
+void RichString::importString( SequenceInputStream& rStrm, bool bRich )
{
sal_uInt8 nFlags = bRich ? rStrm.readuInt8() : 0;
- OUString aBaseText = rStrm.readString();
+ OUString aBaseText = BiffHelper::readString( rStrm );
- if( !rStrm.isEof() && getFlag( nFlags, OOBIN_STRINGFLAG_FONTS ) )
+ if( !rStrm.isEof() && getFlag( nFlags, BIFF12_STRINGFLAG_FONTS ) )
{
FontPortionModelList aPortions;
aPortions.importPortions( rStrm );
@@ -396,9 +398,9 @@ void RichString::importString( RecordInputStream& rStrm, bool bRich )
createPortion()->setText( aBaseText );
}
- if( !rStrm.isEof() && getFlag( nFlags, OOBIN_STRINGFLAG_PHONETICS ) )
+ if( !rStrm.isEof() && getFlag( nFlags, BIFF12_STRINGFLAG_PHONETICS ) )
{
- OUString aPhoneticText = rStrm.readString();
+ OUString aPhoneticText = BiffHelper::readString( rStrm );
PhoneticPortionModelList aPortions;
aPortions.importPortions( rStrm );
maPhonSettings.importStringData( rStrm );
@@ -610,4 +612,3 @@ void RichString::createPhoneticPortions( const ::rtl::OUString& rText, PhoneticP
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/richstringcontext.cxx b/oox/source/xls/richstringcontext.cxx
index 4eb3f5e91a4f..a3cfbe054406 100644
--- a/oox/source/xls/richstringcontext.cxx
+++ b/oox/source/xls/richstringcontext.cxx
@@ -26,28 +26,37 @@
************************************************************************/
#include "oox/xls/richstringcontext.hxx"
-#include "oox/xls/stylesfragment.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
+#include "oox/xls/stylesfragment.hxx"
namespace oox {
namespace xls {
// ============================================================================
-// oox.core.ContextHandler2Helper interface -----------------------------------
+using ::oox::core::ContextHandlerRef;
+using ::rtl::OUString;
-ContextHandlerRef OoxRichStringContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+// ============================================================================
+
+ContextHandlerRef RichStringContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() )
{
switch( nElement )
{
- case XLS_TOKEN( t ): mxPortion = mxString->importText( rAttribs ); return this; // collect text in onEndElement()
- case XLS_TOKEN( r ): mxPortion = mxString->importRun( rAttribs ); return this;
- case XLS_TOKEN( rPh ): mxPhonetic = mxString->importPhoneticRun( rAttribs ); return this;
- case XLS_TOKEN( phoneticPr ): mxString->importPhoneticPr( rAttribs ); break;
+ case XLS_TOKEN( t ):
+ mxPortion = mxString->importText( rAttribs );
+ return this; // collect text in onCharacters()
+ case XLS_TOKEN( r ):
+ mxPortion = mxString->importRun( rAttribs );
+ return this;
+ case XLS_TOKEN( rPh ):
+ mxPhonetic = mxString->importPhoneticRun( rAttribs );
+ return this;
+ case XLS_TOKEN( phoneticPr ):
+ mxString->importPhoneticPr( rAttribs );
+ break;
}
}
else switch( getCurrentElement() )
@@ -57,11 +66,11 @@ ContextHandlerRef OoxRichStringContext::onCreateContext( sal_Int32 nElement, con
{
case XLS_TOKEN( rPr ):
if( mxPortion.get() )
- return new OoxFontContext( *this, mxPortion->createFont() );
+ return new FontContext( *this, mxPortion->createFont() );
break;
case XLS_TOKEN( t ):
- return this; // collect portion text in onEndElement()
+ return this; // collect portion text in onCharacters()
}
break;
@@ -69,22 +78,24 @@ ContextHandlerRef OoxRichStringContext::onCreateContext( sal_Int32 nElement, con
switch( nElement )
{
case XLS_TOKEN( t ):
- return this; // collect phonetic text in onEndElement()
+ return this; // collect phonetic text in onCharacters()
}
break;
}
return 0;
}
-void OoxRichStringContext::onEndElement( const OUString& rChars )
+void RichStringContext::onCharacters( const OUString& rChars )
{
- if( getCurrentElement() == XLS_TOKEN( t ) )
+ if( isCurrentElement( XLS_TOKEN( t ) ) ) switch( getParentElement() )
{
- switch( getPreviousElement() )
- {
- case XLS_TOKEN( rPh ): if( mxPhonetic.get() ) mxPhonetic->setText( rChars ); break;
- default: if( mxPortion.get() ) mxPortion->setText( rChars ); break;
- }
+ case XLS_TOKEN( rPh ):
+ if( mxPhonetic.get() )
+ mxPhonetic->setText( rChars );
+ break;
+ default:
+ if( mxPortion.get() )
+ mxPortion->setText( rChars );
}
}
@@ -92,4 +103,3 @@ void OoxRichStringContext::onEndElement( const OUString& rChars )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/scenariobuffer.cxx b/oox/source/xls/scenariobuffer.cxx
index a4a2627f3efb..8915f1ae0c7b 100644
--- a/oox/source/xls/scenariobuffer.cxx
+++ b/oox/source/xls/scenariobuffer.cxx
@@ -26,39 +26,33 @@
************************************************************************/
#include "oox/xls/scenariobuffer.hxx"
+
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/sheet/XScenario.hpp>
#include <com/sun/star/sheet/XScenarios.hpp>
#include <com/sun/star/sheet/XScenariosSupplier.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::XCell;
-using ::com::sun::star::sheet::XScenario;
-using ::com::sun::star::sheet::XScenarios;
-using ::com::sun::star::sheet::XScenariosSupplier;
-using ::com::sun::star::sheet::XSpreadsheet;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
const sal_Int32 BIFF_SCENARIO_DELETED = 0x4000;
@@ -108,7 +102,7 @@ void Scenario::importInputCells( const AttributeList& rAttribs )
maCells.push_back( aModel );
}
-void Scenario::importScenario( RecordInputStream& rStrm )
+void Scenario::importScenario( SequenceInputStream& rStrm )
{
rStrm.skip( 2 ); // cell count
// two longs instead of flag field
@@ -117,7 +111,7 @@ void Scenario::importScenario( RecordInputStream& rStrm )
rStrm >> maModel.maName >> maModel.maComment >> maModel.maUser;
}
-void Scenario::importInputCells( RecordInputStream& rStrm )
+void Scenario::importInputCells( SequenceInputStream& rStrm )
{
// TODO: where is the deleted flag?
ScenarioCellModel aModel;
@@ -238,7 +232,7 @@ void SheetScenarios::importScenarios( const AttributeList& rAttribs )
maModel.mnShown = rAttribs.getInteger( XML_show, 0 );
}
-void SheetScenarios::importScenarios( RecordInputStream& rStrm )
+void SheetScenarios::importScenarios( SequenceInputStream& rStrm )
{
maModel.mnCurrent = rStrm.readuInt16();
maModel.mnShown = rStrm.readuInt16();
@@ -303,4 +297,3 @@ void ScenarioBuffer::finalizeImport()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/scenariocontext.cxx b/oox/source/xls/scenariocontext.cxx
index 8d1341688a74..be44bc8545f2 100644
--- a/oox/source/xls/scenariocontext.cxx
+++ b/oox/source/xls/scenariocontext.cxx
@@ -26,22 +26,25 @@
************************************************************************/
#include "oox/xls/scenariocontext.hxx"
-#include "oox/xls/scenariobuffer.hxx"
-using ::oox::core::ContextHandlerRef;
+#include "oox/xls/scenariobuffer.hxx"
namespace oox {
namespace xls {
// ============================================================================
-OoxScenarioContext::OoxScenarioContext( OoxWorksheetContextBase& rParent, SheetScenarios& rSheetScenarios ) :
- OoxWorksheetContextBase( rParent ),
+using ::oox::core::ContextHandlerRef;
+
+// ============================================================================
+
+ScenarioContext::ScenarioContext( WorksheetContextBase& rParent, SheetScenarios& rSheetScenarios ) :
+ WorksheetContextBase( rParent ),
mrScenario( rSheetScenarios.createScenario() )
{
}
-ContextHandlerRef OoxScenarioContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ScenarioContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -52,24 +55,24 @@ ContextHandlerRef OoxScenarioContext::onCreateContext( sal_Int32 nElement, const
return 0;
}
-void OoxScenarioContext::onStartElement( const AttributeList& rAttribs )
+void ScenarioContext::onStartElement( const AttributeList& rAttribs )
{
if( isRootElement() )
mrScenario.importScenario( rAttribs );
}
-ContextHandlerRef OoxScenarioContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef ScenarioContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_SCENARIO:
- if( nRecId == OOBIN_ID_INPUTCELLS ) mrScenario.importInputCells( rStrm );
+ case BIFF12_ID_SCENARIO:
+ if( nRecId == BIFF12_ID_INPUTCELLS ) mrScenario.importInputCells( rStrm );
break;
}
return 0;
}
-void OoxScenarioContext::onStartRecord( RecordInputStream& rStrm )
+void ScenarioContext::onStartRecord( SequenceInputStream& rStrm )
{
if( isRootElement() )
mrScenario.importScenario( rStrm );
@@ -77,41 +80,41 @@ void OoxScenarioContext::onStartRecord( RecordInputStream& rStrm )
// ============================================================================
-OoxScenariosContext::OoxScenariosContext( OoxWorksheetFragmentBase& rFragment ) :
- OoxWorksheetContextBase( rFragment ),
+ScenariosContext::ScenariosContext( WorksheetFragmentBase& rFragment ) :
+ WorksheetContextBase( rFragment ),
mrSheetScenarios( getScenarios().createSheetScenarios( getSheetIndex() ) )
{
}
-ContextHandlerRef OoxScenariosContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef ScenariosContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
case XLS_TOKEN( scenarios ):
- if( nElement == XLS_TOKEN( scenario ) ) return new OoxScenarioContext( *this, mrSheetScenarios );
+ if( nElement == XLS_TOKEN( scenario ) ) return new ScenarioContext( *this, mrSheetScenarios );
break;
}
return 0;
}
-void OoxScenariosContext::onStartElement( const AttributeList& rAttribs )
+void ScenariosContext::onStartElement( const AttributeList& rAttribs )
{
if( isRootElement() )
mrSheetScenarios.importScenarios( rAttribs );
}
-ContextHandlerRef OoxScenariosContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef ScenariosContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_SCENARIOS:
- if( nRecId == OOBIN_ID_SCENARIO ) return new OoxScenarioContext( *this, mrSheetScenarios );
+ case BIFF12_ID_SCENARIOS:
+ if( nRecId == BIFF12_ID_SCENARIO ) return new ScenarioContext( *this, mrSheetScenarios );
break;
}
return 0;
}
-void OoxScenariosContext::onStartRecord( RecordInputStream& rStrm )
+void ScenariosContext::onStartRecord( SequenceInputStream& rStrm )
{
if( isRootElement() )
mrSheetScenarios.importScenarios( rStrm );
@@ -121,4 +124,3 @@ void OoxScenariosContext::onStartRecord( RecordInputStream& rStrm )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/sharedformulabuffer.cxx b/oox/source/xls/sharedformulabuffer.cxx
index c95d52910bec..efdfe801f784 100644
--- a/oox/source/xls/sharedformulabuffer.cxx
+++ b/oox/source/xls/sharedformulabuffer.cxx
@@ -26,30 +26,28 @@
************************************************************************/
#include "oox/xls/sharedformulabuffer.hxx"
-#include <rtl/ustrbuf.hxx>
+
#include <com/sun/star/sheet/XFormulaTokens.hpp>
-#include "properties.hxx"
+#include <rtl/ustrbuf.hxx>
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/formulaparser.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::sheet::XFormulaTokens;
-using ::com::sun::star::sheet::XNamedRange;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
bool operator==( const CellAddress& rAddr1, const CellAddress& rAddr2 )
@@ -113,7 +111,7 @@ void SharedFormulaBuffer::importSharedFmla( const OUString& rFormula, const OUSt
}
}
-void SharedFormulaBuffer::importSharedFmla( RecordInputStream& rStrm, const CellAddress& rBaseAddr )
+void SharedFormulaBuffer::importSharedFmla( SequenceInputStream& rStrm, const CellAddress& rBaseAddr )
{
BinRange aRange;
rStrm >> aRange;
@@ -212,4 +210,3 @@ void SharedFormulaBuffer::updateCachedCell( const CellAddress& rBaseAddr, const
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/sharedstringsbuffer.cxx b/oox/source/xls/sharedstringsbuffer.cxx
index f2a92ef06c0a..59d3a905bc40 100644
--- a/oox/source/xls/sharedstringsbuffer.cxx
+++ b/oox/source/xls/sharedstringsbuffer.cxx
@@ -26,16 +26,19 @@
************************************************************************/
#include "oox/xls/sharedstringsbuffer.hxx"
-#include "oox/xls/biffinputstream.hxx"
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::text::XText;
+#include "oox/xls/biffinputstream.hxx"
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+
+// ============================================================================
+
SharedStringsBuffer::SharedStringsBuffer( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper )
{
@@ -81,4 +84,3 @@ void SharedStringsBuffer::convertString( const Reference< XText >& rxText, sal_I
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/sharedstringsfragment.cxx b/oox/source/xls/sharedstringsfragment.cxx
index b868ca08523d..bdb60f6962b8 100644
--- a/oox/source/xls/sharedstringsfragment.cxx
+++ b/oox/source/xls/sharedstringsfragment.cxx
@@ -26,27 +26,28 @@
************************************************************************/
#include "oox/xls/sharedstringsfragment.hxx"
-#include "oox/xls/sharedstringsbuffer.hxx"
-#include "oox/xls/richstringcontext.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
+#include "oox/xls/richstringcontext.hxx"
+#include "oox/xls/sharedstringsbuffer.hxx"
namespace oox {
namespace xls {
// ============================================================================
-OoxSharedStringsFragment::OoxSharedStringsFragment(
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+SharedStringsFragment::SharedStringsFragment(
const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath )
+ WorkbookFragmentBase( rHelper, rFragmentPath )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxSharedStringsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef SharedStringsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
@@ -57,42 +58,40 @@ ContextHandlerRef OoxSharedStringsFragment::onCreateContext( sal_Int32 nElement,
case XLS_TOKEN( sst ):
if( nElement == XLS_TOKEN( si ) )
- return new OoxRichStringContext( *this, getSharedStrings().createRichString() );
+ return new RichStringContext( *this, getSharedStrings().createRichString() );
break;
}
return 0;
}
-ContextHandlerRef OoxSharedStringsFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef SharedStringsFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_SST )
+ if( nRecId == BIFF12_ID_SST )
return this;
break;
- case OOBIN_ID_SST:
- if( nRecId == OOBIN_ID_SI )
+ case BIFF12_ID_SST:
+ if( nRecId == BIFF12_ID_SI )
getSharedStrings().createRichString()->importString( rStrm, true );
break;
}
return 0;
}
-// oox.core.FragmentHandler2 interface ----------------------------------------
-
-const RecordInfo* OoxSharedStringsFragment::getRecordInfos() const
+const RecordInfo* SharedStringsFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_SST, OOBIN_ID_SST + 1 },
+ { BIFF12_ID_SST, BIFF12_ID_SST + 1 },
{ -1, -1 }
};
return spRecInfos;
}
-void OoxSharedStringsFragment::finalizeImport()
+void SharedStringsFragment::finalizeImport()
{
getSharedStrings().finalizeImport();
}
@@ -101,4 +100,3 @@ void OoxSharedStringsFragment::finalizeImport()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx
index 05e4c5bfe767..c515ec02bfbe 100644
--- a/oox/source/xls/sheetdatacontext.cxx
+++ b/oox/source/xls/sheetdatacontext.cxx
@@ -26,15 +26,15 @@
************************************************************************/
#include "oox/xls/sheetdatacontext.hxx"
+
+#include <com/sun/star/sheet/XArrayFormulaTokens.hpp>
+#include <com/sun/star/sheet/XFormulaTokens.hpp>
#include <com/sun/star/table/CellContentType.hpp>
#include <com/sun/star/table/XCell.hpp>
#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/sheet/XFormulaTokens.hpp>
-#include <com/sun/star/sheet/XArrayFormulaTokens.hpp>
#include <com/sun/star/text/XText.hpp>
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/formulaparser.hxx"
@@ -42,47 +42,39 @@
#include "oox/xls/sharedformulabuffer.hxx"
#include "oox/xls/unitconverter.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::CellContentType_EMPTY;
-using ::com::sun::star::table::XCell;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::sheet::XFormulaTokens;
-using ::com::sun::star::sheet::XArrayFormulaTokens;
-using ::com::sun::star::text::XText;
-using ::oox::core::ContextHandlerRef;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::ContextHandlerRef;
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
// record constants -----------------------------------------------------------
-const sal_uInt32 OOBIN_CELL_SHOWPHONETIC = 0x01000000;
-
-const sal_uInt8 OOBIN_DATATABLE_ROW = 0x01;
-const sal_uInt8 OOBIN_DATATABLE_2D = 0x02;
-const sal_uInt8 OOBIN_DATATABLE_REF1DEL = 0x04;
-const sal_uInt8 OOBIN_DATATABLE_REF2DEL = 0x08;
+const sal_uInt32 BIFF12_CELL_SHOWPHONETIC = 0x01000000;
-const sal_uInt16 OOBIN_ROW_THICKTOP = 0x0001;
-const sal_uInt16 OOBIN_ROW_THICKBOTTOM = 0x0002;
-const sal_uInt16 OOBIN_ROW_COLLAPSED = 0x0800;
-const sal_uInt16 OOBIN_ROW_HIDDEN = 0x1000;
-const sal_uInt16 OOBIN_ROW_CUSTOMHEIGHT = 0x2000;
-const sal_uInt16 OOBIN_ROW_CUSTOMFORMAT = 0x4000;
-const sal_uInt8 OOBIN_ROW_SHOWPHONETIC = 0x01;
+const sal_uInt8 BIFF12_DATATABLE_ROW = 0x01;
+const sal_uInt8 BIFF12_DATATABLE_2D = 0x02;
+const sal_uInt8 BIFF12_DATATABLE_REF1DEL = 0x04;
+const sal_uInt8 BIFF12_DATATABLE_REF2DEL = 0x08;
-const sal_uInt8 BIFF_BOOLERR_BOOL = 0;
-const sal_uInt8 BIFF_BOOLERR_ERROR = 1;
+const sal_uInt16 BIFF12_ROW_THICKTOP = 0x0001;
+const sal_uInt16 BIFF12_ROW_THICKBOTTOM = 0x0002;
+const sal_uInt16 BIFF12_ROW_COLLAPSED = 0x0800;
+const sal_uInt16 BIFF12_ROW_HIDDEN = 0x1000;
+const sal_uInt16 BIFF12_ROW_CUSTOMHEIGHT = 0x2000;
+const sal_uInt16 BIFF12_ROW_CUSTOMFORMAT = 0x4000;
+const sal_uInt8 BIFF12_ROW_SHOWPHONETIC = 0x01;
const sal_uInt16 BIFF_DATATABLE_ROW = 0x0004;
const sal_uInt16 BIFF_DATATABLE_2D = 0x0008;
@@ -162,14 +154,12 @@ void ArrayFormulaContext::setTokens( const ApiTokenSequence& rTokens )
// ============================================================================
-OoxSheetDataContext::OoxSheetDataContext( OoxWorksheetFragmentBase& rFragment ) :
- OoxWorksheetContextBase( rFragment )
+SheetDataContext::SheetDataContext( WorksheetFragmentBase& rFragment ) :
+ WorksheetContextBase( rFragment )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef SheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -186,7 +176,7 @@ ContextHandlerRef OoxSheetDataContext::onCreateContext( sal_Int32 nElement, cons
{
case XLS_TOKEN( is ):
mxInlineStr.reset( new RichString( *this ) );
- return new OoxRichStringContext( *this, mxInlineStr );
+ return new RichStringContext( *this, mxInlineStr );
case XLS_TOKEN( v ):
return this;
case XLS_TOKEN( f ):
@@ -198,7 +188,7 @@ ContextHandlerRef OoxSheetDataContext::onCreateContext( sal_Int32 nElement, cons
return 0;
}
-void OoxSheetDataContext::onEndElement( const OUString& rChars )
+void SheetDataContext::onCharacters( const OUString& rChars )
{
switch( getCurrentElement() )
{
@@ -252,84 +242,85 @@ void OoxSheetDataContext::onEndElement( const OUString& rChars )
break;
default:
- OSL_ENSURE( false, "OoxSheetDataContext::onEndElement - unknown formula type" );
+ OSL_ENSURE( false, "SheetDataContext::onCharacters - unknown formula type" );
}
}
catch( Exception& )
{
}
break;
+ }
+}
- case XLS_TOKEN( c ):
- if( maCurrCell.mxCell.is() )
+void SheetDataContext::onEndElement()
+{
+ if( isCurrentElement( XLS_TOKEN( c ) ) && maCurrCell.mxCell.is() )
+ {
+ if( maCurrCell.mxCell->getType() == CellContentType_EMPTY )
+ {
+ if( maCurrCell.mbHasValueStr )
{
- if( maCurrCell.mxCell->getType() == CellContentType_EMPTY )
- {
- if( maCurrCell.mbHasValueStr )
- {
- // implemented in WorksheetHelper class
- setCell( maCurrCell );
- }
- else if( (maCurrCell.mnCellType == XML_inlineStr) && mxInlineStr.get() )
- {
- // convert font settings
- mxInlineStr->finalizeImport();
- // write string to cell
- Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY );
- if( xText.is() )
- mxInlineStr->convert( xText, maCurrCell.mnXfId );
- }
- else
- {
- // empty cell, update cell type
- maCurrCell.mnCellType = XML_TOKEN_INVALID;
- }
- }
-
- // store the cell formatting data
- setCellFormat( maCurrCell );
+ // implemented in WorksheetHelper class
+ setCell( maCurrCell );
}
- break;
+ else if( (maCurrCell.mnCellType == XML_inlineStr) && mxInlineStr.get() )
+ {
+ // convert font settings
+ mxInlineStr->finalizeImport();
+ // write string to cell
+ Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY );
+ if( xText.is() )
+ mxInlineStr->convert( xText, maCurrCell.mnXfId );
+ }
+ else
+ {
+ // empty cell, update cell type
+ maCurrCell.mnCellType = XML_TOKEN_INVALID;
+ }
+ }
+
+ // store the cell formatting data
+ setCellFormat( maCurrCell );
}
}
-ContextHandlerRef OoxSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef SheetDataContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_SHEETDATA:
+ case BIFF12_ID_SHEETDATA:
switch( nRecId )
{
- case OOBIN_ID_ROW: importRow( rStrm ); return this;
+ case BIFF12_ID_ROW: importRow( rStrm ); return this;
}
break;
- case OOBIN_ID_ROW:
+ case BIFF12_ID_ROW:
switch( nRecId )
{
- case OOBIN_ID_ARRAY: importArray( rStrm ); break;
- case OOBIN_ID_CELL_BOOL: importCellBool( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_BLANK: importCellBlank( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_DOUBLE: importCellDouble( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_ERROR: importCellError( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_RK: importCellRk( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_RSTRING: importCellRString( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_SI: importCellSi( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_STRING: importCellString( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_DATATABLE: importDataTable( rStrm ); break;
- case OOBIN_ID_FORMULA_BOOL: importCellBool( rStrm, CELLTYPE_FORMULA ); break;
- case OOBIN_ID_FORMULA_DOUBLE: importCellDouble( rStrm, CELLTYPE_FORMULA ); break;
- case OOBIN_ID_FORMULA_ERROR: importCellError( rStrm, CELLTYPE_FORMULA ); break;
- case OOBIN_ID_FORMULA_STRING: importCellString( rStrm, CELLTYPE_FORMULA ); break;
- case OOBIN_ID_MULTCELL_BOOL: importCellBool( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_BLANK: importCellBlank( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_DOUBLE: importCellDouble( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_ERROR: importCellError( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_RK: importCellRk( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_RSTRING: importCellRString( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_SI: importCellSi( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_STRING: importCellString( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_SHAREDFMLA: importSharedFmla( rStrm ); break;
+ case BIFF12_ID_ARRAY: importArray( rStrm ); break;
+ case BIFF12_ID_CELL_BOOL: importCellBool( rStrm, CELLTYPE_VALUE ); break;
+ case BIFF12_ID_CELL_BLANK: importCellBlank( rStrm, CELLTYPE_VALUE ); break;
+ case BIFF12_ID_CELL_DOUBLE: importCellDouble( rStrm, CELLTYPE_VALUE ); break;
+ case BIFF12_ID_CELL_ERROR: importCellError( rStrm, CELLTYPE_VALUE ); break;
+ case BIFF12_ID_CELL_RK: importCellRk( rStrm, CELLTYPE_VALUE ); break;
+ case BIFF12_ID_CELL_RSTRING: importCellRString( rStrm, CELLTYPE_VALUE ); break;
+ case BIFF12_ID_CELL_SI: importCellSi( rStrm, CELLTYPE_VALUE ); break;
+ case BIFF12_ID_CELL_STRING: importCellString( rStrm, CELLTYPE_VALUE ); break;
+ case BIFF12_ID_DATATABLE: importDataTable( rStrm ); break;
+ case BIFF12_ID_FORMULA_BOOL: importCellBool( rStrm, CELLTYPE_FORMULA ); break;
+ case BIFF12_ID_FORMULA_DOUBLE: importCellDouble( rStrm, CELLTYPE_FORMULA ); break;
+ case BIFF12_ID_FORMULA_ERROR: importCellError( rStrm, CELLTYPE_FORMULA ); break;
+ case BIFF12_ID_FORMULA_STRING: importCellString( rStrm, CELLTYPE_FORMULA ); break;
+ case BIFF12_ID_MULTCELL_BOOL: importCellBool( rStrm, CELLTYPE_MULTI ); break;
+ case BIFF12_ID_MULTCELL_BLANK: importCellBlank( rStrm, CELLTYPE_MULTI ); break;
+ case BIFF12_ID_MULTCELL_DOUBLE: importCellDouble( rStrm, CELLTYPE_MULTI ); break;
+ case BIFF12_ID_MULTCELL_ERROR: importCellError( rStrm, CELLTYPE_MULTI ); break;
+ case BIFF12_ID_MULTCELL_RK: importCellRk( rStrm, CELLTYPE_MULTI ); break;
+ case BIFF12_ID_MULTCELL_RSTRING:importCellRString( rStrm, CELLTYPE_MULTI ); break;
+ case BIFF12_ID_MULTCELL_SI: importCellSi( rStrm, CELLTYPE_MULTI ); break;
+ case BIFF12_ID_MULTCELL_STRING: importCellString( rStrm, CELLTYPE_MULTI ); break;
+ case BIFF12_ID_SHAREDFMLA: importSharedFmla( rStrm ); break;
}
break;
}
@@ -338,7 +329,7 @@ ContextHandlerRef OoxSheetDataContext::onCreateRecordContext( sal_Int32 nRecId,
// private --------------------------------------------------------------------
-void OoxSheetDataContext::importRow( const AttributeList& rAttribs )
+void SheetDataContext::importRow( const AttributeList& rAttribs )
{
RowModel aModel;
aModel.mnFirstRow = aModel.mnLastRow = rAttribs.getInteger( XML_r, -1 );
@@ -356,7 +347,7 @@ void OoxSheetDataContext::importRow( const AttributeList& rAttribs )
setRowModel( aModel );
}
-void OoxSheetDataContext::importCell( const AttributeList& rAttribs )
+void SheetDataContext::importCell( const AttributeList& rAttribs )
{
maCurrCell.reset();
maCurrCell.mxCell = getCell( rAttribs.getString( XML_r, OUString() ), &maCurrCell.maAddress );
@@ -370,7 +361,7 @@ void OoxSheetDataContext::importCell( const AttributeList& rAttribs )
extendUsedArea( maCurrCell.maAddress );
}
-void OoxSheetDataContext::importFormula( const AttributeList& rAttribs )
+void SheetDataContext::importFormula( const AttributeList& rAttribs )
{
maCurrCell.maFormulaRef = rAttribs.getString( XML_ref, OUString() );
maCurrCell.mnFormulaType = rAttribs.getToken( XML_t, XML_normal );
@@ -383,7 +374,7 @@ void OoxSheetDataContext::importFormula( const AttributeList& rAttribs )
maTableData.mbRef2Deleted = rAttribs.getBool( XML_del2, false );
}
-void OoxSheetDataContext::importCellHeader( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellHeader( SequenceInputStream& rStrm, CellType eCellType )
{
maCurrCell.reset();
@@ -399,14 +390,14 @@ void OoxSheetDataContext::importCellHeader( RecordInputStream& rStrm, CellType e
maCurrCell.mxCell = getCell( maCurrPos, &maCurrCell.maAddress );
maCurrCell.mnXfId = extractValue< sal_Int32 >( nXfId, 0, 24 );
- maCurrCell.mbShowPhonetic = getFlag( nXfId, OOBIN_CELL_SHOWPHONETIC );
+ maCurrCell.mbShowPhonetic = getFlag( nXfId, BIFF12_CELL_SHOWPHONETIC );
// update used area of the sheet
if( maCurrCell.mxCell.is() )
extendUsedArea( maCurrCell.maAddress );
}
-void OoxSheetDataContext::importCellBool( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellBool( SequenceInputStream& rStrm, CellType eCellType )
{
importCellHeader( rStrm, eCellType );
maCurrCell.mnCellType = XML_b;
@@ -427,14 +418,14 @@ void OoxSheetDataContext::importCellBool( RecordInputStream& rStrm, CellType eCe
setCellFormat( maCurrCell );
}
-void OoxSheetDataContext::importCellBlank( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellBlank( SequenceInputStream& rStrm, CellType eCellType )
{
- OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "OoxSheetDataContext::importCellBlank - no formula cells supported" );
+ OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellBlank - no formula cells supported" );
importCellHeader( rStrm, eCellType );
setCellFormat( maCurrCell );
}
-void OoxSheetDataContext::importCellDouble( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellDouble( SequenceInputStream& rStrm, CellType eCellType )
{
importCellHeader( rStrm, eCellType );
maCurrCell.mnCellType = XML_n;
@@ -449,7 +440,7 @@ void OoxSheetDataContext::importCellDouble( RecordInputStream& rStrm, CellType e
setCellFormat( maCurrCell );
}
-void OoxSheetDataContext::importCellError( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellError( SequenceInputStream& rStrm, CellType eCellType )
{
importCellHeader( rStrm, eCellType );
maCurrCell.mnCellType = XML_e;
@@ -464,9 +455,9 @@ void OoxSheetDataContext::importCellError( RecordInputStream& rStrm, CellType eC
setCellFormat( maCurrCell );
}
-void OoxSheetDataContext::importCellRk( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellRk( SequenceInputStream& rStrm, CellType eCellType )
{
- OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "OoxSheetDataContext::importCellRk - no formula cells supported" );
+ OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRk - no formula cells supported" );
importCellHeader( rStrm, eCellType );
maCurrCell.mnCellType = XML_n;
if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) )
@@ -474,9 +465,9 @@ void OoxSheetDataContext::importCellRk( RecordInputStream& rStrm, CellType eCell
setCellFormat( maCurrCell );
}
-void OoxSheetDataContext::importCellRString( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellRString( SequenceInputStream& rStrm, CellType eCellType )
{
- OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "OoxSheetDataContext::importCellRString - no formula cells supported" );
+ OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellRString - no formula cells supported" );
importCellHeader( rStrm, eCellType );
maCurrCell.mnCellType = XML_inlineStr;
Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY );
@@ -490,9 +481,9 @@ void OoxSheetDataContext::importCellRString( RecordInputStream& rStrm, CellType
setCellFormat( maCurrCell );
}
-void OoxSheetDataContext::importCellSi( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellSi( SequenceInputStream& rStrm, CellType eCellType )
{
- OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "OoxSheetDataContext::importCellSi - no formula cells supported" );
+ OSL_ENSURE( eCellType != CELLTYPE_FORMULA, "SheetDataContext::importCellSi - no formula cells supported" );
importCellHeader( rStrm, eCellType );
maCurrCell.mnCellType = XML_s;
if( maCurrCell.mxCell.is() && (maCurrCell.mxCell->getType() == CellContentType_EMPTY) )
@@ -500,7 +491,7 @@ void OoxSheetDataContext::importCellSi( RecordInputStream& rStrm, CellType eCell
setCellFormat( maCurrCell );
}
-void OoxSheetDataContext::importCellString( RecordInputStream& rStrm, CellType eCellType )
+void SheetDataContext::importCellString( SequenceInputStream& rStrm, CellType eCellType )
{
importCellHeader( rStrm, eCellType );
maCurrCell.mnCellType = XML_inlineStr;
@@ -518,7 +509,7 @@ void OoxSheetDataContext::importCellString( RecordInputStream& rStrm, CellType e
setCellFormat( maCurrCell );
}
-void OoxSheetDataContext::importCellFormula( RecordInputStream& rStrm )
+void SheetDataContext::importCellFormula( SequenceInputStream& rStrm )
{
rStrm.skip( 2 );
Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY );
@@ -529,7 +520,7 @@ void OoxSheetDataContext::importCellFormula( RecordInputStream& rStrm )
}
}
-void OoxSheetDataContext::importRow( RecordInputStream& rStrm )
+void SheetDataContext::importRow( SequenceInputStream& rStrm )
{
RowModel aModel;
@@ -537,23 +528,23 @@ void OoxSheetDataContext::importRow( RecordInputStream& rStrm )
sal_uInt8 nFlags2;
rStrm >> maCurrPos.mnRow >> aModel.mnXfId >> nHeight >> nFlags1 >> nFlags2;
- // row index is 0-based in OOBIN, but RowModel expects 1-based
+ // row index is 0-based in BIFF12, but RowModel expects 1-based
aModel.mnFirstRow = aModel.mnLastRow = maCurrPos.mnRow + 1;
- // row height is in twips in OOBIN, convert to points
+ // row height is in twips in BIFF12, convert to points
aModel.mfHeight = nHeight / 20.0;
aModel.mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 );
- aModel.mbCustomHeight = getFlag( nFlags1, OOBIN_ROW_CUSTOMHEIGHT );
- aModel.mbCustomFormat = getFlag( nFlags1, OOBIN_ROW_CUSTOMFORMAT );
- aModel.mbShowPhonetic = getFlag( nFlags2, OOBIN_ROW_SHOWPHONETIC );
- aModel.mbHidden = getFlag( nFlags1, OOBIN_ROW_HIDDEN );
- aModel.mbCollapsed = getFlag( nFlags1, OOBIN_ROW_COLLAPSED );
- aModel.mbThickTop = getFlag( nFlags1, OOBIN_ROW_THICKTOP );
- aModel.mbThickBottom = getFlag( nFlags1, OOBIN_ROW_THICKBOTTOM );
+ aModel.mbCustomHeight = getFlag( nFlags1, BIFF12_ROW_CUSTOMHEIGHT );
+ aModel.mbCustomFormat = getFlag( nFlags1, BIFF12_ROW_CUSTOMFORMAT );
+ aModel.mbShowPhonetic = getFlag( nFlags2, BIFF12_ROW_SHOWPHONETIC );
+ aModel.mbHidden = getFlag( nFlags1, BIFF12_ROW_HIDDEN );
+ aModel.mbCollapsed = getFlag( nFlags1, BIFF12_ROW_COLLAPSED );
+ aModel.mbThickTop = getFlag( nFlags1, BIFF12_ROW_THICKTOP );
+ aModel.mbThickBottom = getFlag( nFlags1, BIFF12_ROW_THICKBOTTOM );
// set row properties in the current sheet
setRowModel( aModel );
}
-void OoxSheetDataContext::importArray( RecordInputStream& rStrm )
+void SheetDataContext::importArray( SequenceInputStream& rStrm )
{
BinRange aRange;
rStrm >> aRange;
@@ -568,12 +559,12 @@ void OoxSheetDataContext::importArray( RecordInputStream& rStrm )
}
}
-void OoxSheetDataContext::importSharedFmla( RecordInputStream& rStrm )
+void SheetDataContext::importSharedFmla( SequenceInputStream& rStrm )
{
getSharedFormulas().importSharedFmla( rStrm, maCurrCell.maAddress );
}
-void OoxSheetDataContext::importDataTable( RecordInputStream& rStrm )
+void SheetDataContext::importDataTable( SequenceInputStream& rStrm )
{
BinRange aRange;
rStrm >> aRange;
@@ -586,18 +577,18 @@ void OoxSheetDataContext::importDataTable( RecordInputStream& rStrm )
rStrm >> aRef1 >> aRef2 >> nFlags;
aModel.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false );
aModel.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false );
- aModel.mbRowTable = getFlag( nFlags, OOBIN_DATATABLE_ROW );
- aModel.mb2dTable = getFlag( nFlags, OOBIN_DATATABLE_2D );
- aModel.mbRef1Deleted = getFlag( nFlags, OOBIN_DATATABLE_REF1DEL );
- aModel.mbRef2Deleted = getFlag( nFlags, OOBIN_DATATABLE_REF2DEL );
+ aModel.mbRowTable = getFlag( nFlags, BIFF12_DATATABLE_ROW );
+ aModel.mb2dTable = getFlag( nFlags, BIFF12_DATATABLE_2D );
+ aModel.mbRef1Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF1DEL );
+ aModel.mbRef2Deleted = getFlag( nFlags, BIFF12_DATATABLE_REF2DEL );
setTableOperation( aTableRange, aModel );
}
}
// ============================================================================
-BiffSheetDataContext::BiffSheetDataContext( const BiffWorksheetFragmentBase& rParent ) :
- BiffWorksheetContextBase( rParent ),
+BiffSheetDataContext::BiffSheetDataContext( const WorksheetHelper& rHelper ) :
+ BiffWorksheetContextBase( rHelper ),
mnBiff2XfId( 0 )
{
mnArrayIgnoreSize = (getBiff() == BIFF2) ? 1 : ((getBiff() <= BIFF4) ? 2 : 6);
@@ -621,80 +612,80 @@ BiffSheetDataContext::BiffSheetDataContext( const BiffWorksheetFragmentBase& rPa
}
}
-void BiffSheetDataContext::importRecord()
+void BiffSheetDataContext::importRecord( BiffInputStream& rStrm )
{
- sal_uInt16 nRecId = mrStrm.getRecId();
+ sal_uInt16 nRecId = rStrm.getRecId();
switch( nRecId )
{
// records in all BIFF versions
case BIFF2_ID_ARRAY: // #i72713#
- case BIFF3_ID_ARRAY: importArray(); break;
+ case BIFF3_ID_ARRAY: importArray( rStrm ); break;
case BIFF2_ID_BLANK:
- case BIFF3_ID_BLANK: importBlank(); break;
+ case BIFF3_ID_BLANK: importBlank( rStrm ); break;
case BIFF2_ID_BOOLERR:
- case BIFF3_ID_BOOLERR: importBoolErr(); break;
- case BIFF2_ID_INTEGER: importInteger(); break;
- case BIFF_ID_IXFE: mrStrm >> mnBiff2XfId; break;
+ case BIFF3_ID_BOOLERR: importBoolErr( rStrm ); break;
+ case BIFF2_ID_INTEGER: importInteger( rStrm ); break;
+ case BIFF_ID_IXFE: rStrm >> mnBiff2XfId; break;
case BIFF2_ID_LABEL:
- case BIFF3_ID_LABEL: importLabel(); break;
+ case BIFF3_ID_LABEL: importLabel( rStrm ); break;
case BIFF2_ID_NUMBER:
- case BIFF3_ID_NUMBER: importNumber(); break;
- case BIFF_ID_RK: importRk(); break;
+ case BIFF3_ID_NUMBER: importNumber( rStrm ); break;
+ case BIFF_ID_RK: importRk( rStrm ); break;
// BIFF specific records
default: switch( getBiff() )
{
case BIFF2: switch( nRecId )
{
- case BIFF2_ID_DATATABLE: importDataTable(); break;
- case BIFF2_ID_DATATABLE2: importDataTable(); break;
- case BIFF2_ID_FORMULA: importFormula(); break;
- case BIFF2_ID_ROW: importRow(); break;
+ case BIFF2_ID_DATATABLE: importDataTable( rStrm ); break;
+ case BIFF2_ID_DATATABLE2: importDataTable( rStrm ); break;
+ case BIFF2_ID_FORMULA: importFormula( rStrm ); break;
+ case BIFF2_ID_ROW: importRow( rStrm ); break;
}
break;
case BIFF3: switch( nRecId )
{
- case BIFF3_ID_DATATABLE: importDataTable(); break;
- case BIFF3_ID_FORMULA: importFormula(); break;
- case BIFF3_ID_ROW: importRow(); break;
+ case BIFF3_ID_DATATABLE: importDataTable( rStrm ); break;
+ case BIFF3_ID_FORMULA: importFormula( rStrm ); break;
+ case BIFF3_ID_ROW: importRow( rStrm ); break;
}
break;
case BIFF4: switch( nRecId )
{
- case BIFF3_ID_DATATABLE: importDataTable(); break;
- case BIFF4_ID_FORMULA: importFormula(); break;
- case BIFF3_ID_ROW: importRow(); break;
+ case BIFF3_ID_DATATABLE: importDataTable( rStrm ); break;
+ case BIFF4_ID_FORMULA: importFormula( rStrm ); break;
+ case BIFF3_ID_ROW: importRow( rStrm ); break;
}
break;
case BIFF5: switch( nRecId )
{
- case BIFF3_ID_DATATABLE: importDataTable(); break;
+ case BIFF3_ID_DATATABLE: importDataTable( rStrm ); break;
case BIFF3_ID_FORMULA:
case BIFF4_ID_FORMULA:
- case BIFF5_ID_FORMULA: importFormula(); break;
- case BIFF_ID_MULTBLANK: importMultBlank(); break;
- case BIFF_ID_MULTRK: importMultRk(); break;
- case BIFF3_ID_ROW: importRow(); break;
- case BIFF_ID_RSTRING: importLabel(); break;
- case BIFF_ID_SHAREDFMLA: importSharedFmla(); break;
+ case BIFF5_ID_FORMULA: importFormula( rStrm ); break;
+ case BIFF_ID_MULTBLANK: importMultBlank( rStrm ); break;
+ case BIFF_ID_MULTRK: importMultRk( rStrm ); break;
+ case BIFF3_ID_ROW: importRow( rStrm ); break;
+ case BIFF_ID_RSTRING: importLabel( rStrm ); break;
+ case BIFF_ID_SHAREDFMLA: importSharedFmla( rStrm ); break;
}
break;
case BIFF8: switch( nRecId )
{
- case BIFF3_ID_DATATABLE: importDataTable(); break;
+ case BIFF3_ID_DATATABLE: importDataTable( rStrm ); break;
case BIFF3_ID_FORMULA:
case BIFF4_ID_FORMULA:
- case BIFF5_ID_FORMULA: importFormula(); break;
- case BIFF_ID_LABELSST: importLabelSst(); break;
- case BIFF_ID_MULTBLANK: importMultBlank(); break;
- case BIFF_ID_MULTRK: importMultRk(); break;
- case BIFF3_ID_ROW: importRow(); break;
- case BIFF_ID_RSTRING: importLabel(); break;
- case BIFF_ID_SHAREDFMLA: importSharedFmla(); break;
+ case BIFF5_ID_FORMULA: importFormula( rStrm ); break;
+ case BIFF_ID_LABELSST: importLabelSst( rStrm ); break;
+ case BIFF_ID_MULTBLANK: importMultBlank( rStrm ); break;
+ case BIFF_ID_MULTRK: importMultRk( rStrm ); break;
+ case BIFF3_ID_ROW: importRow( rStrm ); break;
+ case BIFF_ID_RSTRING: importLabel( rStrm ); break;
+ case BIFF_ID_SHAREDFMLA: importSharedFmla( rStrm ); break;
}
break;
@@ -714,44 +705,44 @@ void BiffSheetDataContext::setCurrCell( const BinAddress& rAddr )
extendUsedArea( maCurrCell.maAddress );
}
-void BiffSheetDataContext::importXfId( bool bBiff2 )
+void BiffSheetDataContext::importXfId( BiffInputStream& rStrm, bool bBiff2 )
{
if( bBiff2 )
{
sal_uInt8 nBiff2XfId;
- mrStrm >> nBiff2XfId;
- mrStrm.skip( 2 );
+ rStrm >> nBiff2XfId;
+ rStrm.skip( 2 );
maCurrCell.mnXfId = nBiff2XfId & BIFF2_XF_MASK;
if( maCurrCell.mnXfId == BIFF2_XF_EXTENDED_IDS )
maCurrCell.mnXfId = mnBiff2XfId;
}
else
{
- maCurrCell.mnXfId = mrStrm.readuInt16();
+ maCurrCell.mnXfId = rStrm.readuInt16();
}
}
-void BiffSheetDataContext::importCellHeader( bool bBiff2 )
+void BiffSheetDataContext::importCellHeader( BiffInputStream& rStrm, bool bBiff2 )
{
BinAddress aAddr;
- mrStrm >> aAddr;
+ rStrm >> aAddr;
setCurrCell( aAddr );
- importXfId( bBiff2 );
+ importXfId( rStrm, bBiff2 );
}
-void BiffSheetDataContext::importBlank()
+void BiffSheetDataContext::importBlank( BiffInputStream& rStrm )
{
- importCellHeader( mrStrm.getRecId() == BIFF2_ID_BLANK );
+ importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BLANK );
setCellFormat( maCurrCell );
}
-void BiffSheetDataContext::importBoolErr()
+void BiffSheetDataContext::importBoolErr( BiffInputStream& rStrm )
{
- importCellHeader( mrStrm.getRecId() == BIFF2_ID_BOOLERR );
+ importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BOOLERR );
if( maCurrCell.mxCell.is() )
{
sal_uInt8 nValue, nType;
- mrStrm >> nValue >> nType;
+ rStrm >> nValue >> nType;
switch( nType )
{
case BIFF_BOOLERR_BOOL:
@@ -771,33 +762,33 @@ void BiffSheetDataContext::importBoolErr()
setCellFormat( maCurrCell );
}
-void BiffSheetDataContext::importFormula()
+void BiffSheetDataContext::importFormula( BiffInputStream& rStrm )
{
- importCellHeader( getBiff() == BIFF2 );
+ importCellHeader( rStrm, getBiff() == BIFF2 );
maCurrCell.mnCellType = XML_n;
Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY );
if( xTokens.is() )
{
- mrStrm.skip( mnFormulaIgnoreSize );
+ rStrm.skip( mnFormulaIgnoreSize );
ExtCellFormulaContext aContext( *this, xTokens, maCurrCell.maAddress );
- getFormulaParser().importFormula( aContext, mrStrm );
+ getFormulaParser().importFormula( aContext, rStrm );
}
setCellFormat( maCurrCell );
}
-void BiffSheetDataContext::importInteger()
+void BiffSheetDataContext::importInteger( BiffInputStream& rStrm )
{
- importCellHeader( true );
+ importCellHeader( rStrm, true );
maCurrCell.mnCellType = XML_n;
if( maCurrCell.mxCell.is() )
- maCurrCell.mxCell->setValue( mrStrm.readuInt16() );
+ maCurrCell.mxCell->setValue( rStrm.readuInt16() );
setCellFormat( maCurrCell );
}
-void BiffSheetDataContext::importLabel()
+void BiffSheetDataContext::importLabel( BiffInputStream& rStrm )
{
- bool bBiff2Xf = mrStrm.getRecId() == BIFF2_ID_LABEL;
- importCellHeader( bBiff2Xf );
+ bool bBiff2Xf = rStrm.getRecId() == BIFF2_ID_LABEL;
+ importCellHeader( rStrm, bBiff2Xf );
maCurrCell.mnCellType = XML_inlineStr;
Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY );
if( xText.is() )
@@ -812,7 +803,7 @@ void BiffSheetDataContext::importLabel()
RichString aString( *this );
if( getBiff() == BIFF8 )
{
- aString.importUniString( mrStrm );
+ aString.importUniString( rStrm );
}
else
{
@@ -821,8 +812,8 @@ void BiffSheetDataContext::importLabel()
if( const Font* pFont = getStyles().getFontFromCellXf( maCurrCell.mnXfId ).get() )
eTextEnc = pFont->getFontEncoding();
BiffStringFlags nFlags = bBiff2Xf ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT;
- setFlag( nFlags, BIFF_STR_EXTRAFONTS, mrStrm.getRecId() == BIFF_ID_RSTRING );
- aString.importByteString( mrStrm, eTextEnc, nFlags );
+ setFlag( nFlags, BIFF_STR_EXTRAFONTS, rStrm.getRecId() == BIFF_ID_RSTRING );
+ aString.importByteString( rStrm, eTextEnc, nFlags );
}
aString.finalizeImport();
aString.convert( xText, maCurrCell.mnXfId );
@@ -830,81 +821,81 @@ void BiffSheetDataContext::importLabel()
setCellFormat( maCurrCell );
}
-void BiffSheetDataContext::importLabelSst()
+void BiffSheetDataContext::importLabelSst( BiffInputStream& rStrm )
{
- importCellHeader( false );
+ importCellHeader( rStrm, false );
maCurrCell.mnCellType = XML_s;
if( maCurrCell.mxCell.is() )
- setSharedStringCell( maCurrCell.mxCell, mrStrm.readInt32(), maCurrCell.mnXfId );
+ setSharedStringCell( maCurrCell.mxCell, rStrm.readInt32(), maCurrCell.mnXfId );
setCellFormat( maCurrCell );
}
-void BiffSheetDataContext::importMultBlank()
+void BiffSheetDataContext::importMultBlank( BiffInputStream& rStrm )
{
BinAddress aAddr;
- for( mrStrm >> aAddr; mrStrm.getRemaining() > 2; ++aAddr.mnCol )
+ for( rStrm >> aAddr; rStrm.getRemaining() > 2; ++aAddr.mnCol )
{
setCurrCell( aAddr );
- importXfId( false );
+ importXfId( rStrm, false );
setCellFormat( maCurrCell );
}
}
-void BiffSheetDataContext::importMultRk()
+void BiffSheetDataContext::importMultRk( BiffInputStream& rStrm )
{
BinAddress aAddr;
- for( mrStrm >> aAddr; mrStrm.getRemaining() > 2; ++aAddr.mnCol )
+ for( rStrm >> aAddr; rStrm.getRemaining() > 2; ++aAddr.mnCol )
{
setCurrCell( aAddr );
maCurrCell.mnCellType = XML_n;
- importXfId( false );
- sal_Int32 nRkValue = mrStrm.readInt32();
+ importXfId( rStrm, false );
+ sal_Int32 nRkValue = rStrm.readInt32();
if( maCurrCell.mxCell.is() )
maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( nRkValue ) );
setCellFormat( maCurrCell );
}
}
-void BiffSheetDataContext::importNumber()
+void BiffSheetDataContext::importNumber( BiffInputStream& rStrm )
{
- importCellHeader( mrStrm.getRecId() == BIFF2_ID_NUMBER );
+ importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_NUMBER );
maCurrCell.mnCellType = XML_n;
if( maCurrCell.mxCell.is() )
- maCurrCell.mxCell->setValue( mrStrm.readDouble() );
+ maCurrCell.mxCell->setValue( rStrm.readDouble() );
setCellFormat( maCurrCell );
}
-void BiffSheetDataContext::importRk()
+void BiffSheetDataContext::importRk( BiffInputStream& rStrm )
{
- importCellHeader( false );
+ importCellHeader( rStrm, false );
maCurrCell.mnCellType = XML_n;
if( maCurrCell.mxCell.is() )
- maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( mrStrm.readInt32() ) );
+ maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) );
setCellFormat( maCurrCell );
}
-void BiffSheetDataContext::importRow()
+void BiffSheetDataContext::importRow( BiffInputStream& rStrm )
{
RowModel aModel;
sal_uInt16 nRow, nHeight;
- mrStrm >> nRow;
- mrStrm.skip( 4 );
- mrStrm >> nHeight;
+ rStrm >> nRow;
+ rStrm.skip( 4 );
+ rStrm >> nHeight;
if( getBiff() == BIFF2 )
{
- mrStrm.skip( 2 );
- aModel.mbCustomFormat = mrStrm.readuInt8() == BIFF2_ROW_CUSTOMFORMAT;
+ rStrm.skip( 2 );
+ aModel.mbCustomFormat = rStrm.readuInt8() == BIFF2_ROW_CUSTOMFORMAT;
if( aModel.mbCustomFormat )
{
- mrStrm.skip( 5 );
- aModel.mnXfId = mrStrm.readuInt16();
+ rStrm.skip( 5 );
+ aModel.mnXfId = rStrm.readuInt16();
}
}
else
{
- mrStrm.skip( 4 );
- sal_uInt32 nFlags = mrStrm.readuInt32();
+ rStrm.skip( 4 );
+ sal_uInt32 nFlags = rStrm.readuInt32();
aModel.mnXfId = extractValue< sal_Int32 >( nFlags, 16, 12 );
aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 0, 3 );
aModel.mbCustomFormat = getFlag( nFlags, BIFF_ROW_CUSTOMFORMAT );
@@ -924,52 +915,52 @@ void BiffSheetDataContext::importRow()
setRowModel( aModel );
}
-void BiffSheetDataContext::importArray()
+void BiffSheetDataContext::importArray( BiffInputStream& rStrm )
{
BinRange aRange;
- aRange.read( mrStrm, false ); // columns always 8-bit
+ aRange.read( rStrm, false ); // columns always 8-bit
CellRangeAddress aArrayRange;
Reference< XCellRange > xRange = getCellRange( aRange, &aArrayRange );
Reference< XArrayFormulaTokens > xTokens( xRange, UNO_QUERY );
if( xRange.is() && xTokens.is() )
{
- mrStrm.skip( mnArrayIgnoreSize );
+ rStrm.skip( mnArrayIgnoreSize );
ArrayFormulaContext aContext( xTokens, aArrayRange );
- getFormulaParser().importFormula( aContext, mrStrm );
+ getFormulaParser().importFormula( aContext, rStrm );
}
}
-void BiffSheetDataContext::importSharedFmla()
+void BiffSheetDataContext::importSharedFmla( BiffInputStream& rStrm )
{
- getSharedFormulas().importSharedFmla( mrStrm, maCurrCell.maAddress );
+ getSharedFormulas().importSharedFmla( rStrm, maCurrCell.maAddress );
}
-void BiffSheetDataContext::importDataTable()
+void BiffSheetDataContext::importDataTable( BiffInputStream& rStrm )
{
BinRange aRange;
- aRange.read( mrStrm, false ); // columns always 8-bit
+ aRange.read( rStrm, false ); // columns always 8-bit
CellRangeAddress aTableRange;
if( getAddressConverter().convertToCellRange( aTableRange, aRange, getSheetIndex(), true, true ) )
{
DataTableModel aModel;
BinAddress aRef1, aRef2;
- switch( mrStrm.getRecId() )
+ switch( rStrm.getRecId() )
{
case BIFF2_ID_DATATABLE:
- mrStrm.skip( 1 );
- aModel.mbRowTable = mrStrm.readuInt8() != 0;
+ rStrm.skip( 1 );
+ aModel.mbRowTable = rStrm.readuInt8() != 0;
aModel.mb2dTable = false;
- mrStrm >> aRef1;
+ rStrm >> aRef1;
break;
case BIFF2_ID_DATATABLE2:
- mrStrm.skip( 2 );
+ rStrm.skip( 2 );
aModel.mb2dTable = true;
- mrStrm >> aRef1 >> aRef2;
+ rStrm >> aRef1 >> aRef2;
break;
case BIFF3_ID_DATATABLE:
{
sal_uInt16 nFlags;
- mrStrm >> nFlags >> aRef1 >> aRef2;
+ rStrm >> nFlags >> aRef1 >> aRef2;
aModel.mbRowTable = getFlag( nFlags, BIFF_DATATABLE_ROW );
aModel.mb2dTable = getFlag( nFlags, BIFF_DATATABLE_2D );
aModel.mbRef1Deleted = getFlag( nFlags, BIFF_DATATABLE_REF1DEL );
@@ -989,4 +980,3 @@ void BiffSheetDataContext::importDataTable()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx
index 5a149961c0e2..56c26d8b9f67 100644
--- a/oox/source/xls/stylesbuffer.cxx
+++ b/oox/source/xls/stylesbuffer.cxx
@@ -26,8 +26,7 @@
************************************************************************/
#include "oox/xls/stylesbuffer.hxx"
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
+
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/FontFamily.hpp>
#include <com/sun/star/awt/FontPitch.hpp>
@@ -38,56 +37,51 @@
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/awt/XFont2.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/XText.hpp>
#include <rtl/tencinfo.h>
#include <rtl/ustrbuf.hxx>
-#include "properties.hxx"
+#include "oox/core/filterbase.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/condformatbuffer.hxx"
#include "oox/xls/excelhandlers.hxx"
#include "oox/xls/themebuffer.hxx"
#include "oox/xls/unitconverter.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-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::container::XIndexAccess;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNamed;
-using ::com::sun::star::awt::FontDescriptor;
-using ::com::sun::star::awt::XDevice;
-using ::com::sun::star::awt::XFont2;
-using ::com::sun::star::table::BorderLine;
-using ::com::sun::star::table::TableBorder;
-using ::com::sun::star::text::XText;
-using ::com::sun::star::style::XStyle;
-using ::oox::core::FilterBase;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::FilterBase;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
// OOXML constants ------------------------------------------------------------
-// OOX predefined color indexes (also used in BIFF3-BIFF8)
-const sal_Int32 OOX_COLOR_USEROFFSET = 0; /// First user defined color in palette (OOX).
-const sal_Int32 BIFF_COLOR_USEROFFSET = 8; /// First user defined color in palette (BIFF).
+// OOXML predefined color indexes (also used in BIFF3-BIFF8)
+const sal_Int32 OOX_COLOR_USEROFFSET = 0; /// First user defined color in palette (OOXML/BIFF12).
+const sal_Int32 BIFF_COLOR_USEROFFSET = 8; /// First user defined color in palette (BIFF3-BIFF8).
-// OOX font family (also used in BIFF)
+// OOXML font family (also used in BIFF)
const sal_Int32 OOX_FONTFAMILY_NONE = 0;
const sal_Int32 OOX_FONTFAMILY_ROMAN = 1;
const sal_Int32 OOX_FONTFAMILY_SWISS = 2;
@@ -95,102 +89,102 @@ const sal_Int32 OOX_FONTFAMILY_MODERN = 3;
const sal_Int32 OOX_FONTFAMILY_SCRIPT = 4;
const sal_Int32 OOX_FONTFAMILY_DECORATIVE = 5;
-// OOX cell text direction (also used in BIFF)
+// OOXML cell text direction (also used in BIFF)
const sal_Int32 OOX_XF_TEXTDIR_CONTEXT = 0;
const sal_Int32 OOX_XF_TEXTDIR_LTR = 1;
const sal_Int32 OOX_XF_TEXTDIR_RTL = 2;
-// OOX cell rotation (also used in BIFF)
+// OOXML cell rotation (also used in BIFF)
const sal_Int32 OOX_XF_ROTATION_NONE = 0;
const sal_Int32 OOX_XF_ROTATION_90CCW = 90;
const sal_Int32 OOX_XF_ROTATION_90CW = 180;
const sal_Int32 OOX_XF_ROTATION_STACKED = 255;
-// OOX cell indentation
+// OOXML cell indentation
const sal_Int32 OOX_XF_INDENT_NONE = 0;
-// OOX built-in cell styles (also used in BIFF)
+// OOXML built-in cell styles (also used in BIFF)
const sal_Int32 OOX_STYLE_NORMAL = 0; /// Default cell style.
const sal_Int32 OOX_STYLE_ROWLEVEL = 1; /// RowLevel_x cell style.
const sal_Int32 OOX_STYLE_COLLEVEL = 2; /// ColLevel_x cell style.
const sal_Int32 OOX_STYLE_LEVELCOUNT = 7; /// Number of outline level styles.
-// OOBIN constants ------------------------------------------------------------
-
-// OOBIN color types
-const sal_uInt8 OOBIN_COLOR_AUTO = 0;
-const sal_uInt8 OOBIN_COLOR_INDEXED = 1;
-const sal_uInt8 OOBIN_COLOR_RGB = 2;
-const sal_uInt8 OOBIN_COLOR_THEME = 3;
-
-// OOBIN diagonal borders
-const sal_uInt8 OOBIN_BORDER_DIAG_TLBR = 0x01; /// Top-left to bottom-right.
-const sal_uInt8 OOBIN_BORDER_DIAG_BLTR = 0x02; /// Bottom-left to top-right.
-
-// OOBIN gradient fill
-const sal_Int32 OOBIN_FILL_GRADIENT = 40;
-
-// OOBIN XF flags
-const sal_uInt32 OOBIN_XF_WRAPTEXT = 0x00400000;
-const sal_uInt32 OOBIN_XF_JUSTLASTLINE = 0x00800000;
-const sal_uInt32 OOBIN_XF_SHRINK = 0x01000000;
-const sal_uInt32 OOBIN_XF_LOCKED = 0x10000000;
-const sal_uInt32 OOBIN_XF_HIDDEN = 0x20000000;
-
-// OOBIN XF attribute used flags
-const sal_uInt16 OOBIN_XF_NUMFMT_USED = 0x0001;
-const sal_uInt16 OOBIN_XF_FONT_USED = 0x0002;
-const sal_uInt16 OOBIN_XF_ALIGN_USED = 0x0004;
-const sal_uInt16 OOBIN_XF_BORDER_USED = 0x0008;
-const sal_uInt16 OOBIN_XF_AREA_USED = 0x0010;
-const sal_uInt16 OOBIN_XF_PROT_USED = 0x0020;
-
-// OOBIN DXF constants
-const sal_uInt16 OOBIN_DXF_FILL_PATTERN = 0;
-const sal_uInt16 OOBIN_DXF_FILL_FGCOLOR = 1;
-const sal_uInt16 OOBIN_DXF_FILL_BGCOLOR = 2;
-const sal_uInt16 OOBIN_DXF_FILL_GRADIENT = 3;
-const sal_uInt16 OOBIN_DXF_FILL_STOP = 4;
-const sal_uInt16 OOBIN_DXF_FONT_COLOR = 5;
-const sal_uInt16 OOBIN_DXF_BORDER_TOP = 6;
-const sal_uInt16 OOBIN_DXF_BORDER_BOTTOM = 7;
-const sal_uInt16 OOBIN_DXF_BORDER_LEFT = 8;
-const sal_uInt16 OOBIN_DXF_BORDER_RIGHT = 9;
-const sal_uInt16 OOBIN_DXF_BORDER_DIAG = 10;
-const sal_uInt16 OOBIN_DXF_BORDER_VERT = 11;
-const sal_uInt16 OOBIN_DXF_BORDER_HOR = 12;
-const sal_uInt16 OOBIN_DXF_BORDER_DIAGUP = 13;
-const sal_uInt16 OOBIN_DXF_BORDER_DIAGDOWN = 14;
-const sal_uInt16 OOBIN_DXF_FONT_NAME = 24;
-const sal_uInt16 OOBIN_DXF_FONT_WEIGHT = 25;
-const sal_uInt16 OOBIN_DXF_FONT_UNDERLINE = 26;
-const sal_uInt16 OOBIN_DXF_FONT_ESCAPEMENT = 27;
-const sal_uInt16 OOBIN_DXF_FONT_ITALIC = 28;
-const sal_uInt16 OOBIN_DXF_FONT_STRIKE = 29;
-const sal_uInt16 OOBIN_DXF_FONT_OUTLINE = 30;
-const sal_uInt16 OOBIN_DXF_FONT_SHADOW = 31;
-const sal_uInt16 OOBIN_DXF_FONT_CONDENSE = 32;
-const sal_uInt16 OOBIN_DXF_FONT_EXTEND = 33;
-const sal_uInt16 OOBIN_DXF_FONT_CHARSET = 34;
-const sal_uInt16 OOBIN_DXF_FONT_FAMILY = 35;
-const sal_uInt16 OOBIN_DXF_FONT_HEIGHT = 36;
-const sal_uInt16 OOBIN_DXF_FONT_SCHEME = 37;
-const sal_uInt16 OOBIN_DXF_NUMFMT_CODE = 38;
-const sal_uInt16 OOBIN_DXF_NUMFMT_ID = 41;
-
-// OOBIN CELLSTYLE flags
-const sal_uInt16 OOBIN_CELLSTYLE_BUILTIN = 0x0001;
-const sal_uInt16 OOBIN_CELLSTYLE_HIDDEN = 0x0002;
-const sal_uInt16 OOBIN_CELLSTYLE_CUSTOM = 0x0004;
-
-// OOBIN and BIFF constants ---------------------------------------------------
+// BIFF12 constants -----------------------------------------------------------
+
+// BIFF12 color types
+const sal_uInt8 BIFF12_COLOR_AUTO = 0;
+const sal_uInt8 BIFF12_COLOR_INDEXED = 1;
+const sal_uInt8 BIFF12_COLOR_RGB = 2;
+const sal_uInt8 BIFF12_COLOR_THEME = 3;
+
+// BIFF12 diagonal borders
+const sal_uInt8 BIFF12_BORDER_DIAG_TLBR = 0x01; /// Top-left to bottom-right.
+const sal_uInt8 BIFF12_BORDER_DIAG_BLTR = 0x02; /// Bottom-left to top-right.
+
+// BIFF12 gradient fill
+const sal_Int32 BIFF12_FILL_GRADIENT = 40;
+
+// BIFF12 XF flags
+const sal_uInt32 BIFF12_XF_WRAPTEXT = 0x00400000;
+const sal_uInt32 BIFF12_XF_JUSTLASTLINE = 0x00800000;
+const sal_uInt32 BIFF12_XF_SHRINK = 0x01000000;
+const sal_uInt32 BIFF12_XF_LOCKED = 0x10000000;
+const sal_uInt32 BIFF12_XF_HIDDEN = 0x20000000;
+
+// BIFF12 XF attribute used flags
+const sal_uInt16 BIFF12_XF_NUMFMT_USED = 0x0001;
+const sal_uInt16 BIFF12_XF_FONT_USED = 0x0002;
+const sal_uInt16 BIFF12_XF_ALIGN_USED = 0x0004;
+const sal_uInt16 BIFF12_XF_BORDER_USED = 0x0008;
+const sal_uInt16 BIFF12_XF_AREA_USED = 0x0010;
+const sal_uInt16 BIFF12_XF_PROT_USED = 0x0020;
+
+// BIFF12 DXF constants
+const sal_uInt16 BIFF12_DXF_FILL_PATTERN = 0;
+const sal_uInt16 BIFF12_DXF_FILL_FGCOLOR = 1;
+const sal_uInt16 BIFF12_DXF_FILL_BGCOLOR = 2;
+const sal_uInt16 BIFF12_DXF_FILL_GRADIENT = 3;
+const sal_uInt16 BIFF12_DXF_FILL_STOP = 4;
+const sal_uInt16 BIFF12_DXF_FONT_COLOR = 5;
+const sal_uInt16 BIFF12_DXF_BORDER_TOP = 6;
+const sal_uInt16 BIFF12_DXF_BORDER_BOTTOM = 7;
+const sal_uInt16 BIFF12_DXF_BORDER_LEFT = 8;
+const sal_uInt16 BIFF12_DXF_BORDER_RIGHT = 9;
+const sal_uInt16 BIFF12_DXF_BORDER_DIAG = 10;
+const sal_uInt16 BIFF12_DXF_BORDER_VERT = 11;
+const sal_uInt16 BIFF12_DXF_BORDER_HOR = 12;
+const sal_uInt16 BIFF12_DXF_BORDER_DIAGUP = 13;
+const sal_uInt16 BIFF12_DXF_BORDER_DIAGDOWN = 14;
+const sal_uInt16 BIFF12_DXF_FONT_NAME = 24;
+const sal_uInt16 BIFF12_DXF_FONT_WEIGHT = 25;
+const sal_uInt16 BIFF12_DXF_FONT_UNDERLINE = 26;
+const sal_uInt16 BIFF12_DXF_FONT_ESCAPEMENT = 27;
+const sal_uInt16 BIFF12_DXF_FONT_ITALIC = 28;
+const sal_uInt16 BIFF12_DXF_FONT_STRIKE = 29;
+const sal_uInt16 BIFF12_DXF_FONT_OUTLINE = 30;
+const sal_uInt16 BIFF12_DXF_FONT_SHADOW = 31;
+const sal_uInt16 BIFF12_DXF_FONT_CONDENSE = 32;
+const sal_uInt16 BIFF12_DXF_FONT_EXTEND = 33;
+const sal_uInt16 BIFF12_DXF_FONT_CHARSET = 34;
+const sal_uInt16 BIFF12_DXF_FONT_FAMILY = 35;
+const sal_uInt16 BIFF12_DXF_FONT_HEIGHT = 36;
+const sal_uInt16 BIFF12_DXF_FONT_SCHEME = 37;
+const sal_uInt16 BIFF12_DXF_NUMFMT_CODE = 38;
+const sal_uInt16 BIFF12_DXF_NUMFMT_ID = 41;
+
+// BIFF12 CELLSTYLE flags
+const sal_uInt16 BIFF12_CELLSTYLE_BUILTIN = 0x0001;
+const sal_uInt16 BIFF12_CELLSTYLE_HIDDEN = 0x0002;
+const sal_uInt16 BIFF12_CELLSTYLE_CUSTOM = 0x0004;
+
+// BIFF constants -------------------------------------------------------------
// BIFF predefined color indexes
const sal_uInt16 BIFF2_COLOR_BLACK = 0; /// Black (text) in BIFF2.
const sal_uInt16 BIFF2_COLOR_WHITE = 1; /// White (background) in BIFF2.
-// BIFF font flags, also used in OOBIN
+// BIFF font flags, also used in BIFF12
const sal_uInt16 BIFF_FONTFLAG_BOLD = 0x0001;
const sal_uInt16 BIFF_FONTFLAG_ITALIC = 0x0002;
const sal_uInt16 BIFF_FONTFLAG_UNDERLINE = 0x0004;
@@ -202,7 +196,7 @@ const sal_uInt16 BIFF_FONTFLAG_CONDENSE = 0x0040;
// BIFF font weight
const sal_uInt16 BIFF_FONTWEIGHT_BOLD = 450;
-// BIFF font underline, also used in OOBIN
+// BIFF font underline, also used in BIFF12
const sal_uInt8 BIFF_FONTUNDERL_NONE = 0;
const sal_uInt8 BIFF_FONTUNDERL_SINGLE = 1;
const sal_uInt8 BIFF_FONTUNDERL_DOUBLE = 2;
@@ -306,14 +300,14 @@ sal_Int32 lclReadRgbColor( BinaryInputStream& rStrm )
// ============================================================================
ExcelGraphicHelper::ExcelGraphicHelper( const WorkbookHelper& rHelper ) :
- GraphicHelper( rHelper.getGlobalFactory(), rHelper.getBaseFilter().getTargetFrame(), rHelper.getBaseFilter().getStorage() ),
+ GraphicHelper( rHelper.getBaseFilter().getComponentContext(), rHelper.getBaseFilter().getTargetFrame(), rHelper.getBaseFilter().getStorage() ),
WorkbookHelper( rHelper )
{
}
sal_Int32 ExcelGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
{
- if( getFilterType() == FILTER_OOX )
+ if( getFilterType() == FILTER_OOXML )
return getTheme().getColorByToken( nToken );
return GraphicHelper::getSchemeColor( nToken );
}
@@ -372,7 +366,7 @@ void Color::importColor( const AttributeList& rAttribs )
}
}
-void Color::importColor( RecordInputStream& rStrm )
+void Color::importColor( SequenceInputStream& rStrm )
{
sal_uInt8 nFlags, nIndex;
sal_Int16 nTint;
@@ -387,18 +381,18 @@ void Color::importColor( RecordInputStream& rStrm )
switch( extractValue< sal_uInt8 >( nFlags, 1, 7 ) )
{
- case OOBIN_COLOR_AUTO:
+ case BIFF12_COLOR_AUTO:
setAuto();
rStrm.skip( 4 );
break;
- case OOBIN_COLOR_INDEXED:
+ case BIFF12_COLOR_INDEXED:
setIndexed( nIndex, fTint );
rStrm.skip( 4 );
break;
- case OOBIN_COLOR_RGB:
+ case BIFF12_COLOR_RGB:
setRgb( lclReadRgbColor( rStrm ), fTint );
break;
- case OOBIN_COLOR_THEME:
+ case BIFF12_COLOR_THEME:
setTheme( nIndex, fTint );
rStrm.skip( 4 );
break;
@@ -409,12 +403,12 @@ void Color::importColor( RecordInputStream& rStrm )
}
}
-void Color::importColorId( RecordInputStream& rStrm )
+void Color::importColorId( SequenceInputStream& rStrm )
{
setIndexed( rStrm.readInt32() );
}
-void Color::importColorRgb( RecordInputStream& rStrm )
+void Color::importColorRgb( SequenceInputStream& rStrm )
{
setRgb( lclReadRgbColor( rStrm ) );
}
@@ -429,7 +423,7 @@ void Color::importColorRgb( BiffInputStream& rStrm )
setRgb( lclReadRgbColor( rStrm ) );
}
-RecordInputStream& operator>>( RecordInputStream& rStrm, Color& orColor )
+SequenceInputStream& operator>>( SequenceInputStream& rStrm, Color& orColor )
{
orColor.importColor( rStrm );
return rStrm;
@@ -473,7 +467,7 @@ static const sal_Int32 spnDefColors5[] =
/* 56 */ 0x1D2FBE, 0x286676, 0x004500, 0x453E01, 0x6A2813, 0x85396A, 0x4A3285, 0x424242
};
-/** Default color table for BIFF8/OOX. */
+/** Default color table for BIFF8/BIFF12/OOXML. */
static const sal_Int32 spnDefColors8[] =
{
/* 0 */ PALETTE_EGA_COLORS_LIGHT,
@@ -499,7 +493,7 @@ ColorPalette::ColorPalette( const WorkbookHelper& rHelper ) :
// default colors
switch( getFilterType() )
{
- case FILTER_OOX:
+ case FILTER_OOXML:
maColors.insert( maColors.begin(), spnDefColors8, STATIC_ARRAY_END( spnDefColors8 ) );
mnAppendIndex = OOX_COLOR_USEROFFSET;
break;
@@ -524,7 +518,7 @@ void ColorPalette::importPaletteColor( const AttributeList& rAttribs )
appendColor( rAttribs.getIntegerHex( XML_rgb, API_RGB_WHITE ) );
}
-void ColorPalette::importPaletteColor( RecordInputStream& rStrm )
+void ColorPalette::importPaletteColor( SequenceInputStream& rStrm )
{
sal_Int32 nRgb = lclReadRgbColor( rStrm );
appendColor( nRgb & 0xFFFFFF );
@@ -545,6 +539,18 @@ void ColorPalette::importPalette( BiffInputStream& rStrm )
}
}
+void ColorPalette::importPalette( const Any& rPalette )
+{
+ Sequence< sal_Int32 > rColorSeq;
+ if( (rPalette >>= rColorSeq) && rColorSeq.hasElements() )
+ {
+ const sal_Int32* pnColor = rColorSeq.getConstArray();
+ const sal_Int32* pnColorEnd = pnColor + rColorSeq.getLength();
+ for( ; pnColor < pnColorEnd; ++pnColor )
+ appendColor( *pnColor & 0xFFFFFF );
+ }
+}
+
sal_Int32 ColorPalette::getColor( sal_Int32 nPaletteIdx ) const
{
sal_Int32 nColor = API_RGB_TRANSPARENT;
@@ -617,7 +623,7 @@ FontModel::FontModel() :
{
}
-void FontModel::setBinScheme( sal_uInt8 nScheme )
+void FontModel::setBiff12Scheme( sal_uInt8 nScheme )
{
static const sal_Int32 spnSchemes[] = { XML_none, XML_major, XML_minor };
mnScheme = STATIC_ARRAY_SELECT( spnSchemes, nScheme, XML_none );
@@ -785,7 +791,7 @@ void Font::importAttribs( sal_Int32 nElement, const AttributeList& rAttribs )
}
}
-void Font::importFont( RecordInputStream& rStrm )
+void Font::importFont( SequenceInputStream& rStrm )
{
OSL_ENSURE( !mbDxf, "Font::importFont - unexpected conditional formatting flag" );
@@ -795,71 +801,71 @@ void Font::importFont( RecordInputStream& rStrm )
rStrm.skip( 1 );
rStrm >> maModel.maColor >> nScheme >> maModel.maName;
- // equal constants in BIFF and OOBIN for weight, underline, and escapement
- maModel.setBinScheme( nScheme );
+ // equal constants in all BIFFs for weight, underline, and escapement
+ maModel.setBiff12Scheme( nScheme );
maModel.setBiffHeight( nHeight );
maModel.setBiffWeight( nWeight );
maModel.setBiffUnderline( nUnderline );
maModel.setBiffEscapement( nEscapement );
maModel.mnFamily = nFamily;
maModel.mnCharSet = nCharSet;
- // equal flags in BIFF and OOBIN
+ // equal flags in all BIFFs
maModel.mbItalic = getFlag( nFlags, BIFF_FONTFLAG_ITALIC );
maModel.mbStrikeout = getFlag( nFlags, BIFF_FONTFLAG_STRIKEOUT );
maModel.mbOutline = getFlag( nFlags, BIFF_FONTFLAG_OUTLINE );
maModel.mbShadow = getFlag( nFlags, BIFF_FONTFLAG_SHADOW );
}
-void Font::importDxfName( RecordInputStream& rStrm )
+void Font::importDxfName( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfName - missing conditional formatting flag" );
- maModel.maName = rStrm.readString( false );
+ maModel.maName = BiffHelper::readString( rStrm, false );
maUsedFlags.mbColorUsed = true;
}
-void Font::importDxfColor( RecordInputStream& rStrm )
+void Font::importDxfColor( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfColor - missing conditional formatting flag" );
rStrm >> maModel.maColor;
maUsedFlags.mbColorUsed = true;
}
-void Font::importDxfScheme( RecordInputStream& rStrm )
+void Font::importDxfScheme( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfScheme - missing conditional formatting flag" );
- maModel.setBinScheme( rStrm.readuInt8() );
+ maModel.setBiff12Scheme( rStrm.readuInt8() );
maUsedFlags.mbSchemeUsed = true;
}
-void Font::importDxfHeight( RecordInputStream& rStrm )
+void Font::importDxfHeight( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfHeight - missing conditional formatting flag" );
maModel.setBiffHeight( rStrm.readuInt16() );
maUsedFlags.mbHeightUsed = true;
}
-void Font::importDxfWeight( RecordInputStream& rStrm )
+void Font::importDxfWeight( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfWeight - missing conditional formatting flag" );
maModel.setBiffWeight( rStrm.readuInt16() );
maUsedFlags.mbWeightUsed = true;
}
-void Font::importDxfUnderline( RecordInputStream& rStrm )
+void Font::importDxfUnderline( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfUnderline - missing conditional formatting flag" );
maModel.setBiffUnderline( rStrm.readuInt16() );
maUsedFlags.mbUnderlineUsed = true;
}
-void Font::importDxfEscapement( RecordInputStream& rStrm )
+void Font::importDxfEscapement( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfEscapement - missing conditional formatting flag" );
maModel.setBiffEscapement( rStrm.readuInt16() );
maUsedFlags.mbEscapementUsed = true;
}
-void Font::importDxfFlag( sal_Int32 nElement, RecordInputStream& rStrm )
+void Font::importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfFlag - missing conditional formatting flag" );
bool bFlag = rStrm.readuInt8() != 0;
@@ -1039,7 +1045,8 @@ void Font::finalizeImport()
// supported script types
if( maUsedFlags.mbNameUsed )
{
- Reference< XDevice > xDevice = getReferenceDevice();
+ PropertySet aDocProps( getDocument() );
+ Reference< XDevice > xDevice( aDocProps.getAnyProperty( PROP_ReferenceDevice ), UNO_QUERY );
if( xDevice.is() )
{
Reference< XFont2 > xFont( xDevice->getFont( maApiData.maDesc ), UNO_QUERY );
@@ -1226,7 +1233,7 @@ AlignmentModel::AlignmentModel() :
{
}
-void AlignmentModel::setBinHorAlign( sal_uInt8 nHorAlign )
+void AlignmentModel::setBiffHorAlign( sal_uInt8 nHorAlign )
{
static const sal_Int32 spnHorAligns[] = {
XML_general, XML_left, XML_center, XML_right,
@@ -1234,14 +1241,14 @@ void AlignmentModel::setBinHorAlign( sal_uInt8 nHorAlign )
mnHorAlign = STATIC_ARRAY_SELECT( spnHorAligns, nHorAlign, XML_general );
}
-void AlignmentModel::setBinVerAlign( sal_uInt8 nVerAlign )
+void AlignmentModel::setBiffVerAlign( sal_uInt8 nVerAlign )
{
static const sal_Int32 spnVerAligns[] = {
XML_top, XML_center, XML_bottom, XML_justify, XML_distributed };
mnVerAlign = STATIC_ARRAY_SELECT( spnVerAligns, nVerAlign, XML_bottom );
}
-void AlignmentModel::setBinTextOrient( sal_uInt8 nTextOrient )
+void AlignmentModel::setBiffTextOrient( sal_uInt8 nTextOrient )
{
static const sal_Int32 spnRotations[] = {
OOX_XF_ROTATION_NONE, OOX_XF_ROTATION_STACKED,
@@ -1295,49 +1302,49 @@ void Alignment::importAlignment( const AttributeList& rAttribs )
maModel.mbJustLastLine = rAttribs.getBool( XML_justifyLastLine, false );
}
-void Alignment::setBinData( sal_uInt32 nFlags )
+void Alignment::setBiff12Data( sal_uInt32 nFlags )
{
- maModel.setBinHorAlign( extractValue< sal_uInt8 >( nFlags, 16, 3 ) );
- maModel.setBinVerAlign( extractValue< sal_uInt8 >( nFlags, 19, 3 ) );
+ maModel.setBiffHorAlign( extractValue< sal_uInt8 >( nFlags, 16, 3 ) );
+ maModel.setBiffVerAlign( extractValue< sal_uInt8 >( nFlags, 19, 3 ) );
maModel.mnTextDir = extractValue< sal_Int32 >( nFlags, 26, 2 );
maModel.mnRotation = extractValue< sal_Int32 >( nFlags, 0, 8 );
maModel.mnIndent = extractValue< sal_uInt8 >( nFlags, 8, 8 );
- maModel.mbWrapText = getFlag( nFlags, OOBIN_XF_WRAPTEXT );
- maModel.mbShrink = getFlag( nFlags, OOBIN_XF_SHRINK );
- maModel.mbJustLastLine = getFlag( nFlags, OOBIN_XF_JUSTLASTLINE );
+ maModel.mbWrapText = getFlag( nFlags, BIFF12_XF_WRAPTEXT );
+ maModel.mbShrink = getFlag( nFlags, BIFF12_XF_SHRINK );
+ maModel.mbJustLastLine = getFlag( nFlags, BIFF12_XF_JUSTLASTLINE );
}
void Alignment::setBiff2Data( sal_uInt8 nFlags )
{
- maModel.setBinHorAlign( extractValue< sal_uInt8 >( nFlags, 0, 3 ) );
+ maModel.setBiffHorAlign( extractValue< sal_uInt8 >( nFlags, 0, 3 ) );
}
void Alignment::setBiff3Data( sal_uInt16 nAlign )
{
- maModel.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
+ maModel.setBiffHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
maModel.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT ); // new in BIFF3
}
void Alignment::setBiff4Data( sal_uInt16 nAlign )
{
- maModel.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
- maModel.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 2 ) ); // new in BIFF4
- maModel.setBinTextOrient( extractValue< sal_uInt8 >( nAlign, 6, 2 ) ); // new in BIFF4
+ maModel.setBiffHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
+ maModel.setBiffVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 2 ) ); // new in BIFF4
+ maModel.setBiffTextOrient( extractValue< sal_uInt8 >( nAlign, 6, 2 ) ); // new in BIFF4
maModel.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT );
}
void Alignment::setBiff5Data( sal_uInt16 nAlign )
{
- maModel.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
- maModel.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 3 ) );
- maModel.setBinTextOrient( extractValue< sal_uInt8 >( nAlign, 8, 2 ) );
+ maModel.setBiffHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
+ maModel.setBiffVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 3 ) );
+ maModel.setBiffTextOrient( extractValue< sal_uInt8 >( nAlign, 8, 2 ) );
maModel.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT );
}
void Alignment::setBiff8Data( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib )
{
- maModel.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
- maModel.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 3 ) );
+ maModel.setBiffHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
+ maModel.setBiffVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 3 ) );
maModel.mnTextDir = extractValue< sal_Int32 >( nMiscAttrib, 6, 2 ); // new in BIFF8
maModel.mnRotation = extractValue< sal_Int32 >( nAlign, 8, 8 ); // new in BIFF8
maModel.mnIndent = extractValue< sal_uInt8 >( nMiscAttrib, 0, 4 ); // new in BIFF8
@@ -1375,11 +1382,11 @@ void Alignment::finalizeImport()
}
/* indentation: expressed as number of blocks of 3 space characters in
- OOX, and as multiple of 10 points in BIFF. */
+ OOXML/BIFF12, and as multiple of 10 points in BIFF8. */
sal_Int32 nIndent = 0;
switch( getFilterType() )
{
- case FILTER_OOX: nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, UNIT_SPACE ); break;
+ case FILTER_OOXML: nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, UNIT_SPACE ); break;
case FILTER_BIFF: nIndent = getUnitConverter().scaleToMm100( 10.0 * maModel.mnIndent, UNIT_POINT ); break;
case FILTER_UNKNOWN: break;
}
@@ -1459,10 +1466,10 @@ void Protection::importProtection( const AttributeList& rAttribs )
maModel.mbHidden = rAttribs.getBool( XML_hidden, false );
}
-void Protection::setBinData( sal_uInt32 nFlags )
+void Protection::setBiff12Data( sal_uInt32 nFlags )
{
- maModel.mbLocked = getFlag( nFlags, OOBIN_XF_LOCKED );
- maModel.mbHidden = getFlag( nFlags, OOBIN_XF_HIDDEN );
+ maModel.mbLocked = getFlag( nFlags, BIFF12_XF_LOCKED );
+ maModel.mbHidden = getFlag( nFlags, BIFF12_XF_HIDDEN );
}
void Protection::setBiff2Data( sal_uInt8 nNumFmt )
@@ -1645,11 +1652,11 @@ void Border::importColor( sal_Int32 nElement, const AttributeList& rAttribs )
pBorderLine->maColor.importColor( rAttribs );
}
-void Border::importBorder( RecordInputStream& rStrm )
+void Border::importBorder( SequenceInputStream& rStrm )
{
sal_uInt8 nFlags = rStrm.readuInt8();
- maModel.mbDiagTLtoBR = getFlag( nFlags, OOBIN_BORDER_DIAG_TLBR );
- maModel.mbDiagBLtoTR = getFlag( nFlags, OOBIN_BORDER_DIAG_BLTR );
+ maModel.mbDiagTLtoBR = getFlag( nFlags, BIFF12_BORDER_DIAG_TLBR );
+ maModel.mbDiagBLtoTR = getFlag( nFlags, BIFF12_BORDER_DIAG_BLTR );
maModel.maTop.setBiffStyle( rStrm.readuInt16() );
rStrm >> maModel.maTop.maColor;
maModel.maBottom.setBiffStyle( rStrm.readuInt16() );
@@ -1662,7 +1669,7 @@ void Border::importBorder( RecordInputStream& rStrm )
rStrm >> maModel.maDiagonal.maColor;
}
-void Border::importDxfBorder( sal_Int32 nElement, RecordInputStream& rStrm )
+void Border::importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Border::importDxfBorder - missing conditional formatting flag" );
if( BorderLineModel* pBorderLine = getBorderLine( nElement ) )
@@ -1823,7 +1830,7 @@ PatternFillModel::PatternFillModel( bool bDxf ) :
maFillColor.setIndexed( OOX_COLOR_WINDOWBACK );
}
-void PatternFillModel::setBinPattern( sal_Int32 nPattern )
+void PatternFillModel::setBiffPattern( sal_Int32 nPattern )
{
static const sal_Int32 spnPatternIds[] = {
XML_none, XML_solid, XML_mediumGray, XML_darkGray,
@@ -1838,8 +1845,8 @@ void PatternFillModel::setBiffData( sal_uInt16 nPatternColor, sal_uInt16 nFillCo
{
maPatternColor.setIndexed( nPatternColor );
maFillColor.setIndexed( nFillColor );
- // patterns equal in BIFF and OOBIN
- setBinPattern( nPattern );
+ // patterns equal in all BIFFs
+ setBiffPattern( nPattern );
}
// ----------------------------------------------------------------------------
@@ -1854,7 +1861,7 @@ GradientFillModel::GradientFillModel() :
{
}
-void GradientFillModel::readGradient( RecordInputStream& rStrm )
+void GradientFillModel::readGradient( SequenceInputStream& rStrm )
{
sal_Int32 nType;
rStrm >> nType >> mfAngle >> mfLeft >> mfRight >> mfTop >> mfBottom;
@@ -1862,7 +1869,7 @@ void GradientFillModel::readGradient( RecordInputStream& rStrm )
mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
}
-void GradientFillModel::readGradientStop( RecordInputStream& rStrm, bool bDxf )
+void GradientFillModel::readGradientStop( SequenceInputStream& rStrm, bool bDxf )
{
Color aColor;
double fPosition;
@@ -1969,11 +1976,11 @@ void Fill::importColor( const AttributeList& rAttribs, double fPosition )
mxGradientModel->maColors[ fPosition ].importColor( rAttribs );
}
-void Fill::importFill( RecordInputStream& rStrm )
+void Fill::importFill( SequenceInputStream& rStrm )
{
OSL_ENSURE( !mbDxf, "Fill::importFill - unexpected conditional formatting flag" );
sal_Int32 nPattern = rStrm.readInt32();
- if( nPattern == OOBIN_FILL_GRADIENT )
+ if( nPattern == BIFF12_FILL_GRADIENT )
{
mxGradientModel.reset( new GradientFillModel );
sal_Int32 nStopCount;
@@ -1986,21 +1993,21 @@ void Fill::importFill( RecordInputStream& rStrm )
else
{
mxPatternModel.reset( new PatternFillModel( mbDxf ) );
- mxPatternModel->setBinPattern( nPattern );
+ mxPatternModel->setBiffPattern( nPattern );
rStrm >> mxPatternModel->maPatternColor >> mxPatternModel->maFillColor;
}
}
-void Fill::importDxfPattern( RecordInputStream& rStrm )
+void Fill::importDxfPattern( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfPattern - missing conditional formatting flag" );
if( !mxPatternModel )
mxPatternModel.reset( new PatternFillModel( mbDxf ) );
- mxPatternModel->setBinPattern( rStrm.readuInt8() );
+ mxPatternModel->setBiffPattern( rStrm.readuInt8() );
mxPatternModel->mbPatternUsed = true;
}
-void Fill::importDxfFgColor( RecordInputStream& rStrm )
+void Fill::importDxfFgColor( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfFgColor - missing conditional formatting flag" );
if( !mxPatternModel )
@@ -2009,7 +2016,7 @@ void Fill::importDxfFgColor( RecordInputStream& rStrm )
mxPatternModel->mbPattColorUsed = true;
}
-void Fill::importDxfBgColor( RecordInputStream& rStrm )
+void Fill::importDxfBgColor( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfBgColor - missing conditional formatting flag" );
if( !mxPatternModel )
@@ -2018,7 +2025,7 @@ void Fill::importDxfBgColor( RecordInputStream& rStrm )
mxPatternModel->mbFillColorUsed = true;
}
-void Fill::importDxfGradient( RecordInputStream& rStrm )
+void Fill::importDxfGradient( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfGradient - missing conditional formatting flag" );
if( !mxGradientModel )
@@ -2026,7 +2033,7 @@ void Fill::importDxfGradient( RecordInputStream& rStrm )
mxGradientModel->readGradient( rStrm );
}
-void Fill::importDxfStop( RecordInputStream& rStrm )
+void Fill::importDxfStop( SequenceInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfStop - missing conditional formatting flag" );
if( !mxGradientModel )
@@ -2096,7 +2103,7 @@ void Fill::finalizeImport()
if( mxPatternModel.get() )
{
- // finalize the OOX data struct
+ // finalize the OOXML data struct
PatternFillModel& rModel = *mxPatternModel;
if( mbDxf )
{
@@ -2248,7 +2255,7 @@ void Xf::importProtection( const AttributeList& rAttribs )
maProtection.importProtection( rAttribs );
}
-void Xf::importXf( RecordInputStream& rStrm, bool bCellXf )
+void Xf::importXf( SequenceInputStream& rStrm, bool bCellXf )
{
maModel.mbCellXf = bCellXf;
maModel.mnStyleXfId = rStrm.readuInt16();
@@ -2257,16 +2264,16 @@ void Xf::importXf( RecordInputStream& rStrm, bool bCellXf )
maModel.mnFillId = rStrm.readuInt16();
maModel.mnBorderId = rStrm.readuInt16();
sal_uInt32 nFlags = rStrm.readuInt32();
- maAlignment.setBinData( nFlags );
- maProtection.setBinData( nFlags );
+ maAlignment.setBiff12Data( nFlags );
+ maProtection.setBiff12Data( nFlags );
// used flags, see comments in Xf::setBiffUsedFlags()
sal_uInt16 nUsedFlags = rStrm.readuInt16();
- maModel.mbFontUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_FONT_USED );
- maModel.mbNumFmtUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_NUMFMT_USED );
- maModel.mbAlignUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_ALIGN_USED );
- maModel.mbProtUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_PROT_USED );
- maModel.mbBorderUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_BORDER_USED );
- maModel.mbAreaUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_AREA_USED );
+ maModel.mbFontUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_FONT_USED );
+ maModel.mbNumFmtUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_NUMFMT_USED );
+ maModel.mbAlignUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_ALIGN_USED );
+ maModel.mbProtUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_PROT_USED );
+ maModel.mbBorderUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_BORDER_USED );
+ maModel.mbAreaUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF12_XF_AREA_USED );
}
void Xf::importXf( BiffInputStream& rStrm )
@@ -2539,7 +2546,7 @@ void Dxf::importProtection( const AttributeList& rAttribs )
mxProtection->importProtection( rAttribs );
}
-void Dxf::importDxf( RecordInputStream& rStrm )
+void Dxf::importDxf( SequenceInputStream& rStrm )
{
sal_Int32 nNumFmtId = -1;
OUString aFmtCode;
@@ -2554,28 +2561,28 @@ void Dxf::importDxf( RecordInputStream& rStrm )
nRecEnd += nSubRecSize;
switch( nSubRecId )
{
- case OOBIN_DXF_FILL_PATTERN: createFill( false )->importDxfPattern( rStrm ); break;
- case OOBIN_DXF_FILL_FGCOLOR: createFill( false )->importDxfFgColor( rStrm ); break;
- case OOBIN_DXF_FILL_BGCOLOR: createFill( false )->importDxfBgColor( rStrm ); break;
- case OOBIN_DXF_FILL_GRADIENT: createFill( false )->importDxfGradient( rStrm ); break;
- case OOBIN_DXF_FILL_STOP: createFill( false )->importDxfStop( rStrm ); break;
- case OOBIN_DXF_FONT_COLOR: createFont( false )->importDxfColor( rStrm ); break;
- case OOBIN_DXF_BORDER_TOP: createBorder( false )->importDxfBorder( XLS_TOKEN( top ), rStrm ); break;
- case OOBIN_DXF_BORDER_BOTTOM: createBorder( false )->importDxfBorder( XLS_TOKEN( bottom ), rStrm ); break;
- case OOBIN_DXF_BORDER_LEFT: createBorder( false )->importDxfBorder( XLS_TOKEN( left ), rStrm ); break;
- case OOBIN_DXF_BORDER_RIGHT: createBorder( false )->importDxfBorder( XLS_TOKEN( right ), rStrm ); break;
- case OOBIN_DXF_FONT_NAME: createFont( false )->importDxfName( rStrm ); break;
- case OOBIN_DXF_FONT_WEIGHT: createFont( false )->importDxfWeight( rStrm ); break;
- case OOBIN_DXF_FONT_UNDERLINE: createFont( false )->importDxfUnderline( rStrm ); break;
- case OOBIN_DXF_FONT_ESCAPEMENT: createFont( false )->importDxfEscapement( rStrm ); break;
- case OOBIN_DXF_FONT_ITALIC: createFont( false )->importDxfFlag( XML_i, rStrm ); break;
- case OOBIN_DXF_FONT_STRIKE: createFont( false )->importDxfFlag( XML_strike, rStrm ); break;
- case OOBIN_DXF_FONT_OUTLINE: createFont( false )->importDxfFlag( XML_outline, rStrm ); break;
- case OOBIN_DXF_FONT_SHADOW: createFont( false )->importDxfFlag( XML_shadow, rStrm ); break;
- case OOBIN_DXF_FONT_HEIGHT: createFont( false )->importDxfHeight( rStrm ); break;
- case OOBIN_DXF_FONT_SCHEME: createFont( false )->importDxfScheme( rStrm ); break;
- case OOBIN_DXF_NUMFMT_CODE: aFmtCode = rStrm.readString( false ); break;
- case OOBIN_DXF_NUMFMT_ID: nNumFmtId = rStrm.readuInt16(); break;
+ case BIFF12_DXF_FILL_PATTERN: createFill( false )->importDxfPattern( rStrm ); break;
+ case BIFF12_DXF_FILL_FGCOLOR: createFill( false )->importDxfFgColor( rStrm ); break;
+ case BIFF12_DXF_FILL_BGCOLOR: createFill( false )->importDxfBgColor( rStrm ); break;
+ case BIFF12_DXF_FILL_GRADIENT: createFill( false )->importDxfGradient( rStrm ); break;
+ case BIFF12_DXF_FILL_STOP: createFill( false )->importDxfStop( rStrm ); break;
+ case BIFF12_DXF_FONT_COLOR: createFont( false )->importDxfColor( rStrm ); break;
+ case BIFF12_DXF_BORDER_TOP: createBorder( false )->importDxfBorder( XLS_TOKEN( top ), rStrm ); break;
+ case BIFF12_DXF_BORDER_BOTTOM: createBorder( false )->importDxfBorder( XLS_TOKEN( bottom ), rStrm ); break;
+ case BIFF12_DXF_BORDER_LEFT: createBorder( false )->importDxfBorder( XLS_TOKEN( left ), rStrm ); break;
+ case BIFF12_DXF_BORDER_RIGHT: createBorder( false )->importDxfBorder( XLS_TOKEN( right ), rStrm ); break;
+ case BIFF12_DXF_FONT_NAME: createFont( false )->importDxfName( rStrm ); break;
+ case BIFF12_DXF_FONT_WEIGHT: createFont( false )->importDxfWeight( rStrm ); break;
+ case BIFF12_DXF_FONT_UNDERLINE: createFont( false )->importDxfUnderline( rStrm ); break;
+ case BIFF12_DXF_FONT_ESCAPEMENT: createFont( false )->importDxfEscapement( rStrm ); break;
+ case BIFF12_DXF_FONT_ITALIC: createFont( false )->importDxfFlag( XML_i, rStrm ); break;
+ case BIFF12_DXF_FONT_STRIKE: createFont( false )->importDxfFlag( XML_strike, rStrm ); break;
+ case BIFF12_DXF_FONT_OUTLINE: createFont( false )->importDxfFlag( XML_outline, rStrm ); break;
+ case BIFF12_DXF_FONT_SHADOW: createFont( false )->importDxfFlag( XML_shadow, rStrm ); break;
+ case BIFF12_DXF_FONT_HEIGHT: createFont( false )->importDxfHeight( rStrm ); break;
+ case BIFF12_DXF_FONT_SCHEME: createFont( false )->importDxfScheme( rStrm ); break;
+ case BIFF12_DXF_NUMFMT_CODE: aFmtCode = BiffHelper::readString( rStrm, false ); break;
+ case BIFF12_DXF_NUMFMT_ID: nNumFmtId = rStrm.readuInt16(); break;
}
rStrm.seek( nRecEnd );
}
@@ -2844,16 +2851,16 @@ void CellStyle::importCellStyle( const AttributeList& rAttribs )
maModel.mbHidden = rAttribs.getBool( XML_hidden, false );
}
-void CellStyle::importCellStyle( RecordInputStream& rStrm )
+void CellStyle::importCellStyle( SequenceInputStream& rStrm )
{
sal_uInt16 nFlags;
rStrm >> maModel.mnXfId >> nFlags;
maModel.mnBuiltinId = rStrm.readInt8();
maModel.mnLevel = rStrm.readInt8();
rStrm >> maModel.maName;
- maModel.mbBuiltin = getFlag( nFlags, OOBIN_CELLSTYLE_BUILTIN );
- maModel.mbCustom = getFlag( nFlags, OOBIN_CELLSTYLE_CUSTOM );
- maModel.mbHidden = getFlag( nFlags, OOBIN_CELLSTYLE_HIDDEN );
+ maModel.mbBuiltin = getFlag( nFlags, BIFF12_CELLSTYLE_BUILTIN );
+ maModel.mbCustom = getFlag( nFlags, BIFF12_CELLSTYLE_CUSTOM );
+ maModel.mbHidden = getFlag( nFlags, BIFF12_CELLSTYLE_HIDDEN );
}
void CellStyle::importStyle( BiffInputStream& rStrm )
@@ -2945,7 +2952,7 @@ CellStyleRef CellStyleBuffer::importCellStyle( const AttributeList& rAttribs )
return xCellStyle;
}
-CellStyleRef CellStyleBuffer::importCellStyle( RecordInputStream& rStrm )
+CellStyleRef CellStyleBuffer::importCellStyle( SequenceInputStream& rStrm )
{
CellStyleRef xCellStyle( new CellStyle( *this ) );
xCellStyle->importCellStyle( rStrm );
@@ -3093,6 +3100,19 @@ OUString CellStyleBuffer::createCellStyle( const CellStyleRef& rxCellStyle ) con
// ============================================================================
+AutoFormatModel::AutoFormatModel() :
+ mnAutoFormatId( 0 ),
+ mbApplyNumFmt( false ),
+ mbApplyFont( false ),
+ mbApplyAlignment( false ),
+ mbApplyBorder( false ),
+ mbApplyFill( false ),
+ mbApplyProtection( false )
+{
+}
+
+// ============================================================================
+
StylesBuffer::StylesBuffer( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
maPalette( rHelper ),
@@ -3169,17 +3189,17 @@ CellStyleRef StylesBuffer::importCellStyle( const AttributeList& rAttribs )
return maCellStyles.importCellStyle( rAttribs );
}
-void StylesBuffer::importPaletteColor( RecordInputStream& rStrm )
+void StylesBuffer::importPaletteColor( SequenceInputStream& rStrm )
{
maPalette.importPaletteColor( rStrm );
}
-void StylesBuffer::importNumFmt( RecordInputStream& rStrm )
+void StylesBuffer::importNumFmt( SequenceInputStream& rStrm )
{
maNumFmts.importNumFmt( rStrm );
}
-void StylesBuffer::importCellStyle( RecordInputStream& rStrm )
+void StylesBuffer::importCellStyle( SequenceInputStream& rStrm )
{
maCellStyles.importCellStyle( rStrm );
}
@@ -3236,6 +3256,11 @@ void StylesBuffer::importStyle( BiffInputStream& rStrm )
maCellStyles.importStyle( rStrm );
}
+void StylesBuffer::importPalette( const Any& rPalette )
+{
+ maPalette.importPalette( rPalette );
+}
+
void StylesBuffer::finalizeImport()
{
// fonts first, are needed to finalize unit converter and XFs below
@@ -3319,7 +3344,7 @@ bool StylesBuffer::equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) co
switch( getFilterType() )
{
- case FILTER_OOX:
+ case FILTER_OOXML:
// in OOXML, borders are assumed to be unique
return false;
@@ -3344,7 +3369,7 @@ bool StylesBuffer::equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) const
switch( getFilterType() )
{
- case FILTER_OOX:
+ case FILTER_OOXML:
// in OOXML, fills are assumed to be unique
return false;
@@ -3444,4 +3469,3 @@ void StylesBuffer::writeStyleXfToPropertySet( PropertySet& rPropSet, sal_Int32 n
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/stylesfragment.cxx b/oox/source/xls/stylesfragment.cxx
index 217fce443209..c890196dc518 100644
--- a/oox/source/xls/stylesfragment.cxx
+++ b/oox/source/xls/stylesfragment.cxx
@@ -26,23 +26,26 @@
************************************************************************/
#include "oox/xls/stylesfragment.hxx"
-#include "oox/helper/attributelist.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
+#include "oox/helper/attributelist.hxx"
namespace oox {
namespace xls {
// ============================================================================
-OoxIndexedColorsContext::OoxIndexedColorsContext( OoxWorkbookFragmentBase& rFragment ) :
- OoxWorkbookContextBase( rFragment )
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+IndexedColorsContext::IndexedColorsContext( WorkbookFragmentBase& rFragment ) :
+ WorkbookContextBase( rFragment )
{
}
-ContextHandlerRef OoxIndexedColorsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef IndexedColorsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -53,12 +56,12 @@ ContextHandlerRef OoxIndexedColorsContext::onCreateContext( sal_Int32 nElement,
return 0;
}
-ContextHandlerRef OoxIndexedColorsContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef IndexedColorsContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
- case OOBIN_ID_INDEXEDCOLORS:
- if( nRecId == OOBIN_ID_RGBCOLOR ) getStyles().importPaletteColor( rStrm );
+ case BIFF12_ID_INDEXEDCOLORS:
+ if( nRecId == BIFF12_ID_RGBCOLOR ) getStyles().importPaletteColor( rStrm );
break;
}
return 0;
@@ -66,7 +69,7 @@ ContextHandlerRef OoxIndexedColorsContext::onCreateRecordContext( sal_Int32 nRec
// ============================================================================
-ContextHandlerRef OoxFontContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef FontContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( mxFont.get() )
mxFont->importAttribs( nElement, rAttribs );
@@ -75,13 +78,13 @@ ContextHandlerRef OoxFontContext::onCreateContext( sal_Int32 nElement, const Att
// ============================================================================
-void OoxBorderContext::onStartElement( const AttributeList& rAttribs )
+void BorderContext::onStartElement( const AttributeList& rAttribs )
{
if( mxBorder.get() && (getCurrentElement() == XLS_TOKEN( border )) )
mxBorder->importBorder( rAttribs );
}
-ContextHandlerRef OoxBorderContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef BorderContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( mxBorder.get() ) switch( getCurrentElement() )
{
@@ -98,7 +101,7 @@ ContextHandlerRef OoxBorderContext::onCreateContext( sal_Int32 nElement, const A
// ============================================================================
-ContextHandlerRef OoxFillContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef FillContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( mxFill.get() ) switch( getCurrentElement() )
{
@@ -133,13 +136,13 @@ ContextHandlerRef OoxFillContext::onCreateContext( sal_Int32 nElement, const Att
// ============================================================================
-void OoxXfContext::onStartElement( const AttributeList& rAttribs )
+void XfContext::onStartElement( const AttributeList& rAttribs )
{
if( mxXf.get() && (getCurrentElement() == XLS_TOKEN( xf )) )
mxXf->importXf( rAttribs, mbCellXf );
}
-ContextHandlerRef OoxXfContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef XfContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( mxXf.get() ) switch( getCurrentElement() )
{
@@ -156,16 +159,16 @@ ContextHandlerRef OoxXfContext::onCreateContext( sal_Int32 nElement, const Attri
// ============================================================================
-ContextHandlerRef OoxDxfContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef DxfContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( mxDxf.get() ) switch( getCurrentElement() )
{
case XLS_TOKEN( dxf ):
switch( nElement )
{
- case XLS_TOKEN( font ): return new OoxFontContext( *this, mxDxf->createFont() );
- case XLS_TOKEN( border ): return new OoxBorderContext( *this, mxDxf->createBorder() );
- case XLS_TOKEN( fill ): return new OoxFillContext( *this, mxDxf->createFill() );
+ case XLS_TOKEN( font ): return new FontContext( *this, mxDxf->createFont() );
+ case XLS_TOKEN( border ): return new BorderContext( *this, mxDxf->createBorder() );
+ case XLS_TOKEN( fill ): return new FillContext( *this, mxDxf->createFill() );
case XLS_TOKEN( numFmt ): mxDxf->importNumFmt( rAttribs ); break;
#if 0
@@ -180,14 +183,12 @@ ContextHandlerRef OoxDxfContext::onCreateContext( sal_Int32 nElement, const Attr
// ============================================================================
-OoxStylesFragment::OoxStylesFragment( const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath )
+StylesFragment::StylesFragment( const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
+ WorkbookFragmentBase( rHelper, rFragmentPath )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxStylesFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef StylesFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -211,28 +212,28 @@ ContextHandlerRef OoxStylesFragment::onCreateContext( sal_Int32 nElement, const
break;
case XLS_TOKEN( colors ):
- if( nElement == XLS_TOKEN( indexedColors ) ) return new OoxIndexedColorsContext( *this );
+ if( nElement == XLS_TOKEN( indexedColors ) ) return new IndexedColorsContext( *this );
break;
case XLS_TOKEN( numFmts ):
if( nElement == XLS_TOKEN( numFmt ) ) getStyles().importNumFmt( rAttribs );
break;
case XLS_TOKEN( fonts ):
- if( nElement == XLS_TOKEN( font ) ) return new OoxFontContext( *this, getStyles().createFont() );
+ if( nElement == XLS_TOKEN( font ) ) return new FontContext( *this, getStyles().createFont() );
break;
case XLS_TOKEN( borders ):
- if( nElement == XLS_TOKEN( border ) ) return new OoxBorderContext( *this, getStyles().createBorder() );
+ if( nElement == XLS_TOKEN( border ) ) return new BorderContext( *this, getStyles().createBorder() );
break;
case XLS_TOKEN( fills ):
- if( nElement == XLS_TOKEN( fill ) ) return new OoxFillContext( *this, getStyles().createFill() );
+ if( nElement == XLS_TOKEN( fill ) ) return new FillContext( *this, getStyles().createFill() );
break;
case XLS_TOKEN( cellXfs ):
- if( nElement == XLS_TOKEN( xf ) ) return new OoxXfContext( *this, getStyles().createCellXf(), true );
+ if( nElement == XLS_TOKEN( xf ) ) return new XfContext( *this, getStyles().createCellXf(), true );
break;
case XLS_TOKEN( cellStyleXfs ):
- if( nElement == XLS_TOKEN( xf ) ) return new OoxXfContext( *this, getStyles().createStyleXf(), false );
+ if( nElement == XLS_TOKEN( xf ) ) return new XfContext( *this, getStyles().createStyleXf(), false );
break;
case XLS_TOKEN( dxfs ):
- if( nElement == XLS_TOKEN( dxf ) ) return new OoxDxfContext( *this, getStyles().createDxf() );
+ if( nElement == XLS_TOKEN( dxf ) ) return new DxfContext( *this, getStyles().createDxf() );
break;
case XLS_TOKEN( cellStyles ):
if( nElement == XLS_TOKEN( cellStyle ) ) getStyles().importCellStyle( rAttribs );
@@ -241,85 +242,83 @@ ContextHandlerRef OoxStylesFragment::onCreateContext( sal_Int32 nElement, const
return 0;
}
-ContextHandlerRef OoxStylesFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef StylesFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_STYLESHEET ) return this;
+ if( nRecId == BIFF12_ID_STYLESHEET ) return this;
break;
- case OOBIN_ID_STYLESHEET:
+ case BIFF12_ID_STYLESHEET:
switch( nRecId )
{
- case OOBIN_ID_COLORS:
- case OOBIN_ID_NUMFMTS:
- case OOBIN_ID_FONTS:
- case OOBIN_ID_BORDERS:
- case OOBIN_ID_FILLS:
- case OOBIN_ID_CELLXFS:
- case OOBIN_ID_CELLSTYLEXFS:
- case OOBIN_ID_DXFS:
- case OOBIN_ID_CELLSTYLES: return this;
+ case BIFF12_ID_COLORS:
+ case BIFF12_ID_NUMFMTS:
+ case BIFF12_ID_FONTS:
+ case BIFF12_ID_BORDERS:
+ case BIFF12_ID_FILLS:
+ case BIFF12_ID_CELLXFS:
+ case BIFF12_ID_CELLSTYLEXFS:
+ case BIFF12_ID_DXFS:
+ case BIFF12_ID_CELLSTYLES: return this;
}
break;
- case OOBIN_ID_COLORS:
- if( nRecId == OOBIN_ID_INDEXEDCOLORS ) return new OoxIndexedColorsContext( *this );
+ case BIFF12_ID_COLORS:
+ if( nRecId == BIFF12_ID_INDEXEDCOLORS ) return new IndexedColorsContext( *this );
break;
- case OOBIN_ID_NUMFMTS:
- if( nRecId == OOBIN_ID_NUMFMT ) getStyles().importNumFmt( rStrm );
+ case BIFF12_ID_NUMFMTS:
+ if( nRecId == BIFF12_ID_NUMFMT ) getStyles().importNumFmt( rStrm );
break;
- case OOBIN_ID_FONTS:
- if( nRecId == OOBIN_ID_FONT ) getStyles().createFont()->importFont( rStrm );
+ case BIFF12_ID_FONTS:
+ if( nRecId == BIFF12_ID_FONT ) getStyles().createFont()->importFont( rStrm );
break;
- case OOBIN_ID_BORDERS:
- if( nRecId == OOBIN_ID_BORDER ) getStyles().createBorder()->importBorder( rStrm );
+ case BIFF12_ID_BORDERS:
+ if( nRecId == BIFF12_ID_BORDER ) getStyles().createBorder()->importBorder( rStrm );
break;
- case OOBIN_ID_FILLS:
- if( nRecId == OOBIN_ID_FILL ) getStyles().createFill()->importFill( rStrm );
+ case BIFF12_ID_FILLS:
+ if( nRecId == BIFF12_ID_FILL ) getStyles().createFill()->importFill( rStrm );
break;
- case OOBIN_ID_CELLXFS:
- if( nRecId == OOBIN_ID_XF ) getStyles().createCellXf()->importXf( rStrm, true );
+ case BIFF12_ID_CELLXFS:
+ if( nRecId == BIFF12_ID_XF ) getStyles().createCellXf()->importXf( rStrm, true );
break;
- case OOBIN_ID_CELLSTYLEXFS:
- if( nRecId == OOBIN_ID_XF ) getStyles().createStyleXf()->importXf( rStrm, false );
+ case BIFF12_ID_CELLSTYLEXFS:
+ if( nRecId == BIFF12_ID_XF ) getStyles().createStyleXf()->importXf( rStrm, false );
break;
- case OOBIN_ID_DXFS:
- if( nRecId == OOBIN_ID_DXF ) getStyles().createDxf()->importDxf( rStrm );
+ case BIFF12_ID_DXFS:
+ if( nRecId == BIFF12_ID_DXF ) getStyles().createDxf()->importDxf( rStrm );
break;
- case OOBIN_ID_CELLSTYLES:
- if( nRecId == OOBIN_ID_CELLSTYLE ) getStyles().importCellStyle( rStrm );
+ case BIFF12_ID_CELLSTYLES:
+ if( nRecId == BIFF12_ID_CELLSTYLE ) getStyles().importCellStyle( rStrm );
break;
}
return 0;
}
-// oox.core.FragmentHandler2 interface ----------------------------------------
-
-const RecordInfo* OoxStylesFragment::getRecordInfos() const
+const RecordInfo* StylesFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_BORDERS, OOBIN_ID_BORDERS + 1 },
- { OOBIN_ID_CELLSTYLES, OOBIN_ID_CELLSTYLES + 1 },
- { OOBIN_ID_CELLSTYLEXFS, OOBIN_ID_CELLSTYLEXFS + 1 },
- { OOBIN_ID_CELLXFS, OOBIN_ID_CELLXFS + 1 },
- { OOBIN_ID_COLORS, OOBIN_ID_COLORS + 1 },
- { OOBIN_ID_DXFS, OOBIN_ID_DXFS + 1 },
- { OOBIN_ID_FILLS, OOBIN_ID_FILLS + 1 },
- { OOBIN_ID_FONTS, OOBIN_ID_FONTS + 1 },
- { OOBIN_ID_INDEXEDCOLORS, OOBIN_ID_INDEXEDCOLORS + 1 },
- { OOBIN_ID_MRUCOLORS, OOBIN_ID_MRUCOLORS + 1 },
- { OOBIN_ID_NUMFMTS, OOBIN_ID_NUMFMTS + 1 },
- { OOBIN_ID_STYLESHEET, OOBIN_ID_STYLESHEET + 1 },
- { OOBIN_ID_TABLESTYLES, OOBIN_ID_TABLESTYLES + 1 },
+ { BIFF12_ID_BORDERS, BIFF12_ID_BORDERS + 1 },
+ { BIFF12_ID_CELLSTYLES, BIFF12_ID_CELLSTYLES + 1 },
+ { BIFF12_ID_CELLSTYLEXFS, BIFF12_ID_CELLSTYLEXFS + 1 },
+ { BIFF12_ID_CELLXFS, BIFF12_ID_CELLXFS + 1 },
+ { BIFF12_ID_COLORS, BIFF12_ID_COLORS + 1 },
+ { BIFF12_ID_DXFS, BIFF12_ID_DXFS + 1 },
+ { BIFF12_ID_FILLS, BIFF12_ID_FILLS + 1 },
+ { BIFF12_ID_FONTS, BIFF12_ID_FONTS + 1 },
+ { BIFF12_ID_INDEXEDCOLORS, BIFF12_ID_INDEXEDCOLORS + 1 },
+ { BIFF12_ID_MRUCOLORS, BIFF12_ID_MRUCOLORS + 1 },
+ { BIFF12_ID_NUMFMTS, BIFF12_ID_NUMFMTS + 1 },
+ { BIFF12_ID_STYLESHEET, BIFF12_ID_STYLESHEET + 1 },
+ { BIFF12_ID_TABLESTYLES, BIFF12_ID_TABLESTYLES + 1 },
{ -1, -1 }
};
return spRecInfos;
}
-void OoxStylesFragment::finalizeImport()
+void StylesFragment::finalizeImport()
{
getStyles().finalizeImport();
}
@@ -328,4 +327,3 @@ void OoxStylesFragment::finalizeImport()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/tablebuffer.cxx b/oox/source/xls/tablebuffer.cxx
index 452df7a1171a..91fad31e6ee4 100644
--- a/oox/source/xls/tablebuffer.cxx
+++ b/oox/source/xls/tablebuffer.cxx
@@ -26,28 +26,26 @@
************************************************************************/
#include "oox/xls/tablebuffer.hxx"
-#include <com/sun/star/sheet/XDatabaseRanges.hpp>
+
#include <com/sun/star/sheet/XDatabaseRange.hpp>
-#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/helper/containerhelper.hxx"
+#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::sheet::XDatabaseRanges;
-using ::com::sun::star::sheet::XDatabaseRange;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
TableModel::TableModel() :
mnId( -1 ),
mnType( XML_worksheet ),
@@ -60,6 +58,7 @@ TableModel::TableModel() :
Table::Table( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
+ maAutoFilters( rHelper ),
mnTokenIndex( -1 )
{
}
@@ -75,7 +74,7 @@ void Table::importTable( const AttributeList& rAttribs, sal_Int16 nSheet )
maModel.mnTotalsRows = rAttribs.getInteger( XML_totalsRowCount, 0 );
}
-void Table::importTable( RecordInputStream& rStrm, sal_Int16 nSheet )
+void Table::importTable( SequenceInputStream& rStrm, sal_Int16 nSheet )
{
BinRange aBinRange;
sal_Int32 nType;
@@ -90,22 +89,20 @@ void Table::importTable( RecordInputStream& rStrm, sal_Int16 nSheet )
void Table::finalizeImport()
{
- // validate cell range
- maDestRange = maModel.maRange;
- bool bValidRange = getAddressConverter().validateCellRange( maDestRange, true, true );
-
// create database range
- if( bValidRange && (maModel.mnId > 0) && (maModel.maDisplayName.getLength() > 0) ) try
+ if( (maModel.mnId > 0) && (maModel.maDisplayName.getLength() > 0) ) try
{
- // find an unused name
- Reference< XDatabaseRanges > xDatabaseRanges = getDatabaseRanges();
- Reference< XNameAccess > xNameAccess( xDatabaseRanges, UNO_QUERY_THROW );
- OUString aName = ContainerHelper::getUnusedName( xNameAccess, maModel.maDisplayName, '_' );
- xDatabaseRanges->addNewByName( aName, maModel.maRange );
- Reference< XDatabaseRange > xDatabaseRange( xDatabaseRanges->getByName( aName ), UNO_QUERY_THROW );
+ maDBRangeName = maModel.maDisplayName;
+ Reference< XDatabaseRange > xDatabaseRange( createDatabaseRangeObject( maDBRangeName, maModel.maRange ), UNO_SET_THROW );
+ maDestRange = xDatabaseRange->getDataArea();
+
+ // get formula token index of the database range
PropertySet aPropSet( xDatabaseRange );
if( !aPropSet.getProperty( mnTokenIndex, PROP_TokenIndex ) )
mnTokenIndex = -1;
+
+ // filter settings
+ maAutoFilters.finalizeImport( xDatabaseRange );
}
catch( Exception& )
{
@@ -120,24 +117,19 @@ TableBuffer::TableBuffer( const WorkbookHelper& rHelper ) :
{
}
-TableRef TableBuffer::importTable( const AttributeList& rAttribs, sal_Int16 nSheet )
+Table& TableBuffer::createTable()
{
- TableRef xTable( new Table( *this ) );
- xTable->importTable( rAttribs, nSheet );
- insertTable( xTable );
- return xTable;
-}
-
-TableRef TableBuffer::importTable( RecordInputStream& rStrm, sal_Int16 nSheet )
-{
- TableRef xTable( new Table( *this ) );
- xTable->importTable( rStrm, nSheet );
- insertTable( xTable );
- return xTable;
+ TableVector::value_type xTable( new Table( *this ) );
+ maTables.push_back( xTable );
+ return *xTable;
}
void TableBuffer::finalizeImport()
{
+ // map all tables by identifier and display name
+ for( TableVector::iterator aIt = maTables.begin(), aEnd = maTables.end(); aIt != aEnd; ++aIt )
+ insertTableToMaps( *aIt );
+ // finalize all valid tables
maIdTables.forEachMem( &Table::finalizeImport );
}
@@ -153,16 +145,16 @@ TableRef TableBuffer::getTable( const OUString& rDispName ) const
// private --------------------------------------------------------------------
-void TableBuffer::insertTable( TableRef xTable )
+void TableBuffer::insertTableToMaps( const TableRef& rxTable )
{
- sal_Int32 nTableId = xTable->getTableId();
- const OUString& rDispName = xTable->getDisplayName();
+ sal_Int32 nTableId = rxTable->getTableId();
+ const OUString& rDispName = rxTable->getDisplayName();
if( (nTableId > 0) && (rDispName.getLength() > 0) )
{
- OSL_ENSURE( maIdTables.find( nTableId ) == maIdTables.end(), "TableBuffer::insertTable - multiple table identifier" );
- maIdTables[ nTableId ] = xTable;
- OSL_ENSURE( maNameTables.find( rDispName ) == maNameTables.end(), "TableBuffer::insertTable - multiple table name" );
- maNameTables[ rDispName ] = xTable;
+ OSL_ENSURE( !maIdTables.has( nTableId ), "TableBuffer::insertTableToMaps - multiple table identifier" );
+ maIdTables[ nTableId ] = rxTable;
+ OSL_ENSURE( !maNameTables.has( rDispName ), "TableBuffer::insertTableToMaps - multiple table name" );
+ maNameTables[ rDispName ] = rxTable;
}
}
@@ -170,4 +162,3 @@ void TableBuffer::insertTable( TableRef xTable )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/tablefragment.cxx b/oox/source/xls/tablefragment.cxx
index 800a45cd9530..37503f8577fb 100644
--- a/oox/source/xls/tablefragment.cxx
+++ b/oox/source/xls/tablefragment.cxx
@@ -27,54 +27,75 @@
#include "oox/xls/tablefragment.hxx"
-using ::rtl::OUString;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
+#include "oox/xls/autofilterbuffer.hxx"
+#include "oox/xls/autofiltercontext.hxx"
+#include "oox/xls/tablebuffer.hxx"
namespace oox {
namespace xls {
// ============================================================================
-OoxTableFragment::OoxTableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorksheetFragmentBase( rHelper, rFragmentPath )
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+TableFragment::TableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
+ WorksheetFragmentBase( rHelper, rFragmentPath ),
+ mrTable( getTables().createTable() )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef TableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
if( nElement == XLS_TOKEN( table ) )
- mxTable = getTables().importTable( rAttribs, getSheetIndex() );
+ {
+ mrTable.importTable( rAttribs, getSheetIndex() );
+ return this;
+ }
+ break;
+ case XLS_TOKEN( table ):
+ if( nElement == XLS_TOKEN( autoFilter ) )
+ return new AutoFilterContext( *this, mrTable.createAutoFilter() );
break;
}
return 0;
}
-ContextHandlerRef OoxTableFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef TableFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_TABLE )
- mxTable = getTables().importTable( rStrm, getSheetIndex() );
+ if( nRecId == BIFF12_ID_TABLE )
+ {
+ mrTable.importTable( rStrm, getSheetIndex() );
+ return this;
+ }
+ break;
+ case BIFF12_ID_TABLE:
+ if( nRecId == BIFF12_ID_AUTOFILTER )
+ return new AutoFilterContext( *this, mrTable.createAutoFilter() );
break;
}
return 0;
}
-// oox.core.FragmentHandler2 interface ----------------------------------------
-
-const RecordInfo* OoxTableFragment::getRecordInfos() const
+const RecordInfo* TableFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_TABLE, OOBIN_ID_TABLE + 1 },
- { -1, -1 }
+ { BIFF12_ID_AUTOFILTER, BIFF12_ID_AUTOFILTER + 1 },
+ { BIFF12_ID_CUSTOMFILTERS, BIFF12_ID_CUSTOMFILTERS + 1 },
+ { BIFF12_ID_DISCRETEFILTERS, BIFF12_ID_DISCRETEFILTERS + 1 },
+ { BIFF12_ID_FILTERCOLUMN, BIFF12_ID_FILTERCOLUMN + 1 },
+ { BIFF12_ID_TABLE, BIFF12_ID_TABLE + 1 },
+ { -1, -1 }
};
return spRecInfos;
}
@@ -83,4 +104,3 @@ const RecordInfo* OoxTableFragment::getRecordInfos() const
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/themebuffer.cxx b/oox/source/xls/themebuffer.cxx
index 23617287dc57..c3e016327133 100644
--- a/oox/source/xls/themebuffer.cxx
+++ b/oox/source/xls/themebuffer.cxx
@@ -26,16 +26,18 @@
************************************************************************/
#include "oox/xls/themebuffer.hxx"
-#include "oox/xls/stylesbuffer.hxx"
-#include "tokens.hxx"
-using ::oox::drawingml::ClrScheme;
+#include "oox/xls/stylesbuffer.hxx"
namespace oox {
namespace xls {
// ============================================================================
+using ::oox::drawingml::ClrScheme;
+
+// ============================================================================
+
namespace {
/** Specifies default theme fonts for a specific locale. */
@@ -91,7 +93,7 @@ ThemeBuffer::ThemeBuffer( const WorkbookHelper& rHelper ) :
{
switch( getFilterType() )
{
- case FILTER_OOX:
+ case FILTER_OOXML:
//! TODO: locale dependent font name
mxDefFontModel->maName = CREATE_OUSTRING( "Cambria" );
mxDefFontModel->mfHeight = 11.0;
@@ -119,4 +121,3 @@ sal_Int32 ThemeBuffer::getColorByToken( sal_Int32 nToken ) const
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/unitconverter.cxx b/oox/source/xls/unitconverter.cxx
index 170a1f66f2e2..1b5f1e9b072c 100644
--- a/oox/source/xls/unitconverter.cxx
+++ b/oox/source/xls/unitconverter.cxx
@@ -26,30 +26,31 @@
************************************************************************/
#include "oox/xls/unitconverter.hxx"
-#include <rtl/math.hxx>
+
+#include <com/sun/star/awt/DeviceInfo.hpp>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/XDevice.hpp>
-#include <com/sun/star/awt/DeviceInfo.hpp>
#include <com/sun/star/awt/XFont.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/DateTime.hpp>
+#include <rtl/math.hxx>
#include "oox/core/filterbase.hxx"
+#include "oox/helper/propertyset.hxx"
#include "oox/xls/stylesbuffer.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::awt::FontDescriptor;
-using ::com::sun::star::awt::XDevice;
-using ::com::sun::star::awt::DeviceInfo;
-using ::com::sun::star::awt::XFont;
-using ::com::sun::star::util::Date;
-using ::com::sun::star::util::DateTime;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
const double MM100_PER_INCH = 2540.0;
@@ -132,7 +133,8 @@ UnitConverter::UnitConverter( const WorkbookHelper& rHelper ) :
void UnitConverter::finalizeImport()
{
- Reference< XDevice > xDevice = getReferenceDevice();
+ PropertySet aDocProps( getDocument() );
+ Reference< XDevice > xDevice( aDocProps.getAnyProperty( PROP_ReferenceDevice ), UNO_QUERY );
if( xDevice.is() )
{
// get reference device metric first, needed to get character widths below
@@ -255,4 +257,3 @@ double UnitConverter::getCoefficient( Unit eUnit ) const
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/viewsettings.cxx b/oox/source/xls/viewsettings.cxx
index 05dfa7bf9f96..c9658dd41cf9 100644
--- a/oox/source/xls/viewsettings.cxx
+++ b/oox/source/xls/viewsettings.cxx
@@ -26,128 +26,121 @@
************************************************************************/
#include "oox/xls/viewsettings.hxx"
+
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/document/XViewDataSupplier.hpp>
-#include <com/sun/star/text/WritingMode2.hpp>
#include <comphelper/mediadescriptor.hxx>
-#include "properties.hxx"
+#include "oox/core/filterbase.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/unitconverter.hxx"
#include "oox/xls/workbooksettings.hxx"
#include "oox/xls/worksheetbuffer.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::container::XIndexContainer;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::document::XViewDataSupplier;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::oox::core::FilterBase;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
+using ::oox::core::FilterBase;
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
-const sal_Int32 OOX_BOOKVIEW_TABBARRATIO_DEF = 600; /// Default tabbar ratio.
-const sal_Int32 OOX_SHEETVIEW_NORMALZOOM_DEF = 100; /// Default zoom for normal view.
-const sal_Int32 OOX_SHEETVIEW_SHEETLAYZOOM_DEF = 60; /// Default zoom for pagebreak preview.
-const sal_Int32 OOX_SHEETVIEW_PAGELAYZOOM_DEF = 100; /// Default zoom for page layout view.
-
-const sal_uInt8 OOBIN_PANE_FROZEN = 0x01;
-const sal_uInt8 OOBIN_PANE_FROZENNOSPLIT = 0x02;
-
-const sal_uInt16 OOBIN_SHEETVIEW_WINPROTECTED = 0x0001;
-const sal_uInt16 OOBIN_SHEETVIEW_SHOWFORMULAS = 0x0002;
-const sal_uInt16 OOBIN_SHEETVIEW_SHOWGRID = 0x0004;
-const sal_uInt16 OOBIN_SHEETVIEW_SHOWHEADINGS = 0x0008;
-const sal_uInt16 OOBIN_SHEETVIEW_SHOWZEROS = 0x0010;
-const sal_uInt16 OOBIN_SHEETVIEW_RIGHTTOLEFT = 0x0020;
-const sal_uInt16 OOBIN_SHEETVIEW_SELECTED = 0x0040;
-const sal_uInt16 OOBIN_SHEETVIEW_SHOWRULER = 0x0080;
-const sal_uInt16 OOBIN_SHEETVIEW_SHOWOUTLINE = 0x0100;
-const sal_uInt16 OOBIN_SHEETVIEW_DEFGRIDCOLOR = 0x0200;
-const sal_uInt16 OOBIN_SHEETVIEW_SHOWWHITESPACE = 0x0400;
-
-const sal_uInt16 OOBIN_CHARTSHEETVIEW_SELECTED = 0x0001;
-const sal_uInt16 OOBIN_CHARTSHEETVIEW_ZOOMTOFIT = 0x0002;
-
-const sal_uInt8 OOBIN_WBVIEW_HIDDEN = 0x01;
-const sal_uInt8 OOBIN_WBVIEW_MINIMIZED = 0x02;
-const sal_uInt8 OOBIN_WBVIEW_SHOWHORSCROLL = 0x08;
-const sal_uInt8 OOBIN_WBVIEW_SHOWVERSCROLL = 0x10;
-const sal_uInt8 OOBIN_WBVIEW_SHOWTABBAR = 0x20;
-const sal_uInt8 OOBIN_WBVIEW_AUTOFILTERGROUP = 0x40;
-
-const sal_uInt8 BIFF_PANE_BOTTOMRIGHT = 0; /// Bottom-right pane.
-const sal_uInt8 BIFF_PANE_TOPRIGHT = 1; /// Right, or top-right pane.
-const sal_uInt8 BIFF_PANE_BOTTOMLEFT = 2; /// Bottom, or bottom-left pane.
-const sal_uInt8 BIFF_PANE_TOPLEFT = 3; /// Single, top, left, or top-left pane.
-
-const sal_uInt16 BIFF_WINDOW1_HIDDEN = 0x0001;
-const sal_uInt16 BIFF_WINDOW1_MINIMIZED = 0x0002;
-const sal_uInt16 BIFF_WINDOW1_SHOWHORSCROLL = 0x0008;
-const sal_uInt16 BIFF_WINDOW1_SHOWVERSCROLL = 0x0010;
-const sal_uInt16 BIFF_WINDOW1_SHOWTABBAR = 0x0020;
-
-const sal_uInt16 BIFF_WINDOW2_SHOWFORMULAS = 0x0001;
-const sal_uInt16 BIFF_WINDOW2_SHOWGRID = 0x0002;
-const sal_uInt16 BIFF_WINDOW2_SHOWHEADINGS = 0x0004;
-const sal_uInt16 BIFF_WINDOW2_FROZEN = 0x0008;
-const sal_uInt16 BIFF_WINDOW2_SHOWZEROS = 0x0010;
-const sal_uInt16 BIFF_WINDOW2_DEFGRIDCOLOR = 0x0020;
-const sal_uInt16 BIFF_WINDOW2_RIGHTTOLEFT = 0x0040;
-const sal_uInt16 BIFF_WINDOW2_SHOWOUTLINE = 0x0080;
-const sal_uInt16 BIFF_WINDOW2_FROZENNOSPLIT = 0x0100;
-const sal_uInt16 BIFF_WINDOW2_SELECTED = 0x0200;
-const sal_uInt16 BIFF_WINDOW2_DISPLAYED = 0x0400;
-const sal_uInt16 BIFF_WINDOW2_PAGEBREAKMODE = 0x0800;
+const sal_Int32 OOX_BOOKVIEW_TABBARRATIO_DEF = 600; /// Default tabbar ratio.
+const sal_Int32 OOX_SHEETVIEW_NORMALZOOM_DEF = 100; /// Default zoom for normal view.
+const sal_Int32 OOX_SHEETVIEW_SHEETLAYZOOM_DEF = 60; /// Default zoom for pagebreak preview.
+const sal_Int32 OOX_SHEETVIEW_PAGELAYZOOM_DEF = 100; /// Default zoom for page layout view.
+
+const sal_uInt8 BIFF12_PANE_FROZEN = 0x01;
+const sal_uInt8 BIFF12_PANE_FROZENNOSPLIT = 0x02;
+
+const sal_uInt16 BIFF12_SHEETVIEW_WINPROTECTED = 0x0001;
+const sal_uInt16 BIFF12_SHEETVIEW_SHOWFORMULAS = 0x0002;
+const sal_uInt16 BIFF12_SHEETVIEW_SHOWGRID = 0x0004;
+const sal_uInt16 BIFF12_SHEETVIEW_SHOWHEADINGS = 0x0008;
+const sal_uInt16 BIFF12_SHEETVIEW_SHOWZEROS = 0x0010;
+const sal_uInt16 BIFF12_SHEETVIEW_RIGHTTOLEFT = 0x0020;
+const sal_uInt16 BIFF12_SHEETVIEW_SELECTED = 0x0040;
+const sal_uInt16 BIFF12_SHEETVIEW_SHOWRULER = 0x0080;
+const sal_uInt16 BIFF12_SHEETVIEW_SHOWOUTLINE = 0x0100;
+const sal_uInt16 BIFF12_SHEETVIEW_DEFGRIDCOLOR = 0x0200;
+const sal_uInt16 BIFF12_SHEETVIEW_SHOWWHITESPACE = 0x0400;
+
+const sal_uInt16 BIFF12_CHARTSHEETVIEW_SELECTED = 0x0001;
+const sal_uInt16 BIFF12_CHARTSHEETVIEW_ZOOMTOFIT = 0x0002;
+
+const sal_uInt8 BIFF12_WBVIEW_HIDDEN = 0x01;
+const sal_uInt8 BIFF12_WBVIEW_MINIMIZED = 0x02;
+const sal_uInt8 BIFF12_WBVIEW_SHOWHORSCROLL = 0x08;
+const sal_uInt8 BIFF12_WBVIEW_SHOWVERSCROLL = 0x10;
+const sal_uInt8 BIFF12_WBVIEW_SHOWTABBAR = 0x20;
+const sal_uInt8 BIFF12_WBVIEW_AUTOFILTERGROUP = 0x40;
+
+const sal_uInt8 BIFF_PANE_BOTTOMRIGHT = 0; /// Bottom-right pane.
+const sal_uInt8 BIFF_PANE_TOPRIGHT = 1; /// Right, or top-right pane.
+const sal_uInt8 BIFF_PANE_BOTTOMLEFT = 2; /// Bottom, or bottom-left pane.
+const sal_uInt8 BIFF_PANE_TOPLEFT = 3; /// Single, top, left, or top-left pane.
+
+const sal_uInt16 BIFF_WINDOW1_HIDDEN = 0x0001;
+const sal_uInt16 BIFF_WINDOW1_MINIMIZED = 0x0002;
+const sal_uInt16 BIFF_WINDOW1_SHOWHORSCROLL = 0x0008;
+const sal_uInt16 BIFF_WINDOW1_SHOWVERSCROLL = 0x0010;
+const sal_uInt16 BIFF_WINDOW1_SHOWTABBAR = 0x0020;
+
+const sal_uInt16 BIFF_WINDOW2_SHOWFORMULAS = 0x0001;
+const sal_uInt16 BIFF_WINDOW2_SHOWGRID = 0x0002;
+const sal_uInt16 BIFF_WINDOW2_SHOWHEADINGS = 0x0004;
+const sal_uInt16 BIFF_WINDOW2_FROZEN = 0x0008;
+const sal_uInt16 BIFF_WINDOW2_SHOWZEROS = 0x0010;
+const sal_uInt16 BIFF_WINDOW2_DEFGRIDCOLOR = 0x0020;
+const sal_uInt16 BIFF_WINDOW2_RIGHTTOLEFT = 0x0040;
+const sal_uInt16 BIFF_WINDOW2_SHOWOUTLINE = 0x0080;
+const sal_uInt16 BIFF_WINDOW2_FROZENNOSPLIT = 0x0100;
+const sal_uInt16 BIFF_WINDOW2_SELECTED = 0x0200;
+const sal_uInt16 BIFF_WINDOW2_DISPLAYED = 0x0400;
+const sal_uInt16 BIFF_WINDOW2_PAGEBREAKMODE = 0x0800;
// Attention: view settings in Calc do not use com.sun.star.view.DocumentZoomType!
-const sal_Int16 API_ZOOMTYPE_PERCENT = 0; /// Zoom value in percent.
+const sal_Int16 API_ZOOMTYPE_PERCENT = 0; /// Zoom value in percent.
-const sal_Int32 API_ZOOMVALUE_MIN = 20; /// Minimum zoom in Calc.
-const sal_Int32 API_ZOOMVALUE_MAX = 400; /// Maximum zoom in Calc.
+const sal_Int32 API_ZOOMVALUE_MIN = 20; /// Minimum zoom in Calc.
+const sal_Int32 API_ZOOMVALUE_MAX = 400; /// Maximum zoom in Calc.
// no predefined constants for split mode
-const sal_Int16 API_SPLITMODE_NONE = 0; /// No splits in window.
-const sal_Int16 API_SPLITMODE_SPLIT = 1; /// Window is split.
-const sal_Int16 API_SPLITMODE_FREEZE = 2; /// Window has frozen panes.
+const sal_Int16 API_SPLITMODE_NONE = 0; /// No splits in window.
+const sal_Int16 API_SPLITMODE_SPLIT = 1; /// Window is split.
+const sal_Int16 API_SPLITMODE_FREEZE = 2; /// Window has frozen panes.
// no predefined constants for pane idetifiers
-const sal_Int16 API_SPLITPANE_TOPLEFT = 0; /// Top-left, or top pane.
-const sal_Int16 API_SPLITPANE_TOPRIGHT = 1; /// Top-right pane.
-const sal_Int16 API_SPLITPANE_BOTTOMLEFT = 2; /// Bottom-left, bottom, left, or single pane.
-const sal_Int16 API_SPLITPANE_BOTTOMRIGHT = 3; /// Bottom-right, or right pane.
+const sal_Int16 API_SPLITPANE_TOPLEFT = 0; /// Top-left, or top pane.
+const sal_Int16 API_SPLITPANE_TOPRIGHT = 1; /// Top-right pane.
+const sal_Int16 API_SPLITPANE_BOTTOMLEFT = 2; /// Bottom-left, bottom, left, or single pane.
+const sal_Int16 API_SPLITPANE_BOTTOMRIGHT = 3; /// Bottom-right, or right pane.
// ----------------------------------------------------------------------------
-/** Returns the OOXML pane identifier from the passed OOBIN or BIFF pane id. */
-sal_Int32 lclGetOoxPaneId( sal_Int32 nBinPaneId, sal_Int32 nDefaultPaneId )
+/** Returns the OOXML pane identifier from the passed BIFF pane id. */
+sal_Int32 lclGetOoxPaneId( sal_Int32 nBiffPaneId, sal_Int32 nDefaultPaneId )
{
static const sal_Int32 spnPaneIds[] = { XML_bottomRight, XML_topRight, XML_bottomLeft, XML_topLeft };
- return STATIC_ARRAY_SELECT( spnPaneIds, nBinPaneId, nDefaultPaneId );
+ return STATIC_ARRAY_SELECT( spnPaneIds, nBiffPaneId, nDefaultPaneId );
}
} // namespace
@@ -295,7 +288,7 @@ void SheetViewSettings::importChartSheetView( const AttributeList& rAttribs )
rModel.mbZoomToFit = rAttribs.getBool( XML_zoomToFit, false );
}
-void SheetViewSettings::importSheetView( RecordInputStream& rStrm )
+void SheetViewSettings::importSheetView( SequenceInputStream& rStrm )
{
SheetViewModel& rModel = *createSheetView();
sal_uInt16 nFlags;
@@ -312,17 +305,17 @@ void SheetViewSettings::importSheetView( RecordInputStream& rStrm )
rModel.maFirstPos = getAddressConverter().createValidCellAddress( aFirstPos, getSheetIndex(), false );
static const sal_Int32 spnViewTypes[] = { XML_normal, XML_pageBreakPreview, XML_pageLayout };
rModel.mnViewType = STATIC_ARRAY_SELECT( spnViewTypes, nViewType, XML_normal );
- rModel.mbSelected = getFlag( nFlags, OOBIN_SHEETVIEW_SELECTED );
- rModel.mbRightToLeft = getFlag( nFlags, OOBIN_SHEETVIEW_RIGHTTOLEFT );
- rModel.mbDefGridColor = getFlag( nFlags, OOBIN_SHEETVIEW_DEFGRIDCOLOR );
- rModel.mbShowFormulas = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWFORMULAS );
- rModel.mbShowGrid = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWGRID );
- rModel.mbShowHeadings = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWHEADINGS );
- rModel.mbShowZeros = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWZEROS );
- rModel.mbShowOutline = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWOUTLINE );
+ rModel.mbSelected = getFlag( nFlags, BIFF12_SHEETVIEW_SELECTED );
+ rModel.mbRightToLeft = getFlag( nFlags, BIFF12_SHEETVIEW_RIGHTTOLEFT );
+ rModel.mbDefGridColor = getFlag( nFlags, BIFF12_SHEETVIEW_DEFGRIDCOLOR );
+ rModel.mbShowFormulas = getFlag( nFlags, BIFF12_SHEETVIEW_SHOWFORMULAS );
+ rModel.mbShowGrid = getFlag( nFlags, BIFF12_SHEETVIEW_SHOWGRID );
+ rModel.mbShowHeadings = getFlag( nFlags, BIFF12_SHEETVIEW_SHOWHEADINGS );
+ rModel.mbShowZeros = getFlag( nFlags, BIFF12_SHEETVIEW_SHOWZEROS );
+ rModel.mbShowOutline = getFlag( nFlags, BIFF12_SHEETVIEW_SHOWOUTLINE );
}
-void SheetViewSettings::importPane( RecordInputStream& rStrm )
+void SheetViewSettings::importPane( SequenceInputStream& rStrm )
{
OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importPane - missing sheet view model" );
if( !maSheetViews.empty() )
@@ -336,11 +329,11 @@ void SheetViewSettings::importPane( RecordInputStream& rStrm )
rModel.maSecondPos = getAddressConverter().createValidCellAddress( aSecondPos, getSheetIndex(), false );
rModel.mnActivePaneId = lclGetOoxPaneId( nActivePaneId, XML_topLeft );
- rModel.mnPaneState = getFlagValue( nFlags, OOBIN_PANE_FROZEN, getFlagValue( nFlags, OOBIN_PANE_FROZENNOSPLIT, XML_frozen, XML_frozenSplit ), XML_split );
+ rModel.mnPaneState = getFlagValue( nFlags, BIFF12_PANE_FROZEN, getFlagValue( nFlags, BIFF12_PANE_FROZENNOSPLIT, XML_frozen, XML_frozenSplit ), XML_split );
}
}
-void SheetViewSettings::importSelection( RecordInputStream& rStrm )
+void SheetViewSettings::importSelection( SequenceInputStream& rStrm )
{
OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importSelection - missing sheet view model" );
if( !maSheetViews.empty() )
@@ -360,14 +353,14 @@ void SheetViewSettings::importSelection( RecordInputStream& rStrm )
}
}
-void SheetViewSettings::importChartSheetView( RecordInputStream& rStrm )
+void SheetViewSettings::importChartSheetView( SequenceInputStream& rStrm )
{
SheetViewModel& rModel = *createSheetView();
sal_uInt16 nFlags;
rStrm >> nFlags >> rModel.mnCurrentZoom >> rModel.mnWorkbookViewId;
- rModel.mbSelected = getFlag( nFlags, OOBIN_CHARTSHEETVIEW_SELECTED );
- rModel.mbZoomToFit = getFlag( nFlags, OOBIN_CHARTSHEETVIEW_ZOOMTOFIT );
+ rModel.mbSelected = getFlag( nFlags, BIFF12_CHARTSHEETVIEW_SELECTED );
+ rModel.mbZoomToFit = getFlag( nFlags, BIFF12_CHARTSHEETVIEW_ZOOMTOFIT );
}
void SheetViewSettings::importWindow2( BiffInputStream& rStrm )
@@ -502,13 +495,6 @@ void SheetViewSettings::finalizeImport()
xModel->mbShowOutline = true;
}
- // mirrored sheet (this is not a view setting in Calc)
- if( xModel->mbRightToLeft )
- {
- PropertySet aPropSet( getSheet() );
- aPropSet.setProperty( PROP_TableLayout, ::com::sun::star::text::WritingMode2::RL_TB );
- }
-
// sheet selected (active sheet must be selected)
bool bSelected = xModel->mbSelected || (getSheetIndex() == getViewSettings().getActiveCalcSheet());
@@ -599,6 +585,11 @@ void SheetViewSettings::finalizeImport()
getViewSettings().setSheetViewSettings( getSheetIndex(), xModel, Any( aPropMap.makePropertyValueSequence() ) );
}
+bool SheetViewSettings::isSheetRightToLeft() const
+{
+ return !maSheetViews.empty() && maSheetViews.front()->mbRightToLeft;
+}
+
// private --------------------------------------------------------------------
SheetViewModelRef SheetViewSettings::createSheetView()
@@ -657,19 +648,19 @@ void ViewSettings::importOleSize( const AttributeList& rAttribs )
mbValidOleSize = getAddressConverter().convertToCellRange( maOleSize, aRange, 0, true, false );
}
-void ViewSettings::importWorkbookView( RecordInputStream& rStrm )
+void ViewSettings::importWorkbookView( SequenceInputStream& rStrm )
{
WorkbookViewModel& rModel = createWorkbookView();
sal_uInt8 nFlags;
rStrm >> rModel.mnWinX >> rModel.mnWinY >> rModel.mnWinWidth >> rModel.mnWinHeight >> rModel.mnTabBarWidth >> rModel.mnFirstVisSheet >> rModel.mnActiveSheet >> nFlags;
- rModel.mnVisibility = getFlagValue( nFlags, OOBIN_WBVIEW_HIDDEN, XML_hidden, XML_visible );
- rModel.mbShowTabBar = getFlag( nFlags, OOBIN_WBVIEW_SHOWTABBAR );
- rModel.mbShowHorScroll = getFlag( nFlags, OOBIN_WBVIEW_SHOWHORSCROLL );
- rModel.mbShowVerScroll = getFlag( nFlags, OOBIN_WBVIEW_SHOWVERSCROLL );
- rModel.mbMinimized = getFlag( nFlags, OOBIN_WBVIEW_MINIMIZED );
+ rModel.mnVisibility = getFlagValue( nFlags, BIFF12_WBVIEW_HIDDEN, XML_hidden, XML_visible );
+ rModel.mbShowTabBar = getFlag( nFlags, BIFF12_WBVIEW_SHOWTABBAR );
+ rModel.mbShowHorScroll = getFlag( nFlags, BIFF12_WBVIEW_SHOWHORSCROLL );
+ rModel.mbShowVerScroll = getFlag( nFlags, BIFF12_WBVIEW_SHOWVERSCROLL );
+ rModel.mbMinimized = getFlag( nFlags, BIFF12_WBVIEW_MINIMIZED );
}
-void ViewSettings::importOleSize( RecordInputStream& rStrm )
+void ViewSettings::importOleSize( SequenceInputStream& rStrm )
{
BinRange aBinRange;
rStrm >> aBinRange;
diff --git a/oox/source/xls/webquerybuffer.cxx b/oox/source/xls/webquerybuffer.cxx
deleted file mode 100644
index 2babebd4a8d7..000000000000
--- a/oox/source/xls/webquerybuffer.cxx
+++ /dev/null
@@ -1,199 +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.
- *
- ************************************************************************/
-
-#include "oox/xls/webquerybuffer.hxx"
-#include "oox/helper/attributelist.hxx"
-
-#define DEBUG_OOX_WEBQUERY_BUFFER 1
-
-#if DEBUG_OOX_WEBQUERY_BUFFER
-#include <stdio.h>
-#endif
-
-using ::rtl::OUString;
-
-namespace oox {
-namespace xls {
-
-const sal_Int32 Connection::CONNECTION_ODBC_SOURCE = 1;
-const sal_Int32 Connection::CONNECTION_DAO_SOURCE = 2;
-const sal_Int32 Connection::CONNECTION_FILE_SOURCE = 3;
-const sal_Int32 Connection::CONNECTION_WEBQUERY = 4;
-const sal_Int32 Connection::CONNECTION_OLEDB_SOURCE = 5;
-const sal_Int32 Connection::CONNECTION_TEXT_SOURCE = 6;
-const sal_Int32 Connection::CONNECTION_ADO_RECORD_SET = 7;
-const sal_Int32 Connection::CONNECTION_DSP = 8;
-
-// ============================================================================
-
-WebQueryBuffer::WebQueryBuffer( const WorkbookHelper& rHelper ) :
- WorkbookHelper( rHelper )
-{
- maQueryTableMap.clear();
-}
-
-void WebQueryBuffer::importQueryTable( const AttributeList& rAttribs )
-{
- OUString aName = rAttribs.getString( XML_name, OUString() );
- if ( !aName.getLength() )
- return;
-
- QueryTable aQTable;
- aQTable.mnConnectionId = rAttribs.getInteger( XML_connectionId, 0 );
-
- maQueryTableMap.insert( QueryTableHashMap::value_type( aName, aQTable ) );
-
- // All documented attributes of queryTable:
- // adjustColumnWidth (bool)
- // applyAlignmentFormats (bool)
- // applyBorderFormats (bool)
- // applyFontFormats (bool)
- // applyNumberFormats (bool)
- // applyPatternFormats (bool)
- // applyWidthHeightFormats (bool)
- // autoFormatId (unsigned int)
- // backgroundRefresh (bool)
- // connectionId (unsigned int)
- // disableEdit (bool)
- // disableRefresh (bool)
- // fillFormulas (bool)
- // firstBackgroundRefresh (bool)
- // growShrinkType (insertClear, insertDelete, overwriteClear)
- // headers (bool)
- // intermediate (bool)
- // name (string)
- // preserveFormatting(bool)
- // refreshOnLoad (bool)
- // removeDataOnSave (bool)
- // rowNumbers (bool)
-}
-
-void WebQueryBuffer::importConnection( const AttributeList& rAttribs )
-{
- if ( !rAttribs.hasAttribute( XML_id ) || !rAttribs.hasAttribute( XML_name ) )
- {
- mnCurConnId = -1;
- return;
- }
-
- sal_uInt32 nId = rAttribs.getUnsigned( XML_id, 0 );
- if ( maConnections.size() < (nId + 1) )
- maConnections.resize(nId + 1);
-
- Connection aConn;
- aConn.maName = rAttribs.getString( XML_name, OUString() );
- aConn.mnType = rAttribs.getInteger( XML_type, 0 );
- maConnections[nId] = aConn;
- mnCurConnId = nId;
-
- // All documented attributes of connection.
- // background (bool)
- // credentials (integrated, none, prompt, stored)
- // deleted (bool)
- // description (string)
- // id (unsigned int)
- // interval (unsigned int)
- // keepAlive (bool)
- // minRefreshableVersion (unsigned byte)
- // name (string)
- // new (bool)
- // odcFile (string)
- // onlyUseConnectionFile (bool)
- // reconnectionMethod (unsigned int)
- // refreshedVersion (unsigned byte)
- // refreshOnLoad (bool)
- // saveData (bool)
- // savePassword (bool)
- // singleSignOnId (string)
- // sourceFile (string)
- // type (unsigned int)
-}
-
-void WebQueryBuffer::importWebPr( const AttributeList& rAttribs )
-{
- if ( 0 > mnCurConnId )
- return;
-
- Connection& rConn = maConnections[mnCurConnId];
- rConn.mpProperties.reset( new WebProperties );
- WebProperties* pWebPr = static_cast< WebProperties* >( rConn.mpProperties.get() );
- pWebPr->maURL = rAttribs.getString( XML_url, OUString() );
-
- // All available attributes:
- // consecutive (bool)
- // editPage (string)
- // firstRow (bool)
- // htmlFormat (all, none, rtf)
- // htmlTables (bool)
- // parsePre (bool)
- // post (string)
- // sourceData (bool)
- // textDates (bool)
- // url (string)
- // xl2000 (bool)
- // xl97 (bool)
- // xml (bool)
-}
-
-void WebQueryBuffer::dump() const
-{
-#if DEBUG_OOX_WEBQUERY_BUFFER
- fprintf(stdout, "----------------------------------------\n");
- {
- using ::std::vector;
- vector< Connection >::const_iterator itr = maConnections.begin(), itrEnd = maConnections.end();
- sal_Int32 nId = 0;
- for (; itr != itrEnd; ++itr, ++nId)
- {
- if ( itr->mnType == Connection::CONNECTION_WEBQUERY )
- {
- WebProperties* pWebPr = static_cast< WebProperties* >( itr->mpProperties.get() );
- fprintf(stdout, "WebQueryBuffer::dump: id = %d url = %s\n",
- (int)nId,
- OUStringToOString(pWebPr->maURL, RTL_TEXTENCODING_UTF8).getStr());
- }
- }
- }
-
- QueryTableHashMap::const_iterator itr = maQueryTableMap.begin(), itrEnd = maQueryTableMap.end();
- for (; itr != itrEnd; ++itr)
- {
- fprintf(stdout, "WebQueryBuffer::dump: name = %s connection ID = %d\n",
- OUStringToOString(itr->first, RTL_TEXTENCODING_UTF8).getStr(),
- (int)(itr->second.mnConnectionId));
- }
-
- fprintf(stdout, "----------------------------------------\n");
- fflush(stdout);
-#endif
-}
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx
index 6e43a32495be..dce3c8eb461e 100644
--- a/oox/source/xls/workbookfragment.cxx
+++ b/oox/source/xls/workbookfragment.cxx
@@ -26,14 +26,14 @@
************************************************************************/
#include "oox/xls/workbookfragment.hxx"
+
#include <com/sun/star/table/CellAddress.hpp>
+#include "oox/core/filterbase.hxx"
+#include "oox/drawingml/themefragmenthandler.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/progressbar.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/ole/olestorage.hxx"
-#include "oox/core/filterbase.hxx"
-#include "oox/drawingml/themefragmenthandler.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/chartsheetfragment.hxx"
#include "oox/xls/connectionsfragment.hxx"
@@ -50,25 +50,21 @@
#include "oox/xls/worksheetbuffer.hxx"
#include "oox/xls/worksheetfragment.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-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::io::XInputStream;
-using ::com::sun::star::table::CellAddress;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::FragmentHandlerRef;
-using ::oox::core::RecordInfo;
-using ::oox::core::Relation;
-using ::oox::drawingml::ThemeFragmentHandler;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+using namespace ::oox::core;
+
+using ::oox::drawingml::ThemeFragmentHandler;
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
const double PROGRESS_LENGTH_GLOBALS = 0.1; /// 10% of progress bar for globals import.
@@ -77,15 +73,12 @@ const double PROGRESS_LENGTH_GLOBALS = 0.1; /// 10% of progress bar
// ============================================================================
-OoxWorkbookFragment::OoxWorkbookFragment(
- const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath )
+WorkbookFragment::WorkbookFragment( const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
+ WorkbookFragmentBase( rHelper, rFragmentPath )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxWorkbookFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef WorkbookFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -128,108 +121,102 @@ ContextHandlerRef OoxWorkbookFragment::onCreateContext( sal_Int32 nElement, cons
return 0;
}
-void OoxWorkbookFragment::onEndElement( const OUString& rChars )
+void WorkbookFragment::onCharacters( const OUString& rChars )
{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( definedName ):
- if( mxCurrName.get() ) mxCurrName->setFormula( rChars );
- break;
- }
+ if( isCurrentElement( XLS_TOKEN( definedName ) ) && mxCurrName.get() )
+ mxCurrName->setFormula( rChars );
}
-ContextHandlerRef OoxWorkbookFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef WorkbookFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_WORKBOOK ) return this;
+ if( nRecId == BIFF12_ID_WORKBOOK ) return this;
break;
- case OOBIN_ID_WORKBOOK:
+ case BIFF12_ID_WORKBOOK:
switch( nRecId )
{
- case OOBIN_ID_SHEETS:
- case OOBIN_ID_BOOKVIEWS:
- case OOBIN_ID_EXTERNALREFS:
- case OOBIN_ID_PIVOTCACHES: return this;
-
- case OOBIN_ID_FILESHARING: getWorkbookSettings().importFileSharing( rStrm ); break;
- case OOBIN_ID_WORKBOOKPR: getWorkbookSettings().importWorkbookPr( rStrm ); break;
- case OOBIN_ID_CALCPR: getWorkbookSettings().importCalcPr( rStrm ); break;
- case OOBIN_ID_OLESIZE: getViewSettings().importOleSize( rStrm ); break;
- case OOBIN_ID_DEFINEDNAME: getDefinedNames().importDefinedName( rStrm ); break;
+ case BIFF12_ID_SHEETS:
+ case BIFF12_ID_BOOKVIEWS:
+ case BIFF12_ID_EXTERNALREFS:
+ case BIFF12_ID_PIVOTCACHES: return this;
+
+ case BIFF12_ID_FILESHARING: getWorkbookSettings().importFileSharing( rStrm ); break;
+ case BIFF12_ID_WORKBOOKPR: getWorkbookSettings().importWorkbookPr( rStrm ); break;
+ case BIFF12_ID_CALCPR: getWorkbookSettings().importCalcPr( rStrm ); break;
+ case BIFF12_ID_OLESIZE: getViewSettings().importOleSize( rStrm ); break;
+ case BIFF12_ID_DEFINEDNAME: getDefinedNames().importDefinedName( rStrm ); break;
}
break;
- case OOBIN_ID_SHEETS:
- if( nRecId == OOBIN_ID_SHEET ) getWorksheets().importSheet( rStrm );
+ case BIFF12_ID_SHEETS:
+ if( nRecId == BIFF12_ID_SHEET ) getWorksheets().importSheet( rStrm );
break;
- case OOBIN_ID_BOOKVIEWS:
- if( nRecId == OOBIN_ID_WORKBOOKVIEW ) getViewSettings().importWorkbookView( rStrm );
+ case BIFF12_ID_BOOKVIEWS:
+ if( nRecId == BIFF12_ID_WORKBOOKVIEW ) getViewSettings().importWorkbookView( rStrm );
break;
- case OOBIN_ID_EXTERNALREFS:
+ case BIFF12_ID_EXTERNALREFS:
switch( nRecId )
{
- case OOBIN_ID_EXTERNALREF: importExternalRef( rStrm ); break;
- case OOBIN_ID_EXTERNALSELF: getExternalLinks().importExternalSelf( rStrm ); break;
- case OOBIN_ID_EXTERNALSAME: getExternalLinks().importExternalSame( rStrm ); break;
- case OOBIN_ID_EXTERNALADDIN: getExternalLinks().importExternalAddin( rStrm ); break;
- case OOBIN_ID_EXTERNALSHEETS: getExternalLinks().importExternalSheets( rStrm ); break;
+ case BIFF12_ID_EXTERNALREF: importExternalRef( rStrm ); break;
+ case BIFF12_ID_EXTERNALSELF: getExternalLinks().importExternalSelf( rStrm ); break;
+ case BIFF12_ID_EXTERNALSAME: getExternalLinks().importExternalSame( rStrm ); break;
+ case BIFF12_ID_EXTERNALADDIN: getExternalLinks().importExternalAddin( rStrm ); break;
+ case BIFF12_ID_EXTERNALSHEETS: getExternalLinks().importExternalSheets( rStrm ); break;
}
break;
- case OOBIN_ID_PIVOTCACHES:
- if( nRecId == OOBIN_ID_PIVOTCACHE ) importPivotCache( rStrm );
+ case BIFF12_ID_PIVOTCACHES:
+ if( nRecId == BIFF12_ID_PIVOTCACHE ) importPivotCache( rStrm );
}
return 0;
}
-// oox.core.FragmentHandler2 interface ----------------------------------------
-
-const RecordInfo* OoxWorkbookFragment::getRecordInfos() const
+const RecordInfo* WorkbookFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_BOOKVIEWS, OOBIN_ID_BOOKVIEWS + 1 },
- { OOBIN_ID_EXTERNALREFS, OOBIN_ID_EXTERNALREFS + 1 },
- { OOBIN_ID_FUNCTIONGROUPS, OOBIN_ID_FUNCTIONGROUPS + 2 },
- { OOBIN_ID_PIVOTCACHE, OOBIN_ID_PIVOTCACHE + 1 },
- { OOBIN_ID_PIVOTCACHES, OOBIN_ID_PIVOTCACHES + 1 },
- { OOBIN_ID_SHEETS, OOBIN_ID_SHEETS + 1 },
- { OOBIN_ID_WORKBOOK, OOBIN_ID_WORKBOOK + 1 },
- { -1, -1 }
+ { BIFF12_ID_BOOKVIEWS, BIFF12_ID_BOOKVIEWS + 1 },
+ { BIFF12_ID_EXTERNALREFS, BIFF12_ID_EXTERNALREFS + 1 },
+ { BIFF12_ID_FUNCTIONGROUPS, BIFF12_ID_FUNCTIONGROUPS + 2 },
+ { BIFF12_ID_PIVOTCACHE, BIFF12_ID_PIVOTCACHE + 1 },
+ { BIFF12_ID_PIVOTCACHES, BIFF12_ID_PIVOTCACHES + 1 },
+ { BIFF12_ID_SHEETS, BIFF12_ID_SHEETS + 1 },
+ { BIFF12_ID_WORKBOOK, BIFF12_ID_WORKBOOK + 1 },
+ { -1, -1 }
};
return spRecInfos;
}
-void OoxWorkbookFragment::finalizeImport()
+void WorkbookFragment::finalizeImport()
{
ISegmentProgressBarRef xGlobalSegment = getProgressBar().createSegment( PROGRESS_LENGTH_GLOBALS );
// read the theme substream
- OUString aThemeFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "theme" ) );
+ OUString aThemeFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "theme" ) );
if( aThemeFragmentPath.getLength() > 0 )
importOoxFragment( new ThemeFragmentHandler( getFilter(), aThemeFragmentPath, getTheme() ) );
xGlobalSegment->setPosition( 0.25 );
// read the styles substream (requires finalized theme buffer)
- OUString aStylesFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "styles" ) );
+ OUString aStylesFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "styles" ) );
if( aStylesFragmentPath.getLength() > 0 )
- importOoxFragment( new OoxStylesFragment( *this, aStylesFragmentPath ) );
+ importOoxFragment( new StylesFragment( *this, aStylesFragmentPath ) );
xGlobalSegment->setPosition( 0.5 );
// read the shared string table substream (requires finalized styles buffer)
- OUString aSstFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "sharedStrings" ) );
+ OUString aSstFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "sharedStrings" ) );
if( aSstFragmentPath.getLength() > 0 )
- importOoxFragment( new OoxSharedStringsFragment( *this, aSstFragmentPath ) );
+ importOoxFragment( new SharedStringsFragment( *this, aSstFragmentPath ) );
xGlobalSegment->setPosition( 0.75 );
// read the connections substream
- OUString aConnFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "connections" ) );
+ OUString aConnFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "connections" ) );
if( aConnFragmentPath.getLength() > 0 )
- importOoxFragment( new OoxConnectionsFragment( *this, aConnFragmentPath ) );
+ importOoxFragment( new ConnectionsFragment( *this, aConnFragmentPath ) );
xGlobalSegment->setPosition( 1.0 );
/* Create fragments for all sheets, before importing them. Needed to do
@@ -248,35 +235,35 @@ void OoxWorkbookFragment::finalizeImport()
{
// get fragment path of the sheet
OUString aFragmentPath = getFragmentPathFromRelation( *pRelation );
- OSL_ENSURE( aFragmentPath.getLength() > 0, "OoxWorkbookFragment::finalizeImport - cannot access sheet fragment" );
+ OSL_ENSURE( aFragmentPath.getLength() > 0, "WorkbookFragment::finalizeImport - cannot access sheet fragment" );
if( aFragmentPath.getLength() > 0 )
{
- ::rtl::Reference< OoxWorksheetFragmentBase > xFragment;
+ ::rtl::Reference< WorksheetFragmentBase > xFragment;
double fSegmentLength = getProgressBar().getFreeLength() / (nWorksheetCount - nWorksheet);
ISegmentProgressBarRef xSheetSegment = getProgressBar().createSegment( fSegmentLength );
// create the fragment according to the sheet type
- if( pRelation->maType == CREATE_OFFICEDOC_RELATIONSTYPE( "worksheet" ) )
+ if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "worksheet" ) )
{
- xFragment.set( new OoxWorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_WORKSHEET, nCalcSheet ) );
+ xFragment.set( new WorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_WORKSHEET, nCalcSheet ) );
}
- else if( pRelation->maType == CREATE_OFFICEDOC_RELATIONSTYPE( "chartsheet" ) )
+ else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "chartsheet" ) )
{
- xFragment.set( new OoxChartsheetFragment( *this, aFragmentPath, xSheetSegment, nCalcSheet ) );
+ xFragment.set( new ChartsheetFragment( *this, aFragmentPath, xSheetSegment, nCalcSheet ) );
}
- else if( (pRelation->maType == CREATE_MSOFFICE_RELATIONSTYPE( "xlMacrosheet" )) ||
- (pRelation->maType == CREATE_MSOFFICE_RELATIONSTYPE( "xlIntlMacrosheet" )) )
+ else if( (pRelation->maType == CREATE_MSOFFICE_RELATION_TYPE( "xlMacrosheet" )) ||
+ (pRelation->maType == CREATE_MSOFFICE_RELATION_TYPE( "xlIntlMacrosheet" )) )
{
- xFragment.set( new OoxWorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_MACROSHEET, nCalcSheet ) );
+ xFragment.set( new WorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_MACROSHEET, nCalcSheet ) );
}
- else if( pRelation->maType == CREATE_OFFICEDOC_RELATIONSTYPE( "dialogsheet" ) )
+ else if( pRelation->maType == CREATE_OFFICEDOC_RELATION_TYPE( "dialogsheet" ) )
{
- xFragment.set( new OoxWorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_DIALOGSHEET, nCalcSheet ) );
+ xFragment.set( new WorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_DIALOGSHEET, nCalcSheet ) );
}
// insert the fragment into the map
- OSL_ENSURE( xFragment.is(), "OoxWorkbookFragment::finalizeImport - unknown sheet type" );
- OSL_ENSURE( !xFragment.is() || xFragment->isValidSheet(), "OoxWorkbookFragment::finalizeImport - missing sheet in document" );
+ OSL_ENSURE( xFragment.is(), "WorkbookFragment::finalizeImport - unknown sheet type" );
+ OSL_ENSURE( !xFragment.is() || xFragment->isValidSheet(), "WorkbookFragment::finalizeImport - missing sheet in document" );
if( xFragment.is() && xFragment->isValidSheet() )
aSheetFragments.push_back( xFragment.get() );
}
@@ -297,7 +284,7 @@ void OoxWorkbookFragment::finalizeImport()
}
// open the VBA project storage
- OUString aVbaFragmentPath = getFragmentPathFromFirstType( CREATE_MSOFFICE_RELATIONSTYPE( "vbaProject" ) );
+ OUString aVbaFragmentPath = getFragmentPathFromFirstType( CREATE_MSOFFICE_RELATION_TYPE( "vbaProject" ) );
if( aVbaFragmentPath.getLength() > 0 )
{
Reference< XInputStream > xInStrm = getBaseFilter().openInputStream( aVbaFragmentPath );
@@ -311,45 +298,45 @@ void OoxWorkbookFragment::finalizeImport()
// private --------------------------------------------------------------------
-void OoxWorkbookFragment::importExternalReference( const AttributeList& rAttribs )
+void WorkbookFragment::importExternalReference( const AttributeList& rAttribs )
{
if( ExternalLink* pExtLink = getExternalLinks().importExternalReference( rAttribs ).get() )
importExternalLinkFragment( *pExtLink );
}
-void OoxWorkbookFragment::importDefinedName( const AttributeList& rAttribs )
+void WorkbookFragment::importDefinedName( const AttributeList& rAttribs )
{
mxCurrName = getDefinedNames().importDefinedName( rAttribs );
}
-void OoxWorkbookFragment::importPivotCache( const AttributeList& rAttribs )
+void WorkbookFragment::importPivotCache( const AttributeList& rAttribs )
{
sal_Int32 nCacheId = rAttribs.getInteger( XML_cacheId, -1 );
OUString aRelId = rAttribs.getString( R_TOKEN( id ), OUString() );
importPivotCacheDefFragment( aRelId, nCacheId );
}
-void OoxWorkbookFragment::importExternalRef( RecordInputStream& rStrm )
+void WorkbookFragment::importExternalRef( SequenceInputStream& rStrm )
{
if( ExternalLink* pExtLink = getExternalLinks().importExternalRef( rStrm ).get() )
importExternalLinkFragment( *pExtLink );
}
-void OoxWorkbookFragment::importPivotCache( RecordInputStream& rStrm )
+void WorkbookFragment::importPivotCache( SequenceInputStream& rStrm )
{
sal_Int32 nCacheId = rStrm.readInt32();
- OUString aRelId = rStrm.readString();
+ OUString aRelId = BiffHelper::readString( rStrm );
importPivotCacheDefFragment( aRelId, nCacheId );
}
-void OoxWorkbookFragment::importExternalLinkFragment( ExternalLink& rExtLink )
+void WorkbookFragment::importExternalLinkFragment( ExternalLink& rExtLink )
{
OUString aFragmentPath = getFragmentPathFromRelId( rExtLink.getRelId() );
if( aFragmentPath.getLength() > 0 )
- importOoxFragment( new OoxExternalLinkFragment( *this, aFragmentPath, rExtLink ) );
+ importOoxFragment( new ExternalLinkFragment( *this, aFragmentPath, rExtLink ) );
}
-void OoxWorkbookFragment::importPivotCacheDefFragment( const OUString& rRelId, sal_Int32 nCacheId )
+void WorkbookFragment::importPivotCacheDefFragment( const OUString& rRelId, sal_Int32 nCacheId )
{
// pivot caches will be imported on demand, here we just store the fragment path in the buffer
getPivotCaches().registerPivotCacheFragment( nCacheId, getFragmentPathFromRelId( rRelId ) );
@@ -431,14 +418,15 @@ bool BiffWorkbookFragment::importWorkspaceFragment()
// import the workspace globals
ISegmentProgressBarRef xGlobalsProgress = getProgressBar().createSegment( PROGRESS_LENGTH_GLOBALS );
bool bLoop = true;
- while( bRet && bLoop && mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
+ BiffInputStream& rStrm = getInputStream();
+ while( bRet && bLoop && rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
{
- switch( mrStrm.getRecId() )
+ switch( rStrm.getRecId() )
{
- case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
- case BIFF_ID_CODEPAGE: setCodePage( mrStrm.readuInt16() ); break;
- case BIFF_ID_FILEPASS: bRet = getCodecHelper().importFilePass( mrStrm ); break;
- case BIFF_ID_SHEETHEADER: mrStrm.rewindRecord(); bLoop = false; break;
+ case BIFF_ID_SHEET: rWorksheets.importSheet( rStrm ); break;
+ case BIFF_ID_CODEPAGE: setCodePage( rStrm.readuInt16() ); break;
+ case BIFF_ID_FILEPASS: bRet = getCodecHelper().importFilePass( rStrm ); break;
+ case BIFF_ID_SHEETHEADER: rStrm.rewindRecord(); bLoop = false; break;
}
}
xGlobalsProgress->setPosition( 1.0 );
@@ -448,15 +436,15 @@ bool BiffWorkbookFragment::importWorkspaceFragment()
for( sal_Int32 nWorksheet = 0, nWorksheetCount = rWorksheets.getWorksheetCount(); bNextSheet && (nWorksheet < nWorksheetCount); ++nWorksheet )
{
// try to start a new sheet fragment (with leading SHEETHEADER record)
- bNextSheet = mrStrm.startNextRecord() && (mrStrm.getRecId() == BIFF_ID_SHEETHEADER);
+ bNextSheet = rStrm.startNextRecord() && (rStrm.getRecId() == BIFF_ID_SHEETHEADER);
if( bNextSheet )
{
double fSegmentLength = getProgressBar().getFreeLength() / (nWorksheetCount - nWorksheet);
ISegmentProgressBarRef xSheetProgress = getProgressBar().createSegment( fSegmentLength );
/* Read current sheet name (sheet substreams may not be in the
same order as SHEET records are). */
- mrStrm.skip( 4 );
- OUString aSheetName = mrStrm.readByteStringUC( false, getTextEncoding() );
+ rStrm.skip( 4 );
+ OUString aSheetName = rStrm.readByteStringUC( false, getTextEncoding() );
sal_Int16 nCurrSheet = rWorksheets.getCalcSheetIndex( aSheetName );
// load the sheet fragment records
BiffFragmentType eSheetFragment = startFragment( getBiff() );
@@ -485,27 +473,28 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
bool bRet = true;
bool bLoop = true;
- while( bRet && bLoop && mrStrm.startNextRecord() )
+ BiffInputStream& rStrm = getInputStream();
+ while( bRet && bLoop && rStrm.startNextRecord() )
{
- sal_uInt16 nRecId = mrStrm.getRecId();
+ sal_uInt16 nRecId = rStrm.getRecId();
bool bExtLinkRec = false;
/* #i56376# BIFF5-BIFF8: If an EOF record for globals is missing,
simulate it. The issue is about a document where the sheet fragment
starts directly after the EXTSST record, without terminating the
globals fragment with an EOF record. */
- if( isBofRecord() || (nRecId == BIFF_ID_EOF) )
+ if( BiffHelper::isBofRecord( rStrm ) || (nRecId == BIFF_ID_EOF) )
{
bLoop = false;
}
else switch( nRecId )
{
// records in all BIFF versions
- case BIFF_ID_CODEPAGE: setCodePage( mrStrm.readuInt16() ); break;
- case BIFF_ID_DATEMODE: rWorkbookSett.importDateMode( mrStrm ); break;
- case BIFF_ID_FILEPASS: bRet = getCodecHelper().importFilePass( mrStrm ); break;
- case BIFF_ID_PRECISION: rWorkbookSett.importPrecision( mrStrm ); break;
- case BIFF_ID_WINDOW1: rViewSett.importWindow1( mrStrm ); break;
+ case BIFF_ID_CODEPAGE: setCodePage( rStrm.readuInt16() ); break;
+ case BIFF_ID_DATEMODE: rWorkbookSett.importDateMode( rStrm ); break;
+ case BIFF_ID_FILEPASS: bRet = getCodecHelper().importFilePass( rStrm ); break;
+ case BIFF_ID_PRECISION: rWorkbookSett.importPrecision( rStrm ); break;
+ case BIFF_ID_WINDOW1: rViewSett.importWindow1( rStrm ); break;
// BIFF specific records
default: switch( getBiff() )
@@ -515,10 +504,10 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
case BIFF2_ID_DEFINEDNAME: bExtLinkRec = true; break;
case BIFF2_ID_EXTERNALNAME: bExtLinkRec = true; break;
case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
- case BIFF2_ID_FONT: rStyles.importFont( mrStrm ); break;
- case BIFF_ID_FONTCOLOR: rStyles.importFontColor( mrStrm ); break;
- case BIFF2_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
- case BIFF2_ID_XF: rStyles.importXf( mrStrm ); break;
+ case BIFF2_ID_FONT: rStyles.importFont( rStrm ); break;
+ case BIFF_ID_FONTCOLOR: rStyles.importFontColor( rStrm ); break;
+ case BIFF2_ID_FORMAT: rStyles.importFormat( rStrm ); break;
+ case BIFF2_ID_XF: rStyles.importXf( rStrm ); break;
}
break;
@@ -528,14 +517,14 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
case BIFF3_ID_DEFINEDNAME: bExtLinkRec = true; break;
case BIFF3_ID_EXTERNALNAME: bExtLinkRec = true; break;
case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
- case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( mrStrm ); break;
- case BIFF3_ID_FONT: rStyles.importFont( mrStrm ); break;
- case BIFF2_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
- case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
- case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
- case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
+ case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( rStrm ); break;
+ case BIFF3_ID_FONT: rStyles.importFont( rStrm ); break;
+ case BIFF2_ID_FORMAT: rStyles.importFormat( rStrm ); break;
+ case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( rStrm ); break;
+ case BIFF_ID_PALETTE: rStyles.importPalette( rStrm ); break;
+ case BIFF_ID_STYLE: rStyles.importStyle( rStrm ); break;
case BIFF_ID_XCT: bExtLinkRec = true; break;
- case BIFF3_ID_XF: rStyles.importXf( mrStrm ); break;
+ case BIFF3_ID_XF: rStyles.importXf( rStrm ); break;
}
break;
@@ -545,62 +534,62 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
case BIFF3_ID_DEFINEDNAME: bExtLinkRec = true; break;
case BIFF3_ID_EXTERNALNAME: bExtLinkRec = true; break;
case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
- case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( mrStrm ); break;
- case BIFF3_ID_FONT: rStyles.importFont( mrStrm ); break;
- case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
- case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
- case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
- case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
+ case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( rStrm ); break;
+ case BIFF3_ID_FONT: rStyles.importFont( rStrm ); break;
+ case BIFF4_ID_FORMAT: rStyles.importFormat( rStrm ); break;
+ case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( rStrm ); break;
+ case BIFF_ID_PALETTE: rStyles.importPalette( rStrm ); break;
+ case BIFF_ID_STYLE: rStyles.importStyle( rStrm ); break;
case BIFF_ID_XCT: bExtLinkRec = true; break;
- case BIFF4_ID_XF: rStyles.importXf( mrStrm ); break;
+ case BIFF4_ID_XF: rStyles.importXf( rStrm ); break;
}
break;
case BIFF5: switch( nRecId )
{
- case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( mrStrm ); break;
+ case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( rStrm ); break;
case BIFF_ID_CRN: bExtLinkRec = true; break;
case BIFF5_ID_DEFINEDNAME: bExtLinkRec = true; break;
case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true; break;
case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
- case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( mrStrm ); break;
- case BIFF5_ID_FONT: rStyles.importFont( mrStrm ); break;
- case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
- case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
- case BIFF_ID_OLESIZE: rViewSett.importOleSize( mrStrm ); break;
- case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
- case BIFF_ID_PIVOTCACHE: rPivotCaches.importPivotCacheRef( mrStrm ); break;
- case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
- case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
+ case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( rStrm ); break;
+ case BIFF5_ID_FONT: rStyles.importFont( rStrm ); break;
+ case BIFF4_ID_FORMAT: rStyles.importFormat( rStrm ); break;
+ case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( rStrm ); break;
+ case BIFF_ID_OLESIZE: rViewSett.importOleSize( rStrm ); break;
+ case BIFF_ID_PALETTE: rStyles.importPalette( rStrm ); break;
+ case BIFF_ID_PIVOTCACHE: rPivotCaches.importPivotCacheRef( rStrm ); break;
+ case BIFF_ID_SHEET: rWorksheets.importSheet( rStrm ); break;
+ case BIFF_ID_STYLE: rStyles.importStyle( rStrm ); break;
case BIFF_ID_XCT: bExtLinkRec = true; break;
- case BIFF5_ID_XF: rStyles.importXf( mrStrm ); break;
+ case BIFF5_ID_XF: rStyles.importXf( rStrm ); break;
}
break;
case BIFF8: switch( nRecId )
{
- case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( mrStrm ); break;
- case BIFF_ID_CODENAME: rWorkbookSett.importCodeName( mrStrm ); break;
+ case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( rStrm ); break;
+ case BIFF_ID_CODENAME: rWorkbookSett.importCodeName( rStrm ); break;
case BIFF_ID_CRN: bExtLinkRec = true; break;
case BIFF5_ID_DEFINEDNAME: bExtLinkRec = true; break;
case BIFF_ID_EXTERNALBOOK: bExtLinkRec = true; break;
case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true; break;
case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
- case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( mrStrm ); break;
- case BIFF5_ID_FONT: rStyles.importFont( mrStrm ); break;
- case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
- case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
- case BIFF_ID_OLESIZE: rViewSett.importOleSize( mrStrm ); break;
- case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
- case BIFF_ID_PIVOTCACHE: rPivotCaches.importPivotCacheRef( mrStrm ); break;
- case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
- case BIFF_ID_SST: rSharedStrings.importSst( mrStrm ); break;
- case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
- case BIFF_ID_USESELFS: rWorkbookSett.importUsesElfs( mrStrm ); break;
+ case BIFF_ID_FILESHARING: rWorkbookSett.importFileSharing( rStrm ); break;
+ case BIFF5_ID_FONT: rStyles.importFont( rStrm ); break;
+ case BIFF4_ID_FORMAT: rStyles.importFormat( rStrm ); break;
+ case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( rStrm ); break;
+ case BIFF_ID_OLESIZE: rViewSett.importOleSize( rStrm ); break;
+ case BIFF_ID_PALETTE: rStyles.importPalette( rStrm ); break;
+ case BIFF_ID_PIVOTCACHE: rPivotCaches.importPivotCacheRef( rStrm ); break;
+ case BIFF_ID_SHEET: rWorksheets.importSheet( rStrm ); break;
+ case BIFF_ID_SST: rSharedStrings.importSst( rStrm ); break;
+ case BIFF_ID_STYLE: rStyles.importStyle( rStrm ); break;
+ case BIFF_ID_USESELFS: rWorkbookSett.importUsesElfs( rStrm ); break;
case BIFF_ID_VBAPROJECT: bHasVbaProject = true; break;
case BIFF_ID_VBAPROJECTEMPTY: bEmptyVbaProject = true; break;
case BIFF_ID_XCT: bExtLinkRec = true; break;
- case BIFF5_ID_XF: rStyles.importXf( mrStrm ); break;
+ case BIFF5_ID_XF: rStyles.importXf( rStrm ); break;
}
break;
@@ -609,7 +598,7 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
}
if( bExtLinkRec )
- aExtLinkRecs.push_back( mrStrm.getRecHandle() );
+ aExtLinkRecs.push_back( rStrm.getRecHandle() );
}
// finalize global buffers
@@ -626,16 +615,16 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
if( bRet && !aExtLinkRecs.empty() )
{
// remember current stream position (the EOF record)
- sal_Int64 nEofHandle = mrStrm.getRecHandle();
- // this fragment class implements import of external link records
- BiffExternalLinkFragment aLinkFragment( *this, true );
+ sal_Int64 nEofHandle = rStrm.getRecHandle();
+ // context handler implementing import of external link records
+ BiffExternalSheetDataContext aSheetContext( *this, true );
// import all records by using their cached record handle
- for( RecordHandleVec::const_iterator aIt = aExtLinkRecs.begin(), aEnd = aExtLinkRecs.end(); (aIt != aEnd) && mrStrm.startRecordByHandle( *aIt ); ++aIt )
- aLinkFragment.importRecord();
+ for( RecordHandleVec::const_iterator aIt = aExtLinkRecs.begin(), aEnd = aExtLinkRecs.end(); (aIt != aEnd) && rStrm.startRecordByHandle( *aIt ); ++aIt )
+ aSheetContext.importRecord( rStrm );
// finalize global buffers
- aLinkFragment.finalizeImport();
+ getDefinedNames().finalizeImport();
// seek back to the EOF record of the workbook globals fragment
- bRet = mrStrm.startRecordByHandle( nEofHandle );
+ bRet = rStrm.startRecordByHandle( nEofHandle );
}
// open the VBA project storage
@@ -643,8 +632,8 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
setVbaProjectStorage( getBaseFilter().openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false ) );
// #i56376# missing EOF - rewind before worksheet BOF record (see above)
- if( bRet && isBofRecord() )
- mrStrm.rewindRecord();
+ if( bRet && BiffHelper::isBofRecord( rStrm ) )
+ rStrm.rewindRecord();
rProgressBar.setPosition( 1.0 );
return bRet;
@@ -673,6 +662,7 @@ bool BiffWorkbookFragment::importSheetFragment( ISegmentProgressBar& rProgressBa
createBuffersPerSheet( nCalcSheet );
// preprocess some records
+ BiffInputStream& rStrm = getInputStream();
switch( getBiff() )
{
// load the workbook globals fragment records in BIFF2-BIFF4
@@ -681,12 +671,12 @@ bool BiffWorkbookFragment::importSheetFragment( ISegmentProgressBar& rProgressBa
case BIFF4:
{
// remember current record to seek back below
- sal_Int64 nRecHandle = mrStrm.getRecHandle();
+ sal_Int64 nRecHandle = rStrm.getRecHandle();
// import the global records
ISegmentProgressBarRef xGlobalsProgress = rProgressBar.createSegment( PROGRESS_LENGTH_GLOBALS );
importGlobalsFragment( *xGlobalsProgress );
// rewind stream to fragment BOF record
- mrStrm.startRecordByHandle( nRecHandle );
+ rStrm.startRecordByHandle( nRecHandle );
}
break;
@@ -694,11 +684,11 @@ bool BiffWorkbookFragment::importSheetFragment( ISegmentProgressBar& rProgressBa
case BIFF5:
{
// remember current record to seek back below
- sal_Int64 nRecHandle = mrStrm.getRecHandle();
+ sal_Int64 nRecHandle = rStrm.getRecHandle();
// fragment implementing import of external link records
- BiffExternalLinkFragment( *this, false ).importFragment();
+ BiffExternalLinkFragment( *this ).importFragment();
// rewind stream to fragment BOF record
- mrStrm.startRecordByHandle( nRecHandle );
+ rStrm.startRecordByHandle( nRecHandle );
}
break;
@@ -735,4 +725,3 @@ bool BiffWorkbookFragment::importSheetFragment( ISegmentProgressBar& rProgressBa
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx
index ceba5690004c..8cd2748101d7 100644
--- a/oox/source/xls/workbookhelper.cxx
+++ b/oox/source/xls/workbookhelper.cxx
@@ -26,31 +26,31 @@
************************************************************************/
#include "oox/xls/workbookhelper.hxx"
-#include <osl/thread.h>
+
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/document/XActionLockable.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XDatabaseRange.hpp>
+#include <com/sun/star/sheet/XDatabaseRanges.hpp>
#include <com/sun/star/sheet/XNamedRange.hpp>
#include <com/sun/star/sheet/XNamedRanges.hpp>
-#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-#include <com/sun/star/sheet/XExternalDocLinks.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-#include "properties.hxx"
+#include <com/sun/star/table/CellAddress.hpp>
+#include <osl/thread.h>
+#include "oox/drawingml/theme.hxx"
#include "oox/helper/progressbar.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/drawingml/theme.hxx"
+#include "oox/ole/vbaproject.hxx"
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/biffcodec.hxx"
+#include "oox/xls/connectionsbuffer.hxx"
#include "oox/xls/defnamesbuffer.hxx"
#include "oox/xls/excelchartconverter.hxx"
#include "oox/xls/excelfilter.hxx"
-#include "oox/xls/excelvbaproject.hxx"
#include "oox/xls/externallinkbuffer.hxx"
#include "oox/xls/formulaparser.hxx"
#include "oox/xls/pagesettings.hxx"
@@ -63,43 +63,29 @@
#include "oox/xls/themebuffer.hxx"
#include "oox/xls/unitconverter.hxx"
#include "oox/xls/viewsettings.hxx"
-#include "oox/xls/webquerybuffer.hxx"
#include "oox/xls/workbooksettings.hxx"
#include "oox/xls/worksheetbuffer.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-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::container::XIndexAccess;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNameContainer;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::awt::XDevice;
-using ::com::sun::star::document::XActionLockable;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::XCell;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::sheet::XSpreadsheetDocument;
-using ::com::sun::star::sheet::XSpreadsheet;
-using ::com::sun::star::sheet::XNamedRange;
-using ::com::sun::star::sheet::XNamedRanges;
-using ::com::sun::star::sheet::XDatabaseRanges;
-using ::com::sun::star::sheet::XExternalDocLinks;
-using ::com::sun::star::style::XStyle;
-using ::com::sun::star::style::XStyleFamiliesSupplier;
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+
using ::oox::core::BinaryFilterBase;
using ::oox::core::FilterBase;
using ::oox::core::FragmentHandler;
using ::oox::core::XmlFilterBase;
using ::oox::drawingml::Theme;
-
-namespace oox {
-namespace xls {
+using ::rtl::OUString;
// ============================================================================
@@ -145,22 +131,14 @@ public:
/** Returns a reference to the source/target spreadsheet document model. */
inline Reference< XSpreadsheetDocument > getDocument() const { return mxDoc; }
- /** Returns the reference device of the document. */
- Reference< XDevice > getReferenceDevice() const;
- /** Returns the container for defined names from the Calc document. */
- Reference< XNamedRanges > getNamedRanges() const;
- /** Returns the container for database ranges from the Calc document. */
- Reference< XDatabaseRanges > getDatabaseRanges() const;
- /** Returns the container for external documents from the Calc document. */
- Reference< XExternalDocLinks > getExternalDocLinks() const;
- /** Returns the container for DDE links from the Calc document. */
- Reference< XNameAccess > getDdeLinks() const;
/** Returns the cell or page styles container from the Calc document. */
Reference< XNameContainer > getStyleFamily( bool bPageStyles ) const;
/** Returns the specified cell or page style from the Calc document. */
Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const;
/** Creates and returns a defined name on-the-fly in the Calc document. */
Reference< XNamedRange > createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const;
+ /** Creates and returns a database range on-the-fly in the Calc document. */
+ Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const;
/** Creates and returns a com.sun.star.style.Style object for cells or pages. */
Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle ) const;
@@ -186,8 +164,8 @@ public:
inline TableBuffer& getTables() const { return *mxTables; }
/** Returns the scenarios collection. */
inline ScenarioBuffer& getScenarios() const { return *mxScenarios; }
- /** Returns the web queries. */
- inline WebQueryBuffer& getWebQueries() const { return *mxWebQueries; }
+ /** Returns the collection of external data connections. */
+ inline ConnectionsBuffer& getConnections() const { return *mxConnections; }
/** Returns the collection of pivot caches. */
inline PivotCacheBuffer& getPivotCaches() const { return *mxPivotCaches; }
/** Returns the collection of pivot tables. */
@@ -206,12 +184,12 @@ public:
/** Returns the page/print settings converter. */
inline PageSettingsConverter& getPageSettingsConverter() const { return *mxPageSettConverter; }
- // OOX specific -----------------------------------------------------------
+ // OOXML/BIFF12 specific --------------------------------------------------
- /** Returns the base OOX filter object. */
+ /** Returns the base OOXML/BIFF12 filter object. */
inline XmlFilterBase& getOoxFilter() const { return *mpOoxFilter; }
- // BIFF specific ----------------------------------------------------------
+ // BIFF2-BIFF8 specific ---------------------------------------------------
/** Returns the base BIFF filter object. */
inline BinaryFilterBase& getBiffFilter() const { return *mpBiffFilter; }
@@ -250,7 +228,7 @@ private:
typedef ::std::auto_ptr< DefinedNamesBuffer > DefNamesBfrPtr;
typedef ::std::auto_ptr< TableBuffer > TableBfrPtr;
typedef ::std::auto_ptr< ScenarioBuffer > ScenarioBfrPtr;
- typedef ::std::auto_ptr< WebQueryBuffer > WebQueryBfrPtr;
+ typedef ::std::auto_ptr< ConnectionsBuffer > ConnectionsBfrPtr;
typedef ::std::auto_ptr< PivotCacheBuffer > PivotCacheBfrPtr;
typedef ::std::auto_ptr< PivotTableBuffer > PivotTableBfrPtr;
typedef ::std::auto_ptr< FormulaParser > FormulaParserPtr;
@@ -284,7 +262,7 @@ private:
DefNamesBfrPtr mxDefNames; /// All defined names.
TableBfrPtr mxTables; /// All tables (database ranges).
ScenarioBfrPtr mxScenarios; /// All scenarios.
- WebQueryBfrPtr mxWebQueries; /// Web queries buffer.
+ ConnectionsBfrPtr mxConnections; /// All external data connections.
PivotCacheBfrPtr mxPivotCaches; /// All pivot caches in the document.
PivotTableBfrPtr mxPivotTables; /// All pivot tables in the document.
@@ -295,11 +273,11 @@ private:
ExcelChartConvPtr mxChartConverter; /// Chart object converter.
PageSettConvPtr mxPageSettConverter; /// Page/print settings converter.
- // OOX specific
- XmlFilterBase* mpOoxFilter; /// Base OOX filter object.
+ // OOXML/BIFF12 specific
+ XmlFilterBase* mpOoxFilter; /// Base OOXML/BIFF12 filter object.
- // BIFF specific
- BinaryFilterBase* mpBiffFilter; /// Base BIFF filter object.
+ // BIFF2-BIFF8 specific
+ BinaryFilterBase* mpBiffFilter; /// Base BIFF2-BIFF8 filter object.
BiffCodecHelperPtr mxCodecHelper; /// Encoder/decoder helper.
BiffType meBiff; /// BIFF version for BIFF import/export.
rtl_TextEncoding meTextEnc; /// BIFF byte string text encoding.
@@ -311,7 +289,7 @@ private:
WorkbookData::WorkbookData( ExcelFilter& rFilter ) :
mrBaseFilter( rFilter ),
mrExcelBase( rFilter ),
- meFilterType( FILTER_OOX ),
+ meFilterType( FILTER_OOXML ),
mpOoxFilter( &rFilter ),
mpBiffFilter( 0 ),
meBiff( BIFF_UNKNOWN )
@@ -342,46 +320,6 @@ WorkbookData::~WorkbookData()
// document model -------------------------------------------------------------
-Reference< XDevice > WorkbookData::getReferenceDevice() const
-{
- PropertySet aPropSet( mxDoc );
- Reference< XDevice > xDevice;
- aPropSet.getProperty( xDevice, PROP_ReferenceDevice );
- return xDevice;
-}
-
-Reference< XNamedRanges > WorkbookData::getNamedRanges() const
-{
- PropertySet aPropSet( mxDoc );
- Reference< XNamedRanges > xNamedRanges;
- aPropSet.getProperty( xNamedRanges, PROP_NamedRanges );
- return xNamedRanges;
-}
-
-Reference< XDatabaseRanges > WorkbookData::getDatabaseRanges() const
-{
- PropertySet aPropSet( mxDoc );
- Reference< XDatabaseRanges > xDatabaseRanges;
- aPropSet.getProperty( xDatabaseRanges, PROP_DatabaseRanges );
- return xDatabaseRanges;
-}
-
-Reference< XExternalDocLinks > WorkbookData::getExternalDocLinks() const
-{
- PropertySet aPropSet( mxDoc );
- Reference< XExternalDocLinks > xDocLinks;
- aPropSet.getProperty( xDocLinks, PROP_ExternalDocLinks );
- return xDocLinks;
-}
-
-Reference< XNameAccess > WorkbookData::getDdeLinks() const
-{
- PropertySet aPropSet( mxDoc );
- Reference< XNameAccess > xDdeLinks;
- aPropSet.getProperty( xDdeLinks, PROP_DDELinks );
- return xDdeLinks;
-}
-
Reference< XNameContainer > WorkbookData::getStyleFamily( bool bPageStyles ) const
{
Reference< XNameContainer > xStylesNC;
@@ -415,16 +353,16 @@ Reference< XStyle > WorkbookData::getStyleObject( const OUString& rStyleName, bo
Reference< XNamedRange > WorkbookData::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const
{
- // find an unused name
- Reference< XNamedRanges > xNamedRanges = getNamedRanges();
- Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY );
- if( xNameAccess.is() )
- orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
-
// create the name and insert it into the Calc document
Reference< XNamedRange > xNamedRange;
- if( xNamedRanges.is() && (orName.getLength() > 0) ) try
+ if( orName.getLength() > 0 ) try
{
+ // find an unused name
+ PropertySet aDocProps( mxDoc );
+ Reference< XNamedRanges > xNamedRanges( aDocProps.getAnyProperty( PROP_NamedRanges ), UNO_QUERY_THROW );
+ Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY_THROW );
+ orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
+ // create the named range
xNamedRanges->addNewByName( orName, OUString(), CellAddress( 0, 0, 0 ), nNameFlags );
xNamedRange.set( xNamedRanges->getByName( orName ), UNO_QUERY );
}
@@ -435,6 +373,32 @@ Reference< XNamedRange > WorkbookData::createNamedRangeObject( OUString& orName,
return xNamedRange;
}
+Reference< XDatabaseRange > WorkbookData::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const
+{
+ // validate cell range
+ CellRangeAddress aDestRange = rRangeAddr;
+ bool bValidRange = getAddressConverter().validateCellRange( aDestRange, true, true );
+
+ // create database range and insert it into the Calc document
+ Reference< XDatabaseRange > xDatabaseRange;
+ if( bValidRange && (orName.getLength() > 0) ) try
+ {
+ // find an unused name
+ PropertySet aDocProps( mxDoc );
+ Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
+ Reference< XNameAccess > xNameAccess( xDatabaseRanges, UNO_QUERY_THROW );
+ orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
+ // create the database range
+ xDatabaseRanges->addNewByName( orName, aDestRange );
+ xDatabaseRange.set( xDatabaseRanges->getByName( orName ), UNO_QUERY );
+ }
+ catch( Exception& )
+ {
+ }
+ OSL_ENSURE( xDatabaseRange.is(), "WorkbookData::createDatabaseRangeObject - cannot create database range" );
+ return xDatabaseRange;
+}
+
Reference< XStyle > WorkbookData::createStyleObject( OUString& orStyleName, bool bPageStyle ) const
{
Reference< XStyle > xStyle;
@@ -542,7 +506,7 @@ void WorkbookData::initialize( bool bWorkbookFile )
mxDefNames.reset( new DefinedNamesBuffer( *this ) );
mxTables.reset( new TableBuffer( *this ) );
mxScenarios.reset( new ScenarioBuffer( *this ) );
- mxWebQueries.reset( new WebQueryBuffer( *this ) );
+ mxConnections.reset( new ConnectionsBuffer( *this ) );
mxPivotCaches.reset( new PivotCacheBuffer( *this ) );
mxPivotTables.reset( new PivotTableBuffer( *this ) );
@@ -564,7 +528,7 @@ void WorkbookData::initialize( bool bWorkbookFile )
// disable automatic update of linked sheets and DDE links
aPropSet.setProperty( PROP_IsExecuteLinkEnabled, false );
// #i79890# disable automatic update of defined names
- Reference< XActionLockable > xLockable( getNamedRanges(), UNO_QUERY );
+ Reference< XActionLockable > xLockable( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY );
if( xLockable.is() )
xLockable->addActionLock();
@@ -585,7 +549,7 @@ void WorkbookData::initialize( bool bWorkbookFile )
mxCodecHelper.reset( new BiffCodecHelper( *this ) );
break;
- case FILTER_OOX:
+ case FILTER_OOXML:
break;
case FILTER_UNKNOWN:
@@ -602,7 +566,7 @@ void WorkbookData::finalize()
// #i74668# do not insert default sheets
aPropSet.setProperty( PROP_IsLoaded, true );
// #i79890# enable automatic update of defined names (before IsAdjustHeightEnabled!)
- Reference< XActionLockable > xLockable( getNamedRanges(), UNO_QUERY );
+ Reference< XActionLockable > xLockable( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY );
if( xLockable.is() )
xLockable->removeActionLock();
// enable automatic update of linked sheets and DDE links
@@ -613,6 +577,8 @@ void WorkbookData::finalize()
aPropSet.setProperty( PROP_IsUndoEnabled, true );
// disable editing read-only documents (e.g. from read-only files)
aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, false );
+ // #111099# open forms in alive mode (has no effect, if no controls in document)
+ aPropSet.setProperty( PROP_ApplyFormDesignMode, false );
}
}
@@ -631,7 +597,7 @@ FilterBase& WorkbookHelper::getBaseFilter() const
Reference< XMultiServiceFactory > WorkbookHelper::getGlobalFactory() const
{
- return mrBookData.getBaseFilter().getGlobalFactory();
+ return mrBookData.getBaseFilter().getServiceFactory();
}
FilterType WorkbookHelper::getFilterType() const
@@ -690,10 +656,7 @@ void WorkbookHelper::finalizeWorkbookImport()
contains the workbook code name). */
StorageRef xVbaPrjStrg = mrBookData.getVbaProjectStorage();
if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
- {
- ExcelVbaProject aVbaProject( getGlobalFactory(), getDocument() );
- aVbaProject.importVbaProject( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() );
- }
+ getBaseFilter().getVbaProject().importVbaProject( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() );
}
// document model -------------------------------------------------------------
@@ -708,31 +671,6 @@ Reference< XMultiServiceFactory > WorkbookHelper::getDocumentFactory() const
return mrBookData.getBaseFilter().getModelFactory();
}
-Reference< XDevice > WorkbookHelper::getReferenceDevice() const
-{
- return mrBookData.getReferenceDevice();
-}
-
-Reference< XNamedRanges > WorkbookHelper::getNamedRanges() const
-{
- return mrBookData.getNamedRanges();
-}
-
-Reference< XDatabaseRanges > WorkbookHelper::getDatabaseRanges() const
-{
- return mrBookData.getDatabaseRanges();
-}
-
-Reference< XExternalDocLinks > WorkbookHelper::getExternalDocLinks() const
-{
- return mrBookData.getExternalDocLinks();
-}
-
-Reference< XNameAccess > WorkbookHelper::getDdeLinks() const
-{
- return mrBookData.getDdeLinks();
-}
-
Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( sal_Int16 nSheet ) const
{
Reference< XSpreadsheet > xSheet;
@@ -804,6 +742,11 @@ Reference< XNamedRange > WorkbookHelper::createNamedRangeObject( OUString& orNam
return mrBookData.createNamedRangeObject( orName, nNameFlags );
}
+Reference< XDatabaseRange > WorkbookHelper::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const
+{
+ return mrBookData.createDatabaseRangeObject( orName, rRangeAddr );
+}
+
Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle ) const
{
return mrBookData.createStyleObject( orStyleName, bPageStyle );
@@ -861,9 +804,9 @@ ScenarioBuffer& WorkbookHelper::getScenarios() const
return mrBookData.getScenarios();
}
-WebQueryBuffer& WorkbookHelper::getWebQueries() const
+ConnectionsBuffer& WorkbookHelper::getConnections() const
{
- return mrBookData.getWebQueries();
+ return mrBookData.getConnections();
}
PivotCacheBuffer& WorkbookHelper::getPivotCaches() const
@@ -903,11 +846,11 @@ PageSettingsConverter& WorkbookHelper::getPageSettingsConverter() const
return mrBookData.getPageSettingsConverter();
}
-// OOX specific ---------------------------------------------------------------
+// OOXML/BIFF12 specific ------------------------------------------------------
XmlFilterBase& WorkbookHelper::getOoxFilter() const
{
- OSL_ENSURE( mrBookData.getFilterType() == FILTER_OOX, "WorkbookHelper::getOoxFilter - invalid call" );
+ OSL_ENSURE( mrBookData.getFilterType() == FILTER_OOXML, "WorkbookHelper::getOoxFilter - invalid call" );
return mrBookData.getOoxFilter();
}
@@ -1002,4 +945,3 @@ bool WorkbookHelperRoot::isValid() const
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/workbooksettings.cxx b/oox/source/xls/workbooksettings.cxx
index 51d60ebafe3b..6889d42ed2f6 100644
--- a/oox/source/xls/workbooksettings.cxx
+++ b/oox/source/xls/workbooksettings.cxx
@@ -26,48 +26,45 @@
************************************************************************/
#include "oox/xls/workbooksettings.hxx"
+
#include <com/sun/star/sheet/XCalculatable.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <comphelper/mediadescriptor.hxx>
-#include "properties.hxx"
+#include "oox/core/filterbase.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/unitconverter.hxx"
-using ::rtl::OUString;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::sheet::XCalculatable;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::util::Date;
-using ::com::sun::star::util::XNumberFormatsSupplier;
-using ::comphelper::MediaDescriptor;
-using ::oox::core::CodecHelper;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::CodecHelper;
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
-const sal_uInt32 OOBIN_WORKBOOKPR_DATE1904 = 0x00000001;
-const sal_uInt32 OOBIN_WORKBOOKPR_STRIPEXT = 0x00000080;
+const sal_uInt32 BIFF12_WORKBOOKPR_DATE1904 = 0x00000001;
+const sal_uInt32 BIFF12_WORKBOOKPR_STRIPEXT = 0x00000080;
-const sal_uInt16 OOBIN_CALCPR_A1 = 0x0002;
-const sal_uInt16 OOBIN_CALCPR_ITERATE = 0x0004;
-const sal_uInt16 OOBIN_CALCPR_FULLPRECISION = 0x0008;
-const sal_uInt16 OOBIN_CALCPR_CALCCOMPLETED = 0x0010;
-const sal_uInt16 OOBIN_CALCPR_CALCONSAVE = 0x0020;
-const sal_uInt16 OOBIN_CALCPR_CONCURRENT = 0x0040;
-const sal_uInt16 OOBIN_CALCPR_MANUALPROC = 0x0080;
+const sal_uInt16 BIFF12_CALCPR_A1 = 0x0002;
+const sal_uInt16 BIFF12_CALCPR_ITERATE = 0x0004;
+const sal_uInt16 BIFF12_CALCPR_FULLPRECISION = 0x0008;
+const sal_uInt16 BIFF12_CALCPR_CALCCOMPLETED = 0x0010;
+const sal_uInt16 BIFF12_CALCPR_CALCONSAVE = 0x0020;
+const sal_uInt16 BIFF12_CALCPR_CONCURRENT = 0x0040;
+const sal_uInt16 BIFF12_CALCPR_MANUALPROC = 0x0080;
// no predefined constants for show objects mode
const sal_Int16 API_SHOWMODE_SHOW = 0; /// Show drawing objects.
@@ -95,7 +92,7 @@ WorkbookSettingsModel::WorkbookSettingsModel() :
{
}
-void WorkbookSettingsModel::setBinObjectMode( sal_uInt16 nObjMode )
+void WorkbookSettingsModel::setBiffObjectMode( sal_uInt16 nObjMode )
{
static const sal_Int32 spnObjModes[] = { XML_all, XML_placeholders, XML_none };
mnShowObjectMode = STATIC_ARRAY_SELECT( spnObjModes, nObjMode, XML_all );
@@ -158,37 +155,37 @@ void WorkbookSettings::importCalcPr( const AttributeList& rAttribs )
maCalcSettings.mbConcurrent = rAttribs.getBool( XML_concurrentCalc, true );
}
-void WorkbookSettings::importFileSharing( RecordInputStream& rStrm )
+void WorkbookSettings::importFileSharing( SequenceInputStream& rStrm )
{
maFileSharing.mbRecommendReadOnly = rStrm.readuInt16() != 0;
rStrm >> maFileSharing.mnPasswordHash >> maFileSharing.maUserName;
}
-void WorkbookSettings::importWorkbookPr( RecordInputStream& rStrm )
+void WorkbookSettings::importWorkbookPr( SequenceInputStream& rStrm )
{
sal_uInt32 nFlags;
rStrm >> nFlags >> maBookSettings.mnDefaultThemeVer >> maBookSettings.maCodeName;
- maBookSettings.setBinObjectMode( extractValue< sal_uInt16 >( nFlags, 13, 2 ) );
+ maBookSettings.setBiffObjectMode( extractValue< sal_uInt16 >( nFlags, 13, 2 ) );
// set flag means: strip external link values
- maBookSettings.mbSaveExtLinkValues = !getFlag( nFlags, OOBIN_WORKBOOKPR_STRIPEXT );
- setDateMode( getFlag( nFlags, OOBIN_WORKBOOKPR_DATE1904 ) );
+ maBookSettings.mbSaveExtLinkValues = !getFlag( nFlags, BIFF12_WORKBOOKPR_STRIPEXT );
+ setDateMode( getFlag( nFlags, BIFF12_WORKBOOKPR_DATE1904 ) );
}
-void WorkbookSettings::importCalcPr( RecordInputStream& rStrm )
+void WorkbookSettings::importCalcPr( SequenceInputStream& rStrm )
{
sal_Int32 nCalcMode, nProcCount;
sal_uInt16 nFlags;
rStrm >> maCalcSettings.mnCalcId >> nCalcMode >> maCalcSettings.mnIterateCount >> maCalcSettings.mfIterateDelta >> nProcCount >> nFlags;
static const sal_Int32 spnCalcModes[] = { XML_manual, XML_auto, XML_autoNoTable };
- maCalcSettings.mnRefMode = getFlagValue( nFlags, OOBIN_CALCPR_A1, XML_A1, XML_R1C1 );
+ maCalcSettings.mnRefMode = getFlagValue( nFlags, BIFF12_CALCPR_A1, XML_A1, XML_R1C1 );
maCalcSettings.mnCalcMode = STATIC_ARRAY_SELECT( spnCalcModes, nCalcMode, XML_auto );
- maCalcSettings.mnProcCount = getFlagValue< sal_Int32 >( nFlags, OOBIN_CALCPR_MANUALPROC, nProcCount, -1 );
- maCalcSettings.mbCalcOnSave = getFlag( nFlags, OOBIN_CALCPR_CALCONSAVE );
- maCalcSettings.mbCalcCompleted = getFlag( nFlags, OOBIN_CALCPR_CALCCOMPLETED );
- maCalcSettings.mbFullPrecision = getFlag( nFlags, OOBIN_CALCPR_FULLPRECISION );
- maCalcSettings.mbIterate = getFlag( nFlags, OOBIN_CALCPR_ITERATE );
- maCalcSettings.mbConcurrent = getFlag( nFlags, OOBIN_CALCPR_CONCURRENT );
+ maCalcSettings.mnProcCount = getFlagValue< sal_Int32 >( nFlags, BIFF12_CALCPR_MANUALPROC, nProcCount, -1 );
+ maCalcSettings.mbCalcOnSave = getFlag( nFlags, BIFF12_CALCPR_CALCONSAVE );
+ maCalcSettings.mbCalcCompleted = getFlag( nFlags, BIFF12_CALCPR_CALCCOMPLETED );
+ maCalcSettings.mbFullPrecision = getFlag( nFlags, BIFF12_CALCPR_FULLPRECISION );
+ maCalcSettings.mbIterate = getFlag( nFlags, BIFF12_CALCPR_ITERATE );
+ maCalcSettings.mbConcurrent = getFlag( nFlags, BIFF12_CALCPR_CONCURRENT );
}
void WorkbookSettings::setSaveExtLinkValues( bool bSaveExtLinks )
@@ -248,7 +245,7 @@ void WorkbookSettings::importFileSharing( BiffInputStream& rStrm )
void WorkbookSettings::importHideObj( BiffInputStream& rStrm )
{
- maBookSettings.setBinObjectMode( rStrm.readuInt16() );
+ maBookSettings.setBiffObjectMode( rStrm.readuInt16() );
}
void WorkbookSettings::importIteration( BiffInputStream& rStrm )
@@ -288,7 +285,7 @@ void WorkbookSettings::finalizeImport()
PropertySet aPropSet( getDocument() );
switch( getFilterType() )
{
- case FILTER_OOX:
+ case FILTER_OOXML:
case FILTER_BIFF:
aPropSet.setProperty( PROP_IgnoreCase, true ); // always in Excel
aPropSet.setProperty( PROP_RegularExpressions, false ); // not supported in Excel
@@ -367,4 +364,3 @@ void WorkbookSettings::setDateMode( bool bDateMode1904 )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/worksheetbuffer.cxx b/oox/source/xls/worksheetbuffer.cxx
index 6f8d50ff38f6..6144c35d6a55 100644
--- a/oox/source/xls/worksheetbuffer.cxx
+++ b/oox/source/xls/worksheetbuffer.cxx
@@ -26,37 +26,35 @@
************************************************************************/
#include "oox/xls/worksheetbuffer.hxx"
-#include <rtl/ustrbuf.hxx>
+
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XExternalSheetName.hpp>
#include <com/sun/star/sheet/XSheetLinkable.hpp>
-#include "properties.hxx"
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <rtl/ustrbuf.hxx>
+#include "oox/core/filterbase.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/helper/recordinputstream.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/excelhandlers.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::container::XNameAccess;
-using ::com::sun::star::container::XNamed;
-using ::com::sun::star::sheet::XSpreadsheetDocument;
-using ::com::sun::star::sheet::XSpreadsheets;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
SheetInfoModel::SheetInfoModel() :
mnBiffHandle( -1 ),
mnSheetId( -1 ),
@@ -97,7 +95,7 @@ void WorksheetBuffer::importSheet( const AttributeList& rAttribs )
insertSheet( aModel );
}
-void WorksheetBuffer::importSheet( RecordInputStream& rStrm )
+void WorksheetBuffer::importSheet( SequenceInputStream& rStrm )
{
sal_Int32 nState;
SheetInfoModel aModel;
@@ -258,4 +256,3 @@ void WorksheetBuffer::insertSheet( const SheetInfoModel& rModel )
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx
index bee58fdbaff3..4867c7c350c1 100644
--- a/oox/source/xls/worksheetfragment.cxx
+++ b/oox/source/xls/worksheetfragment.cxx
@@ -26,11 +26,12 @@
************************************************************************/
#include "oox/xls/worksheetfragment.hxx"
-#include "oox/helper/attributelist.hxx"
-#include "oox/helper/recordinputstream.hxx"
+
#include "oox/core/filterbase.hxx"
#include "oox/core/relations.hxx"
+#include "oox/helper/attributelist.hxx"
#include "oox/xls/addressconverter.hxx"
+#include "oox/xls/autofilterbuffer.hxx"
#include "oox/xls/autofiltercontext.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/commentsfragment.hxx"
@@ -38,7 +39,6 @@
#include "oox/xls/drawingfragment.hxx"
#include "oox/xls/externallinkbuffer.hxx"
#include "oox/xls/pagesettings.hxx"
-#include "oox/xls/pivottablebuffer.hxx"
#include "oox/xls/pivottablefragment.hxx"
#include "oox/xls/querytablefragment.hxx"
#include "oox/xls/scenariobuffer.hxx"
@@ -49,23 +49,20 @@
#include "oox/xls/workbooksettings.hxx"
#include "oox/xls/worksheetsettings.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::oox::core::ContextHandlerRef;
-using ::oox::core::RecordInfo;
-using ::oox::core::Relations;
-using ::oox::core::RelationsRef;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::uno;
+using namespace ::oox::core;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
const sal_uInt16 BIFF_COLINFO_HIDDEN = 0x0001;
@@ -87,23 +84,23 @@ const sal_uInt32 BIFF_DATAVAL_SHOWERROR = 0x00080000;
const sal_uInt32 BIFF_SHRFEATHEAD_SHEETPROT = 2;
-const sal_Int32 OOBIN_OLEOBJECT_CONTENT = 1;
-const sal_Int32 OOBIN_OLEOBJECT_ICON = 4;
-const sal_Int32 OOBIN_OLEOBJECT_ALWAYS = 1;
-const sal_Int32 OOBIN_OLEOBJECT_ONCALL = 3;
-const sal_uInt16 OOBIN_OLEOBJECT_LINKED = 0x0001;
-const sal_uInt16 OOBIN_OLEOBJECT_AUTOLOAD = 0x0002;
+const sal_Int32 BIFF12_OLEOBJECT_CONTENT = 1;
+const sal_Int32 BIFF12_OLEOBJECT_ICON = 4;
+const sal_Int32 BIFF12_OLEOBJECT_ALWAYS = 1;
+const sal_Int32 BIFF12_OLEOBJECT_ONCALL = 3;
+const sal_uInt16 BIFF12_OLEOBJECT_LINKED = 0x0001;
+const sal_uInt16 BIFF12_OLEOBJECT_AUTOLOAD = 0x0002;
} // namespace
// ============================================================================
-OoxDataValidationsContext::OoxDataValidationsContext( OoxWorksheetFragmentBase& rFragment ) :
- OoxWorksheetContextBase( rFragment )
+DataValidationsContext::DataValidationsContext( WorksheetFragmentBase& rFragment ) :
+ WorksheetContextBase( rFragment )
{
}
-ContextHandlerRef OoxDataValidationsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef DataValidationsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -119,7 +116,7 @@ ContextHandlerRef OoxDataValidationsContext::onCreateContext( sal_Int32 nElement
{
case XLS_TOKEN( formula1 ):
case XLS_TOKEN( formula2 ):
- return this; // collect formulas in onEndElement()
+ return this; // collect formulas in onCharacters()
}
break;
}
@@ -138,7 +135,7 @@ ApiTokenSequence lclImportDataValFormula( FormulaParser& rParser, const OUString
} // namespace
-void OoxDataValidationsContext::onEndElement( const OUString& rChars )
+void DataValidationsContext::onCharacters( const OUString& rChars )
{
if( mxValModel.get() ) switch( getCurrentElement() )
{
@@ -153,22 +150,27 @@ void OoxDataValidationsContext::onEndElement( const OUString& rChars )
mxValModel->maTokens2 = lclImportDataValFormula(
getFormulaParser(), rChars, mxValModel->maRanges.getBaseAddress() );
break;
- case XLS_TOKEN( dataValidation ):
- setValidation( *mxValModel );
- mxValModel.reset();
- break;
+ }
+}
+
+void DataValidationsContext::onEndElement()
+{
+ if( isCurrentElement( XLS_TOKEN( dataValidation ) ) && mxValModel.get() )
+ {
+ setValidation( *mxValModel );
+ mxValModel.reset();
}
}
-ContextHandlerRef OoxDataValidationsContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef DataValidationsContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
- if( nRecId == OOBIN_ID_DATAVALIDATION )
+ if( nRecId == BIFF12_ID_DATAVALIDATION )
importDataValidation( rStrm );
return 0;
}
-void OoxDataValidationsContext::importDataValidation( const AttributeList& rAttribs )
+void DataValidationsContext::importDataValidation( const AttributeList& rAttribs )
{
mxValModel.reset( new ValidationModel );
getAddressConverter().convertToCellRangeList( mxValModel->maRanges, rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true );
@@ -188,7 +190,7 @@ void OoxDataValidationsContext::importDataValidation( const AttributeList& rAttr
mxValModel->mbAllowBlank = rAttribs.getBool( XML_allowBlank, false );
}
-void OoxDataValidationsContext::importDataValidation( RecordInputStream& rStrm )
+void DataValidationsContext::importDataValidation( SequenceInputStream& rStrm )
{
ValidationModel aModel;
@@ -196,10 +198,10 @@ void OoxDataValidationsContext::importDataValidation( RecordInputStream& rStrm )
BinRangeList aRanges;
rStrm >> nFlags >> aRanges >> aModel.maErrorTitle >> aModel.maErrorMessage >> aModel.maInputTitle >> aModel.maInputMessage;
- // equal flags in BIFF and OOBIN
- aModel.setBinType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
- aModel.setBinOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
- aModel.setBinErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
+ // equal flags in all BIFFs
+ aModel.setBiffType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
+ aModel.setBiffOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
+ aModel.setBiffErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
aModel.mbAllowBlank = getFlag( nFlags, BIFF_DATAVAL_ALLOWBLANK );
aModel.mbNoDropDown = getFlag( nFlags, BIFF_DATAVAL_NODROPDOWN );
aModel.mbShowInputMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWINPUT );
@@ -226,24 +228,22 @@ void OoxDataValidationsContext::importDataValidation( RecordInputStream& rStrm )
// ============================================================================
-OoxWorksheetFragment::OoxWorksheetFragment( const WorkbookHelper& rHelper,
- const OUString& rFragmentPath, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
- OoxWorksheetFragmentBase( rHelper, rFragmentPath, xProgressBar, eSheetType, nSheet )
+WorksheetFragment::WorksheetFragment( const WorkbookHelper& rHelper,
+ const OUString& rFragmentPath, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+ WorksheetFragmentBase( rHelper, rFragmentPath, rxProgressBar, eSheetType, nSheet )
{
// import data tables related to this worksheet
- RelationsRef xTableRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "table" ) );
+ RelationsRef xTableRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "table" ) );
for( Relations::const_iterator aIt = xTableRels->begin(), aEnd = xTableRels->end(); aIt != aEnd; ++aIt )
- importOoxFragment( new OoxTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
+ importOoxFragment( new TableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
// import comments related to this worksheet
- OUString aCommentsFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "comments" ) );
+ OUString aCommentsFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "comments" ) );
if( aCommentsFragmentPath.getLength() > 0 )
- importOoxFragment( new OoxCommentsFragment( *this, aCommentsFragmentPath ) );
+ importOoxFragment( new CommentsFragment( *this, aCommentsFragmentPath ) );
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextHandlerRef OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -252,7 +252,7 @@ ContextHandlerRef OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, con
case SHEETTYPE_WORKSHEET: return (nElement == XLS_TOKEN( worksheet )) ? this : 0;
case SHEETTYPE_CHARTSHEET: return 0;
case SHEETTYPE_MACROSHEET: return (nElement == XM_TOKEN( macrosheet )) ? this : 0;
- case SHEETTYPE_DIALOGSHEET: return (nElement == XM_TOKEN( dialogsheet )) ? this : 0;
+ case SHEETTYPE_DIALOGSHEET: return (nElement == XLS_TOKEN( dialogsheet )) ? this : 0;
case SHEETTYPE_MODULESHEET: return 0;
case SHEETTYPE_EMPTYSHEET: return 0;
}
@@ -260,12 +260,14 @@ ContextHandlerRef OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, con
case XLS_TOKEN( worksheet ):
case XM_TOKEN( macrosheet ):
+ case XLS_TOKEN( dialogsheet ):
switch( nElement )
{
- case XLS_TOKEN( sheetData ): return new OoxSheetDataContext( *this );
- case XLS_TOKEN( autoFilter ): return new OoxAutoFilterContext( *this );
- case XLS_TOKEN( conditionalFormatting ): return new OoxCondFormatContext( *this );
- case XLS_TOKEN( dataValidations ): return new OoxDataValidationsContext( *this );
+ case XLS_TOKEN( sheetData ): return new SheetDataContext( *this );
+ case XLS_TOKEN( conditionalFormatting ): return new CondFormatContext( *this );
+ case XLS_TOKEN( dataValidations ): return new DataValidationsContext( *this );
+ case XLS_TOKEN( autoFilter ): return new AutoFilterContext( *this, getAutoFilters().createAutoFilter() );
+ case XLS_TOKEN( scenarios ): return new ScenariosContext( *this );
case XLS_TOKEN( sheetViews ):
case XLS_TOKEN( cols ):
@@ -288,8 +290,6 @@ ContextHandlerRef OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, con
case XLS_TOKEN( picture ): getPageSettings().importPicture( getRelations(), rAttribs ); break;
case XLS_TOKEN( drawing ): importDrawing( rAttribs ); break;
case XLS_TOKEN( legacyDrawing ): importLegacyDrawing( rAttribs ); break;
- case XLS_TOKEN( scenarios ):
- return new OoxScenariosContext( *this );
}
break;
@@ -340,7 +340,7 @@ ContextHandlerRef OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, con
case XLS_TOKEN( oddHeader ):
case XLS_TOKEN( oddFooter ):
case XLS_TOKEN( evenHeader ):
- case XLS_TOKEN( evenFooter ): return this; // collect h/f contents in onEndElement()
+ case XLS_TOKEN( evenFooter ): return this; // collect h/f contents in onCharacters()
}
break;
@@ -354,7 +354,7 @@ ContextHandlerRef OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, con
return 0;
}
-void OoxWorksheetFragment::onEndElement( const OUString& rChars )
+void WorksheetFragment::onCharacters( const OUString& rChars )
{
switch( getCurrentElement() )
{
@@ -369,134 +369,136 @@ void OoxWorksheetFragment::onEndElement( const OUString& rChars )
}
}
-ContextHandlerRef OoxWorksheetFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef WorksheetFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- if( nRecId == OOBIN_ID_WORKSHEET ) return this;
+ if( nRecId == BIFF12_ID_WORKSHEET ) return this;
break;
- case OOBIN_ID_WORKSHEET:
+ case BIFF12_ID_WORKSHEET:
switch( nRecId )
{
- case OOBIN_ID_SHEETDATA: return new OoxSheetDataContext( *this );
- case OOBIN_ID_CONDFORMATTING: return new OoxCondFormatContext( *this );
- case OOBIN_ID_DATAVALIDATIONS: return new OoxDataValidationsContext( *this );
-
- case OOBIN_ID_SHEETVIEWS:
- case OOBIN_ID_COLS:
- case OOBIN_ID_MERGECELLS:
- case OOBIN_ID_ROWBREAKS:
- case OOBIN_ID_COLBREAKS:
- case OOBIN_ID_OLEOBJECTS:
- case OOBIN_ID_CONTROLS: return this;
-
- case OOBIN_ID_SHEETPR: getWorksheetSettings().importSheetPr( rStrm ); break;
- case OOBIN_ID_DIMENSION: importDimension( rStrm ); break;
- case OOBIN_ID_SHEETFORMATPR: importSheetFormatPr( rStrm ); break;
- case OOBIN_ID_HYPERLINK: importHyperlink( rStrm ); break;
- case OOBIN_ID_PAGEMARGINS: getPageSettings().importPageMargins( rStrm ); break;
- case OOBIN_ID_PAGESETUP: getPageSettings().importPageSetup( getRelations(), rStrm ); break;
- case OOBIN_ID_PRINTOPTIONS: getPageSettings().importPrintOptions( rStrm ); break;
- case OOBIN_ID_HEADERFOOTER: getPageSettings().importHeaderFooter( rStrm ); break;
- case OOBIN_ID_PICTURE: getPageSettings().importPicture( getRelations(), rStrm ); break;
- case OOBIN_ID_SHEETPROTECTION: getWorksheetSettings().importSheetProtection( rStrm ); break;
- case OOBIN_ID_PHONETICPR: getWorksheetSettings().importPhoneticPr( rStrm ); break;
- case OOBIN_ID_DRAWING: importDrawing( rStrm ); break;
- case OOBIN_ID_LEGACYDRAWING: importLegacyDrawing( rStrm ); break;
- case OOBIN_ID_SCENARIOS:
- return new OoxScenariosContext( *this );
+ case BIFF12_ID_SHEETDATA: return new SheetDataContext( *this );
+ case BIFF12_ID_CONDFORMATTING: return new CondFormatContext( *this );
+ case BIFF12_ID_DATAVALIDATIONS: return new DataValidationsContext( *this );
+ case BIFF12_ID_AUTOFILTER: return new AutoFilterContext( *this, getAutoFilters().createAutoFilter() );
+ case BIFF12_ID_SCENARIOS: return new ScenariosContext( *this );
+
+ case BIFF12_ID_SHEETVIEWS:
+ case BIFF12_ID_COLS:
+ case BIFF12_ID_MERGECELLS:
+ case BIFF12_ID_ROWBREAKS:
+ case BIFF12_ID_COLBREAKS:
+ case BIFF12_ID_OLEOBJECTS:
+ case BIFF12_ID_CONTROLS: return this;
+
+ case BIFF12_ID_SHEETPR: getWorksheetSettings().importSheetPr( rStrm ); break;
+ case BIFF12_ID_DIMENSION: importDimension( rStrm ); break;
+ case BIFF12_ID_SHEETFORMATPR: importSheetFormatPr( rStrm ); break;
+ case BIFF12_ID_HYPERLINK: importHyperlink( rStrm ); break;
+ case BIFF12_ID_PAGEMARGINS: getPageSettings().importPageMargins( rStrm ); break;
+ case BIFF12_ID_PAGESETUP: getPageSettings().importPageSetup( getRelations(), rStrm ); break;
+ case BIFF12_ID_PRINTOPTIONS: getPageSettings().importPrintOptions( rStrm ); break;
+ case BIFF12_ID_HEADERFOOTER: getPageSettings().importHeaderFooter( rStrm ); break;
+ case BIFF12_ID_PICTURE: getPageSettings().importPicture( getRelations(), rStrm ); break;
+ case BIFF12_ID_SHEETPROTECTION: getWorksheetSettings().importSheetProtection( rStrm ); break;
+ case BIFF12_ID_PHONETICPR: getWorksheetSettings().importPhoneticPr( rStrm ); break;
+ case BIFF12_ID_DRAWING: importDrawing( rStrm ); break;
+ case BIFF12_ID_LEGACYDRAWING: importLegacyDrawing( rStrm ); break;
}
break;
- case OOBIN_ID_SHEETVIEWS:
+ case BIFF12_ID_SHEETVIEWS:
switch( nRecId )
{
- case OOBIN_ID_SHEETVIEW: getSheetViewSettings().importSheetView( rStrm ); return this;
+ case BIFF12_ID_SHEETVIEW: getSheetViewSettings().importSheetView( rStrm ); return this;
}
break;
- case OOBIN_ID_SHEETVIEW:
+ case BIFF12_ID_SHEETVIEW:
switch( nRecId )
{
- case OOBIN_ID_PANE: getSheetViewSettings().importPane( rStrm ); break;
- case OOBIN_ID_SELECTION: getSheetViewSettings().importSelection( rStrm ); break;
+ case BIFF12_ID_PANE: getSheetViewSettings().importPane( rStrm ); break;
+ case BIFF12_ID_SELECTION: getSheetViewSettings().importSelection( rStrm ); break;
}
break;
- case OOBIN_ID_COLS:
- if( nRecId == OOBIN_ID_COL ) importCol( rStrm );
+ case BIFF12_ID_COLS:
+ if( nRecId == BIFF12_ID_COL ) importCol( rStrm );
break;
- case OOBIN_ID_MERGECELLS:
- if( nRecId == OOBIN_ID_MERGECELL ) importMergeCell( rStrm );
+ case BIFF12_ID_MERGECELLS:
+ if( nRecId == BIFF12_ID_MERGECELL ) importMergeCell( rStrm );
break;
- case OOBIN_ID_ROWBREAKS:
- if( nRecId == OOBIN_ID_BRK ) importBrk( rStrm, true );
+ case BIFF12_ID_ROWBREAKS:
+ if( nRecId == BIFF12_ID_BRK ) importBrk( rStrm, true );
break;
- case OOBIN_ID_COLBREAKS:
- if( nRecId == OOBIN_ID_BRK ) importBrk( rStrm, false );
+ case BIFF12_ID_COLBREAKS:
+ if( nRecId == BIFF12_ID_BRK ) importBrk( rStrm, false );
break;
- case OOBIN_ID_OLEOBJECTS:
- if( nRecId == OOBIN_ID_OLEOBJECT ) importOleObject( rStrm );
+ case BIFF12_ID_OLEOBJECTS:
+ if( nRecId == BIFF12_ID_OLEOBJECT ) importOleObject( rStrm );
break;
- case OOBIN_ID_CONTROLS:
- if( nRecId == OOBIN_ID_CONTROL ) importControl( rStrm );
+ case BIFF12_ID_CONTROLS:
+ if( nRecId == BIFF12_ID_CONTROL ) importControl( rStrm );
break;
}
return 0;
}
-// oox.core.FragmentHandler2 interface ----------------------------------------
-
-const RecordInfo* OoxWorksheetFragment::getRecordInfos() const
+const RecordInfo* WorksheetFragment::getRecordInfos() const
{
static const RecordInfo spRecInfos[] =
{
- { OOBIN_ID_CFRULE, OOBIN_ID_CFRULE + 1 },
- { OOBIN_ID_COLBREAKS, OOBIN_ID_COLBREAKS + 1 },
- { OOBIN_ID_COLORSCALE, OOBIN_ID_COLORSCALE + 1 },
- { OOBIN_ID_COLS, OOBIN_ID_COLS + 1 },
- { OOBIN_ID_CONDFORMATTING, OOBIN_ID_CONDFORMATTING + 1 },
- { OOBIN_ID_CONTROLS, OOBIN_ID_CONTROLS + 2 },
- { OOBIN_ID_CUSTOMSHEETVIEW, OOBIN_ID_CUSTOMSHEETVIEW + 1 },
- { OOBIN_ID_CUSTOMSHEETVIEWS, OOBIN_ID_CUSTOMSHEETVIEWS + 3 },
- { OOBIN_ID_DATABAR, OOBIN_ID_DATABAR + 1 },
- { OOBIN_ID_DATAVALIDATIONS, OOBIN_ID_DATAVALIDATIONS + 1 },
- { OOBIN_ID_HEADERFOOTER, OOBIN_ID_HEADERFOOTER + 1 },
- { OOBIN_ID_ICONSET, OOBIN_ID_ICONSET + 1 },
- { OOBIN_ID_MERGECELLS, OOBIN_ID_MERGECELLS + 1 },
- { OOBIN_ID_OLEOBJECTS, OOBIN_ID_OLEOBJECTS + 2 },
- { OOBIN_ID_ROW, -1 },
- { OOBIN_ID_ROWBREAKS, OOBIN_ID_ROWBREAKS + 1 },
- { OOBIN_ID_SCENARIO, OOBIN_ID_SCENARIO + 1 },
- { OOBIN_ID_SCENARIOS, OOBIN_ID_SCENARIOS + 1 },
- { OOBIN_ID_SHEETDATA, OOBIN_ID_SHEETDATA + 1 },
- { OOBIN_ID_SHEETVIEW, OOBIN_ID_SHEETVIEW + 1 },
- { OOBIN_ID_SHEETVIEWS, OOBIN_ID_SHEETVIEWS + 1 },
- { OOBIN_ID_TABLEPARTS, OOBIN_ID_TABLEPARTS + 2 },
- { OOBIN_ID_WORKSHEET, OOBIN_ID_WORKSHEET + 1 },
+ { BIFF12_ID_AUTOFILTER, BIFF12_ID_AUTOFILTER + 1 },
+ { BIFF12_ID_CFRULE, BIFF12_ID_CFRULE + 1 },
+ { BIFF12_ID_COLBREAKS, BIFF12_ID_COLBREAKS + 1 },
+ { BIFF12_ID_COLORSCALE, BIFF12_ID_COLORSCALE + 1 },
+ { BIFF12_ID_COLS, BIFF12_ID_COLS + 1 },
+ { BIFF12_ID_CONDFORMATTING, BIFF12_ID_CONDFORMATTING + 1 },
+ { BIFF12_ID_CONTROLS, BIFF12_ID_CONTROLS + 2 },
+ { BIFF12_ID_CUSTOMFILTERS, BIFF12_ID_CUSTOMFILTERS + 1 },
+ { BIFF12_ID_CUSTOMSHEETVIEW, BIFF12_ID_CUSTOMSHEETVIEW + 1 },
+ { BIFF12_ID_CUSTOMSHEETVIEWS, BIFF12_ID_CUSTOMSHEETVIEWS + 3 },
+ { BIFF12_ID_DATABAR, BIFF12_ID_DATABAR + 1 },
+ { BIFF12_ID_DATAVALIDATIONS, BIFF12_ID_DATAVALIDATIONS + 1 },
+ { BIFF12_ID_DISCRETEFILTERS, BIFF12_ID_DISCRETEFILTERS + 1 },
+ { BIFF12_ID_FILTERCOLUMN, BIFF12_ID_FILTERCOLUMN + 1 },
+ { BIFF12_ID_HEADERFOOTER, BIFF12_ID_HEADERFOOTER + 1 },
+ { BIFF12_ID_ICONSET, BIFF12_ID_ICONSET + 1 },
+ { BIFF12_ID_MERGECELLS, BIFF12_ID_MERGECELLS + 1 },
+ { BIFF12_ID_OLEOBJECTS, BIFF12_ID_OLEOBJECTS + 2 },
+ { BIFF12_ID_ROW, -1 },
+ { BIFF12_ID_ROWBREAKS, BIFF12_ID_ROWBREAKS + 1 },
+ { BIFF12_ID_SCENARIO, BIFF12_ID_SCENARIO + 1 },
+ { BIFF12_ID_SCENARIOS, BIFF12_ID_SCENARIOS + 1 },
+ { BIFF12_ID_SHEETDATA, BIFF12_ID_SHEETDATA + 1 },
+ { BIFF12_ID_SHEETVIEW, BIFF12_ID_SHEETVIEW + 1 },
+ { BIFF12_ID_SHEETVIEWS, BIFF12_ID_SHEETVIEWS + 1 },
+ { BIFF12_ID_TABLEPARTS, BIFF12_ID_TABLEPARTS + 2 },
+ { BIFF12_ID_WORKSHEET, BIFF12_ID_WORKSHEET + 1 },
{ -1, -1 }
};
return spRecInfos;
}
-void OoxWorksheetFragment::initializeImport()
+void WorksheetFragment::initializeImport()
{
// initial processing in base class WorksheetHelper
initializeWorksheetImport();
// import query table fragments related to this worksheet
- RelationsRef xQueryRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "queryTable" ) );
+ RelationsRef xQueryRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "queryTable" ) );
for( Relations::const_iterator aIt = xQueryRels->begin(), aEnd = xQueryRels->end(); aIt != aEnd; ++aIt )
- importOoxFragment( new OoxQueryTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
+ importOoxFragment( new QueryTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
// import pivot table fragments related to this worksheet
- RelationsRef xPivotRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "pivotTable" ) );
+ RelationsRef xPivotRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "pivotTable" ) );
for( Relations::const_iterator aIt = xPivotRels->begin(), aEnd = xPivotRels->end(); aIt != aEnd; ++aIt )
- importOoxFragment( new OoxPivotTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
+ importOoxFragment( new PivotTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
}
-void OoxWorksheetFragment::finalizeImport()
+void WorksheetFragment::finalizeImport()
{
// final processing in base class WorksheetHelper
finalizeWorksheetImport();
@@ -504,13 +506,13 @@ void OoxWorksheetFragment::finalizeImport()
// private --------------------------------------------------------------------
-void OoxWorksheetFragment::importPageSetUpPr( const AttributeList& rAttribs )
+void WorksheetFragment::importPageSetUpPr( const AttributeList& rAttribs )
{
// for whatever reason, this flag is still stored separated from the page settings
getPageSettings().setFitToPagesMode( rAttribs.getBool( XML_fitToPage, false ) );
}
-void OoxWorksheetFragment::importDimension( const AttributeList& rAttribs )
+void WorksheetFragment::importDimension( const AttributeList& rAttribs )
{
CellRangeAddress aRange;
getAddressConverter().convertToCellRangeUnchecked( aRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex() );
@@ -522,7 +524,7 @@ void OoxWorksheetFragment::importDimension( const AttributeList& rAttribs )
extendUsedArea( aRange );
}
-void OoxWorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
+void WorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
{
// default column settings
setBaseColumnWidth( rAttribs.getInteger( XML_baseColWidth, 8 ) );
@@ -536,7 +538,7 @@ void OoxWorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
rAttribs.getBool( XML_thickBottom, false ) );
}
-void OoxWorksheetFragment::importCol( const AttributeList& rAttribs )
+void WorksheetFragment::importCol( const AttributeList& rAttribs )
{
ColumnModel aModel;
aModel.mnFirstCol = rAttribs.getInteger( XML_min, -1 );
@@ -551,14 +553,14 @@ void OoxWorksheetFragment::importCol( const AttributeList& rAttribs )
setColumnModel( aModel );
}
-void OoxWorksheetFragment::importMergeCell( const AttributeList& rAttribs )
+void WorksheetFragment::importMergeCell( const AttributeList& rAttribs )
{
CellRangeAddress aRange;
if( getAddressConverter().convertToCellRange( aRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true ) )
setMergedRange( aRange );
}
-void OoxWorksheetFragment::importHyperlink( const AttributeList& rAttribs )
+void WorksheetFragment::importHyperlink( const AttributeList& rAttribs )
{
HyperlinkModel aModel;
if( getAddressConverter().convertToCellRange( aModel.maRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true ) )
@@ -571,7 +573,7 @@ void OoxWorksheetFragment::importHyperlink( const AttributeList& rAttribs )
}
}
-void OoxWorksheetFragment::importBrk( const AttributeList& rAttribs, bool bRowBreak )
+void WorksheetFragment::importBrk( const AttributeList& rAttribs, bool bRowBreak )
{
PageBreakModel aModel;
aModel.mnColRow = rAttribs.getInteger( XML_id, 0 );
@@ -581,22 +583,22 @@ void OoxWorksheetFragment::importBrk( const AttributeList& rAttribs, bool bRowBr
setPageBreak( aModel, bRowBreak );
}
-void OoxWorksheetFragment::importDrawing( const AttributeList& rAttribs )
+void WorksheetFragment::importDrawing( const AttributeList& rAttribs )
{
setDrawingPath( getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ) );
}
-void OoxWorksheetFragment::importLegacyDrawing( const AttributeList& rAttribs )
+void WorksheetFragment::importLegacyDrawing( const AttributeList& rAttribs )
{
setVmlDrawingPath( getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ) );
}
-void OoxWorksheetFragment::importOleObject( const AttributeList& rAttribs )
+void WorksheetFragment::importOleObject( const AttributeList& rAttribs )
{
::oox::vml::OleObjectInfo aInfo;
aInfo.setShapeId( rAttribs.getInteger( XML_shapeId, 0 ) );
OSL_ENSURE( rAttribs.hasAttribute( XML_link ) != rAttribs.hasAttribute( R_TOKEN( id ) ),
- "OoxWorksheetFragment::importOleObject - OLE object must be either linked or embedded" );
+ "WorksheetFragment::importOleObject - OLE object must be either linked or embedded" );
aInfo.mbLinked = rAttribs.hasAttribute( XML_link );
if( aInfo.mbLinked )
aInfo.maTargetLink = getFormulaParser().importOleTargetLink( rAttribs.getString( XML_link, OUString() ) );
@@ -609,7 +611,7 @@ void OoxWorksheetFragment::importOleObject( const AttributeList& rAttribs )
getVmlDrawing().registerOleObject( aInfo );
}
-void OoxWorksheetFragment::importControl( const AttributeList& rAttribs )
+void WorksheetFragment::importControl( const AttributeList& rAttribs )
{
::oox::vml::ControlInfo aInfo;
aInfo.setShapeId( rAttribs.getInteger( XML_shapeId, 0 ) );
@@ -618,7 +620,7 @@ void OoxWorksheetFragment::importControl( const AttributeList& rAttribs )
getVmlDrawing().registerControl( aInfo );
}
-void OoxWorksheetFragment::importDimension( RecordInputStream& rStrm )
+void WorksheetFragment::importDimension( SequenceInputStream& rStrm )
{
BinRange aBinRange;
aBinRange.read( rStrm );
@@ -632,7 +634,7 @@ void OoxWorksheetFragment::importDimension( RecordInputStream& rStrm )
extendUsedArea( aRange );
}
-void OoxWorksheetFragment::importSheetFormatPr( RecordInputStream& rStrm )
+void WorksheetFragment::importSheetFormatPr( SequenceInputStream& rStrm )
{
sal_Int32 nDefaultWidth;
sal_uInt16 nBaseWidth, nDefaultHeight, nFlags;
@@ -640,9 +642,9 @@ void OoxWorksheetFragment::importSheetFormatPr( RecordInputStream& rStrm )
// base column with
setBaseColumnWidth( nBaseWidth );
- // default width is stored as 1/256th of a character in OOBIN, convert to entire character
+ // default width is stored as 1/256th of a character in BIFF12, convert to entire character
setDefaultColumnWidth( static_cast< double >( nDefaultWidth ) / 256.0 );
- // row height is in twips in OOBIN, convert to points; equal flags in BIFF and OOBIN
+ // row height is in twips in BIFF12, convert to points; equal flags in all BIFFs
setDefaultRowSettings(
nDefaultHeight / 20.0,
getFlag( nFlags, BIFF_DEFROW_CUSTOMHEIGHT ),
@@ -651,7 +653,7 @@ void OoxWorksheetFragment::importSheetFormatPr( RecordInputStream& rStrm )
getFlag( nFlags, BIFF_DEFROW_THICKBOTTOM ) );
}
-void OoxWorksheetFragment::importCol( RecordInputStream& rStrm )
+void WorksheetFragment::importCol( SequenceInputStream& rStrm )
{
ColumnModel aModel;
@@ -659,12 +661,12 @@ void OoxWorksheetFragment::importCol( RecordInputStream& rStrm )
sal_uInt16 nFlags;
rStrm >> aModel.mnFirstCol >> aModel.mnLastCol >> nWidth >> aModel.mnXfId >> nFlags;
- // column indexes are 0-based in OOBIN, but ColumnModel expects 1-based
+ // column indexes are 0-based in BIFF12, but ColumnModel expects 1-based
++aModel.mnFirstCol;
++aModel.mnLastCol;
- // width is stored as 1/256th of a character in OOBIN, convert to entire character
+ // width is stored as 1/256th of a character in BIFF12, convert to entire character
aModel.mfWidth = static_cast< double >( nWidth ) / 256.0;
- // equal flags in BIFF and OOBIN
+ // equal flags in all BIFFs
aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 8, 3 );
aModel.mbShowPhonetic = getFlag( nFlags, BIFF_COLINFO_SHOWPHONETIC );
aModel.mbHidden = getFlag( nFlags, BIFF_COLINFO_HIDDEN );
@@ -673,7 +675,7 @@ void OoxWorksheetFragment::importCol( RecordInputStream& rStrm )
setColumnModel( aModel );
}
-void OoxWorksheetFragment::importMergeCell( RecordInputStream& rStrm )
+void WorksheetFragment::importMergeCell( SequenceInputStream& rStrm )
{
BinRange aBinRange;
rStrm >> aBinRange;
@@ -682,20 +684,20 @@ void OoxWorksheetFragment::importMergeCell( RecordInputStream& rStrm )
setMergedRange( aRange );
}
-void OoxWorksheetFragment::importHyperlink( RecordInputStream& rStrm )
+void WorksheetFragment::importHyperlink( SequenceInputStream& rStrm )
{
BinRange aBinRange;
rStrm >> aBinRange;
HyperlinkModel aModel;
if( getAddressConverter().convertToCellRange( aModel.maRange, aBinRange, getSheetIndex(), true, true ) )
{
- aModel.maTarget = getRelations().getExternalTargetFromRelId( rStrm.readString() );
+ aModel.maTarget = getRelations().getExternalTargetFromRelId( BiffHelper::readString( rStrm ) );
rStrm >> aModel.maLocation >> aModel.maTooltip >> aModel.maDisplay;
setHyperlink( aModel );
}
}
-void OoxWorksheetFragment::importBrk( RecordInputStream& rStrm, bool bRowBreak )
+void WorksheetFragment::importBrk( SequenceInputStream& rStrm, bool bRowBreak )
{
PageBreakModel aModel;
sal_Int32 nManual;
@@ -704,44 +706,44 @@ void OoxWorksheetFragment::importBrk( RecordInputStream& rStrm, bool bRowBreak )
setPageBreak( aModel, bRowBreak );
}
-void OoxWorksheetFragment::importDrawing( RecordInputStream& rStrm )
+void WorksheetFragment::importDrawing( SequenceInputStream& rStrm )
{
- setDrawingPath( getFragmentPathFromRelId( rStrm.readString() ) );
+ setDrawingPath( getFragmentPathFromRelId( BiffHelper::readString( rStrm ) ) );
}
-void OoxWorksheetFragment::importLegacyDrawing( RecordInputStream& rStrm )
+void WorksheetFragment::importLegacyDrawing( SequenceInputStream& rStrm )
{
- setVmlDrawingPath( getFragmentPathFromRelId( rStrm.readString() ) );
+ setVmlDrawingPath( getFragmentPathFromRelId( BiffHelper::readString( rStrm ) ) );
}
-void OoxWorksheetFragment::importOleObject( RecordInputStream& rStrm )
+void WorksheetFragment::importOleObject( SequenceInputStream& rStrm )
{
::oox::vml::OleObjectInfo aInfo;
sal_Int32 nAspect, nUpdateMode, nShapeId;
sal_uInt16 nFlags;
rStrm >> nAspect >> nUpdateMode >> nShapeId >> nFlags >> aInfo.maProgId;
- aInfo.mbLinked = getFlag( nFlags, OOBIN_OLEOBJECT_LINKED );
+ aInfo.mbLinked = getFlag( nFlags, BIFF12_OLEOBJECT_LINKED );
if( aInfo.mbLinked )
aInfo.maTargetLink = getFormulaParser().importOleTargetLink( rStrm );
else
- importEmbeddedOleData( aInfo.maEmbeddedData, rStrm.readString() );
+ importEmbeddedOleData( aInfo.maEmbeddedData, BiffHelper::readString( rStrm ) );
aInfo.setShapeId( nShapeId );
- aInfo.mbShowAsIcon = nAspect == OOBIN_OLEOBJECT_ICON;
- aInfo.mbAutoUpdate = nUpdateMode == OOBIN_OLEOBJECT_ALWAYS;
- aInfo.mbAutoLoad = getFlag( nFlags, OOBIN_OLEOBJECT_AUTOLOAD );
+ aInfo.mbShowAsIcon = nAspect == BIFF12_OLEOBJECT_ICON;
+ aInfo.mbAutoUpdate = nUpdateMode == BIFF12_OLEOBJECT_ALWAYS;
+ aInfo.mbAutoLoad = getFlag( nFlags, BIFF12_OLEOBJECT_AUTOLOAD );
getVmlDrawing().registerOleObject( aInfo );
}
-void OoxWorksheetFragment::importControl( RecordInputStream& rStrm )
+void WorksheetFragment::importControl( SequenceInputStream& rStrm )
{
::oox::vml::ControlInfo aInfo;
aInfo.setShapeId( rStrm.readInt32() );
- aInfo.maFragmentPath = getFragmentPathFromRelId( rStrm.readString() );
+ aInfo.maFragmentPath = getFragmentPathFromRelId( BiffHelper::readString( rStrm ) );
rStrm >> aInfo.maName;
getVmlDrawing().registerControl( aInfo );
}
-void OoxWorksheetFragment::importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const OUString& rRelId )
+void WorksheetFragment::importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const OUString& rRelId )
{
OUString aFragmentPath = getFragmentPathFromRelId( rRelId );
if( aFragmentPath.getLength() > 0 )
@@ -750,8 +752,9 @@ void OoxWorksheetFragment::importEmbeddedOleData( StreamDataSequence& orEmbedded
// ============================================================================
-BiffWorksheetFragment::BiffWorksheetFragment( const BiffWorkbookFragmentBase& rParent, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
- BiffWorksheetFragmentBase( rParent, xProgressBar, eSheetType, nSheet )
+BiffWorksheetFragment::BiffWorksheetFragment( const BiffWorkbookFragmentBase& rParent,
+ const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+ BiffWorksheetFragmentBase( rParent, rxProgressBar, eSheetType, nSheet )
{
}
@@ -774,9 +777,10 @@ bool BiffWorksheetFragment::importFragment()
PageSettings& rPageSett = getPageSettings();
// process all record in this sheet fragment
- while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
+ BiffInputStream& rStrm = getInputStream();
+ while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
{
- if( isBofRecord() )
+ if( BiffHelper::isBofRecord( rStrm ) )
{
// skip unknown embedded fragments (BOF/EOF blocks)
skipFragment();
@@ -784,126 +788,130 @@ bool BiffWorksheetFragment::importFragment()
else
{
// cache base stream position to detect if record is already processed
- sal_Int64 nStrmPos = mrStrm.tellBase();
- sal_uInt16 nRecId = mrStrm.getRecId();
+ sal_Int64 nStrmPos = rStrm.tellBase();
+ sal_uInt16 nRecId = rStrm.getRecId();
switch( nRecId )
{
// records in all BIFF versions
- case BIFF_ID_BOTTOMMARGIN: rPageSett.importBottomMargin( mrStrm ); break;
- case BIFF_ID_CALCCOUNT: rWorkbookSett.importCalcCount( mrStrm ); break;
- case BIFF_ID_CALCMODE: rWorkbookSett.importCalcMode( mrStrm ); break;
- case BIFF_ID_DEFCOLWIDTH: importDefColWidth(); break;
- case BIFF_ID_DELTA: rWorkbookSett.importDelta( mrStrm ); break;
- case BIFF2_ID_DIMENSION: importDimension(); break;
- case BIFF3_ID_DIMENSION: importDimension(); break;
- case BIFF_ID_FOOTER: rPageSett.importFooter( mrStrm ); break;
- case BIFF_ID_HEADER: rPageSett.importHeader( mrStrm ); break;
- case BIFF_ID_HORPAGEBREAKS: importPageBreaks( true ); break;
- case BIFF_ID_ITERATION: rWorkbookSett.importIteration( mrStrm ); break;
- case BIFF_ID_LEFTMARGIN: rPageSett.importLeftMargin( mrStrm ); break;
- case BIFF_ID_PANE: rSheetViewSett.importPane( mrStrm ); break;
- case BIFF_ID_PASSWORD: rWorksheetSett.importPassword( mrStrm ); break;
- case BIFF_ID_PRINTGRIDLINES: rPageSett.importPrintGridLines( mrStrm ); break;
- case BIFF_ID_PRINTHEADERS: rPageSett.importPrintHeaders( mrStrm ); break;
- case BIFF_ID_PROTECT: rWorksheetSett.importProtect( mrStrm ); break;
- case BIFF_ID_REFMODE: rWorkbookSett.importRefMode( mrStrm ); break;
- case BIFF_ID_RIGHTMARGIN: rPageSett.importRightMargin( mrStrm ); break;
- case BIFF_ID_SELECTION: rSheetViewSett.importSelection( mrStrm ); break;
- case BIFF_ID_TOPMARGIN: rPageSett.importTopMargin( mrStrm ); break;
- case BIFF_ID_VERPAGEBREAKS: importPageBreaks( false ); break;
+ case BIFF_ID_BOTTOMMARGIN: rPageSett.importBottomMargin( rStrm ); break;
+ case BIFF_ID_CALCCOUNT: rWorkbookSett.importCalcCount( rStrm ); break;
+ case BIFF_ID_CALCMODE: rWorkbookSett.importCalcMode( rStrm ); break;
+ case BIFF_ID_DEFCOLWIDTH: importDefColWidth( rStrm ); break;
+ case BIFF_ID_DELTA: rWorkbookSett.importDelta( rStrm ); break;
+ case BIFF2_ID_DIMENSION: importDimension( rStrm ); break;
+ case BIFF3_ID_DIMENSION: importDimension( rStrm ); break;
+ case BIFF_ID_FOOTER: rPageSett.importFooter( rStrm ); break;
+ case BIFF_ID_HEADER: rPageSett.importHeader( rStrm ); break;
+ case BIFF_ID_HORPAGEBREAKS: importPageBreaks( rStrm, true ); break;
+ case BIFF_ID_ITERATION: rWorkbookSett.importIteration( rStrm ); break;
+ case BIFF_ID_LEFTMARGIN: rPageSett.importLeftMargin( rStrm ); break;
+ case BIFF_ID_PANE: rSheetViewSett.importPane( rStrm ); break;
+ case BIFF_ID_PASSWORD: rWorksheetSett.importPassword( rStrm ); break;
+ case BIFF_ID_PRINTGRIDLINES: rPageSett.importPrintGridLines( rStrm ); break;
+ case BIFF_ID_PRINTHEADERS: rPageSett.importPrintHeaders( rStrm ); break;
+ case BIFF_ID_PROTECT: rWorksheetSett.importProtect( rStrm ); break;
+ case BIFF_ID_REFMODE: rWorkbookSett.importRefMode( rStrm ); break;
+ case BIFF_ID_RIGHTMARGIN: rPageSett.importRightMargin( rStrm ); break;
+ case BIFF_ID_SELECTION: rSheetViewSett.importSelection( rStrm ); break;
+ case BIFF_ID_TOPMARGIN: rPageSett.importTopMargin( rStrm ); break;
+ case BIFF_ID_VERPAGEBREAKS: importPageBreaks( rStrm, false ); break;
// BIFF specific records
default: switch( getBiff() )
{
case BIFF2: switch( nRecId )
{
- case BIFF_ID_COLUMNDEFAULT: importColumnDefault(); break;
- case BIFF_ID_COLWIDTH: importColWidth(); break;
- case BIFF2_ID_DEFROWHEIGHT: importDefRowHeight(); break;
- case BIFF2_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_COLUMNDEFAULT: importColumnDefault( rStrm ); break;
+ case BIFF_ID_COLWIDTH: importColWidth( rStrm ); break;
+ case BIFF2_ID_DEFROWHEIGHT: importDefRowHeight( rStrm ); break;
+ case BIFF2_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
case BIFF3: switch( nRecId )
{
- case BIFF_ID_COLINFO: importColInfo(); break;
- case BIFF_ID_DEFCOLWIDTH: importDefColWidth(); break;
- case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break;
- case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break;
- case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
- case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break;
- case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( mrStrm ); break;
- case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( mrStrm ); break;
- case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
- case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_COLINFO: importColInfo( rStrm ); break;
+ case BIFF_ID_DEFCOLWIDTH: importDefColWidth( rStrm ); break;
+ case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight( rStrm ); break;
+ case BIFF_ID_HCENTER: rPageSett.importHorCenter( rStrm ); break;
+ case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm ); break;
+ case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( rStrm ); break;
+ case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( rStrm ); break;
+ case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( rStrm ); break;
+ case BIFF_ID_VCENTER: rPageSett.importVerCenter( rStrm ); break;
+ case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
case BIFF4: switch( nRecId )
{
- case BIFF_ID_COLINFO: importColInfo(); break;
- case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break;
- case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break;
- case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
- case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
- case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break;
- case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( mrStrm ); break;
- case BIFF_ID_STANDARDWIDTH: importStandardWidth(); break;
- case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( mrStrm ); break;
- case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
- case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_COLINFO: importColInfo( rStrm ); break;
+ case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight( rStrm ); break;
+ case BIFF_ID_HCENTER: rPageSett.importHorCenter( rStrm ); break;
+ case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm ); break;
+ case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( rStrm ); break;
+ case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( rStrm ); break;
+ case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( rStrm ); break;
+ case BIFF_ID_STANDARDWIDTH: importStandardWidth( rStrm ); break;
+ case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( rStrm ); break;
+ case BIFF_ID_VCENTER: rPageSett.importVerCenter( rStrm ); break;
+ case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
case BIFF5: switch( nRecId )
{
- case BIFF_ID_COLINFO: importColInfo(); break;
- case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break;
- case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break;
- case BIFF_ID_MERGEDCELLS: importMergedCells(); break; // #i62300# also in BIFF5
- case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
- case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
- case BIFF_ID_PTDEFINITION: importPTDefinition(); break;
- case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break;
- case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( mrStrm ); break;
- case BIFF_ID_SCL: rSheetViewSett.importScl( mrStrm ); break;
- case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( mrStrm ); break;
- case BIFF_ID_STANDARDWIDTH: importStandardWidth(); break;
- case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( mrStrm ); break;
- case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
- case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_AUTOFILTER: importAutoFilter( rStrm ); break;
+ case BIFF_ID_COLINFO: importColInfo( rStrm ); break;
+ case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight( rStrm ); break;
+ case BIFF_ID_HCENTER: rPageSett.importHorCenter( rStrm ); break;
+ case BIFF_ID_MERGEDCELLS: importMergedCells( rStrm ); break; // #i62300# also in BIFF5
+ case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm ); break;
+ case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( rStrm ); break;
+ case BIFF_ID_PTDEFINITION: importPTDefinition( rStrm ); break;
+ case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( rStrm ); break;
+ case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( rStrm ); break;
+ case BIFF_ID_SCL: rSheetViewSett.importScl( rStrm ); break;
+ case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( rStrm ); break;
+ case BIFF_ID_STANDARDWIDTH: importStandardWidth( rStrm ); break;
+ case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( rStrm ); break;
+ case BIFF_ID_VCENTER: rPageSett.importVerCenter( rStrm ); break;
+ case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
case BIFF8: switch( nRecId )
{
- case BIFF_ID_CFHEADER: rCondFormats.importCfHeader( mrStrm ); break;
- case BIFF_ID_CODENAME: rWorksheetSett.importCodeName( mrStrm ); break;
- case BIFF_ID_COLINFO: importColInfo(); break;
- case BIFF_ID_DATAVALIDATION: importDataValidation(); break;
- case BIFF_ID_DATAVALIDATIONS: importDataValidations(); break;
- case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight(); break;
- case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break;
- case BIFF_ID_HYPERLINK: importHyperlink(); break;
- case BIFF_ID_LABELRANGES: importLabelRanges(); break;
- case BIFF_ID_MERGEDCELLS: importMergedCells(); break;
- case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
- case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
- case BIFF_ID_PHONETICPR: rWorksheetSett.importPhoneticPr( mrStrm ); break;
- case BIFF_ID_PICTURE: rPageSett.importPicture( mrStrm ); break;
- case BIFF_ID_PTDEFINITION: importPTDefinition(); break;
- case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break;
- case BIFF_ID_SCENARIOS: importScenarios(); break;
- case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( mrStrm ); break;
- case BIFF_ID_SCL: rSheetViewSett.importScl( mrStrm ); break;
- case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( mrStrm ); break;
- case BIFF_ID_SHAREDFEATHEAD: importSharedFeatHead(); break;
- case BIFF_ID_STANDARDWIDTH: importStandardWidth(); break;
- case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( mrStrm ); break;
- case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
- case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break;
+ case BIFF_ID_AUTOFILTER: importAutoFilter( rStrm ); break;
+ case BIFF_ID_CFHEADER: rCondFormats.importCfHeader( rStrm ); break;
+ case BIFF_ID_CODENAME: rWorksheetSett.importCodeName( rStrm ); break;
+ case BIFF_ID_COLINFO: importColInfo( rStrm ); break;
+ case BIFF_ID_DATAVALIDATION: importDataValidation( rStrm ); break;
+ case BIFF_ID_DATAVALIDATIONS: importDataValidations( rStrm ); break;
+ case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight( rStrm ); break;
+ case BIFF_ID_HCENTER: rPageSett.importHorCenter( rStrm ); break;
+ case BIFF_ID_HYPERLINK: importHyperlink( rStrm ); break;
+ case BIFF_ID_LABELRANGES: importLabelRanges( rStrm ); break;
+ case BIFF_ID_MERGEDCELLS: importMergedCells( rStrm ); break;
+ case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm ); break;
+ case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( rStrm ); break;
+ case BIFF_ID_PHONETICPR: rWorksheetSett.importPhoneticPr( rStrm ); break;
+ case BIFF_ID_PICTURE: rPageSett.importPicture( rStrm ); break;
+ case BIFF_ID_PTDEFINITION: importPTDefinition( rStrm ); break;
+ case BIFF_ID_QUERYTABLE: importQueryTable( rStrm ); break;
+ case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( rStrm ); break;
+ case BIFF_ID_SCENARIOS: importScenarios( rStrm ); break;
+ case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( rStrm ); break;
+ case BIFF_ID_SCL: rSheetViewSett.importScl( rStrm ); break;
+ case BIFF_ID_SHEETEXT: rWorksheetSett.importSheetExt( rStrm ); break;
+ case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( rStrm ); break;
+ case BIFF_ID_SHAREDFEATHEAD: importSharedFeatHead( rStrm ); break;
+ case BIFF_ID_STANDARDWIDTH: importStandardWidth( rStrm ); break;
+ case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( rStrm ); break;
+ case BIFF_ID_VCENTER: rPageSett.importVerCenter( rStrm ); break;
+ case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( rStrm ); break;
}
break;
@@ -911,26 +919,41 @@ bool BiffWorksheetFragment::importFragment()
}
}
- // record not processed, try cell records
- if( mrStrm.tellBase() == nStrmPos )
- aSheetData.importRecord();
- // record still not processed, try pivot table records
- if( mxPTContext.get() && (mrStrm.tellBase() == nStrmPos) )
- mxPTContext->importRecord();
+ // record not processed, try record context objects
+ if( rStrm.tellBase() == nStrmPos )
+ {
+ // first, try cell table records
+ aSheetData.importRecord( rStrm );
+ // handle another open record context
+ if( mxContext.get() )
+ {
+ // if it was a cell table record, forget the other record context
+ if( rStrm.tellBase() == nStrmPos )
+ mxContext->importRecord( rStrm );
+ else
+ mxContext.reset();
+ }
+ }
}
}
// final processing in base class WorksheetHelper
finalizeWorksheetImport();
- return mrStrm.getRecId() == BIFF_ID_EOF;
+ return rStrm.getRecId() == BIFF_ID_EOF;
}
// private --------------------------------------------------------------------
-void BiffWorksheetFragment::importColInfo()
+void BiffWorksheetFragment::importAutoFilter( BiffInputStream& rStrm )
+{
+ mxContext.reset( new BiffAutoFilterContext( *this, getAutoFilters().createAutoFilter() ) );
+ mxContext->importRecord( rStrm );
+}
+
+void BiffWorksheetFragment::importColInfo( BiffInputStream& rStrm )
{
sal_uInt16 nFirstCol, nLastCol, nWidth, nXfId, nFlags;
- mrStrm >> nFirstCol >> nLastCol >> nWidth >> nXfId >> nFlags;
+ rStrm >> nFirstCol >> nLastCol >> nWidth >> nXfId >> nFlags;
ColumnModel aModel;
// column indexes are 0-based in BIFF, but ColumnModel expects 1-based
@@ -947,18 +970,18 @@ void BiffWorksheetFragment::importColInfo()
setColumnModel( aModel );
}
-void BiffWorksheetFragment::importColumnDefault()
+void BiffWorksheetFragment::importColumnDefault( BiffInputStream& rStrm )
{
sal_uInt16 nFirstCol, nLastCol, nXfId;
- mrStrm >> nFirstCol >> nLastCol >> nXfId;
+ rStrm >> nFirstCol >> nLastCol >> nXfId;
setDefaultColumnFormat( nFirstCol, nLastCol, nXfId );
}
-void BiffWorksheetFragment::importColWidth()
+void BiffWorksheetFragment::importColWidth( BiffInputStream& rStrm )
{
sal_uInt8 nFirstCol, nLastCol;
sal_uInt16 nWidth;
- mrStrm >> nFirstCol >> nLastCol >> nWidth;
+ rStrm >> nFirstCol >> nLastCol >> nWidth;
ColumnModel aModel;
// column indexes are 0-based in BIFF, but ColumnModel expects 1-based
@@ -970,20 +993,20 @@ void BiffWorksheetFragment::importColWidth()
setColumnModel( aModel );
}
-void BiffWorksheetFragment::importDefColWidth()
+void BiffWorksheetFragment::importDefColWidth( BiffInputStream& rStrm )
{
/* Stored as entire number of characters without padding pixels, which
will be added in setBaseColumnWidth(). Call has no effect, if a
width has already been set from the STANDARDWIDTH record. */
- setBaseColumnWidth( mrStrm.readuInt16() );
+ setBaseColumnWidth( rStrm.readuInt16() );
}
-void BiffWorksheetFragment::importDefRowHeight()
+void BiffWorksheetFragment::importDefRowHeight( BiffInputStream& rStrm )
{
sal_uInt16 nFlags = BIFF_DEFROW_CUSTOMHEIGHT, nHeight;
if( getBiff() != BIFF2 )
- mrStrm >> nFlags;
- mrStrm >> nHeight;
+ rStrm >> nFlags;
+ rStrm >> nHeight;
if( getBiff() == BIFF2 )
nHeight &= BIFF2_DEFROW_MASK;
// row height is in twips in BIFF, convert to points
@@ -995,11 +1018,11 @@ void BiffWorksheetFragment::importDefRowHeight()
getFlag( nFlags, BIFF_DEFROW_THICKBOTTOM ) );
}
-void BiffWorksheetFragment::importDataValidations()
+void BiffWorksheetFragment::importDataValidations( BiffInputStream& rStrm )
{
sal_Int32 nObjId;
- mrStrm.skip( 10 );
- mrStrm >> nObjId;
+ rStrm.skip( 10 );
+ rStrm >> nObjId;
//! TODO: invalidate object id in drawing object manager
}
@@ -1026,50 +1049,50 @@ ApiTokenSequence lclReadDataValFormula( BiffInputStream& rStrm, FormulaParser& r
} // namespace
-void BiffWorksheetFragment::importDataValidation()
+void BiffWorksheetFragment::importDataValidation( BiffInputStream& rStrm )
{
ValidationModel aModel;
// flags
sal_uInt32 nFlags;
- mrStrm >> nFlags;
- aModel.setBinType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
- aModel.setBinOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
- aModel.setBinErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
+ rStrm >> nFlags;
+ aModel.setBiffType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
+ aModel.setBiffOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
+ aModel.setBiffErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
aModel.mbAllowBlank = getFlag( nFlags, BIFF_DATAVAL_ALLOWBLANK );
aModel.mbNoDropDown = getFlag( nFlags, BIFF_DATAVAL_NODROPDOWN );
aModel.mbShowInputMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWINPUT );
aModel.mbShowErrorMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWERROR );
// message strings
- aModel.maInputTitle = lclReadDataValMessage( mrStrm );
- aModel.maErrorTitle = lclReadDataValMessage( mrStrm );
- aModel.maInputMessage = lclReadDataValMessage( mrStrm );
- aModel.maErrorMessage = lclReadDataValMessage( mrStrm );
+ aModel.maInputTitle = lclReadDataValMessage( rStrm );
+ aModel.maErrorTitle = lclReadDataValMessage( rStrm );
+ aModel.maInputMessage = lclReadDataValMessage( rStrm );
+ aModel.maErrorMessage = lclReadDataValMessage( rStrm );
// condition formula(s)
FormulaParser& rParser = getFormulaParser();
- aModel.maTokens1 = lclReadDataValFormula( mrStrm, rParser );
- aModel.maTokens2 = lclReadDataValFormula( mrStrm, rParser );
+ aModel.maTokens1 = lclReadDataValFormula( rStrm, rParser );
+ aModel.maTokens2 = lclReadDataValFormula( rStrm, rParser );
// process string list of a list validation (convert to list of string tokens)
if( (aModel.mnType == XML_list) && getFlag( nFlags, BIFF_DATAVAL_STRINGLIST ) )
rParser.convertStringToStringList( aModel.maTokens1, '\0', true );
// cell range list
BinRangeList aRanges;
- mrStrm >> aRanges;
+ rStrm >> aRanges;
getAddressConverter().convertToCellRangeList( aModel.maRanges, aRanges, getSheetIndex(), true );
// set validation data
setValidation( aModel );
}
-void BiffWorksheetFragment::importDimension()
+void BiffWorksheetFragment::importDimension( BiffInputStream& rStrm )
{
// 32-bit row indexes in BIFF8
- bool bInt32Rows = (mrStrm.getRecId() == BIFF3_ID_DIMENSION) && (getBiff() == BIFF8);
+ bool bInt32Rows = (rStrm.getRecId() == BIFF3_ID_DIMENSION) && (getBiff() == BIFF8);
BinRange aBinRange;
- aBinRange.read( mrStrm, true, bInt32Rows );
+ aBinRange.read( rStrm, true, bInt32Rows );
/* BIFF stores the used area with end column and end row increased by 1
(first unused column and row). */
if( (aBinRange.maFirst.mnCol < aBinRange.maLast.mnCol) && (aBinRange.maFirst.mnRow < aBinRange.maLast.mnRow) )
@@ -1083,13 +1106,13 @@ void BiffWorksheetFragment::importDimension()
}
}
-void BiffWorksheetFragment::importHyperlink()
+void BiffWorksheetFragment::importHyperlink( BiffInputStream& rStrm )
{
HyperlinkModel aModel;
// read cell range for the hyperlink
BinRange aBiffRange;
- mrStrm >> aBiffRange;
+ rStrm >> aBiffRange;
// #i80006# Excel silently ignores invalid hi-byte of column index (TODO: everywhere?)
aBiffRange.maFirst.mnCol &= 0xFF;
aBiffRange.maLast.mnCol &= 0xFF;
@@ -1097,15 +1120,15 @@ void BiffWorksheetFragment::importHyperlink()
return;
// try to read the StdHlink data
- if( !::oox::ole::OleHelper::importStdHlink( aModel, mrStrm, true ) )
+ if( !::oox::ole::OleHelper::importStdHlink( aModel, rStrm, true ) )
return;
// try to read the optional following SCREENTIP record
- if( (mrStrm.getNextRecId() == BIFF_ID_SCREENTIP) && mrStrm.startNextRecord() )
+ if( (rStrm.getNextRecId() == BIFF_ID_SCREENTIP) && rStrm.startNextRecord() )
{
- mrStrm.skip( 2 ); // repeated record id
+ rStrm.skip( 2 ); // repeated record id
// the cell range, again
- mrStrm >> aBiffRange;
+ rStrm >> aBiffRange;
CellRangeAddress aRange;
if( getAddressConverter().convertToCellRange( aRange, aBiffRange, getSheetIndex(), true, true ) &&
(aRange.StartColumn == aModel.maRange.StartColumn) &&
@@ -1115,7 +1138,7 @@ void BiffWorksheetFragment::importHyperlink()
{
/* This time, we have no string length, no flag field, and a
null-terminated 16-bit character array. */
- aModel.maTooltip = mrStrm.readNulUnicodeArray();
+ aModel.maTooltip = rStrm.readNulUnicodeArray();
}
}
@@ -1123,72 +1146,78 @@ void BiffWorksheetFragment::importHyperlink()
setHyperlink( aModel );
}
-void BiffWorksheetFragment::importLabelRanges()
+void BiffWorksheetFragment::importLabelRanges( BiffInputStream& rStrm )
{
BinRangeList aBiffRowRanges, aBiffColRanges;
- mrStrm >> aBiffRowRanges >> aBiffColRanges;
+ rStrm >> aBiffRowRanges >> aBiffColRanges;
ApiCellRangeList aColRanges, aRowRanges;
getAddressConverter().convertToCellRangeList( aColRanges, aBiffColRanges, getSheetIndex(), true );
getAddressConverter().convertToCellRangeList( aRowRanges, aBiffRowRanges, getSheetIndex(), true );
setLabelRanges( aColRanges, aRowRanges );
}
-void BiffWorksheetFragment::importMergedCells()
+void BiffWorksheetFragment::importMergedCells( BiffInputStream& rStrm )
{
BinRangeList aBiffRanges;
- mrStrm >> aBiffRanges;
+ rStrm >> aBiffRanges;
ApiCellRangeList aRanges;
getAddressConverter().convertToCellRangeList( aRanges, aBiffRanges, getSheetIndex(), true );
for( ApiCellRangeList::const_iterator aIt = aRanges.begin(), aEnd = aRanges.end(); aIt != aEnd; ++aIt )
setMergedRange( *aIt );
}
-void BiffWorksheetFragment::importPageBreaks( bool bRowBreak )
+void BiffWorksheetFragment::importPageBreaks( BiffInputStream& rStrm, bool bRowBreak )
{
PageBreakModel aModel;
aModel.mbManual = true; // only manual breaks stored in BIFF
bool bBiff8 = getBiff() == BIFF8; // skip start/end columns or rows in BIFF8
sal_uInt16 nCount;
- mrStrm >> nCount;
- for( sal_uInt16 nIndex = 0; !mrStrm.isEof() && (nIndex < nCount); ++nIndex )
+ rStrm >> nCount;
+ for( sal_uInt16 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
{
- aModel.mnColRow = mrStrm.readuInt16();
+ aModel.mnColRow = rStrm.readuInt16();
setPageBreak( aModel, bRowBreak );
if( bBiff8 )
- mrStrm.skip( 4 );
+ rStrm.skip( 4 );
}
}
-void BiffWorksheetFragment::importPTDefinition()
+void BiffWorksheetFragment::importPTDefinition( BiffInputStream& rStrm )
{
- mxPTContext.reset( new BiffPivotTableContext( *this, getPivotTables().createPivotTable() ) );
- mxPTContext->importRecord();
+ mxContext.reset( new BiffPivotTableContext( *this ) );
+ mxContext->importRecord( rStrm );
}
-void BiffWorksheetFragment::importScenarios()
+void BiffWorksheetFragment::importQueryTable( BiffInputStream& rStrm )
{
- getScenarios().createSheetScenarios( getSheetIndex() ).importScenarios( mrStrm );
+ mxContext.reset( new BiffQueryTableContext( *this ) );
+ mxContext->importRecord( rStrm );
}
-void BiffWorksheetFragment::importSharedFeatHead()
+void BiffWorksheetFragment::importScenarios( BiffInputStream& rStrm )
{
- mrStrm.skip( 12 );
- sal_uInt16 nType = mrStrm.readuInt16();
- mrStrm.skip( 5 );
+ getScenarios().createSheetScenarios( getSheetIndex() ).importScenarios( rStrm );
+}
+
+void BiffWorksheetFragment::importSharedFeatHead( BiffInputStream& rStrm )
+{
+ rStrm.skip( 12 );
+ sal_uInt16 nType = rStrm.readuInt16();
+ rStrm.skip( 5 );
switch( nType )
{
case BIFF_SHRFEATHEAD_SHEETPROT:
- if( mrStrm.getRemaining() >= 4 )
- getWorksheetSettings().importSheetProtection( mrStrm );
+ if( rStrm.getRemaining() >= 4 )
+ getWorksheetSettings().importSheetProtection( rStrm );
break;
}
}
-void BiffWorksheetFragment::importStandardWidth()
+void BiffWorksheetFragment::importStandardWidth( BiffInputStream& rStrm )
{
sal_uInt16 nWidth;
- mrStrm >> nWidth;
+ rStrm >> nWidth;
// width is stored as 1/256th of a character in BIFF, convert to entire character
double fWidth = static_cast< double >( nWidth ) / 256.0;
// set as default width, will override the width from DEFCOLWIDTH record
@@ -1199,4 +1228,3 @@ void BiffWorksheetFragment::importStandardWidth()
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index d2d42f2be369..48ffac388cfd 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -26,10 +26,10 @@
************************************************************************/
#include "oox/xls/worksheethelper.hxx"
+
#include <algorithm>
-#include <utility>
#include <list>
-#include <rtl/ustrbuf.hxx>
+#include <utility>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
@@ -37,33 +37,35 @@
#include <com/sun/star/sheet/TableValidationVisibility.hpp>
#include <com/sun/star/sheet/ValidationType.hpp>
#include <com/sun/star/sheet/ValidationAlertStyle.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-#include <com/sun/star/sheet/XSheetCondition.hpp>
#include <com/sun/star/sheet/XCellAddressable.hpp>
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
#include <com/sun/star/sheet/XFormulaTokens.hpp>
+#include <com/sun/star/sheet/XLabelRanges.hpp>
#include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
-#include <com/sun/star/sheet/XSheetOutline.hpp>
#include <com/sun/star/sheet/XMultipleOperation.hpp>
-#include <com/sun/star/sheet/XLabelRanges.hpp>
+#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
+#include <com/sun/star/sheet/XSheetCondition.hpp>
+#include <com/sun/star/sheet/XSheetOutline.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/util/NumberFormat.hpp>
#include <com/sun/star/util/XMergeable.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
-#include "properties.hxx"
-#include "tokens.hxx"
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <rtl/ustrbuf.hxx>
+#include "oox/core/filterbase.hxx"
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
-#include "oox/core/filterbase.hxx"
#include "oox/xls/addressconverter.hxx"
+#include "oox/xls/autofilterbuffer.hxx"
#include "oox/xls/commentsbuffer.hxx"
#include "oox/xls/condformatbuffer.hxx"
#include "oox/xls/drawingfragment.hxx"
#include "oox/xls/formulaparser.hxx"
#include "oox/xls/pagesettings.hxx"
+#include "oox/xls/querytablebuffer.hxx"
#include "oox/xls/sharedformulabuffer.hxx"
#include "oox/xls/sharedstringsbuffer.hxx"
#include "oox/xls/stylesbuffer.hxx"
@@ -73,72 +75,42 @@
#include "oox/xls/worksheetbuffer.hxx"
#include "oox/xls/worksheetsettings.hxx"
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::awt::Point;
-using ::com::sun::star::awt::Rectangle;
-using ::com::sun::star::awt::Size;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::drawing::XDrawPage;
-using ::com::sun::star::drawing::XDrawPageSupplier;
-using ::com::sun::star::lang::Locale;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::sheet::ConditionOperator;
-using ::com::sun::star::sheet::ValidationType;
-using ::com::sun::star::sheet::ValidationAlertStyle;
-using ::com::sun::star::sheet::XCellAddressable;
-using ::com::sun::star::sheet::XCellRangeAddressable;
-using ::com::sun::star::sheet::XFormulaTokens;
-using ::com::sun::star::sheet::XLabelRanges;
-using ::com::sun::star::sheet::XMultiFormulaTokens;
-using ::com::sun::star::sheet::XMultipleOperation;
-using ::com::sun::star::sheet::XSheetCellRangeContainer;
-using ::com::sun::star::sheet::XSheetCellRanges;
-using ::com::sun::star::sheet::XSheetCondition;
-using ::com::sun::star::sheet::XSheetOutline;
-using ::com::sun::star::sheet::XSpreadsheet;
-using ::com::sun::star::table::BorderLine;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::XCell;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::table::XColumnRowRange;
-using ::com::sun::star::table::XTableColumns;
-using ::com::sun::star::table::XTableRows;
-using ::com::sun::star::text::XText;
-using ::com::sun::star::text::XTextContent;
-using ::com::sun::star::text::XTextRange;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-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::util::DateTime;
-using ::com::sun::star::util::XMergeable;
-using ::com::sun::star::util::XNumberFormatsSupplier;
-using ::com::sun::star::util::XNumberFormatTypes;
-
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sheet;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
namespace {
-void lclUpdateProgressBar( ISegmentProgressBarRef xProgressBar, const CellRangeAddress& rUsedArea, sal_Int32 nRow )
+void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, const CellRangeAddress& rUsedArea, sal_Int32 nRow )
{
- if( xProgressBar.get() && (rUsedArea.StartRow <= nRow) && (nRow <= rUsedArea.EndRow) )
+ if( rxProgressBar.get() && (rUsedArea.StartRow <= nRow) && (nRow <= rUsedArea.EndRow) )
{
double fPosition = static_cast< double >( nRow - rUsedArea.StartRow + 1 ) / (rUsedArea.EndRow - rUsedArea.StartRow + 1);
- if( xProgressBar->getPosition() < fPosition )
- xProgressBar->setPosition( fPosition );
+ if( rxProgressBar->getPosition() < fPosition )
+ rxProgressBar->setPosition( fPosition );
}
}
-void lclUpdateProgressBar( ISegmentProgressBarRef xProgressBar, double fPosition )
+void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, double fPosition )
{
- if( xProgressBar.get() )
- xProgressBar->setPosition( fPosition );
+ if( rxProgressBar.get() )
+ rxProgressBar->setPosition( fPosition );
}
// ----------------------------------------------------------------------------
@@ -329,14 +301,14 @@ ValidationModel::ValidationModel() :
{
}
-void ValidationModel::setBinType( sal_uInt8 nType )
+void ValidationModel::setBiffType( sal_uInt8 nType )
{
static const sal_Int32 spnTypeIds[] = {
XML_none, XML_whole, XML_decimal, XML_list, XML_date, XML_time, XML_textLength, XML_custom };
mnType = STATIC_ARRAY_SELECT( spnTypeIds, nType, XML_none );
}
-void ValidationModel::setBinOperator( sal_uInt8 nOperator )
+void ValidationModel::setBiffOperator( sal_uInt8 nOperator )
{
static const sal_Int32 spnOperators[] = {
XML_between, XML_notBetween, XML_equal, XML_notEqual,
@@ -344,7 +316,7 @@ void ValidationModel::setBinOperator( sal_uInt8 nOperator )
mnOperator = STATIC_ARRAY_SELECT( spnOperators, nOperator, XML_TOKEN_INVALID );
}
-void ValidationModel::setBinErrorStyle( sal_uInt8 nErrorStyle )
+void ValidationModel::setBiffErrorStyle( sal_uInt8 nErrorStyle )
{
static const sal_Int32 spnErrorStyles[] = { XML_stop, XML_warning, XML_information };
mnErrorStyle = STATIC_ARRAY_SELECT( spnErrorStyles, nErrorStyle, XML_stop );
@@ -358,7 +330,7 @@ class WorksheetData : public WorkbookHelper
public:
explicit WorksheetData(
const WorkbookHelper& rHelper,
- ISegmentProgressBarRef xProgressBar,
+ const ISegmentProgressBarRef& rxProgressBar,
WorksheetType eSheetType,
sal_Int16 nSheet );
@@ -416,11 +388,15 @@ public:
inline CondFormatBuffer& getCondFormats() { return maCondFormats; }
/** Returns the buffer for all cell comments in this sheet. */
inline CommentsBuffer& getComments() { return maComments; }
+ /** Returns the auto filters for the sheet. */
+ inline AutoFilterBuffer& getAutoFilters() { return maAutoFilters; }
+ /** Returns the buffer for all web query tables in this sheet. */
+ inline QueryTableBuffer& getQueryTables() { return maQueryTables; }
/** Returns the page/print settings for this sheet. */
inline PageSettings& getPageSettings() { return maPageSett; }
/** Returns the view settings for this sheet. */
inline SheetViewSettings& getSheetViewSettings() { return maSheetViewSett; }
- /** Returns the VML drawing page for this sheet (OOX only!). */
+ /** Returns the VML drawing page for this sheet (OOXML/BIFF12 only!). */
inline VmlDrawing& getVmlDrawing() { return *mxVmlDrawing; }
/** Changes the current sheet type. */
@@ -543,13 +519,6 @@ private:
/** Merges the passed merged range and updates right/bottom cell borders. */
void finalizeMergedRange( const CellRangeAddress& rRange );
- /** Imports the drawing layer of the sheet (DrawingML part). */
- void finalizeDrawing();
- /** Imports the drawing layer of the sheet (VML part). */
- void finalizeVmlDrawing();
- /** Extends the used cell area with the area used by drawing objects. */
- void finalizeUsedArea();
-
/** Converts column properties for all columns in the sheet. */
void convertColumns();
/** Converts column properties. */
@@ -565,6 +534,9 @@ private:
/** Groups columns or rows for the given range. */
void groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastColRow, bool bCollapsed, bool bRows );
+ /** Imports the drawings of the sheet (DML, VML), and updates the used area. */
+ void finalizeDrawings();
+
private:
typedef ::std::auto_ptr< VmlDrawing > VmlDrawingPtr;
@@ -589,6 +561,8 @@ private:
SharedFormulaBuffer maSharedFmlas; /// Buffer for shared formulas in this sheet.
CondFormatBuffer maCondFormats; /// Buffer for conditional formattings.
CommentsBuffer maComments; /// Buffer for all cell comments in this sheet.
+ AutoFilterBuffer maAutoFilters; /// Sheet auto filters (not associated to a table).
+ QueryTableBuffer maQueryTables; /// Buffer for all web query tables in this sheet.
PageSettings maPageSett; /// Page/print settings for this sheet.
SheetViewSettings maSheetViewSett; /// View settings for this sheet.
VmlDrawingPtr mxVmlDrawing; /// Collection of all VML shapes.
@@ -605,7 +579,7 @@ private:
// ----------------------------------------------------------------------------
-WorksheetData::WorksheetData( const WorkbookHelper& rHelper, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+WorksheetData::WorksheetData( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
WorkbookHelper( rHelper ),
maTrueFormula( CREATE_OUSTRING( "=TRUE()" ) ),
maFalseFormula( CREATE_OUSTRING( "=FALSE()" ) ),
@@ -617,9 +591,11 @@ WorksheetData::WorksheetData( const WorkbookHelper& rHelper, ISegmentProgressBar
maSharedFmlas( *this ),
maCondFormats( *this ),
maComments( *this ),
+ maAutoFilters( *this ),
+ maQueryTables( *this ),
maPageSett( *this ),
maSheetViewSett( *this ),
- mxProgressBar( xProgressBar ),
+ mxProgressBar( rxProgressBar ),
meSheetType( eSheetType ),
mbHasDefWidth( false )
{
@@ -645,7 +621,7 @@ WorksheetData::WorksheetData( const WorkbookHelper& rHelper, ISegmentProgressBar
maDefRowModel.mbCollapsed = false;
// buffers
- if( getFilterType() == FILTER_OOX )
+ if( getFilterType() == FILTER_OOXML )
mxVmlDrawing.reset( new VmlDrawing( *this ) );
// prepare progress bars
@@ -1021,25 +997,17 @@ void WorksheetData::extendUsedArea( const CellRangeAddress& rRange )
void WorksheetData::extendShapeBoundingBox( const Rectangle& rShapeRect )
{
- // scale EMUs to 1/100 mm
- const UnitConverter& rUnitConv = getUnitConverter();
- Rectangle aShapeRectHmm(
- rUnitConv.scaleToMm100( rShapeRect.X, UNIT_EMU ),
- rUnitConv.scaleToMm100( rShapeRect.Y, UNIT_EMU ),
- rUnitConv.scaleToMm100( rShapeRect.Width, UNIT_EMU ),
- rUnitConv.scaleToMm100( rShapeRect.Height, UNIT_EMU ) );
-
if( (maShapeBoundingBox.Width == 0) && (maShapeBoundingBox.Height == 0) )
{
// width and height of maShapeBoundingBox are assumed to be zero on first cell
- maShapeBoundingBox = aShapeRectHmm;
+ maShapeBoundingBox = rShapeRect;
}
else
{
- sal_Int32 nEndX = ::std::max( maShapeBoundingBox.X + maShapeBoundingBox.Width, aShapeRectHmm.X + aShapeRectHmm.Width );
- sal_Int32 nEndY = ::std::max( maShapeBoundingBox.Y + maShapeBoundingBox.Height, aShapeRectHmm.Y + aShapeRectHmm.Height );
- maShapeBoundingBox.X = ::std::min( maShapeBoundingBox.X, aShapeRectHmm.X );
- maShapeBoundingBox.Y = ::std::min( maShapeBoundingBox.Y, aShapeRectHmm.Y );
+ sal_Int32 nEndX = ::std::max( maShapeBoundingBox.X + maShapeBoundingBox.Width, rShapeRect.X + rShapeRect.Width );
+ sal_Int32 nEndY = ::std::max( maShapeBoundingBox.Y + maShapeBoundingBox.Height, rShapeRect.Y + rShapeRect.Height );
+ maShapeBoundingBox.X = ::std::min( maShapeBoundingBox.X, rShapeRect.X );
+ maShapeBoundingBox.Y = ::std::min( maShapeBoundingBox.Y, rShapeRect.Y );
maShapeBoundingBox.Width = nEndX - maShapeBoundingBox.X;
maShapeBoundingBox.Height = nEndY - maShapeBoundingBox.Y;
}
@@ -1069,7 +1037,7 @@ void WorksheetData::setDefaultColumnWidth( double fWidth )
void WorksheetData::setColumnModel( const ColumnModel& rModel )
{
- // convert 1-based OOX column indexes to 0-based API column indexes
+ // convert 1-based OOXML column indexes to 0-based API column indexes
sal_Int32 nFirstCol = rModel.mnFirstCol - 1;
sal_Int32 nLastCol = rModel.mnLastCol - 1;
if( (0 <= nFirstCol) && (nFirstCol <= mrMaxApiPos.Column) )
@@ -1093,7 +1061,7 @@ void WorksheetData::setDefaultRowSettings( double fHeight, bool bCustomHeight, b
void WorksheetData::setRowModel( const RowModel& rModel )
{
- // convert 1-based OOX row indexes to 0-based API row indexes
+ // convert 1-based OOXML row indexes to 0-based API row indexes
sal_Int32 nFirstRow = rModel.mnFirstRow - 1;
sal_Int32 nLastRow = rModel.mnLastRow - 1;
if( (0 <= nFirstRow) && (nFirstRow <= mrMaxApiPos.Row) )
@@ -1161,8 +1129,10 @@ void WorksheetData::finalizeWorksheetImport()
finalizeHyperlinkRanges();
finalizeValidationRanges();
finalizeMergedRanges();
+ maAutoFilters.finalizeImport( getSheetIndex() );
maSheetSett.finalizeImport();
maCondFormats.finalizeImport();
+ maQueryTables.finalizeImport();
maPageSett.finalizeImport();
maSheetViewSett.finalizeImport();
maSheetSett.finalizeImport();
@@ -1171,10 +1141,7 @@ void WorksheetData::finalizeWorksheetImport()
convertColumns();
convertRows();
lclUpdateProgressBar( mxFinalProgress, 0.75 );
- finalizeDrawing();
- finalizeVmlDrawing();
- maComments.finalizeImport(); // after VML drawing
- finalizeUsedArea(); // after DML and VML drawing
+ finalizeDrawings();
lclUpdateProgressBar( mxFinalProgress, 1.0 );
// reset current sheet index in global data
@@ -1432,8 +1399,8 @@ void WorksheetData::finalizeValidationRanges() const
{
PropertySet aPropSet( getCellRangeList( aIt->maRanges ) );
- Reference< XPropertySet > xValidation;
- if( aPropSet.getProperty( xValidation, PROP_Validation ) && xValidation.is() )
+ Reference< XPropertySet > xValidation( aPropSet.getAnyProperty( PROP_Validation ), UNO_QUERY );
+ if( xValidation.is() )
{
PropertySet aValProps( xValidation );
namespace csss = ::com::sun::star::sheet;
@@ -1561,42 +1528,6 @@ void WorksheetData::finalizeMergedRange( const CellRangeAddress& rRange )
}
}
-void WorksheetData::finalizeDrawing()
-{
- OSL_ENSURE( (getFilterType() == FILTER_OOX) || (maDrawingPath.getLength() == 0),
- "WorksheetData::finalizeDrawing - unexpected DrawingML path" );
- if( (getFilterType() == FILTER_OOX) && (maDrawingPath.getLength() > 0) )
- importOoxFragment( new OoxDrawingFragment( *this, maDrawingPath ) );
-}
-
-void WorksheetData::finalizeVmlDrawing()
-{
- OSL_ENSURE( (getFilterType() == FILTER_OOX) || (maVmlDrawingPath.getLength() == 0),
- "WorksheetData::finalizeVmlDrawing - unexpected VML path" );
- if( (getFilterType() == FILTER_OOX) && (maVmlDrawingPath.getLength() > 0) )
- importOoxFragment( new OoxVmlDrawingFragment( *this, maVmlDrawingPath ) );
-}
-
-void WorksheetData::finalizeUsedArea()
-{
- /* Extend used area of the sheet by cells covered with drawing objects.
- Needed if the imported document is inserted as "OLE object from file"
- and thus does not provide an OLE size property by itself. */
- if( (maShapeBoundingBox.Width > 0) || (maShapeBoundingBox.Height > 0) )
- extendUsedArea( getCellRangeFromRectangle( maShapeBoundingBox ) );
-
- // if no used area is set, default to A1
- if( maUsedArea.StartColumn > maUsedArea.EndColumn )
- maUsedArea.StartColumn = maUsedArea.EndColumn = 0;
- if( maUsedArea.StartRow > maUsedArea.EndRow )
- maUsedArea.StartRow = maUsedArea.EndRow = 0;
-
- /* Register the used area of this sheet in global view settings. The
- global view settings will set the visible area if this document is an
- embedded OLE object. */
- getViewSettings().setSheetUsedArea( maUsedArea );
-}
-
void WorksheetData::convertColumns()
{
sal_Int32 nNextCol = 0;
@@ -1606,7 +1537,7 @@ void WorksheetData::convertColumns()
for( ColumnModelMap::const_iterator aIt = maColModels.begin(), aEnd = maColModels.end(); aIt != aEnd; ++aIt )
{
- // convert 1-based OOX column indexes to 0-based API column indexes
+ // convert 1-based OOXML column indexes to 0-based API column indexes
sal_Int32 nFirstCol = ::std::max( aIt->second.mnFirstCol - 1, nNextCol );
sal_Int32 nLastCol = ::std::min( aIt->second.mnLastCol - 1, nMaxCol );
@@ -1656,7 +1587,7 @@ void WorksheetData::convertRows()
for( RowModelMap::const_iterator aIt = maRowModels.begin(), aEnd = maRowModels.end(); aIt != aEnd; ++aIt )
{
- // convert 1-based OOX row indexes to 0-based API row indexes
+ // convert 1-based OOXML row indexes to 0-based API row indexes
sal_Int32 nFirstRow = ::std::max( aIt->second.mnFirstRow - 1, nNextRow );
sal_Int32 nLastRow = ::std::min( aIt->second.mnLastRow - 1, nMaxRow );
@@ -1761,6 +1692,55 @@ void WorksheetData::groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastC
}
}
+void WorksheetData::finalizeDrawings()
+{
+ switch( getFilterType() )
+ {
+ case FILTER_OOXML:
+ // import DML and VML
+ if( maDrawingPath.getLength() > 0 )
+ importOoxFragment( new DrawingFragment( *this, maDrawingPath ) );
+ if( maVmlDrawingPath.getLength() > 0 )
+ importOoxFragment( new VmlDrawingFragment( *this, maVmlDrawingPath ) );
+ break;
+
+ case FILTER_BIFF:
+ // TODO: import DFF shapes
+ break;
+
+ case FILTER_UNKNOWN:
+ break;
+ }
+
+ // comments (after callout shapes have been imported from VML/DFF)
+ maComments.finalizeImport();
+
+ /* Extend used area of the sheet by cells covered with drawing objects.
+ Needed if the imported document is inserted as "OLE object from file"
+ and thus does not provide an OLE size property by itself. */
+ if( (maShapeBoundingBox.Width > 0) || (maShapeBoundingBox.Height > 0) )
+ extendUsedArea( getCellRangeFromRectangle( maShapeBoundingBox ) );
+
+ // if no used area is set, default to A1
+ if( maUsedArea.StartColumn > maUsedArea.EndColumn )
+ maUsedArea.StartColumn = maUsedArea.EndColumn = 0;
+ if( maUsedArea.StartRow > maUsedArea.EndRow )
+ maUsedArea.StartRow = maUsedArea.EndRow = 0;
+
+ /* Register the used area of this sheet in global view settings. The
+ global view settings will set the visible area if this document is an
+ embedded OLE object. */
+ getViewSettings().setSheetUsedArea( maUsedArea );
+
+ /* #i103686# Set right-to-left sheet layout. Must be done after all
+ drawing shapes to simplify calculation of shape coordinates. */
+ if( maSheetViewSett.isSheetRightToLeft() )
+ {
+ PropertySet aPropSet( mxSheet );
+ aPropSet.setProperty( PROP_TableLayout, ::com::sun::star::text::WritingMode2::RL_TB );
+ }
+}
+
// ============================================================================
// ============================================================================
@@ -1942,6 +1922,16 @@ CommentsBuffer& WorksheetHelper::getComments() const
return mrSheetData.getComments();
}
+AutoFilterBuffer& WorksheetHelper::getAutoFilters() const
+{
+ return mrSheetData.getAutoFilters();
+}
+
+QueryTableBuffer& WorksheetHelper::getQueryTables() const
+{
+ return mrSheetData.getQueryTables();
+}
+
PageSettings& WorksheetHelper::getPageSettings() const
{
return mrSheetData.getPageSettings();
@@ -2140,44 +2130,51 @@ void WorksheetHelper::setTableOperation( const CellRangeAddress& rRange, const D
void WorksheetHelper::setLabelRanges( const ApiCellRangeList& rColRanges, const ApiCellRangeList& rRowRanges )
{
const CellAddress& rMaxPos = getAddressConverter().getMaxApiAddress();
- Reference< XLabelRanges > xLabelRanges;
PropertySet aPropSet( getSheet() );
- if( !rColRanges.empty() && aPropSet.getProperty( xLabelRanges, PROP_ColumnLabelRanges ) && xLabelRanges.is() )
+ if( !rColRanges.empty() )
{
- for( ApiCellRangeList::const_iterator aIt = rColRanges.begin(), aEnd = rColRanges.end(); aIt != aEnd; ++aIt )
+ Reference< XLabelRanges > xLabelRanges( aPropSet.getAnyProperty( PROP_ColumnLabelRanges ), UNO_QUERY );
+ if( xLabelRanges.is() )
{
- CellRangeAddress aDataRange = *aIt;
- if( aDataRange.EndRow < rMaxPos.Row )
+ for( ApiCellRangeList::const_iterator aIt = rColRanges.begin(), aEnd = rColRanges.end(); aIt != aEnd; ++aIt )
{
- aDataRange.StartRow = aDataRange.EndRow + 1;
- aDataRange.EndRow = rMaxPos.Row;
- }
- else if( aDataRange.StartRow > 0 )
- {
- aDataRange.EndRow = aDataRange.StartRow - 1;
- aDataRange.StartRow = 0;
+ CellRangeAddress aDataRange = *aIt;
+ if( aDataRange.EndRow < rMaxPos.Row )
+ {
+ aDataRange.StartRow = aDataRange.EndRow + 1;
+ aDataRange.EndRow = rMaxPos.Row;
+ }
+ else if( aDataRange.StartRow > 0 )
+ {
+ aDataRange.EndRow = aDataRange.StartRow - 1;
+ aDataRange.StartRow = 0;
+ }
+ xLabelRanges->addNew( *aIt, aDataRange );
}
- xLabelRanges->addNew( *aIt, aDataRange );
}
}
- if( !rRowRanges.empty() && aPropSet.getProperty( xLabelRanges, PROP_RowLabelRanges ) && xLabelRanges.is() )
+ if( !rRowRanges.empty() )
{
- for( ApiCellRangeList::const_iterator aIt = rRowRanges.begin(), aEnd = rRowRanges.end(); aIt != aEnd; ++aIt )
+ Reference< XLabelRanges > xLabelRanges( aPropSet.getAnyProperty( PROP_RowLabelRanges ), UNO_QUERY );
+ if( xLabelRanges.is() )
{
- CellRangeAddress aDataRange = *aIt;
- if( aDataRange.EndColumn < rMaxPos.Column )
+ for( ApiCellRangeList::const_iterator aIt = rRowRanges.begin(), aEnd = rRowRanges.end(); aIt != aEnd; ++aIt )
{
- aDataRange.StartColumn = aDataRange.EndColumn + 1;
- aDataRange.EndColumn = rMaxPos.Column;
- }
- else if( aDataRange.StartColumn > 0 )
- {
- aDataRange.EndColumn = aDataRange.StartColumn - 1;
- aDataRange.StartColumn = 0;
+ CellRangeAddress aDataRange = *aIt;
+ if( aDataRange.EndColumn < rMaxPos.Column )
+ {
+ aDataRange.StartColumn = aDataRange.EndColumn + 1;
+ aDataRange.EndColumn = rMaxPos.Column;
+ }
+ else if( aDataRange.StartColumn > 0 )
+ {
+ aDataRange.EndColumn = aDataRange.StartColumn - 1;
+ aDataRange.StartColumn = 0;
+ }
+ xLabelRanges->addNew( *aIt, aDataRange );
}
- xLabelRanges->addNew( *aIt, aDataRange );
}
}
}
@@ -2264,8 +2261,8 @@ WorksheetDataOwner::~WorksheetDataOwner()
// ----------------------------------------------------------------------------
-WorksheetHelperRoot::WorksheetHelperRoot( const WorkbookHelper& rHelper, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
- prv::WorksheetDataOwner( prv::WorksheetDataRef( new WorksheetData( rHelper, xProgressBar, eSheetType, nSheet ) ) ),
+WorksheetHelperRoot::WorksheetHelperRoot( const WorkbookHelper& rHelper, const ISegmentProgressBarRef& rxProgressBar, WorksheetType eSheetType, sal_Int16 nSheet ) :
+ prv::WorksheetDataOwner( prv::WorksheetDataRef( new WorksheetData( rHelper, rxProgressBar, eSheetType, nSheet ) ) ),
WorksheetHelper( *mxSheetData )
{
}
@@ -2292,4 +2289,3 @@ bool WorksheetHelperRoot::isValidSheet() const
} // namespace xls
} // namespace oox
-
diff --git a/oox/source/xls/worksheetsettings.cxx b/oox/source/xls/worksheetsettings.cxx
index 0cc9d5f17780..cc1aa45f2012 100644
--- a/oox/source/xls/worksheetsettings.cxx
+++ b/oox/source/xls/worksheetsettings.cxx
@@ -26,41 +26,41 @@
************************************************************************/
#include "oox/xls/worksheetsettings.hxx"
+
+#include <com/sun/star/util/XProtectable.hpp>
+#include "oox/core/filterbase.hxx"
#include "oox/helper/attributelist.hxx"
-#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/pagesettings.hxx"
#include "oox/xls/workbooksettings.hxx"
-#include "oox/core/filterbase.hxx"
-#include "properties.hxx"
-
-#include <com/sun/star/util/XProtectable.hpp>
-
-using ::rtl::OUString;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::util::XProtectable;
-using ::oox::core::CodecHelper;
namespace oox {
namespace xls {
// ============================================================================
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::oox::core::CodecHelper;
+using ::rtl::OUString;
+
+// ============================================================================
+
namespace {
-const sal_uInt8 OOBIN_SHEETPR_FILTERMODE = 0x01;
-const sal_uInt8 OOBIN_SHEETPR_EVAL_CF = 0x02;
+const sal_uInt8 BIFF12_SHEETPR_FILTERMODE = 0x01;
+const sal_uInt8 BIFF12_SHEETPR_EVAL_CF = 0x02;
+
+const sal_uInt32 BIFF_SHEETEXT_NOTABCOLOR = 0x7F;
const sal_uInt16 BIFF_SHEETPR_DIALOGSHEET = 0x0010;
const sal_uInt16 BIFF_SHEETPR_APPLYSTYLES = 0x0020;
const sal_uInt16 BIFF_SHEETPR_SYMBOLSBELOW = 0x0040;
const sal_uInt16 BIFF_SHEETPR_SYMBOLSRIGHT = 0x0080;
const sal_uInt16 BIFF_SHEETPR_FITTOPAGES = 0x0100;
-const sal_uInt16 BIFF_SHEETPR_SKIPEXT = 0x0200; /// BIFF3-BIFF4
+const sal_uInt16 BIFF_SHEETPR_SKIPEXT = 0x0200; // BIFF3-BIFF4
const sal_uInt32 BIFF_SHEETPROT_OBJECTS = 0x00000001;
const sal_uInt32 BIFF_SHEETPROT_SCENARIOS = 0x00000002;
@@ -177,7 +177,7 @@ void WorksheetSettings::importPhoneticPr( const AttributeList& rAttribs )
maPhoneticSett.importPhoneticPr( rAttribs );
}
-void WorksheetSettings::importSheetPr( RecordInputStream& rStrm )
+void WorksheetSettings::importSheetPr( SequenceInputStream& rStrm )
{
sal_uInt16 nFlags1;
sal_uInt8 nFlags2;
@@ -185,8 +185,8 @@ void WorksheetSettings::importSheetPr( RecordInputStream& rStrm )
rStrm.skip( 8 ); // sync anchor cell
rStrm >> maSheetSettings.maCodeName;
// sheet settings
- maSheetSettings.mbFilterMode = getFlag( nFlags2, OOBIN_SHEETPR_FILTERMODE );
- // outline settings, equal flags in BIFF and OOBIN
+ maSheetSettings.mbFilterMode = getFlag( nFlags2, BIFF12_SHEETPR_FILTERMODE );
+ // outline settings, equal flags in all BIFFs
maSheetSettings.mbApplyStyles = getFlag( nFlags1, BIFF_SHEETPR_APPLYSTYLES );
maSheetSettings.mbSummaryRight = getFlag( nFlags1, BIFF_SHEETPR_SYMBOLSRIGHT );
maSheetSettings.mbSummaryBelow = getFlag( nFlags1, BIFF_SHEETPR_SYMBOLSBELOW );
@@ -195,13 +195,13 @@ void WorksheetSettings::importSheetPr( RecordInputStream& rStrm )
getPageSettings().setFitToPagesMode( getFlag( nFlags1, BIFF_SHEETPR_FITTOPAGES ) );
}
-void WorksheetSettings::importChartSheetPr( RecordInputStream& rStrm )
+void WorksheetSettings::importChartSheetPr( SequenceInputStream& rStrm )
{
rStrm.skip( 2 ); // flags, contains only the 'published' flag
rStrm >> maSheetSettings.maTabColor >> maSheetSettings.maCodeName;
}
-void WorksheetSettings::importSheetProtection( RecordInputStream& rStrm )
+void WorksheetSettings::importSheetProtection( SequenceInputStream& rStrm )
{
rStrm >> maSheetProt.mnPasswordHash;
// no flags field for all these boolean flags?!?
@@ -223,7 +223,7 @@ void WorksheetSettings::importSheetProtection( RecordInputStream& rStrm )
maSheetProt.mbSelectUnlocked = rStrm.readInt32() != 0;
}
-void WorksheetSettings::importChartProtection( RecordInputStream& rStrm )
+void WorksheetSettings::importChartProtection( SequenceInputStream& rStrm )
{
rStrm >> maSheetProt.mnPasswordHash;
// no flags field for all these boolean flags?!?
@@ -231,11 +231,21 @@ void WorksheetSettings::importChartProtection( RecordInputStream& rStrm )
maSheetProt.mbObjects = rStrm.readInt32() != 0;
}
-void WorksheetSettings::importPhoneticPr( RecordInputStream& rStrm )
+void WorksheetSettings::importPhoneticPr( SequenceInputStream& rStrm )
{
maPhoneticSett.importPhoneticPr( rStrm );
}
+void WorksheetSettings::importSheetExt( BiffInputStream& rStrm )
+{
+ rStrm.skip( 16 );
+ sal_uInt32 nFlags;
+ rStrm >> nFlags;
+ sal_uInt8 nColorIdx = extractValue< sal_uInt8 >( nFlags, 0, 7 );
+ if( nColorIdx != BIFF_SHEETEXT_NOTABCOLOR )
+ maSheetSettings.maTabColor.setPaletteClr( nColorIdx );
+}
+
void WorksheetSettings::importSheetPr( BiffInputStream& rStrm )
{
sal_uInt16 nFlags;
@@ -324,10 +334,11 @@ void WorksheetSettings::finalizeImport()
PropertySet aPropSet( getSheet() );
aPropSet.setProperty( PROP_CodeName, maSheetSettings.maCodeName );
- if (!maSheetSettings.maTabColor.isAuto())
+ // sheet tab color
+ if( !maSheetSettings.maTabColor.isAuto() )
{
- sal_Int32 nColor = maSheetSettings.maTabColor.getColor(getBaseFilter().getGraphicHelper());
- aPropSet.setProperty(PROP_TabColor, nColor);
+ sal_Int32 nColor = maSheetSettings.maTabColor.getColor( getBaseFilter().getGraphicHelper() );
+ aPropSet.setProperty( PROP_TabColor, nColor );
}
}
@@ -335,4 +346,3 @@ void WorksheetSettings::finalizeImport()
} // namespace xls
} // namespace oox
-
diff --git a/oox/util/oox.component b/oox/util/oox.component
index 686ee6f1728e..f6519d5a8664 100644
--- a/oox/util/oox.component
+++ b/oox/util/oox.component
@@ -28,31 +28,40 @@
<component loader="com.sun.star.loader.SharedLibrary"
xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.Impress.oox.PowerPointImport">
- <service name="com.sun.star.comp.ooxpptx"/>
+ <implementation name="com.sun.star.comp.oox.core.FastTokenHandler">
+ <service name="com.sun.star.xml.sax.FastTokenHandler"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.BiffDetector">
+ <implementation name="com.sun.star.comp.oox.FormatDetector">
<service name="com.sun.star.frame.ExtendedTypeDetection"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.ExcelBiffFilter">
- <service name="com.sun.star.comp.oox.ExcelBiffFilter"/>
+ <implementation name="com.sun.star.comp.oox.docprop.DocumentPropertiesImporter">
+ <service name="com.sun.star.document.OOXMLDocumentPropertiesImporter"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.ExcelFilter">
- <service name="com.sun.star.comp.oox.ExcelFilter"/>
+ <implementation name="com.sun.star.comp.oox.WordVbaProjectFilter">
+ <service name="com.sun.star.document.ImportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.FastTokenHandlerService">
- <service name="com.sun.star.xml.sax.FastTokenHandler"/>
+ <implementation name="com.sun.star.comp.oox.ppt.PowerPointImport">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.FormatDetector">
+ <implementation name="com.sun.star.comp.oox.ShapeContextHandler">
+ <service name="com.sun.star.xml.sax.FastShapeContextHandler"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.xls.BiffDetector">
<service name="com.sun.star.frame.ExtendedTypeDetection"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.OOXMLFormulaParser">
- <service name="com.sun.star.sheet.FilterFormulaParser"/>
+ <implementation name="com.sun.star.comp.oox.xls.ExcelFilter">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.ShapeContextHandler">
- <service name="com.sun.star.xml.sax.FastShapeContextHandler"/>
+ <implementation name="com.sun.star.comp.oox.xls.ExcelBiffFilter">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExportFilter"/>
</implementation>
- <implementation name="com.sun.star.comp.oox.docprop.OOXMLDocumentPropertiesImporter">
- <service name="com.sun.star.document.OOXMLDocumentPropertiesImporter"/>
+ <implementation name="com.sun.star.comp.oox.xls.ExcelVbaProjectFilter">
+ <service name="com.sun.star.document.ImportFilter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.oox.xls.FormulaParser">
+ <service name="com.sun.star.sheet.FilterFormulaParser"/>
</implementation>
</component>